:root {
  --ink: #172033;
  --muted: #627085;
  --page: #f6f8fb;
  --panel: #ffffff;
  --line: #dce4ef;
  --green: #14a779;
  --green-dark: #087956;
  --yellow: #f5c542;
  --blue: #3378c7;
  --orange: #f1773f;
  --pink: #dc5d93;
  --red: #d84949;
  --shadow: 0 18px 44px rgba(40, 52, 76, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 220, 115, 0.32), transparent 24%),
    linear-gradient(180deg, #fbfdff 0, #f2f7f3 52%, #f8f2ec 100%);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 16px auto 32px;
  display: grid;
  gap: 14px;
}

.workbench,
.qr-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.workbench {
  padding: 18px;
}

.app-head,
.teacher-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.lesson-pill,
.section-title span,
.comment-box span,
.timer-card span {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  color: #0d6044;
  background: #daf5e8;
  font-size: 13px;
  font-weight: 900;
}

h1 {
  margin-top: 10px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
}

.app-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.main-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  align-items: stretch;
}

.reading-card,
.result-card {
  border-radius: 8px;
}

.reading-card,
.result-card {
  border: 1px solid var(--line);
  background: var(--panel);
}

.reading-card {
  overflow: hidden;
}

.section-title {
  padding: 16px 16px 0;
}

.section-title h2 {
  margin-top: 9px;
  font-size: clamp(23px, 4vw, 34px);
  line-height: 1.14;
  letter-spacing: 0;
}

.space-scene {
  position: relative;
  height: 150px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.88) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 62%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
    linear-gradient(135deg, #1b3151 0%, #326c83 52%, #eef0ce 100%);
}

.planet {
  position: absolute;
  right: -36px;
  bottom: -44px;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 38%),
    linear-gradient(155deg, #68c6aa 0 34%, #f4d471 35% 47%, #397a9c 48% 100%);
  box-shadow: 0 0 34px rgba(255, 255, 255, 0.28);
}

.orbit {
  position: absolute;
  left: 9%;
  top: 50%;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.orbit-one {
  width: 410px;
  height: 76px;
}

.orbit-two {
  left: 22%;
  top: 33%;
  width: 250px;
  height: 52px;
  transform: rotate(16deg);
}

.station-body {
  position: absolute;
  left: 50%;
  top: 46%;
  display: flex;
  gap: 5px;
  align-items: center;
  transform: translate(-50%, -50%);
}

.station-body span {
  display: block;
  border: 2px solid rgba(22, 32, 51, 0.28);
  background: #f8fbff;
  box-shadow: 0 6px 16px rgba(11, 28, 49, 0.2);
}

.station-body span:nth-child(1),
.station-body span:nth-child(3) {
  width: 40px;
  height: 22px;
  border-radius: 999px;
}

.station-body span:nth-child(2) {
  width: 70px;
  height: 36px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, transparent 48%, rgba(41, 109, 151, 0.24) 49% 52%, transparent 53%),
    #f8fbff;
}

.solar-panel {
  position: absolute;
  top: 46%;
  width: 112px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.45) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, #59b6d8, #2372b0);
  box-shadow: 0 8px 20px rgba(15, 41, 71, 0.22);
  transform: translateY(-50%);
}

.panel-left {
  right: calc(50% + 76px);
}

.panel-right {
  left: calc(50% + 76px);
}

