:root {
  --accent: #7F77DD;
  --accent-soft: #EEEDFE;
  --accent-mid: #CECBF6;
  --accent-dark: #534AB7;

  --g-wrong-bg: #FAC775;   /* 틀림(스펠링) */
  --g-wrong-fg: #633806;
  --g-missed-bg: #9FE1CB;  /* 빠뜨림 */
  --g-missed-fg: #085041;
  --g-extra-bg: #F4C0D1;   /* 잘못넣음 */
  --g-extra-fg: #72243E;

  --bg: #FbFaF7;
  --surface: #ffffff;
  --border: #e7e5df;
  --border-strong: #d3d1c7;
  --text: #2c2c2a;
  --text-2: #5f5e5a;
  --text-muted: #97958d;
  --ok: #0F6E56;
  --ok-mid: #1D9E75;

  --radius: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: 940px; margin: 0 auto; padding: 28px 24px 60px; }

/* ---- header / brand ---- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.brand-title { font-size: 19px; font-weight: 600; }
.subtitle { font-size: 13px; color: var(--text-2); margin: 6px 0 22px; }

.btn-accent {
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius); padding: 0 22px; height: 44px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn-accent:hover { background: var(--accent-dark); }
.btn-accent:active { transform: scale(0.98); }
.btn-ghost {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 9px 15px; font-size: 14px;
}
.btn-ghost:hover { border-color: var(--accent); }

/* ---- list header ---- */
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.list-head .count { font-size: 13px; font-weight: 500; color: var(--text-2); }
.list-head .count b { color: var(--text-muted); font-weight: 500; }

/* ---- video cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 15px;
  background: var(--surface); display: flex; flex-direction: column; gap: 9px;
  cursor: pointer; transition: border-color .12s, transform .12s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-title { font-size: 14px; font-weight: 500; line-height: 1.35; }
.card-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 11px; flex-wrap: wrap; }
.card-meta i { opacity: .8; }
.prog { height: 5px; border-radius: 3px; background: var(--accent-mid); overflow: hidden; }
.prog > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.card-status { font-size: 11px; }
.card-status.resume { color: var(--accent-dark); }
.card-status.done { color: var(--ok); }
.card-status.none { color: var(--text-muted); }

/* ---- practice layout ---- */
.practice { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); min-height: 440px; }
.tracker { width: 172px; border-right: 1px solid var(--border); background: #faf9f5; display: flex; flex-direction: column; flex-shrink: 0; }
.tracker-head { padding: 15px 14px 11px; border-bottom: 1px solid var(--border); }
.tracker-head .t-title { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.tracker-head .t-sub { font-size: 11px; color: var(--text-muted); }
.tracker-head .prog { margin-top: 9px; }
.tracker-list { flex: 1; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; gap: 1px; }
.t-row {
  padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
}
.t-row:hover { background: #f1eFe8; }
.t-row.current { background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }
.t-row.solved { color: var(--text-2); }
.t-row .acc { font-size: 11px; }

.stage { flex: 1; padding: 26px 30px; display: flex; flex-direction: column; }
.player { display: flex; flex-direction: column; align-items: center; gap: 15px; margin-bottom: 22px; }
.play-btn {
  width: 58px; height: 58px; border-radius: 50%; background: var(--accent); color: #fff;
  border: none; font-size: 24px; display: flex; align-items: center; justify-content: center;
}
.play-btn:hover { background: var(--accent-dark); }
.play-btn:active { transform: scale(0.96); }
.controls { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 20px;
  padding: 7px 13px; color: var(--text);
}
.pill:hover { border-color: var(--accent); }
.pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }

.answer-input {
  width: 100%; min-height: 76px; padding: 13px 15px; font-size: 15px; line-height: 1.7;
  border: 1px solid var(--border-strong); border-radius: 10px; resize: vertical;
  font-family: inherit; color: var(--text); outline: none; margin-bottom: 12px;
}
.answer-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.result {
  font-size: 15px; line-height: 1.95; padding: 15px 17px;
  background: var(--accent-soft); border-radius: 10px; margin-bottom: 12px;
}
.result .w-wrong  { background: var(--g-wrong-bg);  color: var(--g-wrong-fg);  border-radius: 5px; padding: 1px 5px; }
.result .w-missed { background: var(--g-missed-bg); color: var(--g-missed-fg); border-radius: 5px; padding: 1px 5px; }
.result .w-extra  { background: var(--g-extra-bg);  color: var(--g-extra-fg);  border-radius: 5px; padding: 1px 5px; text-decoration: line-through; }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.stage-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border);
}
.foot-nav { display: flex; gap: 8px; }
.hint-group { display: flex; gap: 2px; align-items: center; }
.link-muted { font-size: 13px; color: var(--text-2); background: none; border: none; padding: 6px 4px; }
.link-muted:hover { color: var(--accent-dark); }

/* ---- completion modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(44,44,42,0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10;
}
.modal-card {
  background: var(--surface); border-radius: 16px; padding: 32px 30px; max-width: 340px; width: 100%;
  text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.modal-emoji { font-size: 40px; margin-bottom: 10px; }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.modal-sub { font-size: 14px; color: var(--text-2); margin-bottom: 22px; }
.modal-actions { display: flex; gap: 8px; justify-content: center; }

.hidden { display: none !important; }
.top-back { font-size: 13px; color: var(--text-2); background: none; border: none; padding: 6px 0; margin-bottom: 16px; display: inline-flex; align-items: center; gap: 6px; }
.top-back:hover { color: var(--accent-dark); }

/* ---- mobile ---- */
@media (max-width: 680px) {
  .wrap { padding: 18px 14px 40px; }

  .practice { flex-direction: column; }
  .tracker { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .tracker-list { max-height: 180px; }

  .stage { padding: 20px 16px; }
  .controls { flex-wrap: wrap; justify-content: center; }

  .stage-foot { flex-wrap: wrap; gap: 10px; }
  .foot-nav { width: 100%; justify-content: space-between; }
  #checkBtn { flex: 1; }
}
