:root {
  --blue: #4f9cf9;
  --blue-dark: #2f7fe0;
  --bg: #eaf4ff;
  --card: #ffffff;
  --ink: #22314b;
  --muted: #6b7a99;
  --green: #34c77b;
  --red: #ff6b6b;
  --yellow: #ffc93c;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: linear-gradient(180deg, #d8ecff 0%, var(--bg) 40%, #fff7e6 100%);
  color: var(--ink);
  min-height: 100vh;
}
.topbar {
  background: linear-gradient(135deg, var(--blue), #7b61ff);
  color: #fff;
  padding: 14px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(47, 127, 224, .35);
}
.brand { font-size: 1.35rem; font-weight: 800; }
.topbar-sub { font-size: .8rem; opacity: .92; }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 14px 40px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: 0 6px 22px rgba(34, 49, 75, .1);
  margin-bottom: 14px;
}
.center { text-align: center; }
.hidden { display: none !important; }
h1 { font-size: 1.45rem; margin: .4em 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mascot { font-size: 3.4rem; }
.info-grid { display: grid; gap: 8px; margin: 14px 0; }
.info-chip {
  background: #f1f7ff;
  border: 2px dashed var(--blue);
  border-radius: 12px;
  padding: 10px;
  font-weight: 600;
  font-size: .92rem;
}
.name-label { display: block; margin: 12px 0 6px; font-weight: 700; }
.text-input {
  width: 100%;
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #c9dcff;
  outline: none;
}
.text-input:focus { border-color: var(--blue); }
.btn {
  border: none;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; box-shadow: 0 4px 12px rgba(47,127,224,.4); }
.btn-secondary { background: #eef2fa; color: var(--ink); }
.btn-big { width: 100%; margin-top: 14px; font-size: 1.15rem; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.progress-wrap { margin-bottom: 10px; }
.progress-meta { display: flex; justify-content: space-between; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.progress-bar { background: #dde7f7; border-radius: 99px; height: 12px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--yellow)); border-radius: 99px; transition: width .25s; }
.section-tabs { display: flex; gap: 6px; margin-top: 8px; }
.tab { flex: 1; text-align: center; font-size: .75rem; font-weight: 700; padding: 7px 4px; border-radius: 10px; background: #eef2fa; color: var(--muted); }
.tab.active { background: var(--blue); color: #fff; }
.tab.done { background: var(--green); color: #fff; }
.q-section { display: inline-block; font-size: .78rem; font-weight: 800; padding: 5px 12px; border-radius: 99px; margin-bottom: 8px; }
.q-pic {
  font-size: 3.2rem;
  text-align: center;
  background: #f6f9ff;
  border-radius: 16px;
  padding: 10px;
  margin: 4px 0 6px;
  letter-spacing: .2rem;
}
.story-box {
  background: #f0f7ff;
  border-left: 5px solid var(--blue);
  border-radius: 0 14px 14px 0;
  padding: 12px 14px;
  margin: 8px 0 10px;
  font-size: .98rem;
  line-height: 1.6;
}
.q-section.mc { background: #e3f0ff; color: #2f7fe0; }
.q-section.fill { background: #fff3d6; color: #9a6b00; }
.q-section.essay { background: #e9e4ff; color: #5b3df0; }
.q-text { font-size: 1.2rem; font-weight: 700; margin: 6px 0 4px; line-height: 1.45; }
.q-indo { color: var(--muted); font-size: .92rem; margin-bottom: 10px; }
.speak-btn { border: none; background: #f1f7ff; border-radius: 10px; padding: 8px 12px; font-size: .9rem; font-weight: 700; cursor: pointer; margin-bottom: 12px; color: #2f7fe0; }
.opt {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: #f6f9ff;
  border: 2px solid #d7e5ff;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 1.02rem;
  font-weight: 600;
  cursor: pointer;
}
.opt.selected { border-color: var(--blue); background: #e3f0ff; }
.opt .letter {
  width: 30px; height: 30px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue); color: #fff; border-radius: 50%; font-weight: 800;
}
.guide-box {
  background: #fffbe8;
  border: 2px dashed var(--yellow);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: .92rem;
}
.guide-words { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.guide-words span { background: #fff; border: 1.5px solid var(--yellow); border-radius: 8px; padding: 3px 10px; font-weight: 700; }
.answer-input, .answer-area {
  width: 100%;
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #c9dcff;
  outline: none;
  font-family: inherit;
}
.answer-area { min-height: 110px; resize: vertical; }
.answer-input:focus, .answer-area:focus { border-color: var(--blue); }
.nav-row { display: flex; gap: 10px; }
.nav-row .btn { flex: 1; }
.stars { font-size: 2.6rem; }
.score-big { font-size: 2rem; font-weight: 800; margin: .2em 0; }
.result-detail { display: grid; gap: 6px; margin: 12px 0; text-align: left; }
.result-row { background: #f6f9ff; border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: .92rem; }
.review-item { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: 0 3px 12px rgba(34,49,75,.08); }
.review-item.correct { border-left: 6px solid var(--green); }
.review-item.wrong { border-left: 6px solid var(--red); }
.review-q { font-weight: 700; margin-bottom: 6px; }
.review-a { font-size: .9rem; margin: 3px 0; }
.badge-ok { color: var(--green); font-weight: 800; }
.badge-no { color: var(--red); font-weight: 800; }
#btn-home { width: 100%; margin-top: 10px; }
.footer { text-align: center; padding: 10px; }
@media (min-width: 700px) { h1 { font-size: 1.7rem; } }
.translate-btn {
  border: 2px dashed #c9dcff;
  background: #f6f9ff;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  color: var(--muted);
}
.history-item {
  background: #f6f9ff;
  border: 2px solid #d7e5ff;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: .88rem;
  text-align: left;
}
.history-item .hist-score { font-size: 1.05rem; font-weight: 800; }
.hist-btns { display: flex; gap: 6px; margin-top: 8px; }
.hist-btns button {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 8px 4px;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  background: #e3f0ff;
  color: var(--ink);
}
.hist-btns button.danger { background: #ffe9e9; color: #c0392b; }
.shared-banner {
  background: #fff3d6;
  border: 2px dashed var(--yellow);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
  font-weight: 700;
}
