:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #637083;
  --line: #d9dee7;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --green: #0f9f6e;
  --green-bg: #e7f8f1;
  --amber: #f59e0b;
  --shadow: 0 10px 28px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(30, 41, 59, 0.08);
  backdrop-filter: blur(12px);
  padding: 14px 22px 16px;
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

#statusText {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.score {
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}

.score strong {
  font-size: 22px;
}

.score span {
  color: var(--muted);
  font-size: 14px;
}

.progress-shell {
  width: min(1120px, calc(100vw - 44px));
  height: 10px;
  margin: 14px auto 12px;
  overflow: hidden;
  background: #e8edf5;
  border-radius: 999px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--green));
  border-radius: inherit;
  transition: width 180ms ease;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1120px;
  margin: 0 auto;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  border-color: #b8c2d3;
  background: #f9fafc;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

button.primary:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.field {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 152px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-field {
  min-width: 96px;
}

select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  padding: 0 34px 0 10px;
}

select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  color: var(--muted);
  font-size: 14px;
  padding: 0 8px;
}

main {
  width: min(1120px, calc(100vw - 32px));
  margin: 22px auto 60px;
}

.hint-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #edf4ff;
  border: 1px solid #c8dbff;
  border-radius: 8px;
  padding: 14px 16px;
  color: #1e3a8a;
  margin-bottom: 16px;
}

.hint-panel div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 34px;
  border: 1px solid #b5c8ef;
  border-bottom-width: 3px;
  border-radius: 7px;
  background: #fff;
  color: #1e3a8a;
  font-weight: 750;
}

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

.section-heading {
  margin: 18px 0 2px;
  color: #1f2933;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
}

.sentence-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.sentence-card.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14), var(--shadow);
}

.sentence-card.done {
  background: var(--green-bg);
  border-color: #a8ead1;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
}

.play-btn {
  color: var(--brand);
}

.done-btn {
  color: var(--muted);
}

.sentence-card.done .done-btn {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.speaker {
  font-weight: 750;
  color: var(--ink);
}

.section {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.english {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

.zh {
  margin: 8px 0 0;
  color: #49566a;
  font-size: 15px;
}

.sentence-card.current .english {
  color: #111827;
  font-weight: 700;
}

.sentence-card.holding {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2), var(--shadow);
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px 14px 14px;
  }

  .topbar-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .progress-shell {
    width: calc(100vw - 28px);
  }

  .toolbar {
    gap: 10px;
  }

  .field,
  .compact-field {
    flex: 1 1 100%;
    min-width: 0;
  }

  .toolbar button {
    flex: 1 1 calc(50% - 8px);
  }

  .toggle {
    width: 100%;
  }

  main {
    width: calc(100vw - 20px);
    margin-top: 12px;
  }

  .sentence-card {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 9px;
    padding: 12px;
  }

  .english {
    font-size: 16px;
  }

  .hint-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}
