:root {
  --ink: #173b32;
  --muted: #75817b;
  --green: #287a5b;
  --green-dark: #174c3c;
  --green-light: #dff0df;
  --cream: #f7f8f2;
  --paper: #ffffff;
  --yellow: #f4bd4f;
  --coral: #ed8b6b;
  --line: #e4e9e1;
  --shadow: 0 12px 32px rgba(26, 63, 48, 0.09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #e2ede5; }
body {
  margin: 0;
  color: var(--ink);
  background: #e2ede5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible + i { outline: 3px solid rgba(40, 122, 91, 0.28); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.app-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(23, 59, 50, 0.08);
}
.topbar {
  height: 70px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px 13px 13px 5px;
  color: #fff;
  background: var(--green);
  font-size: 18px;
  font-weight: 850;
  transform: rotate(-4deg);
  box-shadow: 0 5px 12px rgba(40, 122, 91, 0.2);
}
.brand div { display: flex; flex-direction: column; }
.brand strong { font-size: 13px; letter-spacing: 1.1px; line-height: 1.2; }
.brand div span { color: var(--muted); font-size: 11px; margin-top: 3px; letter-spacing: 2px; }
.header-actions { display: flex; gap: 6px; }
.icon-button {
  width: 42px;
  height: 42px;
  padding: 9px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.icon-button:active { background: #e9eee7; }
.icon-button svg { width: 22px; height: 22px; }
#home-button { margin-left: -8px; }
.screen { padding: 4px 18px calc(26px + env(safe-area-inset-bottom)); }

.hero {
  min-height: 244px;
  padding: 26px 22px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 12px;
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: 0 16px 32px rgba(23, 76, 60, 0.15);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.04); }
.hero::before { width: 190px; height: 190px; right: -76px; top: -90px; }
.hero::after { width: 130px; height: 130px; left: -80px; bottom: -60px; }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 14px; display: flex; align-items: center; gap: 6px; color: #c7decf; font-size: 11px; letter-spacing: 1px; }
.eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.hero h1 { margin: 0; font-size: clamp(28px, 7.4vw, 38px); line-height: 1.25; letter-spacing: -1px; }
.hero h1 em { color: #f5cc71; font-style: normal; }
.hero-description { margin: 14px 0 0; color: #c7d9d0; font-size: 12px; line-height: 1.8; }
.hero-demo {
  align-self: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  transform: rotate(2deg);
}
.demo-label { display: block; overflow: hidden; color: #b8d2c2; font-size: 7px; letter-spacing: .8px; white-space: nowrap; }
.demo-sentence { margin: 9px 0; display: flex; align-items: center; gap: 4px; font-size: 11px; }
.demo-sentence b { font-weight: 650; }
.demo-sentence i { width: 34px; height: 2px; background: rgba(255,255,255,.25); }
.demo-board { height: 98px; position: relative; border-radius: 10px; background-color: #f1f5e9; background-image: linear-gradient(#e2e9db 1px, transparent 1px), linear-gradient(90deg, #e2e9db 1px, transparent 1px); background-size: 14px 14px; }
.demo-word { position: absolute; z-index: 2; padding: 3px 5px; border-radius: 5px; color: var(--green-dark); background: #fff; box-shadow: 0 2px 5px rgba(23,59,50,.12); font-size: 8px; font-weight: 700; }
.word-one { top: 12px; right: 8px; color: #8a6320; border: 1px solid #f0cf7e; }
.word-two { bottom: 10px; left: 8px; }
.word-three { top: 9px; left: 8px; }
.mini-snake { position: absolute; left: 28px; bottom: 39px; display: flex; }
.mini-snake i { width: 17px; height: 17px; margin-left: -2px; border: 2px solid #f1f5e9; border-radius: 6px; background: #55af75; }
.mini-snake i:last-child { background: var(--green); border-radius: 6px 8px 8px 6px; }
.demo-caption { display: block; margin-top: 8px; color: #d6e4db; font-size: 9px; text-align: center; }

.section-heading { margin: 27px 2px 13px; display: flex; align-items: flex-end; justify-content: space-between; }
.section-kicker { margin: 0 0 4px; color: #8c9992; font-size: 9px; font-weight: 750; letter-spacing: 1.4px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.level-list { display: grid; gap: 10px; }
.level-card {
  width: 100%;
  min-height: 78px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 4px 12px rgba(26,63,48,.03);
  transition: transform .15s, border-color .15s;
}
.level-card:active { transform: scale(.985); border-color: #9fc3ad; }
.level-number { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 15px; font-size: 16px; font-weight: 800; }
.level-one { color: #327355; background: #e0f1e3; }
.level-two { color: #996d24; background: #fff0cc; }
.level-three { color: #a75d47; background: #fce4db; }
.level-four { color: #6652a3; background: #eee9fa; }
.level-five { color: #a86a14; background: #fdeccf; font-size: 11px; letter-spacing: .5px; }
.level-ielts { border-color: #f1dcb0; background: linear-gradient(135deg, #fffdf5 0%, #fdf6e6 100%); }
.level-ielts svg path { stroke: #b07a1f; }
.level-info { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 5px; }
.level-info strong { font-size: 15px; }
.level-info small, .level-progress small { color: var(--muted); font-size: 10px; }
.level-progress { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.level-progress strong { color: var(--green); font-size: 12px; }
.level-card > svg { width: 18px; color: #a9b3ad; }
.level-review { color: #a34d38; background: #fff1ea; }
.review-card { border-color: #f0d8ce; }
.relaxed-option { margin: 14px 2px; padding: 12px 14px; display: flex; align-items: center; position: relative; border-radius: 15px; background: #edf1e9; cursor: pointer; }
.relaxed-option > span { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.relaxed-option strong { font-size: 13px; }
.relaxed-option small { color: var(--muted); font-size: 10px; }
.relaxed-option input { position: absolute; opacity: 0; }
.relaxed-option > i { width: 42px; height: 24px; padding: 3px; border-radius: 20px; background: #bdc7bf; transition: background .2s; }
.relaxed-option > i::after { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: transform .2s; }
.relaxed-option input:checked + i { background: var(--green); }
.relaxed-option input:checked + i::after { transform: translateX(18px); }
.how-to { margin-top: 23px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.steps > div { display: flex; align-items: center; gap: 7px; }
.steps > div > span { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; border: 1px solid #cdd9ce; border-radius: 50%; color: var(--green); font-size: 11px; font-weight: 750; }
.steps p { margin: 0; display: flex; flex-direction: column; gap: 3px; }
.steps strong { font-size: 11px; }
.steps small { color: var(--muted); font-size: 8px; white-space: nowrap; }
.privacy-note { margin: 24px 0 0; color: #9ba59f; font-size: 10px; text-align: center; }
.version-note { margin-top: 6px; }

.game-active { overflow: hidden; }
.game-active .app-shell { width: 100%; max-width: none; height: 100dvh; min-height: 0; box-shadow: none; }
.game-active .topbar { position: fixed; inset: 0 0 auto; z-index: 16; height: auto; padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(12px + env(safe-area-inset-left)); pointer-events: none; }
.game-active .brand { display: none; }
.game-active .header-actions { margin-left: auto; pointer-events: auto; }
.game-active .icon-button { border: 1px solid rgba(255,255,255,.65); background: rgba(247,250,244,.82); box-shadow: 0 4px 14px rgba(23,59,50,.09); backdrop-filter: blur(10px); pointer-events: auto; }
.game-active .game-screen { position: fixed; inset: 0; padding: 0; overflow: hidden; background: #eaf3e8; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.game-active.simulated-landscape .app-shell { position: fixed; left: 50%; top: 50%; width: 100dvh; height: 100vw; margin: 0; transform: translate(-50%, -50%) rotate(90deg); transform-origin: center; }
.game-active.simulated-landscape .sentence-card { width: min(45%, 520px); }
.game-active.simulated-landscape .modal-card { max-height: calc(100vw - 44px); }
.board-wrap { position: absolute; inset: 0; overflow: hidden; background: #eaf3e8; }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; }
.game-stats { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: calc(66px + env(safe-area-inset-left)); z-index: 5; display: flex; align-items: center; gap: 13px; max-width: 160px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.65); border-radius: 14px; background: rgba(247,250,244,.82); box-shadow: 0 4px 16px rgba(23,59,50,.07); backdrop-filter: blur(10px); }
.game-stats > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.game-stats > div:first-child { max-width: 72px; }
.game-stats span { color: var(--muted); font-size: 8px; white-space: nowrap; }
.game-stats strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.attempt-stat { align-items: flex-start; }
.score-stat { align-items: flex-start; }
.score-stat strong { color: var(--green); font-size: 16px; font-variant-numeric: tabular-nums; }
.lives { display: flex; gap: 3px; height: 6px; }
.life { width: 11px; height: 4px; border-radius: 5px; background: var(--coral); transition: background .2s; }
.life.lost { background: #dce2dc; }
.sentence-card { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 50%; z-index: 5; width: min(45vw, 520px); margin: 0; padding: 8px 14px 9px; border: 1px solid rgba(255,255,255,.72); border-radius: 16px; background: rgba(255,255,255,.88); box-shadow: 0 5px 20px rgba(26,63,48,.08); backdrop-filter: blur(12px); transform: translateX(-50%); }
.sentence-top { display: flex; justify-content: space-between; align-items: center; color: #829088; font-size: 9px; }
.combo { padding: 2px 6px; border-radius: 8px; color: #9a6820; background: #fff0cb; font-size: 9px; }
.translation { margin: 3px 0 6px; font-size: 15px; font-weight: 700; line-height: 1.35; text-align: center; }
.sentence-progress { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px 5px; }
.progress-word { padding-bottom: 2px; border-bottom: 2px solid #dbe2da; color: #a4aea8; font-size: 11px; font-weight: 650; letter-spacing: 1px; line-height: 1.2; }
.progress-word.current { color: #9a6b20; border-color: var(--yellow); }
.progress-word.filled { color: var(--green); border-color: #72ad88; letter-spacing: normal; animation: word-in .25s ease-out; }
@keyframes word-in { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.board-toast { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 7; max-width: 55%; padding: 8px 13px; border-radius: 20px; color: #fff; background: rgba(23,59,50,.9); box-shadow: 0 4px 12px rgba(23,59,50,.14); font-size: 11px; text-align: center; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .18s, transform .18s; }
.board-toast.show { opacity: 1; transform: translate(-50%, 0); }
.board-toast.error { background: rgba(173,79,57,.94); }
.speed-boost { position: absolute; top: calc(64px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); z-index: 7; padding: 6px 10px; border-radius: 12px; color: #fff; background: rgba(40,122,91,.92); box-shadow: 0 3px 10px rgba(23,59,50,.15); font-size: 10px; font-weight: 700; pointer-events: none; }
.game-controls { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.joystick { position: absolute; left: calc(44px + env(safe-area-inset-left)); bottom: calc(20px + env(safe-area-inset-bottom)); width: 148px; height: 148px; padding: 10px; border-radius: 50%; background: rgba(247,250,244,.3); pointer-events: auto; touch-action: none; }
.joystick-base { position: relative; width: 100%; height: 100%; border: 2px solid rgba(40,122,91,.24); border-radius: 50%; background: rgba(255,255,255,.48); box-shadow: inset 0 0 24px rgba(40,122,91,.06), 0 6px 20px rgba(23,59,50,.08); backdrop-filter: blur(5px); }
.joystick-knob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(40,122,91,.88); box-shadow: 0 5px 14px rgba(23,59,50,.24); transition: transform .08s ease-out; }
.joystick.active .joystick-knob { background: var(--green-dark); transition: none; }
.joystick-arrow { position: absolute; width: 15px; height: 15px; color: rgba(40,122,91,.4); stroke-width: 2.4; }
.joystick-up { left: 50%; top: 5px; transform: translateX(-50%); }
.joystick-down { left: 50%; bottom: 5px; transform: translateX(-50%); }
.joystick-left { left: 5px; top: 50%; transform: translateY(-50%); }
.joystick-right { right: 5px; top: 50%; transform: translateY(-50%); }
.boost-button { position: absolute; right: calc(52px + env(safe-area-inset-right)); bottom: calc(28px + env(safe-area-inset-bottom)); width: 118px; height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 3px solid rgba(255,255,255,.72); border-radius: 50%; color: #fff; background: rgba(237,139,107,.9); box-shadow: 0 8px 22px rgba(147,78,55,.24); pointer-events: auto; touch-action: none; }
.boost-button svg { width: 28px; height: 28px; fill: rgba(255,255,255,.16); stroke-width: 2; }
.boost-button span { font-size: 11px; font-weight: 750; }
.boost-button.active { background: #d96f4e; box-shadow: 0 0 0 8px rgba(237,139,107,.16), 0 5px 14px rgba(147,78,55,.25); transform: scale(.96); }
.hint-button { position: absolute; right: calc(62px + env(safe-area-inset-right)); bottom: calc(162px + env(safe-area-inset-bottom)); width: 72px; min-height: 42px; padding: 6px 8px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid rgba(234,223,191,.85); border-radius: 18px; color: #946c2c; background: rgba(255,248,232,.88); box-shadow: 0 4px 12px rgba(23,59,50,.06); pointer-events: auto; }
.hint-button:active { transform: scale(.95); }
.hint-button svg { width: 17px; height: 17px; }
.hint-button span { font-size: 10px; font-weight: 700; }
.hint-button small { color: #b49a69; font-size: 8px; }
.pause-overlay { position: absolute; inset: 0; z-index: 13; display: grid; place-items: center; padding: 20px; background: rgba(232,240,228,.88); backdrop-filter: blur(5px); }
.pause-card { width: min(620px, 92vw); max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); padding: 20px 22px; overflow: auto; border-radius: 20px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.pause-symbol { display: flex; justify-content: center; gap: 5px; margin-bottom: 8px; }
.pause-symbol i { width: 6px; height: 22px; border-radius: 3px; background: var(--green); }
.pause-card h2 { margin: 0 0 9px; font-size: 21px; }
.pause-card p { margin: 0; color: var(--muted); font-size: 12px; }
.pause-sentence { color: var(--green-dark) !important; font-size: 15px !important; font-weight: 750; line-height: 1.45; }
.pause-translation { margin-top: 5px !important; line-height: 1.4; }
.pause-progress { margin: 12px 0 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.pause-word { min-width: 42px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 9px; background: #f7f9f5; color: var(--muted); font-size: 11px; font-weight: 700; }
.pause-word.filled { border-color: #bcd7c4; background: #eaf5ed; color: var(--green); }
.pause-word.current { border-color: var(--yellow); background: #fff8e6; color: #9a6b20; }
.pause-listen { margin-bottom: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.pause-listen svg { width: 18px; height: 18px; }
.pause-card .primary-button, .pause-card .secondary-button { width: 100%; }
.pause-card .text-button { margin-top: 8px; }
.rotate-overlay { position: absolute; inset: 0; z-index: 14; display: none; place-items: center; padding: 24px; background: #eaf3e8; }
.rotate-card { max-width: 300px; text-align: center; }
.rotate-card > svg { width: 56px; height: 56px; color: var(--green); transform: rotate(90deg); }
.rotate-card h2 { margin: 18px 0 8px; font-size: 24px; }
.rotate-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 22px; background: rgba(14,42,34,.55); backdrop-filter: blur(5px); animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card { width: 100%; max-width: 400px; max-height: calc(100dvh - 44px); overflow-y: auto; padding: 25px 22px 18px; border-radius: 26px; background: var(--cream); box-shadow: 0 24px 60px rgba(9,35,27,.25); text-align: center; animation: card-in .25s ease-out; }
@keyframes card-in { from { transform: translateY(12px) scale(.98); } to { transform: translateY(0) scale(1); } }
.result-badge { width: 52px; height: 52px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 18px; color: #fff; background: var(--green); transform: rotate(-4deg); box-shadow: 0 8px 16px rgba(40,122,91,.2); }
.result-badge svg { width: 30px; height: 30px; stroke-width: 2.4; }
.result-kicker { margin: 0 0 4px; color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: 1.5px; }
.modal-card h2 { margin: 0; font-size: 26px; }
.result-stars { height: 43px; margin: 8px 0 12px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.result-stars .star { width: 31px; height: 31px; color: #dce1d9; fill: currentColor; stroke: none; }
.result-stars .star.active { color: var(--yellow); filter: drop-shadow(0 3px 3px rgba(186,135,35,.18)); animation: star-in .35s ease-out both; }
.result-stars .star:nth-child(2) { width: 38px; height: 38px; animation-delay: .08s; }
.result-stars .star:nth-child(3) { animation-delay: .16s; }
@keyframes star-in { from { opacity: .2; transform: scale(.4) rotate(-25deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
#result-sentence { margin: 0; padding: 16px 8px 12px; color: var(--green-dark); font-size: 21px; font-weight: 750; line-height: 1.45; }
.result-translation { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.grammar-tip { padding: 12px 14px; border-radius: 13px; background: #eaf0e6; text-align: left; }
.grammar-tip strong { color: var(--green); font-size: 10px; letter-spacing: 1px; }
.grammar-tip p { margin: 4px 0 0; color: #5f7066; font-size: 11px; line-height: 1.65; }
.article-result { margin: 16px 0 4px; padding: 15px; border: 1px solid #dce4d8; border-radius: 15px; background: #fff; text-align: left; }
.article-result h3 { margin: 0 0 8px; color: var(--green); font-size: 15px; }
.article-result p { margin: 0; color: #41594c; font-size: 14px; line-height: 1.7; }
.ielts-review { margin: 16px 0 4px; padding: 14px 15px; border: 1px solid #e8dcc8; border-radius: 15px; background: linear-gradient(135deg, #fdf6e8 0%, #fff 60%); text-align: left; }
.ielts-review h3 { margin: 0 0 10px; color: #b07a1f; font-size: 14px; font-weight: 700; }
.ielts-review-list { display: flex; flex-direction: column; gap: 8px; }
.ielts-review-item { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.7); cursor: pointer; transition: background .15s, box-shadow .15s; }
.ielts-review-item:hover { background: rgba(255,255,255,1); box-shadow: 0 2px 6px rgba(176,122,31,.1); }
.ielts-review-item.active { background: #fff4d9; box-shadow: 0 2px 8px rgba(176,122,31,.2); }
.ielts-word { font-weight: 700; color: #b07a1f; font-size: 14px; }
.ielts-sentence { color: #41594c; font-size: 12px; line-height: 1.5; }
.result-actions { margin-top: 18px; display: flex; gap: 10px; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 20px; flex: 1; border-radius: 14px; font-size: 14px; font-weight: 700; }
.primary-button { border: 1px solid var(--green); color: #fff; background: var(--green); box-shadow: 0 5px 12px rgba(40,122,91,.16); }
.primary-button:active { background: var(--green-dark); transform: translateY(1px); }
.secondary-button { display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #d6e0d5; background: #fff; }
.secondary-button:active { background: #edf2e9; }
.secondary-button svg { width: 18px; }
.text-button { min-height: 40px; margin-top: 8px; padding: 6px 12px; border: 0; color: #7f8c84; background: transparent; font-size: 11px; }
.round-summary { margin: 20px 0 4px; padding: 18px 8px; display: grid; grid-template-columns: repeat(3,1fr); border-radius: 16px; background: #eaf0e6; }
.round-summary > div { display: flex; flex-direction: column; gap: 5px; border-right: 1px solid #d5dfd2; }
.round-summary > div:last-child { border-right: 0; }
.round-summary strong { color: var(--green); font-size: 22px; }
.round-summary span { color: var(--muted); font-size: 10px; }

.game-active #result-modal.sentence-layout { padding: 14px; }
.game-active #result-modal.sentence-layout .modal-card { width: min(700px, 100%); max-width: 700px; padding: 16px 18px 12px; display: grid; grid-template-columns: 150px minmax(0, 1fr); grid-template-rows: auto auto auto minmax(30px, 1fr) auto; column-gap: 22px; row-gap: 2px; overflow: hidden; border-radius: 22px; text-align: left; }
.game-active #result-modal.sentence-layout .result-badge { grid-column: 1; grid-row: 1; width: 40px; height: 40px; margin: 0 auto 3px; border-radius: 14px; }
.game-active #result-modal.sentence-layout .result-badge svg { width: 25px; height: 25px; }
.game-active #result-modal.sentence-layout .result-kicker { grid-column: 1; grid-row: 2; margin: 0; text-align: center; }
.game-active #result-modal.sentence-layout .modal-card h2 { grid-column: 1; grid-row: 3; font-size: 22px; text-align: center; }
.game-active #result-modal.sentence-layout .result-stars { grid-column: 1; grid-row: 4; height: 34px; margin: 3px 0 0; }
.game-active #result-modal.sentence-layout .result-stars .star { width: 26px; height: 26px; }
.game-active #result-modal.sentence-layout .result-stars .star:nth-child(2) { width: 31px; height: 31px; }
.game-active #result-modal.sentence-layout #sentence-result { grid-column: 2; grid-row: 1 / 5; min-height: 0; padding: 2px 3px; overflow-y: auto; }
.game-active #result-modal.sentence-layout #result-sentence { padding: 2px 0 6px; font-size: 20px; line-height: 1.35; }
.game-active #result-modal.sentence-layout .result-translation { margin: 0 0 8px; font-size: 12px; }
.game-active #result-modal.sentence-layout .grammar-tip { padding: 8px 10px; }
.game-active #result-modal.sentence-layout .grammar-tip p { line-height: 1.45; }
.game-active #result-modal.sentence-layout .result-actions { grid-column: 2; grid-row: 5; align-self: end; margin-top: 8px; }
.game-active #result-modal.sentence-layout .result-actions button { min-height: 42px; }
.game-active #result-modal.sentence-layout #result-home-button { grid-column: 1; grid-row: 5; align-self: center; min-height: 36px; margin: 5px 0 0; }

@media (min-width: 541px) {
  .topbar { padding-top: 12px; }
  .screen { padding-left: 24px; padding-right: 24px; }
  .game-active .game-screen { padding: 0; }
  .game-active .topbar { padding-top: calc(8px + env(safe-area-inset-top)); }
}
@media (max-width: 370px) {
  .screen { padding-left: 13px; padding-right: 13px; }
  .hero { padding: 22px 17px; }
  .hero-description { font-size: 11px; }
  .level-card { gap: 9px; }
  .level-number { width: 43px; height: 43px; flex-basis: 43px; }
  .level-progress small { display: none; }
}
@media (max-height: 500px) {
  .game-stats { top: calc(7px + env(safe-area-inset-top)); gap: 9px; padding: 5px 8px; }
  .game-stats > div:first-child { display: none; }
  .sentence-card { top: calc(6px + env(safe-area-inset-top)); width: min(48vw, 500px); padding: 6px 12px 7px; }
  .sentence-top { font-size: 8px; }
  .translation { margin: 2px 0 4px; font-size: 13px; }
  .progress-word { font-size: 10px; }
  .joystick { left: calc(40px + env(safe-area-inset-left)); bottom: calc(16px + env(safe-area-inset-bottom)); width: 128px; height: 128px; padding: 8px; }
  .joystick-knob { width: 54px; height: 54px; margin: -27px; }
  .boost-button { right: calc(46px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); width: 104px; height: 104px; }
  .boost-button svg { width: 26px; height: 26px; }
  .hint-button { right: calc(56px + env(safe-area-inset-right)); bottom: calc(138px + env(safe-area-inset-bottom)); min-height: 38px; }
  .speed-boost { top: calc(56px + env(safe-area-inset-top)); }
  .board-toast { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (orientation: portrait) and (pointer: coarse) {
  .game-active:not(.simulated-landscape) .rotate-overlay { display: grid; }
}

.swipe-tutorial { z-index: 30; }
.swipe-tutorial-card { max-width: 360px; padding: 28px 22px 22px; }
.swipe-tutorial-card h2 { font-size: 24px; }
.swipe-tutorial-intro { margin: 10px auto 18px; max-width: 260px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.swipe-guide { margin: 0 0 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.swipe-guide-item { padding: 15px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 9px; border: 1px solid #dce6da; border-radius: 15px; color: var(--green); background: #edf4e9; }
.swipe-guide-item svg { width: 26px; height: 26px; stroke-width: 2.2; }
.swipe-guide-item > span:last-child { color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1.55; }
.tutorial-joystick { position: relative; width: 50px; height: 50px; border: 2px solid #a9c9b3; border-radius: 50%; background: #fff; }
.tutorial-joystick i { position: absolute; left: 50%; top: 50%; width: 23px; height: 23px; margin: -11.5px; border-radius: 50%; background: var(--green); }
.tutorial-boost { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; color: #fff; background: var(--coral); }
.swipe-tutorial-note { margin: 0 0 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.swipe-tutorial-card .primary-button { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ===== 登录与排行榜 ===== */
.user-chip {
  max-width: 110px;
  height: 36px;
  padding: 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip:active { background: #eef3ec; }
.game-active .user-chip { display: none; }

.leaderboard-card { margin-top: 10px; }
.level-board { background: #fff6dd; font-size: 22px; }

.login-card { max-width: 360px; padding: 28px 24px 22px; text-align: center; }
.login-intro { margin: 10px 0 18px; color: var(--muted); font-size: 13px; }
.avatar-grid { margin: 0 0 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.avatar-option {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  font-size: 26px;
}
.avatar-option.selected { border-color: var(--green); background: var(--green-light); }
.nickname-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  text-align: center;
}
.nickname-input:focus { border-color: var(--green); outline: none; }
.login-error { margin: 10px 0 0; color: #b4483a; font-size: 12px; }
.login-card .primary-button { width: 100%; margin-top: 14px; }
.login-card .text-button { margin-top: 10px; }
.auth-tabs { margin: 0 0 14px; }
.login-card .nickname-input { margin-top: 10px; }
.register-extra[hidden] { display: none; }
.register-extra { margin-top: 14px; }
.account-card { max-width: 380px; max-height: 88dvh; padding: 24px 22px 18px; overflow-y: auto; text-align: center; }
.account-phone { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.account-divider { height: 1px; margin: 16px 0 14px; background: var(--line); }
.account-section-title { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.account-card .nickname-input { margin-top: 10px; }
.account-card .primary-button { width: 100%; margin-top: 12px; }
.account-actions { margin-top: 8px; display: flex; justify-content: center; gap: 16px; }
.account-actions .text-button { margin-top: 0; }
.text-button.danger { color: #b4483a; }
.primary-button.secondary { border: 1.5px solid var(--line); color: var(--ink); background: var(--paper); box-shadow: none; }
.primary-button.secondary:active { background: #edf2e9; }

.leaderboard-modal-card { max-width: 420px; max-height: 86dvh; padding: 20px 18px 14px; display: flex; flex-direction: column; text-align: left; }
.leaderboard-head { display: flex; align-items: flex-start; justify-content: space-between; }
.leaderboard-head h2 { margin: 4px 0 0; }
.board-tabs { margin-top: 14px; display: flex; gap: 8px; }
.board-tab {
  flex: 1;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.board-tab.active { border-color: var(--green); background: var(--green); color: #fff; }
.board-level-tabs .board-tab { height: 30px; font-size: 12px; border-radius: 15px; }
.leaderboard-list { margin-top: 14px; flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f3f6ef;
  font-size: 13px;
}
.board-row .board-rank { width: 26px; flex: 0 0 26px; color: var(--muted); font-weight: 800; text-align: center; }
.board-row:nth-child(1) .board-rank { color: #c8902a; }
.board-row:nth-child(2) .board-rank { color: #8a938e; }
.board-row:nth-child(3) .board-rank { color: #a3653c; }
.board-row .board-avatar { font-size: 20px; }
.board-row .board-name { flex: 1; min-width: 0; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.board-row .board-score { color: var(--green); font-weight: 800; }
.board-row .board-done { color: var(--muted); font-size: 11px; }
.board-empty { padding: 30px 0; color: var(--muted); font-size: 13px; text-align: center; }
.leaderboard-mine { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.leaderboard-mine strong { color: var(--green); }