.rocket-mark {
  position: absolute;
  left: 10%;
  bottom: 24px;
  width: 26px;
  height: 56px;
  border-radius: 16px 16px 8px 8px;
  background:
    radial-gradient(circle at 50% 18%, #dcecff 0 5px, #2d78b7 6px 9px, transparent 10px),
    linear-gradient(90deg, transparent 0 18%, #f15745 19% 33%, transparent 34% 66%, #f15745 67% 81%, transparent 82%),
    #fff7e6;
  box-shadow: 0 0 0 2px rgba(23, 32, 51, 0.12);
  transform: rotate(32deg);
}

.rocket-mark::before,
.rocket-mark::after {
  content: "";
  position: absolute;
}

.rocket-mark::before {
  left: 50%;
  top: -14px;
  width: 0;
  height: 0;
  border-right: 13px solid transparent;
  border-bottom: 18px solid #f15745;
  border-left: 13px solid transparent;
  transform: translateX(-50%);
}

.rocket-mark::after {
  left: 50%;
  bottom: -22px;
  width: 18px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffd96a, #f1773f 58%, transparent 100%);
  transform: translateX(-50%);
}

.reading-text {
  padding: 16px;
  color: #101828;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  line-height: 1.82;
  letter-spacing: 0;
}

.word-focus {
  margin: 0 16px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-focus span {
  min-height: 34px;
  border: 1px solid #f2d681;
  border-radius: 8px;
  padding: 6px 10px;
  color: #714a04;
  background: #fff7d9;
  font-weight: 900;
}

.segment-bar {
  margin: 0 16px 16px;
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) 98px;
  gap: 8px;
  align-items: center;
}

.segment-bar strong {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fbff;
  font-size: 15px;
}

.recorder {
  margin: 0 16px 16px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.timer-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.timer-card strong {
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: #e7edf5;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
  transition: width 0.12s linear;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button,
.secondary-button,
.retry-button,
.ghost-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  font-weight: 900;
}

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

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button,
.ghost-button {
  color: var(--ink);
  background: #eef4fb;
  border-color: var(--line);
}

.compact {
  min-height: 40px;
}

.playback {
  width: calc(100% - 32px);
  margin: 0 16px 16px;
}

.status-text {
  margin: 0 16px 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.status-text.is-error {
  color: var(--red);
  font-weight: 900;
}

.result-card {
  padding-bottom: 16px;
}

.star-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.star-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.star-item h3 {
  font-size: 18px;
  line-height: 1.25;
}

.star-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.star-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid #cbd7e6;
  border-radius: 14px;
  color: #6f7d8e;
  background: #fff;
  font-size: 28px;
  line-height: 1;
}

.star-item.is-on {
  border-color: #f5b28c;
  background: #fff4e9;
}

.star-item.is-on .star-icon {
  border-color: #ef9c61;
  color: #d84f38;
  background: #fff0dc;
}

.praise-box,
.rubric-box,
.comment-box,
.progress-panel,
.transcript-panel {
  margin: 0 16px 12px;
  border-radius: 8px;
}

.praise-box {
  border: 1px solid #b8e9cd;
  padding: 12px;
  color: #0d6044;
  background: #e4f8ec;
  font-weight: 900;
}

.comment-box {
  border: 1px solid #ead58c;
  padding: 13px;
  background: #fff9df;
}

.rubric-box {
  overflow: hidden;
  border: 1px solid #b7d1e9;
  background: #edf5fc;
}

.rubric-box table {
  width: 100%;
  border-collapse: collapse;
}

.rubric-box th {
  min-height: 48px;
  padding: 12px 10px;
  color: #08152b;
  background: #5d9ed1;
  font-size: 23px;
  font-weight: 900;
  text-align: center;
}

.rubric-box th:first-child {
  width: 76%;
}

.rubric-box td {
  border-top: 2px solid rgba(255, 255, 255, 0.72);
  border-right: 2px solid rgba(255, 255, 255, 0.72);
  padding: 13px 10px;
  color: #071125;
  background: #d9e8f4;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.45;
}

.rubric-box td:last-child {
  border-right: 0;
  text-align: center;
  white-space: nowrap;
}

.rocket-level {
  display: inline-block;
  font-size: 27px;
  letter-spacing: 2px;
}

.rubric-box p {
  padding: 12px;
  color: #3d516a;
  background: #f7fbff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.75;
}

.comment-box p {
  margin-top: 9px;
  white-space: pre-line;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.6;
}

.retry-button {
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  color: #fff;
  background: var(--blue);
}

.progress-panel {
  border: 1px solid var(--line);
  padding: 12px;
  background: #fbfcff;
}

.progress-panel > span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  color: #0d6044;
  background: #daf5e8;
  font-size: 13px;
  font-weight: 900;
}

.progress-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: #eef4fb;
  font-size: 14px;
  font-weight: 900;
}

.progress-chip.is-current {
  border-color: #97b8f1;
  color: #1d4fae;
  background: #e9f1ff;
}

.progress-chip.is-complete {
  border-color: #b8e9cd;
  color: #0d6044;
  background: #e4f8ec;
}

.transcript-panel {
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #f8fbff;
}

.transcript-panel summary {
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.transcript-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.qr-panel {
  padding: 16px;
}

.teacher-head h2 {
  margin-top: 8px;
  font-size: 26px;
}

.qr-only-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.qr-card {
  display: grid;
  min-height: 250px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.qr-card img {
  width: 220px;
  height: 220px;
}

.qr-fallback {
  padding: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.qr-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcff;
}

.qr-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.qr-copy a:not(.secondary-button) {
  color: var(--blue);
  font-size: 20px;
  font-weight: 900;
  line-break: anywhere;
}

@media (max-width: 860px) {
  .app-head,
  .main-grid,
  .teacher-head,
  .qr-only-grid {
    grid-template-columns: 1fr;
  }

  .space-scene {
    height: 128px;
  }

  .reading-text {
    line-height: 1.72;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100vw - 18px, 1180px);
    margin-top: 9px;
  }

  .workbench,
  .qr-panel {
    padding: 10px;
  }

  .segment-bar {
    grid-template-columns: 1fr;
  }

  .button-row {
    display: grid;
  }

  .primary-button,
  .secondary-button,
  .retry-button,
  .ghost-button {
    width: 100%;
  }

  .star-item {
    grid-template-columns: 46px 1fr;
    min-height: 78px;
  }

  .star-icon {
    width: 44px;
    height: 44px;
    font-size: 25px;
  }

  .rubric-box th {
    font-size: 20px;
  }

  .rubric-box td {
    font-size: 16px;
  }
}
