/* ===== 专业、克制、不像幼儿园的风格 ===== */
* { box-sizing: border-box; }

:root {
  --bg: #0f1420;
  --card: #181d2a;
  --card-2: #202739;
  --text: #e6e9f0;
  --text-2: #9aa3b8;
  --accent: #4d8bff;
  --accent-2: #3bd0a5;
  --warn: #f0b232;
  --danger: #f26b6b;
  --border: rgba(255,255,255,0.08);
  --radius: 12px;
}

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.back-home {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.2s, background 0.2s;
}

.back-home:hover {
  background: var(--card-2);
  transform: translateY(-2px);
}

#app { max-width: 1080px; margin: 0 auto; padding: 24px; }

.app-header { text-align: center; margin-bottom: 24px; }
.app-header h1 { font-size: 32px; font-weight: 800; margin: 0; letter-spacing: -0.5px; }
.subtitle { color: var(--text-2); margin: 6px 0 0; font-size: 15px; }

/* 左右布局 */
.layout { display: grid; grid-template-columns: 380px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

/* 左侧三个部分 */
.part { padding: 16px 0; border-bottom: 1px solid var(--border); }
.part:first-child { padding-top: 0; }
.part:last-child { border-bottom: none; padding-bottom: 0; }
.part-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.part-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.badge {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.hint { color: var(--text-2); font-size: 13px; margin: 0 0 10px; line-height: 1.5; }

/* 上传区 */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card-2);
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.dropzone.drag { border-color: var(--accent-2); }
.dropzone video, .dropzone img { max-width: 100%; max-height: 260px; border-radius: 8px; }
.dropzone-hint { text-align: center; color: var(--text-2); }
.big-emoji { font-size: 36px; margin-bottom: 6px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  border: none; cursor: pointer;
  padding: 9px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #fff;
  background: var(--card-2);
  border: 1px solid var(--border);
  transition: background .15s, transform .05s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: #2a3144; }
.btn:active { transform: translateY(1px); }
.btn-blue { background: var(--accent); border-color: var(--accent); }
.btn-blue:hover { background: #3a7aee; }
.btn-green { background: var(--accent-2); border-color: var(--accent-2); color: #0a1f18; }
.btn-green:hover { background: #2ec497; }
.btn-yellow { background: var(--warn); border-color: var(--warn); color: #2e2105; }
.btn-purple { background: #7c5cff; border-color: #7c5cff; }
.btn-purple:hover { background: #6b4de6; }
.btn.big { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }

.linkbtn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 13px; padding: 8px 0; text-decoration: underline;
}

.ocr-box { margin-top: 12px; }
#ocr-status { margin: 0 0 6px; color: var(--text-2); font-size: 13px; }
.progress { background: var(--card-2); border-radius: 6px; height: 10px; overflow: hidden; }
.progress-bar { background: var(--accent-2); height: 100%; width: 0; transition: width .2s; }

textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; font-size: 15px; line-height: 1.6; resize: vertical;
  font-family: inherit; color: var(--text); background: var(--card-2);
}
textarea::placeholder { color: #5c657a; }

.word-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  background: var(--card-2); border: 1px solid var(--border); color: var(--text-2);
  padding: 5px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.chip:hover { background: #2a3144; color: var(--text); }

/* 右侧游戏面板 */
.panel-right { position: relative; }
.scoreboard {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card-2); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px;
}
.scoreboard-stats { font-size: 13px; font-weight: 600; color: var(--text-2); }
.scoreboard-btns { display: flex; gap: 6px; }

.game-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  flex: 1 1 90px; padding: 9px; border: none; border-radius: 8px;
  background: var(--card-2); color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border);
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.game-title { font-size: 15px; font-weight: 700; text-align: center; margin-bottom: 12px; color: var(--text-2); }
.game-host { display: flex; flex-direction: column; align-items: center; position: relative; width: 100%; }
.game-canvas {
  border-radius: var(--radius); background: var(--card-2);
  box-shadow: 0 6px 24px rgba(0,0,0,0.35); touch-action: none; max-width: 100%;
}
.game-help { color: var(--text-2); font-size: 13px; text-align: center; margin-top: 10px; }

/* HUD */
.snake-hud, .soccer-hud, .dict-hud, .tf-hud { width: 100%; max-width: 540px; margin-bottom: 10px; }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0; }
.hud-word { font-size: 24px; font-weight: 800; letter-spacing: 3px; color: var(--accent); }
.hud-prompt { font-size: 18px; font-weight: 700; color: var(--text); }
.hud-tip { color: var(--text-2); font-size: 13px; }
.overlay-msg {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; text-align: center;
  font-weight: 600; color: var(--text-2); margin-top: 8px;
}

/* 判断题 / 听写 */
.tf-sentence {
  font-size: 22px; font-weight: 700; text-align: center;
  background: var(--card-2); border-radius: var(--radius); padding: 18px; line-height: 1.4;
}
.tf-choices { display: flex; gap: 10px; margin: 12px 0; }
.tf-btn {
  flex: 1; border: none; border-radius: var(--radius); padding: 14px;
  font-size: 18px; font-weight: 700; color: #fff; cursor: pointer;
}
.tf-true { background: var(--accent-2); color: #0a1f18; }
.tf-false { background: var(--danger); }
.tf-feedback { text-align: center; font-size: 15px; font-weight: 600; min-height: 24px; margin-top: 6px; }
.tf-feedback.ok { color: var(--accent-2); }
.tf-feedback.bad { color: var(--danger); }

.dict-prompt { text-align: center; font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.dict-blanks { text-align: center; font-size: 28px; letter-spacing: 6px; font-weight: 700; color: var(--accent); min-height: 36px; }
.dict-blanks .slot { display: inline-block; min-width: 20px; }
.dict-input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; font-size: 22px; text-align: center; margin: 12px 0;
  font-family: inherit; letter-spacing: 2px; color: var(--text); background: var(--card-2);
}
.dict-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.dict-compare { font-size: 22px; letter-spacing: 3px; margin-top: 6px; font-weight: 700; }
.letter-ok { color: var(--accent-2); }
.letter-bad { color: #5c657a; }

/* 大闯关 */
.lvl-top { text-align: center; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.lvl-progress { background: var(--card-2); border-radius: 6px; height: 10px; overflow: hidden; margin-bottom: 12px; }
.lvl-progress-bar { background: var(--accent-2); height: 100%; width: 0; transition: width .3s; }
.lvl-q { text-align: center; font-weight: 600; margin-bottom: 8px; color: var(--text-2); }
.lvl-sentence { font-size: 20px; font-weight: 700; text-align: center; background: var(--card-2); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; line-height: 1.4; }
.lvl-center { text-align: center; margin: 8px 0; }
.lvl-options { display: flex; flex-direction: column; gap: 8px; }
.lvl-opt {
  border: none; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
  padding: 12px; border-radius: var(--radius); cursor: pointer;
}
.lvl-opt:hover { background: #3a7aee; }
.lvl-finish { text-align: center; padding: 20px; }
.lvl-stars { font-size: 42px; }
.lvl-result { font-size: 18px; font-weight: 700; margin: 10px 0 16px; }

/* 家长报告弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(5, 8, 16, 0.75);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  max-width: 460px; width: 100%; max-height: 86vh; overflow: auto; position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; border: none; background: var(--card-2);
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer; font-size: 15px; color: var(--text-2);
}
.report-title { margin: 0 0 2px; font-size: 20px; }
.report-date { margin: 0 0 14px; color: var(--text-2); font-size: 13px; }
.report-empty { color: var(--text-2); background: var(--card-2); border-radius: 8px; padding: 14px; text-align: center; }
.report-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.report-stat { flex: 1 1 90px; background: var(--card-2); border-radius: 8px; padding: 12px; text-align: center; }
.report-stat-val { font-size: 20px; font-weight: 800; color: var(--accent); }
.report-stat-label { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.report-h3 { font-size: 15px; margin: 18px 0 8px; }
.report-games { display: flex; flex-wrap: wrap; gap: 6px; }
.report-pill { background: var(--card-2); color: var(--text-2); padding: 5px 10px; border-radius: 6px; font-size: 13px; font-weight: 500; }
.chip-hard { background: rgba(242,107,107,0.12); color: #ff9494; }

.confetti { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; }

.app-footer { text-align: center; color: var(--text-2); font-size: 12px; margin-top: 24px; }

/* 🎤 我读你听 */
.speak-card {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
}
.sb-target {
  font-size: 42px; font-weight: 800; color: var(--text); margin-bottom: 8px;
}
.sb-phonetic {
  font-size: 18px; color: var(--accent); margin-bottom: 4px;
}
.sb-meaning {
  font-size: 15px; color: var(--text-2); margin-bottom: 18px;
}
.sb-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
#sb-record { min-width: 180px; }
#sb-record:active { transform: scale(0.98); }
.sb-visual {
  height: 40px; background: var(--card); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px; overflow: hidden;
}
.sb-wave {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transition: all .1s;
}
.sb-wave.active {
  width: 80%; height: 60%; border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--accent), var(--accent) 4px, transparent 4px, transparent 8px);
  animation: pulseBar 0.6s infinite alternate;
}
@keyframes pulseBar { from { opacity: .5; } to { opacity: 1; } }
.sb-feedback { font-size: 17px; font-weight: 700; min-height: 26px; margin-bottom: 10px; }
.sb-feedback.ok { color: var(--accent-2); }
.sb-feedback.bad { color: var(--danger); }
.sb-detail { text-align: left; }
.sb-advice { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.sb-advice p { margin: 6px 0; }
.sb-advice ul { margin: 6px 0; padding-left: 20px; color: var(--text-2); }
.sb-advice li { margin: 4px 0; }
