:root {
  --ink: #1d2c4e;
  --blue: #243f79;
  --sky: #e9f4ff;
  --orange: #ff833f;
  --yellow: #ffd45a;
  --mint: #d9f3e3;
  --paper: #fffdf7;
  --line: #d7e2ef;
  --muted: #60718e;
  --shadow: 0 18px 42px rgba(27, 55, 97, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: radial-gradient(circle at 15% 5%, #fff4bd 0 7%, transparent 28%), linear-gradient(135deg, #e7f4ff 0%, #fbf8ef 48%, #d6eef3 100%);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

button { font: inherit; }

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 32px;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 0 4px 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #6380a4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.045em;
}

h2 { margin-bottom: 0; font-size: 22px; }

.page-badge {
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 800;
}

.learning-layout {
  max-width: 860px;
  margin: 0 auto;
}

.reader-panel {
  border: 2px solid rgba(29, 44, 78, 0.14);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.reader-panel { padding: 18px; }

.reader-guide {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 0 5px 14px;
}

.reader-guide strong { font-size: 17px; }
.reader-settings { position: relative; }
.settings-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #c8d9e7;
  border-radius: 10px;
  color: #6683a2;
  background: #f7fbff;
  cursor: pointer;
}
.settings-button:hover, .settings-button[aria-expanded="true"] { color: var(--blue); border-color: #8bb3d4; background: #eaf5ff; }
.settings-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 4; stroke-linejoin: round; }
.settings-menu {
  position: absolute;
  z-index: 8;
  top: calc(100% + 7px);
  right: 0;
  min-width: 230px;
  padding: 10px;
  border: 1px solid #c8d9e7;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 9px 22px rgba(27, 55, 97, 0.16);
}

.page-stage {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #e4eef7;
  box-shadow: 5px 5px 0 rgba(29, 44, 78, 0.12);
}

.comic-page {
  position: relative;
  width: min(100%, 710px);
  margin: 0 auto;
  aspect-ratio: 2480 / 3508;
  background: white;
}

.comic-page img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hotspot-layer { position: absolute; inset: 0; }

.bubble-hit {
  position: absolute;
  border: 0;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
  outline: 0;
  appearance: none;
  background: transparent;
  transition: none;
  -webkit-tap-highlight-color: transparent;
}

.bubble-hit:hover, .bubble-hit:focus, .bubble-hit:focus-visible, .bubble-hit:active {
  border: 0;
  background: transparent;
  outline: none;
  transform: none;
}

.page-stage.turning .comic-page { animation: turn-page 360ms ease; }

@keyframes turn-page {
  0% { transform: rotateY(0deg); opacity: 1; }
  48% { transform: rotateY(-72deg); opacity: 0.2; }
  100% { transform: rotateY(0deg); opacity: 1; }
}

.page-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 3px 0; }

.nav-button {
  min-height: 45px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.nav-button { padding: 0 16px; color: var(--ink); background: #fff; }
.nav-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 3px 4px 0 var(--ink); }
.nav-button:disabled { cursor: not-allowed; opacity: 0.48; }
.nav-button--primary { background: var(--orange); color: white; }

.page-dots { display: flex; gap: 9px; }
.page-dot { width: 11px; height: 11px; border: 2px solid var(--ink); border-radius: 50%; background: white; }
.page-dot.is-current { background: var(--yellow); transform: scale(1.2); }

.line-card {
  min-height: 88px;
  margin: 0;
  padding: 15px 18px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(145deg, #f6fbff, #eff8ef);
}

.english-line { margin-bottom: 5px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(22px, 3vw, 30px); font-weight: 700; line-height: 1.25; }
.line-hint { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.speed-controls { display: flex; justify-content: center; gap: 6px; }
.speed-controls button { min-width: 39px; border: 1px solid #bdd3e6; border-radius: 999px; padding: 3px 6px; color: #6a819b; background: rgba(255, 255, 255, 0.72); cursor: pointer; font-size: 11px; font-weight: 800; }
.speed-controls button.is-active { border-color: #74a9d2; color: white; background: #84b9df; }

.practice-dock { padding: 20px 3px 0; }

.round-actions { display: flex; justify-content: center; gap: 18px; }
.comic-actions {
  position: absolute;
  z-index: 3;
  right: 2.5%;
  bottom: 1.8%;
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}
.feedback-tag {
  position: absolute;
  z-index: 4;
  right: 1.4%;
  bottom: 10.5%;
  max-width: 56%;
  padding: 3px 7px;
  color: transparent;
  background: linear-gradient(100deg, #36b879 0 18%, #43a6e8 18% 38%, #f1c83b 38% 58%, #4aa9e1 58% 78%, #35b87a 78% 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1.4px rgba(255, 255, 255, 0.96);
  filter: drop-shadow(0 3px 1px rgba(32, 79, 116, 0.2));
  font-family: "Arial Rounded MT Bold", "Microsoft YaHei", sans-serif;
  font-size: clamp(25px, 4.7vw, 43px);
  font-weight: 1000;
  letter-spacing: -0.07em;
  line-height: 0.95;
  white-space: nowrap;
  text-transform: uppercase;
  transform: rotate(-4deg);
  pointer-events: none;
  animation: feedback-pop 180ms ease-out;
}
@keyframes feedback-pop { from { opacity: 0; transform: translateY(8px) rotate(-4deg) scale(0.82); } to { opacity: 1; transform: translateY(0) rotate(-4deg) scale(1); } }
.round-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  min-height: 54px;
  border: 0;
  color: white;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  font-size: 14px;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}
.round-action::before {
  content: "";
  position: absolute;
  top: 0;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: #8dc5ee;
  box-shadow: 0 3px 0 rgba(29, 44, 78, 0.12), 0 5px 10px rgba(27, 55, 97, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.round-action svg { position: relative; z-index: 1; width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.round-action--score svg { fill: currentColor; stroke-width: 2; }
.round-action--record::before { background: #f49a97; }
.round-action--score::before { background: #92c8ef; }
.round-action--score { pointer-events: none; }
.round-action:hover:not(:disabled) { transform: translateY(-3px); }
.round-action:hover:not(:disabled)::before { box-shadow: 0 4px 0 rgba(29, 44, 78, 0.14), 0 7px 13px rgba(27, 55, 97, 0.15); }
.round-action:disabled { cursor: not-allowed; opacity: 0.43; }
.round-action.is-listening::before { animation: listen-wave 900ms ease-in-out infinite; }
.round-action.is-recording::before { animation: record-pulse 750ms ease-in-out infinite; background: #d84242; }
.round-action.is-recording svg { stroke: transparent; fill: white; }
.round-action.is-recording .record-icon-stop { display: block; }
.round-action.is-scored::before { background: #82bde9; }
.score-badge {
  position: absolute;
  z-index: 2;
  top: -5px;
  right: -6px;
  min-width: 32px;
  padding: 3px 5px;
  border: 2px solid white;
  border-radius: 999px;
  color: white;
  background: #f25c57;
  font-size: 11px;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(29, 44, 78, 0.2);
}
@keyframes listen-wave { 50% { transform: scale(1.1); box-shadow: 0 0 0 9px rgba(85, 168, 238, 0.18), 0 5px 0 rgba(29, 44, 78, 0.19); } }
@keyframes record-pulse { 50% { transform: scale(1.09); box-shadow: 0 0 0 10px rgba(239, 90, 87, 0.2), 0 5px 0 rgba(29, 44, 78, 0.19); } }

@media (max-width: 920px) {
  .learning-layout { max-width: 760px; }
}

@media (max-width: 560px) {
  .app-shell { width: min(100% - 18px, 1440px); padding-top: 16px; }
  .masthead, .reader-guide { align-items: flex-start; flex-direction: column; }
  .masthead { gap: 14px; }
  .reader-panel { padding: 10px; border-radius: 18px; }
  .speed-controls { gap: 4px; }
  .speed-controls button { min-width: 36px; padding: 3px 4px; }
  .comic-actions { right: 2.2%; gap: 13px; padding: 0; }
  .feedback-tag { right: 1.2%; bottom: 9.5%; font-size: clamp(22px, 7vw, 34px); }
  .round-action, .round-action::before { width: 47px; height: 47px; min-height: 47px; }
  .round-action svg { width: 24px; height: 24px; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
