:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  background: #0f2931;
  color: #172025;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(7, 31, 39, 0.14), rgba(237, 243, 244, 0.46) 360px, rgba(237, 243, 244, 0.70)),
    url("./assets/steel-background.png") center top / cover fixed,
    #0f2931;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: #ffffff;
  font-size: 32px;
  line-height: 1.1;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.28);
}

h2 {
  font-size: 18px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #243b43;
  box-shadow: 0 8px 24px rgba(25, 52, 61, 0.12);
  backdrop-filter: blur(10px);
}

.icon-button span {
  display: block;
  font-size: 28px;
  line-height: 1;
  transform: translateY(-1px);
}

.app-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.app-menu button {
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: #243b43;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.app-menu button.active {
  border-color: #165a72;
  background: #165a72;
  color: #ffffff;
}

.page-view[hidden] {
  display: none;
}

.calculator,
.result-panel {
  border: 1px solid rgba(36, 73, 82, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(25, 52, 61, 0.16);
  backdrop-filter: blur(14px);
}

.calculator {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #42545b;
  font-size: 14px;
}

input,
select {
  width: 100%;
  height: 48px;
  border: 1px solid #b8c7cc;
  border-radius: 6px;
  background: #fbfcfc;
  color: #172025;
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: #165a72;
  box-shadow: 0 0 0 3px rgba(22, 90, 114, 0.16);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  padding-top: 2px;
}

.primary-button,
.secondary-button {
  height: 48px;
  border-radius: 6px;
  border: 0;
}

.primary-button {
  background: #165a72;
  color: #ffffff;
  font-weight: 700;
}

.secondary-button {
  background: #e2eaec;
  color: #243b43;
}

.result-panel {
  margin-top: 14px;
  padding: 16px;
}

.result-label {
  margin: 0 0 6px;
  color: #687b81;
  font-size: 13px;
}

.result-main {
  min-height: 40px;
  color: #243b43;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.result-main.pass {
  color: #146c43;
}

.result-main.fail {
  color: #b42318;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.result-grid div {
  min-height: 66px;
  border-radius: 6px;
  background: #f4f8f9;
  padding: 10px;
}

.result-grid span {
  display: block;
  color: #6f8085;
  font-size: 12px;
}

.result-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.history-section {
  margin-top: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title span {
  color: #687b81;
  font-size: 13px;
}

.history-filter {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.history-filter label {
  color: #42545b;
  font-size: 13px;
}

.history-filter-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.history-filter-controls .date-trigger,
.history-filter-controls button {
  height: 44px;
}

.history-filter-controls button,
.date-action-row button {
  border: 0;
  border-radius: 6px;
  background: #e2eaec;
  color: #243b43;
}

.history-filter-controls .date-trigger {
  border: 1px solid #b8c7cc;
  background: #fbfcfc;
  text-align: left;
  padding: 0 12px;
}

.page-size-control {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.page-size-control span {
  color: #42545b;
  font-size: 13px;
}

.page-size-control select {
  height: 42px;
}

.date-panel {
  border: 1px solid rgba(36, 73, 82, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 12px;
  box-shadow: 0 10px 24px rgba(25, 52, 61, 0.12);
}

.date-select-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
}

.date-select-row label {
  display: grid;
  gap: 5px;
}

.date-select-row span {
  color: #687b81;
  font-size: 12px;
}

.date-select-row select {
  height: 42px;
}

.date-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.date-action-row button {
  height: 42px;
}

#applyDatePickerButton {
  background: #165a72;
  color: #ffffff;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-pagination {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.history-pagination button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: #e2eaec;
  color: #243b43;
}

.history-pagination button:disabled {
  color: #9badb2;
  opacity: 0.65;
}

.history-pagination span {
  color: #687b81;
  font-size: 13px;
  text-align: center;
}

.history-card {
  border: 1px solid rgba(36, 73, 82, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 12px;
  backdrop-filter: blur(12px);
}

.history-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-card strong {
  font-size: 18px;
}

.history-card time {
  color: #687b81;
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.history-card.pass strong {
  color: #146c43;
}

.history-card.fail strong {
  color: #b42318;
}

.history-card p {
  margin: 8px 0 0;
  color: #4a5c62;
  font-size: 14px;
  line-height: 1.5;
}

.delete-record-button {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border: 0;
  border-radius: 6px;
  background: #f3dfdc;
  color: #9f2a20;
  font-weight: 700;
}

.empty-state {
  margin: 0;
  border: 1px dashed #b8c7cc;
  border-radius: 8px;
  color: #687b81;
  padding: 18px;
  text-align: center;
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 32px;
  }
}

@media (max-width: 380px) {
  .date-select-row {
    grid-template-columns: 1fr;
  }

  .history-card-header {
    display: grid;
    gap: 4px;
  }

  .history-card time {
    text-align: left;
  }
}
