:root {
  color-scheme: light;
  --ink: #12201a;
  --muted: #66736d;
  --line: #dfe8e2;
  --soft: #f4faf6;
  --green: #00663d;
  --red: #cc1f32;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfdfb 0%, #eef7f1 100%);
}

.page {
  width: min(980px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

button,
select,
input {
  font: inherit;
}

.top-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.start-audio,
.stop-all {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.start-audio {
  background: var(--green);
}

.start-audio.ready {
  background: #0f8a57;
}

.stop-all {
  background: var(--red);
}

.start-audio:active,
.stop-all:active {
  transform: translateY(1px);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
}

.status-panel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.status-card {
  min-height: 64px;
  border-radius: 14px;
  padding: 10px 14px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.status-card.left {
  background: #d90018;
}

.status-card.right {
  background: #00663d;
}

.status-label {
  font-size: 13px;
  opacity: 0.88;
  font-weight: 800;
}

.status-card strong {
  font-size: clamp(19px, 2.8vw, 28px);
  line-height: 1.2;
}

.duration-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.duration-control select {
  min-width: 94px;
  border: 1px solid #cfe4d8;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--soft);
  font-weight: 900;
  text-align: center;
}

.diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px dashed #c9d9d0;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.diagnostics strong {
  color: var(--ink);
}

#audioMessage {
  color: #8a6400;
  font-weight: 900;
}

.player-panel {
  padding: 14px;
}

.table-head,
.meridian-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.table-head {
  padding: 0 4px 10px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.meridian-row {
  min-height: 58px;
  padding: 10px 4px;
  border-bottom: 1px solid #edf2ee;
}

.meridian-row:last-child {
  border-bottom: 0;
}

.meridian-name {
  text-align: center;
  font-size: clamp(18px, 2.6vw, 25px);
  font-weight: 950;
  white-space: nowrap;
}

.switch-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.channel-switch {
  width: min(100%, 118px);
  min-height: 42px;
  border: 1px solid #cbdcd2;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: #f7fbf8;
  font-size: 16px;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
}

.channel-switch.active {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.channel-switch:active {
  transform: translateY(1px);
}

input {
  min-width: 0;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

@media (max-width: 520px) {
  .page {
    width: calc(100% - 12px);
    padding: 10px 0 24px;
  }

  .hero {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
  }

  .eyebrow {
    font-size: 12px;
    margin-bottom: 3px;
  }

  h1 {
    font-size: 28px;
    letter-spacing: -0.05em;
  }

  .top-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .start-audio,
  .stop-all {
    padding: 10px 8px;
    font-size: 16px;
  }

  .status-panel {
    grid-template-columns: minmax(0, 1fr) 86px minmax(0, 1fr);
    gap: 6px;
    padding: 8px;
    border-radius: 14px;
  }

  .status-card {
    min-height: 52px;
    border-radius: 12px;
    padding: 8px;
  }

  .status-label {
    font-size: 11px;
  }

  .status-card strong {
    font-size: 16px;
  }

  .duration-control {
    font-size: 12px;
    gap: 4px;
  }

  .duration-control select {
    min-width: 76px;
    width: 76px;
    padding: 7px 4px;
    border-radius: 10px;
    font-size: 13px;
  }

  .diagnostics {
    gap: 4px 8px;
    padding: 7px 8px;
    font-size: 11px;
  }

  .player-panel {
    padding: 6px;
    border-radius: 14px;
  }

  .table-head,
  .meridian-row {
    grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
    gap: 6px;
  }

  .table-head {
    display: grid;
    padding: 4px 2px 7px;
    font-size: 12px;
  }

  .meridian-row {
    min-height: 52px;
    padding: 7px 2px;
  }

  .meridian-name {
    font-size: 17px;
  }

  .channel-switch {
    width: 100%;
    min-height: 38px;
    padding: 7px 3px;
    font-size: 14px;
  }

  .note {
    margin-top: 8px;
    font-size: 12px;
  }
}
