/* =========================================================
   한글 타자 연습 — 스타일
   다크 모던 + 절제된 네온. 16:9 한 화면, 스크롤 없음.
   ========================================================= */

:root {
  --bg: #0a0e15;
  --bg2: #0e141f;
  --panel: #141c2b;
  --panel2: #1a2436;
  --line: #24304a;
  --text: #e9eef8;
  --dim: #8496b3;
  --dim2: #5c6b85;

  --accent: #3ee0c0;
  --accent-d: #1fb99c;
  --violet: #9d8bf7;
  --ok: #5ee08a;
  --warn: #ff6b81;
  --gold: #ffcc5c;

  /* 손가락 색 */
  --f0: #ff8fab;
  --f1: #ffb86c;
  --f2: #ffe066;
  --f3: #6ee7a0;
  --f4: #5ad4e6;
  --f5: #7aa2f7;
  --f6: #bb9af7;
  --f7: #f7768e;

  --r: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(1200px 700px at 15% -10%, #16304a 0%, transparent 60%),
    radial-gradient(1000px 600px at 100% 110%, #2a1f4a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Pretendard', 'Pretendard Variable', -apple-system,
    'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* ---------- 앱 골격 ---------- */
#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen { display: none; height: 100%; flex-direction: column; }
.screen.on { display: flex; }

/* ---------- 상단 바 ---------- */
.topbar {
  flex: 0 0 auto;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 21, 0.72);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; letter-spacing: -0.02em;
}
.brand .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}
.brand small { color: var(--dim2); font-weight: 600; font-size: 13px; }

.topbar .spacer { flex: 1; }

.btn {
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px; font-weight: 600;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { background: #223049; border-color: #35476b; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-d), var(--accent));
  color: #04231d; border: none; font-weight: 800;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* =========================================================
   홈
   ========================================================= */
.home-wrap {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  justify-content: center;
  padding: 0 clamp(24px, 5vw, 80px);
  gap: clamp(16px, 3vh, 34px);
}

.hero h1 {
  font-size: clamp(30px, 4.4vh, 46px);
  font-weight: 900; letter-spacing: -0.035em;
  line-height: 1.15;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  margin-top: 10px; color: var(--dim);
  font-size: clamp(13px, 1.9vh, 16px); line-height: 1.6;
}
.hero-sub {
  display: inline-block;
  margin-top: 14px !important;
  padding: 7px 16px; border-radius: 999px;
  background: rgba(157, 139, 247, .12);
  border: 1px solid rgba(157, 139, 247, .3);
  color: var(--violet) !important;
  font-weight: 700; letter-spacing: -0.01em;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(10px, 1.4vw, 18px);
}

.mode-card {
  position: relative;
  text-align: left;
  padding: clamp(14px, 2.2vh, 24px);
  border-radius: var(--r);
  background: linear-gradient(160deg, var(--panel), var(--bg2));
  border: 1px solid var(--line);
  transition: .18s;
  overflow: hidden;
  min-height: clamp(120px, 20vh, 190px);
  display: flex; flex-direction: column;
}
.mode-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-d);
  box-shadow: 0 14px 40px -18px var(--accent);
}
.mode-card .ico { font-size: clamp(24px, 3.6vh, 34px); line-height: 1; }
.mode-card h3 {
  margin-top: auto; font-size: clamp(16px, 2.4vh, 21px);
  font-weight: 800; letter-spacing: -0.02em;
}
.mode-card p {
  margin-top: 6px; color: var(--dim);
  font-size: clamp(11px, 1.55vh, 13.5px); line-height: 1.5;
}
.mode-card .best {
  margin-top: 10px; font-size: 12px; font-weight: 700;
  color: var(--accent);
}

/* =========================================================
   단계 선택
   ========================================================= */
.page {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding: clamp(18px, 3vh, 34px) clamp(24px, 5vw, 70px);
  gap: clamp(12px, 2vh, 22px);
  overflow: hidden;
}
.page-head h2 {
  font-size: clamp(22px, 3.4vh, 32px); font-weight: 900; letter-spacing: -0.03em;
}
.page-head p { margin-top: 6px; color: var(--dim); font-size: clamp(12px, 1.8vh, 15px); }

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.4vw, 16px);
  align-content: start;
}

.level-card {
  text-align: left; min-width: 0;
  padding: clamp(12px, 2vh, 20px);
  border-radius: var(--r);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: .16s;
  display: flex; flex-direction: column; gap: 6px;
}
.level-card:hover { border-color: var(--accent-d); background: var(--panel2); transform: translateY(-3px); }
.level-card .no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-d), var(--accent));
  color: #04231d; font-weight: 900; font-size: 14px;
}
.level-card h4 { font-size: clamp(14px, 2.1vh, 18px); font-weight: 800; }
.level-card .keys {
  font-size: clamp(13px, 2vh, 17px); font-weight: 700;
  color: var(--accent); letter-spacing: .06em;
}
.level-card .meta { font-size: 12px; color: var(--dim2); }
.level-card .rec { font-size: 12px; color: var(--gold); font-weight: 700; }

/* =========================================================
   연습 화면
   ========================================================= */
.play {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}
/* 게임 화면에서 자판 안내를 켜면 한 줄이 더 생긴다 */
#s-game .play { grid-template-rows: auto auto 1fr auto auto; }

/* 게임 안 자판 안내 — 연습 화면 자판보다 납작하게 눌러 게임판을 덜 잡아먹는다 */
.gamekb {
  border-top: 1px solid var(--line);
  background: rgba(10, 14, 21, .72);
  padding: clamp(5px, .9vh, 10px) 20px clamp(6px, 1.1vh, 12px);
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(3px, .5vh, 6px);
}
.gamekb[hidden] { display: none; }
.gamekb .key {
  width: clamp(26px, 3.6vh, 40px);
  height: clamp(26px, 3.6vh, 40px);
  border-radius: 7px;
}
.gamekb .key .main { font-size: clamp(11px, 1.7vh, 17px); }
.gamekb .key .sub { display: none; }
.gamekb .finger-hint { font-size: clamp(11px, 1.6vh, 15px); }
#btn-game-kb.on { background: var(--accent); color: #06231d; border-color: transparent; }

.play-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}
.tag {
  padding: 5px 11px; border-radius: 999px;
  background: rgba(62, 224, 192, .12);
  border: 1px solid rgba(62, 224, 192, .3);
  color: var(--accent); font-size: 12.5px; font-weight: 800;
}
.tag.v { background: rgba(157,139,247,.12); border-color: rgba(157,139,247,.32); color: var(--violet); }
.play-head .title { font-size: 16px; font-weight: 800; }
.play-head .spacer { flex: 1; }

.stats { display: flex; gap: clamp(12px, 2vw, 30px); align-items: center; }
.stat { text-align: right; }
.stat .k { font-size: 11px; color: var(--dim2); font-weight: 700; letter-spacing: .04em; }
.stat .v { font-size: clamp(17px, 2.6vh, 24px); font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .v.acc { color: var(--accent); }
.stat .v.cpm { color: var(--gold); }

.progress {
  height: 5px; background: var(--panel);
  position: relative; overflow: hidden;
}
.progress i {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  width: 0; transition: width .25s ease;
}

/* --- 타이핑 영역 --- */
.type-area {
  min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(10px, 2vh, 22px);
  padding: clamp(10px, 2vh, 26px) clamp(20px, 4vw, 48px);
}

.upnext {
  display: flex; gap: 10px; align-items: center;
  color: var(--dim2); font-size: clamp(12px, 1.8vh, 15px); font-weight: 600;
  min-height: 20px;
}
.upnext b { color: var(--dim); font-weight: 700; }

.target {
  font-size: clamp(30px, 6.4vh, 62px);
  font-weight: 800; letter-spacing: 0.02em;
  line-height: 1.35; text-align: center;
  word-break: keep-all;
  max-width: 100%;
}
.target.small { font-size: clamp(22px, 4.4vh, 40px); }
.target.xsmall { font-size: clamp(18px, 3.4vh, 30px); letter-spacing: 0; }

.target .ch { transition: color .08s, opacity .08s; }
.target .ch.done { color: var(--accent); }
.target .ch.cur {
  color: #fff;
  border-bottom: 4px solid var(--violet);
  border-radius: 2px;
}
.target .ch.wait { color: var(--dim); }
.target .ch.err { color: var(--warn); background: rgba(255,107,129,.14); border-radius: 4px; }
.target .sp { display: inline-block; min-width: .4em; }

.typebox {
  width: min(920px, 100%);
  position: relative;
}
.typebox input {
  width: 100%;
  padding: clamp(10px, 1.8vh, 18px) 20px;
  font-size: clamp(20px, 3.6vh, 34px);
  font-weight: 700; letter-spacing: 0.02em;
  text-align: center;
  color: var(--text);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.typebox input:focus { border-color: var(--accent-d); box-shadow: 0 0 0 4px rgba(62,224,192,.12); }
.typebox.bad input { border-color: var(--warn); box-shadow: 0 0 0 4px rgba(255,107,129,.14); }
.typebox .hintline {
  margin-top: 8px; text-align: center;
  font-size: 12.5px; color: var(--dim2);
}

/* --- 긴글: 여러 줄 --- */
.lines {
  width: min(1100px, 100%);
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
}
.lines .ln {
  font-size: clamp(15px, 2.3vh, 21px);
  color: var(--dim2); font-weight: 600; opacity: .55;
  text-align: center; word-break: keep-all;
}
.lines .ln.cur { opacity: 1; }

/* =========================================================
   가상 자판
   ========================================================= */
.kb-wrap {
  border-top: 1px solid var(--line);
  background: rgba(10,14,21,.6);
  padding: clamp(8px, 1.6vh, 16px) 20px clamp(10px, 2vh, 20px);
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(6px, 1vh, 12px);
}

.kb { display: flex; flex-direction: column; gap: clamp(4px, .7vh, 7px); }
.kb-row { display: flex; gap: clamp(4px, .7vh, 7px); justify-content: center; }
.kb-row.r2 { padding-left: clamp(12px, 2vh, 22px); }
.kb-row.r3 { padding-left: clamp(30px, 5vh, 56px); }

.key {
  width: clamp(34px, 5.2vh, 54px);
  height: clamp(34px, 5.2vh, 54px);
  border-radius: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
  transition: .1s;
}
.key .main { font-size: clamp(14px, 2.1vh, 19px); font-weight: 700; }
.key .shift {
  position: absolute; top: 3px; right: 5px;
  font-size: clamp(8px, 1.2vh, 11px); color: var(--dim2); font-weight: 700;
}
.key .eng {
  position: absolute; bottom: 2px; left: 5px;
  font-size: clamp(7px, 1vh, 9.5px); color: var(--dim2); font-weight: 600;
}
.key.off { opacity: .22; }
.key.on { border-color: rgba(255,255,255,.16); }

/* 다음에 눌러야 할 키 */
.key.next {
  transform: translateY(-3px) scale(1.06);
  background: var(--fc, var(--accent));
  border-color: #fff;
  color: #06121a;
  box-shadow: 0 0 0 3px rgba(255,255,255,.18), 0 10px 26px -8px var(--fc, var(--accent));
  z-index: 2;
}
.key.next .main { font-weight: 900; }
.key.next .shift, .key.next .eng { color: rgba(0,0,0,.5); }

.key.spacebar { width: clamp(160px, 26vh, 300px); }
.key.mod { width: clamp(52px, 8vh, 86px); font-size: 11px; }
.key.mod .main { font-size: clamp(10px, 1.4vh, 12px); color: var(--dim); }

/* 손가락 색 띠 */
.key::after {
  content: ''; position: absolute; left: 6px; right: 6px; bottom: 3px;
  height: 3px; border-radius: 2px; background: var(--fc); opacity: .5;
}
.key.next::after { opacity: 0; }
.key.mod::after, .key.spacebar::after { display: none; }

.finger-hint {
  font-size: clamp(12px, 1.8vh, 15px); font-weight: 700;
  color: var(--dim); display: flex; align-items: center; gap: 8px;
}
.finger-hint .chip {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--fc, var(--dim));
  box-shadow: 0 0 10px var(--fc, transparent);
}
.finger-hint b { color: var(--text); }

/* =========================================================
   결과 화면
   ========================================================= */
.result-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: clamp(14px, 2.5vh, 30px);
  padding: 30px;
}
.result-wrap h2 { font-size: clamp(26px, 4vh, 40px); font-weight: 900; letter-spacing: -0.03em; }
.result-grid {
  display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}
.rcard {
  padding: clamp(16px, 2.6vh, 26px);
  border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line);
  text-align: center;
}
.rcard .k { font-size: 12.5px; color: var(--dim2); font-weight: 700; }
.rcard .v {
  font-size: clamp(28px, 4.6vh, 44px); font-weight: 900;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 4px;
}
.rcard.a .v { color: var(--accent); }
.rcard.b .v { color: var(--gold); }
.rcard.c .v { color: var(--violet); }
.rcard .sub { font-size: 11.5px; color: var(--dim2); margin-top: 2px; }
.newrec {
  color: var(--gold); font-weight: 800; font-size: 15px;
  display: flex; align-items: center; gap: 8px;
}
/* 기록으로 세지 않은 연습 안내 */
.res-note {
  padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5;
  background: rgba(255, 204, 92, .12);
  border: 1px solid rgba(255, 204, 92, .34);
  color: var(--gold);
}
.res-note[hidden] { display: none; }

.btnrow { display: flex; gap: 12px; }

/* =========================================================
   로그인 안 한 학생의 체험 시간 (guest.js)
   ========================================================= */
.gtimer {
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 204, 92, .14);
  border: 1px solid rgba(255, 204, 92, .38);
  color: var(--gold); font-size: 14px; font-weight: 900;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.gtimer.hot {
  background: rgba(224, 82, 82, .16);
  border-color: rgba(224, 82, 82, .45);
  color: #ff8a8a;
  animation: gt-blink .9s steps(2, start) infinite;
}
@keyframes gt-blink { 50% { opacity: .35; } }

.guestbar {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px; padding: 10px 16px; border-radius: 12px;
  background: rgba(255, 204, 92, .09);
  border: 1px solid rgba(255, 204, 92, .28);
}
.guestbar.empty {
  background: rgba(224, 82, 82, .09);
  border-color: rgba(224, 82, 82, .3);
}
.guestbar .gi { font-size: 18px; }
.guestbar .gt { flex: 1; font-size: 14px; color: var(--dim); }
.guestbar .gt b { color: var(--gold); font-weight: 900; }
.guestbar.empty .gt b { color: #ff8a8a; }

.guestnote {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  justify-content: center; text-align: center;
  margin: 4px 0 2px; padding: 10px 18px; border-radius: 12px;
  background: rgba(255, 204, 92, .1);
  border: 1px solid rgba(255, 204, 92, .3);
}
.guestnote .gt { font-size: 14.5px; font-weight: 800; color: var(--gold); }
.guestnote .gs { font-size: 13px; color: var(--dim2); }

/* =========================================================
   긴글 선택
   ========================================================= */
.text-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.3vw, 16px);
  overflow-y: auto; align-content: start;
  padding-right: 6px;
}
.text-card {
  text-align: left; padding: clamp(13px, 2vh, 20px);
  border-radius: var(--r); background: var(--panel);
  border: 1px solid var(--line); transition: .16s;
  display: flex; flex-direction: column; gap: 6px; min-height: 118px;
}
.text-card:hover { border-color: var(--violet); transform: translateY(-3px); }
.text-card .t { font-size: clamp(15px, 2.2vh, 19px); font-weight: 800; }
.text-card .a { font-size: 12.5px; color: var(--dim); }
.text-card .n { margin-top: auto; font-size: 12px; color: var(--dim2); }
.text-card .badge {
  align-self: flex-start; padding: 3px 9px; border-radius: 999px;
  background: rgba(157,139,247,.14); color: var(--violet);
  font-size: 11px; font-weight: 800;
}

.paste-box {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px;
}
.paste-box textarea {
  width: 100%; height: 110px; resize: none;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); padding: 12px;
  font-size: 14px; line-height: 1.6; outline: none;
}
.paste-box textarea:focus { border-color: var(--accent-d); }
.paste-box .row { display: flex; gap: 10px; align-items: center; }
.paste-box .row span { font-size: 12.5px; color: var(--dim2); flex: 1; }

/* =========================================================
   게임
   ========================================================= */
.game-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 1.6vw, 20px);
}
.game-card {
  text-align: left; padding: clamp(16px, 2.6vh, 26px);
  border-radius: var(--r);
  background: linear-gradient(160deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); transition: .18s;
  display: flex; flex-direction: column; gap: 8px;
  min-height: clamp(140px, 24vh, 210px);
}
.game-card:hover { transform: translateY(-4px); border-color: var(--violet); box-shadow: 0 14px 40px -18px var(--violet); }
.game-card .ico { font-size: clamp(26px, 4vh, 38px); }
.game-card h3 { margin-top: auto; font-size: clamp(17px, 2.6vh, 22px); font-weight: 800; }
.game-card p { color: var(--dim); font-size: clamp(11.5px, 1.6vh, 13.5px); line-height: 1.55; }

.opt-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.opt-row .lb { font-size: 13px; color: var(--dim); font-weight: 700; margin-right: 4px; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 700; transition: .14s;
}
.chip:hover { border-color: var(--accent-d); }
.chip.sel {
  background: linear-gradient(135deg, var(--accent-d), var(--accent));
  color: #04231d; border-color: transparent;
}

/* 게임 무대 */
.stage {
  flex: 1; min-height: 0; position: relative;
  margin: 0 clamp(20px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(20,28,43,.6), rgba(10,14,21,.9));
  overflow: hidden;
}
.stage .grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(62,224,192,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62,224,192,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

/* 낙하 방어전 */
.falling {
  position: absolute;
  padding: 8px 16px; border-radius: 10px;
  background: rgba(20,28,43,.92);
  border: 1px solid var(--line);
  font-size: clamp(17px, 2.8vh, 26px); font-weight: 800;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 6px 24px -10px #000;
}
.falling.lock { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(62,224,192,.25), 0 6px 24px -10px var(--accent); }
.falling .hit { color: var(--accent); }
.falling.boom { animation: boom .28s ease-out forwards; }
@keyframes boom {
  to { transform: translateX(-50%) scale(1.5); opacity: 0; filter: blur(3px); }
}

/* 아이템이 달린 낱말 */
.falling.item {
  border-color: var(--ic);
  box-shadow: 0 0 0 1px var(--ic), 0 0 22px -4px var(--ic);
  background: rgba(20, 28, 43, .96);
}
.falling .ii { margin-right: 8px; font-size: .95em; }
.falling.item.lock { box-shadow: 0 0 0 2px var(--ic), 0 0 26px -2px var(--ic); }

/* 아이템 발동 안내 */
.itemflash {
  position: absolute; left: 50%; top: 26%;
  transform: translateX(-50%);
  padding: 12px 26px; border-radius: 999px;
  background: rgba(10, 14, 21, .9);
  border: 2px solid var(--ic); color: var(--ic);
  font-size: clamp(18px, 3vh, 28px); font-weight: 900;
  white-space: nowrap; pointer-events: none; z-index: 6;
  animation: iflash 1.1s ease-out forwards;
}
@keyframes iflash {
  0% { opacity: 0; transform: translateX(-50%) scale(.8); }
  18% { opacity: 1; transform: translateX(-50%) scale(1.05); }
  70% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-24px) scale(1); }
}

/* 진행 중인 아이템 표시 */
.buffbar {
  position: absolute; left: 16px; top: 14px; z-index: 5;
  display: flex; gap: 8px;
}
.buffbar span {
  padding: 5px 12px; border-radius: 999px;
  background: rgba(10, 14, 21, .85);
  border: 1px solid var(--ic); color: var(--ic);
  font-size: 12.5px; font-weight: 800;
}

/* 한/영 안내 */
.engwarn {
  position: absolute; left: 50%; top: 12%;
  transform: translateX(-50%);
  padding: 12px 24px; border-radius: 12px;
  background: rgba(255, 107, 129, .95); color: #2a0a10;
  font-size: clamp(15px, 2.4vh, 20px); font-weight: 900;
  white-space: nowrap; z-index: 9; pointer-events: none;
  box-shadow: 0 8px 26px -8px #000;
  animation: engwarn 2.2s ease-out forwards;
}
@keyframes engwarn {
  0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  10%, 80% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; }
}
.typebox.eng input { border-color: var(--warn); }
.warnhint { color: var(--warn); }

/* 얼리기 걸린 화면 */
.stage.frozen { box-shadow: inset 0 0 60px -10px rgba(90, 212, 230, .5); }
.stage.frozen .falling { filter: saturate(.5) brightness(1.1); }

.shieldline {
  position: absolute; left: 0; right: 0; bottom: 54px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px var(--accent);
}
.hpbar {
  position: absolute; left: 20px; right: 20px; bottom: 22px;
  height: 16px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); overflow: hidden;
}
.hpbar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width .2s;
}
.hpbar span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #04231d;
}

/* 달리기 */
.track { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: clamp(14px, 3vh, 34px); padding: 0 clamp(20px, 4vw, 60px); }
.lane { position: relative; }
.lane .rail {
  height: clamp(14px, 2.4vh, 22px); border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.lane .rail i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-d), var(--accent));
  width: 0; transition: width .3s ease;
}
.lane.ai .rail i { background: linear-gradient(90deg, #6b5bd6, var(--violet)); }
.lane .who {
  display: flex; align-items: center; gap: 8px;
  font-size: clamp(13px, 2vh, 17px); font-weight: 800; margin-bottom: 6px;
}
.lane .who .pct { color: var(--dim2); font-weight: 700; font-size: 13px; }
.lane .runner {
  position: absolute; top: -26px; font-size: clamp(20px, 3.2vh, 30px);
  transform: translateX(-50%); transition: left .3s ease;
}
.finish {
  position: absolute; right: clamp(20px, 4vw, 60px); top: 12%; bottom: 12%;
  width: 4px; background: repeating-linear-gradient(180deg, #fff 0 8px, #000 8px 16px);
  opacity: .5; border-radius: 2px;
}

/* 두더지 */
.moles {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: clamp(8px, 1.4vh, 16px); padding: clamp(12px, 2vh, 24px);
}
.hole {
  border-radius: var(--r);
  position: relative; overflow: hidden;
  background: rgba(10, 14, 21, .5);
  border: 1px dashed var(--line);
}
/* 흙더미 — 두더지가 그 뒤에서 올라온다 */
.hole .dirt {
  position: absolute; left: 16%; right: 16%; bottom: -3%;
  height: 20%; border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: linear-gradient(#4a3b31, #2b221c);
  box-shadow: inset 0 3px 7px -4px rgba(255, 255, 255, .18);
  z-index: 3;
}
/* 두더지 본체 — 구멍 아래 숨어 있다가 올라온다 */
.hole .mole {
  position: absolute; left: 50%; bottom: 4%;
  height: 84%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  transform: translate(-50%, 108%);
  transition: transform .26s cubic-bezier(.2, 1.5, .5, 1);
  z-index: 2;
}
.hole.up .mole { transform: translate(-50%, 6%); }
.hole .msvg { height: 72%; width: auto; display: block; order: 2; }
/* 낱말 팻말 */
.hole .sign {
  order: 1; margin-bottom: -4%;
  padding: 4px 12px; border-radius: 8px;
  background: linear-gradient(#fdf6e6, #e8d9bd);
  border: 2px solid #8b6f4e;
  box-shadow: 0 3px 8px -3px rgba(0, 0, 0, .6);
  position: relative; z-index: 4; white-space: nowrap;
}
.hole .word {
  font-size: clamp(14px, 2.4vh, 22px); font-weight: 900;
  color: #2f2418; letter-spacing: -.01em;
}
.hole .word .hit { color: #1f8a4c; }
.hole.up { border-style: solid; border-color: #33456b; }
.hole.lock { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.hole.lock .sign { border-color: var(--accent-d); box-shadow: 0 0 12px -2px var(--accent); }

/* 치면 안 되는 동물 — 팻말을 빨갛게 해서 색이 아닌 모양으로도 구분되게 */
.hole .sign.bad {
  background: linear-gradient(#ffe0e3, #f6bfc5);
  border-color: #b8434f;
}
.hole .sign.bad .word { color: #7d1f28; }
.hole .sign.bad::after {
  content: '치지 마세요';
  position: absolute; left: 50%; top: -15px; transform: translateX(-50%);
  font-size: 9.5px; font-weight: 800; color: #ff8a94; white-space: nowrap;
}
.hole.badhole.up { border-color: #7d3a44; }
.hole.badhole.lock { border-color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.hole.badhole .word .hit { color: #b8434f; }
/* 잘못 쳤을 때 */
.hole.wrong { animation: holewrong .5s ease-out; }
@keyframes holewrong {
  0%, 100% { background: rgba(10, 14, 21, .5); }
  30% { background: rgba(255, 107, 129, .3); }
}

/* 규칙 안내 */
.molerule {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  z-index: 6; pointer-events: none;
  padding: 5px 14px; border-radius: 999px;
  background: rgba(10, 14, 21, .85); border: 1px solid var(--line);
  font-size: clamp(11px, 1.6vh, 13px); font-weight: 700; color: var(--dim);
  white-space: nowrap;
}
.molerule .bad { color: var(--warn); }
.hole .timer {
  position: absolute; left: 0; bottom: 0; height: 4px;
  background: var(--warn); width: 100%; z-index: 5;
  display: none;
}
.hole.up .timer { display: block; }
.hole.pop .mole { animation: molepop .28s ease-in forwards; }
@keyframes molepop {
  to { transform: translate(-50%, 118%) scale(.7); opacity: 0; }
}

/* 낱말 맞추기 — 자모 카드 */
.cardwrap {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: clamp(12px, 2.2vh, 22px) clamp(14px, 3vw, 34px);
}
.chead {
  display: flex; justify-content: space-between; align-items: center;
  font-size: clamp(12.5px, 1.9vh, 15px); font-weight: 700; color: var(--dim);
}
.chead b { color: var(--accent); }
.cards {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-wrap: wrap;
  align-content: center; justify-content: center;
  gap: clamp(9px, 1.6vh, 16px);
  padding: clamp(8px, 1.4vh, 14px);
}
.wcard {
  padding: clamp(9px, 1.6vh, 15px) clamp(11px, 1.8vw, 18px);
  border-radius: 14px;
  background: linear-gradient(160deg, var(--panel), var(--bg2));
  border: 1px solid #33456b;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .7);
  transition: .18s;
}
.wcard.hinted { border-color: var(--gold); box-shadow: 0 0 18px -6px var(--gold); }
.wcard .wjs { display: flex; gap: clamp(4px, .8vh, 7px); }
.wcard .wj {
  width: clamp(30px, 5vh, 46px); height: clamp(30px, 5vh, 46px);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel2); border: 1px solid #3a4c74;
  font-size: clamp(16px, 2.8vh, 25px); font-weight: 800; color: var(--text);
}
.wcard .wmeta { font-size: clamp(10.5px, 1.5vh, 12.5px); color: var(--dim2); font-weight: 700; }
.wcard .wmeta b { color: var(--gold); font-size: 1.15em; }
/* 맞힌 카드 */
.wcard.done {
  border-color: var(--accent-d);
  background: linear-gradient(160deg, rgba(62, 224, 192, .14), rgba(62, 224, 192, .04));
  justify-content: center; min-height: clamp(56px, 9vh, 84px);
}
.wcard.done .wans {
  font-size: clamp(18px, 3vh, 28px); font-weight: 900; color: var(--accent);
}
.cnote { text-align: center; font-size: clamp(12.5px, 1.9vh, 15px); font-weight: 700; color: var(--dim); }

/* ---- 마법사 전투 연출 ---- */
.boss .bico {
  transform: scale(var(--grow, 1));
  transition: transform .3s, filter .3s;
  filter: drop-shadow(0 0 12px var(--ec, transparent));
}
.boss .bico.rage { filter: drop-shadow(0 0 18px #ff5a5a) saturate(1.4); }
/* 공격 전 기 모으기 */
.boss .bico.charge { animation: charge .5s ease-in-out infinite alternate; }
@keyframes charge {
  from { transform: scale(var(--grow, 1)); }
  to { transform: scale(calc(var(--grow, 1) * 1.16)); filter: drop-shadow(0 0 24px var(--ec, #fff)) brightness(1.25); }
}
/* 포효 */
.boss .bico.roar { animation: roar .6s ease-out; }
@keyframes roar {
  0% { transform: scale(calc(var(--grow, 1) * 1.16)); }
  22% { transform: scale(calc(var(--grow, 1) * 1.55)) rotate(-4deg); }
  55% { transform: scale(calc(var(--grow, 1) * 1.3)) rotate(3deg); }
  100% { transform: scale(var(--grow, 1)) rotate(0); }
}
/* 맞았을 때 */
.boss .bico.hit { animation: bhit .3s ease-out; }
.boss .bico.bighit { animation: bbighit .55s ease-out; }
@keyframes bhit {
  0%, 100% { filter: none; }
  40% { filter: brightness(2.4) saturate(0); transform: scale(calc(var(--grow,1) * .92)) translateX(5px); }
}
@keyframes bbighit {
  0% { filter: brightness(3) saturate(0); transform: scale(calc(var(--grow,1) * .82)); }
  30% { transform: scale(calc(var(--grow,1) * 1.1)) translateX(-9px) rotate(-6deg); }
  60% { transform: scale(calc(var(--grow,1) * .95)) translateX(7px) rotate(4deg); }
  100% { filter: none; transform: scale(var(--grow,1)); }
}
/* 보스가 뿜는 숨결 */
.breath {
  position: absolute; left: 50%; top: 18%;
  transform: translateX(-50%);
  font-size: clamp(30px, 6vh, 58px); letter-spacing: -.15em;
  z-index: 7; pointer-events: none;
  text-shadow: 0 0 26px var(--ec);
  animation: breath .8s ease-in forwards;
}
@keyframes breath {
  0% { opacity: 0; transform: translateX(-50%) translateY(0) scale(.4); }
  25% { opacity: 1; transform: translateX(-50%) translateY(14vh) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(46vh) scale(2.6); }
}
/* 내 주문이 날아간다 */
.bolt {
  position: absolute; left: 50%; bottom: 26%;
  transform: translateX(-50%);
  font-size: clamp(26px, 4.6vh, 44px); z-index: 7; pointer-events: none;
  text-shadow: 0 0 20px var(--ec);
  animation: bolt .5s ease-out forwards;
}
.bolt.strong { font-size: clamp(36px, 6.4vh, 62px); }
@keyframes bolt {
  0% { opacity: 0; transform: translateX(-50%) translateY(0) scale(.5); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40vh) scale(1.6); }
}
/* 피격 화면 번쩍 */
.hitflash {
  position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: radial-gradient(circle at 50% 20%, var(--ec) 0%, transparent 62%);
  animation: hitflash .5s ease-out forwards;
}
@keyframes hitflash {
  0% { opacity: .55; }
  100% { opacity: 0; }
}
/* 화면 흔들림 */
.stage.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-7px, 2px); }
  40%, 60% { transform: translate(7px, -1px); }
}
@media (prefers-reduced-motion: reduce) {
  .stage.shake, .boss .bico.charge, .boss .bico.roar { animation: none; }
}

/* =========================================================
   한글 조립
   ========================================================= */
.falling.jamo {
  font-size: clamp(22px, 3.6vh, 34px);
  font-weight: 900; padding: 6px 18px;
  border-color: var(--violet);
  box-shadow: 0 0 20px -6px var(--violet);
}
.buildwrap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px clamp(16px, 3vw, 34px) 18px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.bhint { font-size: clamp(13px, 2vh, 17px); color: var(--dim); font-weight: 600; }
.bhint b { color: var(--accent); font-size: 1.25em; }
.bshelf {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  min-height: clamp(40px, 6vh, 56px); align-items: center;
  width: 100%; padding: 8px 14px; border-radius: 12px;
  background: rgba(10, 14, 21, .6); border: 1px dashed var(--line);
}
.btile {
  width: clamp(34px, 5vh, 46px); height: clamp(34px, 5vh, 46px);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: 1px solid var(--violet);
  font-size: clamp(17px, 2.6vh, 23px); font-weight: 800; color: var(--violet);
}
.bcap { font-size: 12.5px; color: var(--dim2); font-weight: 700; }
.bcap b { color: var(--text); }

/* =========================================================
   마법사 주문
   ========================================================= */
.spellwrap {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(12px, 2.4vh, 24px) clamp(16px, 3vw, 40px);
  gap: 10px;
}
.boss { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.boss .bico { font-size: clamp(38px, 7vh, 66px); line-height: 1; }
.belem { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.belem span {
  color: var(--ec); font-weight: 900; font-size: clamp(15px, 2.4vh, 20px);
}
.belem em { font-style: normal; font-size: 12.5px; color: var(--dim); font-weight: 700; }
.bhp {
  width: min(420px, 60vw); height: 15px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.bhp i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #c0392b, var(--warn));
  transition: width .25s;
}
.bhp span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000;
}
.myhp { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.myhp > span { font-size: 12px; color: var(--dim2); font-weight: 700; }
.myhp .bhp i { background: linear-gradient(90deg, var(--ok), var(--accent)); }

.spells { display: flex; gap: clamp(8px, 1.6vw, 18px); justify-content: center; }
.spell {
  flex: 1; max-width: 260px;
  padding: clamp(10px, 1.8vh, 18px) 14px; border-radius: 12px;
  background: rgba(20, 28, 43, .9);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.spell.weak { border-color: var(--ec); box-shadow: 0 0 22px -8px var(--ec); }
.spell.lock { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(62,224,192,.3); }
.spell .se { font-size: 12px; font-weight: 800; color: var(--ec); }
.spell .sw { font-size: clamp(18px, 3vh, 28px); font-weight: 800; }
.spell .sw .hit { color: var(--accent); }

/* =========================================================
   끝말잇기
   ========================================================= */
.chainwrap {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(14px, 2.4vh, 26px) clamp(16px, 3vw, 40px); gap: 12px;
}
.clog {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; justify-content: flex-end;
}
.cline { display: flex; align-items: center; gap: 10px; }
.cline.me { flex-direction: row-reverse; }
.cline .cw { font-size: clamp(18px, 2.6vh, 24px); }
.cline .ct {
  padding: 8px 18px; border-radius: 999px;
  font-size: clamp(17px, 2.8vh, 26px); font-weight: 800;
  background: var(--panel2); border: 1px solid var(--line);
}
.cline.me .ct {
  background: linear-gradient(135deg, var(--accent-d), var(--accent));
  color: #04231d; border-color: transparent;
}
.cturn { text-align: center; font-size: clamp(14px, 2.2vh, 18px); font-weight: 700; }
.cturn b { color: var(--accent); font-size: 1.3em; }
.cturn .dim { color: var(--dim2); font-weight: 600; }
.ctimer { height: 6px; border-radius: 999px; background: var(--panel2); overflow: hidden; }
.ctimer i { display: block; height: 100%; width: 100%; background: var(--accent); transition: width .1s linear; }

/* 게임 HUD */
.hud {
  display: flex; align-items: center; gap: clamp(14px, 2.4vw, 34px);
  padding: 10px clamp(20px, 4vw, 48px);
}
.hud .h { text-align: center; }
.hud .h .k { font-size: 11px; color: var(--dim2); font-weight: 700; }
.hud .h .v { font-size: clamp(18px, 2.8vh, 26px); font-weight: 900; font-variant-numeric: tabular-nums; }
.hud .spacer { flex: 1; }

.gameinput {
  padding: 10px clamp(20px, 4vw, 48px) clamp(12px, 2vh, 18px);
  display: flex; justify-content: center;
}
.gameinput input {
  width: min(620px, 100%);
  padding: 12px 20px; text-align: center;
  font-size: clamp(18px, 2.8vh, 26px); font-weight: 700;
  background: var(--panel); border: 2px solid var(--line);
  border-radius: 12px; color: var(--text); outline: none;
}
.gameinput input:focus { border-color: var(--accent-d); box-shadow: 0 0 0 4px rgba(62,224,192,.12); }

/* 카운트다운 / 오버레이 */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: rgba(6,9,14,.86); backdrop-filter: blur(4px);
}
.overlay .big { font-size: clamp(48px, 12vh, 120px); font-weight: 900; letter-spacing: -0.05em; }
.overlay .big.go { color: var(--accent); }
.overlay h3 { font-size: clamp(24px, 4vh, 38px); font-weight: 900; }
.overlay p { color: var(--dim); font-size: 15px; }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 700;
  z-index: 99; opacity: 0; transition: .2s; pointer-events: none;
}
.toast.on { opacity: 1; bottom: 40px; }

/* =========================================================
   홈 하단
   ========================================================= */
.home-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.foot-note { color: var(--dim2); font-size: 13px; }

/* =========================================================
   학습 리포트
   ========================================================= */
.report-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.report {
  max-width: 1060px; margin: 0 auto;
  padding: clamp(18px, 3vh, 32px) clamp(20px, 4vw, 40px) 60px;
  display: flex; flex-direction: column; gap: clamp(12px, 2vh, 20px);
}

.rep-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 14px; border-bottom: 2px solid var(--line);
}
.rep-school { color: var(--violet); font-size: 13px; font-weight: 800; }
.rep-head h2 { font-size: clamp(21px, 3vh, 28px); font-weight: 900; margin-top: 4px; letter-spacing: -0.03em; }
.rep-date { color: var(--dim); font-size: 14px; margin-top: 3px; }
.rep-name { display: flex; align-items: center; gap: 10px; }
.rep-name label { color: var(--dim2); font-size: 13px; font-weight: 700; }
.rep-name input {
  width: 170px; padding: 9px 14px; font-size: 15px; font-weight: 700;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); outline: none;
}
.rep-name input:focus { border-color: var(--accent-d); }

/* 판정 */
.verdict {
  display: flex; align-items: stretch; gap: 18px;
  padding: 16px 18px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line);
}
.verdict .v-badge {
  flex: 0 0 auto; min-width: 108px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: clamp(22px, 3.4vh, 30px); font-weight: 900;
  letter-spacing: -0.02em;
}
.verdict.ok  { border-color: rgba(94,224,138,.4); }
.verdict.ok  .v-badge { background: rgba(94,224,138,.14); color: var(--ok); }
.verdict.mid { border-color: rgba(255,204,92,.4); }
.verdict.mid .v-badge { background: rgba(255,204,92,.14); color: var(--gold); }
.verdict.no  { border-color: rgba(255,107,129,.4); }
.verdict.no  .v-badge { background: rgba(255,107,129,.14); color: var(--warn); }
.v-checks { flex: 1; display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.v-chk { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.v-chk .mk {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900;
}
.v-chk.y .mk { background: rgba(94,224,138,.18); color: var(--ok); }
.v-chk.n .mk { background: var(--panel2); color: var(--dim2); }
.v-chk .lb { flex: 1; color: var(--dim); font-weight: 600; }
.v-chk .gt { font-weight: 800; }
.v-chk.y .gt { color: var(--ok); }
.v-chk.n .gt { color: var(--dim2); }

/* 숫자 카드 */
.rep-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.rep-cards.sm { margin-bottom: 14px; }
.rcard2 {
  padding: 14px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
}
.rcard2 .k { font-size: 12px; color: var(--dim2); font-weight: 700; }
.rcard2 .v {
  font-size: clamp(21px, 3.2vh, 30px); font-weight: 900;
  letter-spacing: -0.03em; margin-top: 2px; font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.rcard2.warn .v { color: var(--gold); }
.rcard2 .s { font-size: 11.5px; color: var(--dim2); margin-top: 2px; }

/* 상자 */
.rep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.rep-box {
  padding: 16px 18px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line);
}
.rep-box h3 {
  font-size: 15px; font-weight: 800; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.rep-box h3::before {
  content: ''; width: 4px; height: 15px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--violet));
}
.rep-box .empty { color: var(--dim2); font-size: 13.5px; }
.rep-box .empty.good { color: var(--ok); }
.hintnote { margin-top: 10px; font-size: 12px; color: var(--dim2); }

ul.did, ul.notyet { list-style: none; display: flex; flex-direction: column; gap: 6px; }
ul.did li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 9px; background: var(--panel2);
  font-size: 14px;
}
ul.did li span { color: var(--accent); font-weight: 800; font-size: 13px; }
ul.notyet li {
  padding: 8px 12px; border-radius: 9px;
  background: rgba(255,107,129,.07); border: 1px dashed rgba(255,107,129,.3);
  color: var(--dim); font-size: 14px;
}

/* 표 */
.rep-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rep-table th {
  text-align: left; padding: 8px 10px; color: var(--dim2);
  font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--line);
}
.rep-table td { padding: 9px 10px; border-bottom: 1px solid rgba(36,48,74,.5); }
.rep-table .c { text-align: center; }
.rep-table tr.off td { color: var(--dim2); }
.rep-table tr.pass { background: rgba(94,224,138,.06); }
.rep-table .ok { color: var(--ok); font-weight: 800; }
.rep-table .dim { color: var(--dim2); }

/* 자주 틀린 자리 */
.miss-list { display: flex; flex-direction: column; gap: 8px; }
.miss {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 10px; background: var(--panel2);
}
.miss .mj {
  width: 38px; height: 38px; border-radius: 9px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800;
  background: var(--fc); color: #06121a;
}
.miss .mf { flex: 1; font-size: 13.5px; color: var(--dim); font-weight: 600; }
.miss .mc { font-weight: 800; color: var(--warn); font-size: 14px; }

/* 막대 그래프 */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; }
.bars.many { gap: 4px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar .bv { font-size: 11px; color: var(--dim2); font-weight: 700; }
.bars.many .bv { font-size: 9px; }
.bar .bcol { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar .bcol i {
  display: block; width: 100%; border-radius: 5px 5px 0 0;
  background: linear-gradient(var(--accent-d), rgba(31,185,156,.25));
}
.bar.now .bcol i { background: linear-gradient(var(--accent), var(--violet)); }
.bar.now .bv { color: var(--accent); }
.bar .bd { font-size: 10px; color: var(--dim2); }
.bars.many .bd { font-size: 9px; }

/* AI 한마디 */
.rep-box.ai { border-color: rgba(157,139,247,.32); background: linear-gradient(150deg, rgba(157,139,247,.07), var(--panel)); }
.ai-body { font-size: 14.5px; line-height: 1.75; color: var(--text); word-break: keep-all; }
.ai-body .dim { color: var(--dim2); }

.rep-foot { color: var(--dim2); font-size: 12px; text-align: center; padding-top: 6px; }

/* =========================================================
   모달 (통과 기준)
   ========================================================= */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4,7,12,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  width: min(520px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-box h3 { font-size: 19px; font-weight: 900; }
.modal-sub { color: var(--dim); font-size: 13px; }
.goal-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.goal-row label { width: 130px; color: var(--dim); font-weight: 700; }
.goal-row input, .goal-cpm input {
  width: 80px; padding: 8px 10px; text-align: center;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 700; outline: none;
}
.goal-row input:focus, .goal-cpm input:focus { border-color: var(--accent-d); }
.goal-cpm { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.goal-cpm .gc { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.goal-cpm .gc span { font-size: 11px; color: var(--dim2); font-weight: 700; }
.goal-cpm input { width: 100%; }
.dimtext { color: var(--dim2); font-size: 12px; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.name-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.name-chip {
  padding: 8px 16px; font-size: 17px; font-weight: 800;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); cursor: pointer;
}
.name-chip:hover { border-color: var(--accent-d); }
.name-chip.cur { border-color: var(--accent-d); box-shadow: 0 0 0 2px var(--accent-d) inset; }
.name-in {
  width: 100%; padding: 12px 14px; font-size: 20px; font-weight: 700;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); outline: none;
}
.name-in:focus { border-color: var(--accent-d); }
.big-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; padding: 14px 18px; font-size: 18px; font-weight: 800;
  border: 1px solid var(--line); border-radius: 12px; text-align: left;
}
.big-choice small { font-size: 13px; font-weight: 600; opacity: .75; }

/* 방어전 남은 시간 */
.deftime {
  position: absolute; top: 10px; right: 14px; z-index: 6;
  font-size: 15px; font-weight: 800; color: var(--text);
  background: rgba(10, 14, 21, .55); padding: 5px 12px; border-radius: 9px;
  border: 1px solid var(--line);
}

/* ---------- 내 마을 ---------- */
.vg-wrap {
  flex: 1; display: flex; flex-direction: column; gap: 12px;
  padding: 16px 28px 20px; min-height: 0;
  max-width: 1280px; width: 100%; margin: 0 auto;
}
.vg-scene {
  flex: 1; position: relative; min-height: 0; overflow: hidden;
  border-radius: 18px; border: 1px solid var(--line);
  background:
    linear-gradient(#bfe3ff 0%, #dff1ff 44%, #a8e6a3 44%, #8fd98a 84%, #7fc97a 100%);
  transition: background .5s;
}
/* 장마다 하늘빛이 달라진다 — 44% 아래는 village-bg.js 의 언덕이 덮는다 */
.vg-scene.bg-sea { background: linear-gradient(#8fd8f5 0%, #d6f2ff 44%, #63c6e8 44%, #f5e2bd 100%); }
.vg-scene.bg-forest { background: linear-gradient(#a9dcf0 0%, #dff4ff 44%, #4e8f5a 44%, #8fd98a 100%); }
.vg-scene.bg-sky { background: linear-gradient(#6fb3f5 0%, #a9d6ff 30%, #dbeaff 60%, #c2d8fb 100%); }
.vg-scene.bg-winter { background: linear-gradient(#8aa8cc 0%, #cfe0f2 44%, #b9c8de 44%, #f8fbff 100%); }

/* ---------- 장(챕터) 탭 ---------- */
.vg-tabs { display: flex; gap: 6px; margin-left: 4px; }
.vg-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: var(--bg2); border: 1px solid var(--line);
  color: var(--dim); font-size: 13px; font-weight: 700;
  font-family: inherit; transition: .15s;
}
.vg-tab:hover { border-color: var(--accent); color: var(--text); }
.vg-tab .i { font-size: 15px; }
.vg-tab .n { font-weight: 900; }
.vg-tab .t { font-size: 12.5px; }
.vg-tab.sel {
  background: rgba(62, 224, 192, .14);
  border-color: rgba(62, 224, 192, .45); color: var(--accent);
}
.vg-tab.lock { opacity: .45; }
.vg-tab.lock .t { display: none; }
.vg-tab .b { font-size: 13px; }
.vg-season {
  padding: 6px 10px; border-radius: 9px; font-family: inherit; font-size: 13px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--dim);
}

/* ---------- 아이콘 이름표 ---------- */
.vg-cap {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  z-index: 3; white-space: nowrap; pointer-events: none;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(16, 24, 39, .78); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: -.01em;
}
.vg-item[data-tip] { cursor: help; }
.vg-item[data-tip]:hover svg { filter: drop-shadow(0 0 6px rgba(255, 255, 255, .95)); }

/* ---------- 이 아이콘이 왜 생겼는지 ---------- */
.vg-tip {
  position: fixed; z-index: 200; pointer-events: none;
  display: flex; flex-direction: column; gap: 3px;
  max-width: 280px; padding: 10px 14px; border-radius: 12px;
  background: rgba(12, 18, 30, .96); border: 1px solid rgba(62, 224, 192, .35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
/* 시즌 종료가 일주일 안쪽 */
.foot-note.vg-soon { color: var(--gold); font-weight: 800; }

/* ---------- 특별한 날 하늘 (holiday.js) ---------- */
.vg-holiday {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
/* 늘어나도 되는 것 — 별·눈·꽃잎 */
.vg-holiday > svg { width: 100%; height: 100%; display: block; }
/* 비율을 지켜야 하는 것 — 해·달·풍선·호박·태극기 */
.vg-holiday .vg-pin, .vg-holiday .vg-flag { position: absolute; }
.vg-holiday .vg-pin svg { width: 100%; height: auto; display: block; }
.vg-holiday .vg-flag svg {
  width: 100%; height: auto; display: block;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .22));
}
.vg-holiday .vg-flagpole {
  position: absolute; width: 0.5%; min-width: 3px;
  background: linear-gradient(#a8825f, #8f6b4e);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.vg-holiday .vg-flagpole::before {
  content: ''; position: absolute; left: 50%; top: -7px;
  width: 11px; height: 11px; margin-left: -5.5px;
  border-radius: 50%; background: #ffd166;
}

/* 땅에 놓이는 장식(호박 등)은 마을 앞으로 나와야 언덕에 안 가린다 */
.vg-holiday-front { z-index: 5; }

/* 밤 배경인 날은 마을 전체를 가라앉힌다 (언덕·길까지) */
.vg-scene.vg-night .vg-item { filter: brightness(.82) saturate(.92); }
.vg-scene.vg-night .vg-holiday, .vg-scene.vg-night .vg-holiday .vg-item { filter: none; }
.vg-scene.vg-night .vg-cap { background: rgba(8, 12, 22, .88); }

/* 그날 땅빛 — 하늘만 바꾸면 보라 하늘 밑에 초록 풀밭이 남아 따로 논다.
   언덕과 길에만 걸고 마을 그림(집·동물)에는 걸지 않는다. */
.vg-scene[style*="--hd-ground"] .vg-item.vg-sky { filter: var(--hd-ground); }
.vg-scene.vg-night[style*="--hd-ground"] .vg-item.vg-sky {
  filter: var(--hd-ground) brightness(.9);
}
.vg-scene[style*="--hd-ground"] .vg-holiday .vg-item,
.vg-scene[style*="--hd-ground"] .vg-holiday { filter: none; }

.vg-hday {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px; margin-left: 6px;
  background: rgba(255, 204, 92, .16); border: 1px solid rgba(255, 204, 92, .42);
  color: var(--gold); font-size: 13px; font-weight: 800;
}
.vg-hday .n { color: #ffe9a8; }

/* ---------- 시즌마다 마을 빛깔이 바뀐다 ----------
   같은 53개를 다시 짓더라도 빛깔이 다르면 "지난 시즌과 다르다"는 감각이 생긴다.
   채점에서 잡은 배경 대비를 해치지 않게 아주 옅게만 건다. */
.vg-scene.se-spring { filter: hue-rotate(-6deg) saturate(1.06); }
.vg-scene.se-summer { filter: none; }
.vg-scene.se-autumn { filter: sepia(.14) hue-rotate(-10deg) saturate(1.08); }
.vg-scene.se-winter { filter: hue-rotate(10deg) saturate(.92) brightness(.99); }

/* ---------- 우리 반 ---------- */
.vg-rank-box { max-width: 560px; }
.rk-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 6px; }
.rk-card {
  padding: 12px 14px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--line);
}
.rk-card .k { font-size: 12px; color: var(--dim); font-weight: 700; }
.rk-card .v { font-size: 26px; font-weight: 900; color: var(--accent); margin-top: 2px; }
.rk-card .s { font-size: 11.5px; color: var(--dim2); }
.rk-h { font-size: 14px; font-weight: 900; color: var(--gold); margin: 14px 0 8px; }
.rk-list { display: flex; flex-direction: column; gap: 5px; }
.rk {
  display: grid; grid-template-columns: 28px 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px; background: var(--bg2);
  border: 1px solid transparent;
}
.rk.me { background: rgba(62, 224, 192, .11); border-color: rgba(62, 224, 192, .32); }
.rk .m { font-size: 17px; text-align: center; font-weight: 900; color: var(--dim); }
.rk .n { font-size: 14.5px; font-weight: 800; }
.rk .n em { font-style: normal; font-size: 11.5px; color: var(--accent); font-weight: 700; }
.rk .lv { font-size: 12px; color: var(--dim2); font-weight: 700; }
.rk .p { font-size: 14px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.rk-me {
  margin: 12px 0 0; padding: 11px 14px; border-radius: 11px; text-align: center;
  background: rgba(157, 139, 247, .1); border: 1px solid rgba(157, 139, 247, .3);
  font-size: 14.5px; color: var(--text);
}
.rk-me b { color: var(--violet); font-weight: 900; }

/* ---------- 시즌 여정 ---------- */
#btn-vg-journey b { color: var(--gold); font-weight: 900; margin-left: 2px; }
.vg-journey-box { max-width: 720px; }
.vg-journey-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 52vh; overflow-y: auto; padding-right: 4px;
}
.qt {
  display: grid; grid-template-columns: 22px 24px 1fr 90px 66px 52px;
  align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 10px;
  background: var(--bg2); border: 1px solid transparent;
}
.qt.ok { background: rgba(62, 224, 192, .09); border-color: rgba(62, 224, 192, .28); }
.qt .ic { font-size: 17px; }
.qt .bd { display: flex; flex-direction: column; min-width: 0; }
.qt .bd b { font-size: 14px; font-weight: 800; }
.qt .bd em { font-style: normal; font-size: 12px; color: var(--dim2); }
.qt .pg { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.qt .pg i {
  display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-d), var(--accent));
}
.qt.ok .pg i { background: linear-gradient(90deg, #d9a521, var(--gold)); }
.qt .ct {
  font-size: 12.5px; font-weight: 800; color: var(--dim);
  text-align: right; font-variant-numeric: tabular-nums;
}
.qt .rw { font-size: 12px; font-weight: 800; color: var(--gold); text-align: right; }
.qt.ok .rw { color: var(--dim2); }

/* ---------- 내 마을 도움말 ---------- */
.vg-help-box { max-width: 620px; }
.vg-help-sec { margin: 14px 0 0; }
.vg-help-sec h4 {
  font-size: 14px; font-weight: 900; color: var(--accent);
  margin: 0 0 8px; letter-spacing: -.01em;
}
.vg-help-pt { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.vg-help-pt li {
  display: grid; grid-template-columns: 26px 96px 54px 1fr; align-items: center;
  gap: 8px; font-size: 14px;
}
.vg-help-pt .i { font-size: 17px; }
.vg-help-pt .t { font-weight: 700; }
.vg-help-pt .p { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.vg-help-pt .s { font-size: 12.5px; color: var(--dim2); }
.vg-help-note {
  margin: 10px 0 0; font-size: 13px; color: var(--dim); line-height: 1.6;
}
.vg-help-note b { color: var(--text); }
.vg-help-note.season {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px;
  background: rgba(157, 139, 247, .1); border: 1px solid rgba(157, 139, 247, .28);
}
.vg-help-chs { display: flex; flex-direction: column; gap: 6px; }
.vg-help-ch {
  display: grid; grid-template-columns: 26px 42px 1fr auto auto;
  align-items: center; gap: 8px; font-size: 14px;
  padding: 6px 10px; border-radius: 9px; background: var(--bg2);
}
.vg-help-ch.lock { opacity: .6; }
.vg-help-ch.done { background: rgba(255, 204, 92, .1); }
.vg-help-ch .i { font-size: 17px; }
.vg-help-ch .n { font-weight: 900; color: var(--dim); }
.vg-help-ch .t { font-weight: 800; }
.vg-help-ch.lock .t { color: var(--dim2); letter-spacing: .12em; }
.vg-help-ch .w { font-size: 12.5px; color: var(--dim2); }
.vg-help-ch .m { font-size: 12.5px; font-weight: 800; color: var(--gold); }

.vg-tip .h { font-size: 14px; font-weight: 900; color: var(--accent); }
.vg-tip .d { font-size: 12.5px; color: #c8d4e6; line-height: 1.45; }

/* ---------- 리포트·대시보드의 장별 진행 ---------- */
.vg-rep-chs { display: flex; flex-direction: column; gap: 7px; margin: 10px 0 12px; }
.vg-rep-ch {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--text);
}
.vg-rep-ch.lock { opacity: .45; }
.vg-rep-ch .i { width: 20px; text-align: center; }
.vg-rep-ch .n { width: 118px; font-weight: 700; }
.vg-rep-ch .bar {
  flex: 1; height: 9px; border-radius: 5px; background: var(--bg2); overflow: hidden;
}
.vg-rep-ch .bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-d), var(--accent)); border-radius: 5px;
}
.vg-rep-ch.done .bar i { background: linear-gradient(90deg, #d9a521, var(--gold)); }
.vg-rep-ch .c {
  width: 46px; text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 800; color: var(--dim);
}
.vg-rep-ch .m { width: 18px; }
.vg-item { position: absolute; }
.vg-item svg { position: relative; z-index: 1; width: 100%; height: auto; display: block; }
/* 접지 그림자 — 하늘·언덕·길(vg-sky)은 제외 */
.vg-item::after {
  content: ''; position: absolute; z-index: 0;
  left: 6%; right: 6%; bottom: 1%; height: 12%;
  background: rgba(45, 95, 45, .28); border-radius: 50%;
}
.vg-item.vg-sky::after { display: none; }
/* 새로 열린 건물 등장 연출 */
@keyframes vg-pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.vg-item.pop { animation: vg-pop .5s ease-out; transform-origin: bottom center; }
.vg-foot {
  flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 18px;
}
.vg-foot span { font-size: 15px; font-weight: 700; color: var(--text); }
.vg-bar {
  flex: 1; height: 10px; border-radius: 5px; background: var(--bg2); overflow: hidden;
}
.vg-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-d), var(--accent));
  border-radius: 5px; transition: width .4s;
}

@media (max-width: 900px) {
  .rep-cards { grid-template-columns: repeat(2, 1fr); }
  .rep-two { grid-template-columns: 1fr; }
}

/* 스크롤바 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3654; border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a72; }

/* 좁은 화면 대응 */
@media (max-width: 1100px) {
  .mode-grid { grid-template-columns: repeat(3, 1fr); }
  .level-grid { grid-template-columns: repeat(3, 1fr); }
  .text-grid { grid-template-columns: repeat(3, 1fr); }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .text-grid { grid-template-columns: repeat(2, 1fr); }
  .game-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   학생이 만든 게임 (홈 섹션)
   ========================================================= */
.student-sec { display: flex; flex-direction: column; gap: 10px; }
.student-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.student-head h2 { font-size: clamp(15px, 2.2vh, 20px); font-weight: 800; }
.student-head .spacer { flex: 1; }
.tycoin { font-weight: 800; color: var(--gold); font-size: clamp(13px, 2vh, 16px); }
.student-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.4vw, 18px);
}
.sgame-card {
  display: flex; gap: 12px; align-items: center; text-align: left;
  padding: clamp(10px, 1.8vh, 18px);
  border-radius: var(--r);
  background: linear-gradient(160deg, var(--panel), var(--bg2));
  border: 1px solid var(--line);
  cursor: pointer; transition: .18s; overflow: hidden;
}
.sgame-card:hover {
  border-color: var(--violet);
  box-shadow: 0 14px 40px -18px var(--violet);
  transform: translateY(-2px);
}
.sgame-card .ico { font-size: clamp(20px, 3vh, 28px); flex-shrink: 0; }
.sgame-card h3 { font-size: clamp(14px, 2.1vh, 18px); font-weight: 800; }
.sgame-card p { color: var(--dim); font-size: clamp(11px, 1.7vh, 13px); line-height: 1.45; margin-top: 4px; }
.sgame-card .side {
  margin-left: auto; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.sgame-card .credit { color: var(--violet); font-size: 12px; font-weight: 700; white-space: nowrap; }
.pdflink {
  color: var(--dim2); font-size: 12px; text-decoration: none;
  border: 1px solid var(--line); padding: 3px 8px; border-radius: 8px; white-space: nowrap;
}
.pdflink:hover { color: var(--text); border-color: var(--accent-d); }

/* 판 상점 */
.shop-back {
  position: fixed; inset: 0; background: rgba(4, 8, 14, .74);
  display: flex; align-items: center; justify-content: center; z-index: 60;
}
.shop {
  width: min(720px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px;
}
.shop h3 { font-size: 20px; font-weight: 800; }
.shop .desc { color: var(--dim); font-size: 13px; margin: 8px 0 14px; line-height: 1.5; }
.shop-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.shop-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px;
  text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.shop-item .no { font-weight: 800; font-size: 14px; }
.shop-item .price { color: var(--gold); font-weight: 800; font-size: 13px; }
.shop-item.owned { border-color: var(--ok); background: rgba(94, 224, 138, .08); }
.shop-item.owned .price { color: var(--ok); }
.shop-item.locked { opacity: .45; }
.shop-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.shop-foot .spacer { flex: 1; }

/* =========================================================
   학생 게임 1) 타자 판뒤집기
   ========================================================= */
.flipwrap {
  position: absolute; inset: 44px 10px 10px;
  display: grid; grid-template-columns: repeat(10, 1fr);
  gap: 6px; align-content: stretch;
}
.fpanel {
  border-radius: 8px; border: 1px solid rgba(0, 0, 0, .3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: clamp(11px, 1.9vh, 16px);
  overflow: hidden; white-space: nowrap;
  transition: background .25s, transform .15s;
}
.fpanel.me { background: linear-gradient(160deg, #e2504f, #a83232); color: #fff; }
.fpanel.ai { background: linear-gradient(160deg, #3a6fd8, #27498f); color: #fff; }
.fpanel.box {
  background: linear-gradient(160deg, #57606f, #2f3542);
  color: var(--gold); border-color: var(--gold);
}
.fpanel.lock { outline: 2px solid var(--accent); outline-offset: -2px; }
.fpanel.pop { transform: scale(1.14); }
.flipbar {
  position: absolute; top: 8px; left: 10px; right: 10px; height: 30px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: clamp(13px, 2.2vh, 17px);
}
.flipbar .me { color: #ff8f8e; }
.flipbar .ai { color: #7fa8ef; }
.flipbar .meter {
  flex: 1; height: 12px; border-radius: 6px; overflow: hidden;
  background: #27498f; display: flex;
}
.flipbar .meter i { display: block; height: 100%; background: #e2504f; transition: width .3s; }
.flipbar .timeleft { color: var(--dim); font-size: 13px; font-weight: 700; }

/* =========================================================
   학생 게임 2) 과자 캐기
   ========================================================= */
.cave {
  position: absolute; inset: 0; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 50% 38%, #3b2f1f 0%, #241b10 55%, #120d07 100%);
}
.cave::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 12% 20%, rgba(0, 0, 0, .55) 0 18%, transparent 30%),
    radial-gradient(circle at 88% 26%, rgba(0, 0, 0, .5) 0 16%, transparent 28%),
    radial-gradient(circle at 20% 85%, rgba(0, 0, 0, .5) 0 20%, transparent 32%),
    radial-gradient(circle at 82% 82%, rgba(0, 0, 0, .55) 0 18%, transparent 30%);
}
/* 과자봉지 — 지그재그 포장지에 과자 이름이 그대로 쓰여 있다 (기획서 디자인2) */
.snack {
  position: absolute; transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  background: linear-gradient(165deg, var(--bagc, #7ec8e3), var(--bagc-d, #5aa8c6));
  padding: clamp(12px, 1.9vh, 17px) clamp(10px, 1.2vw, 16px);
  clip-path: polygon(0 9%, 6.25% 0, 12.5% 9%, 18.75% 0, 25% 9%, 31.25% 0, 37.5% 9%,
      43.75% 0, 50% 9%, 56.25% 0, 62.5% 9%, 68.75% 0, 75% 9%, 81.25% 0, 87.5% 9%,
      93.75% 0, 100% 9%, 100% 91%, 93.75% 100%, 87.5% 91%, 81.25% 100%, 75% 91%,
      68.75% 100%, 62.5% 91%, 56.25% 100%, 50% 91%, 43.75% 100%, 37.5% 91%,
      31.25% 100%, 25% 91%, 18.75% 100%, 12.5% 91%, 6.25% 100%, 0 91%);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .65));
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.snack .bagico { font-size: clamp(15px, 2.6vh, 24px); line-height: 1; }
.snack .sword {
  background: rgba(255, 255, 255, .94); color: #3a2c18;
  padding: 2px 9px; border-radius: 7px;
  font-weight: 800; font-size: clamp(13px, 2.2vh, 18px); white-space: nowrap;
}
.snack .sword .hit { color: #1fa374; }
.snack.lock .sword { outline: 3px solid var(--accent); }
.snack.dug { animation: dugout .6s forwards ease-in; }
@keyframes dugout {
  30% { transform: translate(-50%, -46%) rotate(var(--rot, 0deg)); }
  100% { transform: translate(-50%, -170%) scale(.3) rotate(50deg); opacity: 0; }
}

/* 호미 — 캐낼 때 날아와 두 번 내려찍는다 */
.hoe {
  position: absolute; width: clamp(54px, 8vh, 84px); height: clamp(54px, 8vh, 84px);
  margin-left: clamp(20px, 3vh, 34px);
  transform: translate(-50%, -50%);
  transform-origin: 85% 12%;
  animation: hoeswing 1s forwards ease-in-out; pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .6));
  z-index: 3;
}
.hoe svg { width: 100%; height: 100%; }
@keyframes hoeswing {
  0% { transform: translate(-30%, -130%) rotate(-80deg); opacity: 0; }
  22% { transform: translate(-50%, -60%) rotate(6deg); opacity: 1; }
  38% { transform: translate(-48%, -80%) rotate(-42deg); }
  56% { transform: translate(-50%, -58%) rotate(8deg); }
  80% { transform: translate(-50%, -62%) rotate(2deg); opacity: 1; }
  100% { transform: translate(-52%, -70%) rotate(-16deg); opacity: 0; }
}

/* 보석 — 운이 좋으면 캐낸 자리에서 반짝이며 튀어나온다 */
.gempop {
  position: absolute; transform: translate(-50%, -50%);
  font-size: clamp(30px, 5.4vh, 48px); line-height: 1;
  animation: gemup 1.6s forwards ease-out; pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(90, 212, 230, .95)); z-index: 4;
}
.gempop .gtag {
  position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%);
  background: rgba(90, 212, 230, .16); border: 1px solid #5ad4e6; color: #bdf0fa;
  font-size: clamp(12px, 2vh, 15px); font-weight: 800;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
@keyframes gemup {
  0% { transform: translate(-50%, -30%) scale(.3); opacity: 0; }
  18% { transform: translate(-50%, -75%) scale(1.25); opacity: 1; }
  32% { transform: translate(-50%, -65%) scale(1); }
  78% { transform: translate(-50%, -120%) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -160%) scale(.9); opacity: 0; }
}
.gemspark {
  position: absolute; transform: translate(-50%, -50%);
  font-size: clamp(16px, 3vh, 26px);
  animation: burstpop .9s forwards ease-out; pointer-events: none; z-index: 4;
}

/* 큰 보상 — 그 게임 최고의 순간에만. 작은 토스트로는 유니콘과 토끼가 똑같아 보였다 */
.gcheer {
  position: absolute; left: 50%; top: 44%; z-index: 30;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  pointer-events: none; text-align: center;
  animation: gcheerIn 1.5s forwards cubic-bezier(.2, .9, .3, 1);
  --ch: #ffd166;
}
.gcheer .ic {
  font-size: clamp(48px, 12vh, 120px); line-height: 1;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .55));
}
.gcheer .tx {
  font-size: clamp(26px, 6vh, 62px); font-weight: 900; color: var(--ch);
  text-shadow: 0 3px 14px rgba(0, 0, 0, .7), 0 0 26px var(--ch);
  letter-spacing: -1px;
}
.gcheer .sb {
  font-size: clamp(14px, 2.6vh, 24px); font-weight: 800; color: #fff6da;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
}
@keyframes gcheerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  26% { transform: translate(-50%, -50%) scale(1); }
  74% { opacity: 1; transform: translate(-50%, -54%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(.94); }
}
/* 큰 보상이 뜨는 순간 판 전체가 한 번 번쩍인다 */
.stage.flashwin::after {
  content: ''; position: absolute; inset: 0; z-index: 29; pointer-events: none;
  background: radial-gradient(circle at 50% 44%, rgba(255, 255, 255, .5), transparent 62%);
  animation: gflash .42s forwards ease-out;
}
@keyframes gflash { to { opacity: 0; } }

/* 게임 인트로 — 시작 전에 한 장 보여 주고 엔터로 넘어간다 */
.gintro {
  position: absolute; inset: 0; z-index: 20; overflow: hidden;
  cursor: pointer; animation: gintroIn .35s ease-out;
  display: flex; align-items: flex-start; justify-content: center;
}
.gintro.out { animation: gintroOut .26s forwards ease-in; }
@keyframes gintroIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes gintroOut { to { opacity: 0; } }
.gintro-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; user-select: none; pointer-events: none;
}
/* 글자는 그림 가운데 위 — 캐릭터와 과자봉지를 가리지 않는 자리 */
.gintro-box {
  position: relative; margin-top: 4.5vh; text-align: center;
  max-width: 44em; padding: clamp(14px, 2.4vh, 26px) clamp(20px, 3vw, 42px);
  background: rgba(18, 11, 5, .72); border: 1px solid rgba(255, 216, 128, .35);
  border-radius: 20px; backdrop-filter: blur(3px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
}
.gintro-by {
  color: #ffd977; font-weight: 800; letter-spacing: .5px;
  font-size: clamp(12px, 2vh, 17px); margin-bottom: 4px;
}
.gintro-box h2 {
  font-size: clamp(30px, 6.4vh, 58px); font-weight: 900; color: #fff6da;
  margin: 0 0 8px; text-shadow: 0 3px 14px rgba(0, 0, 0, .6);
}
.gintro-desc {
  color: #f0e3cc; font-size: clamp(15px, 2.6vh, 23px); line-height: 1.55; font-weight: 600;
}
.gintro-hint {
  color: #9de8f5; font-size: clamp(13px, 2.2vh, 19px); font-weight: 700; margin-top: 8px;
}
.gintro-go {
  margin-top: clamp(10px, 1.8vh, 18px); display: inline-block;
  background: linear-gradient(180deg, #ffd977, #f0b03c); color: #2a1a08;
  font-weight: 900; font-size: clamp(15px, 2.6vh, 22px);
  padding: 9px 26px; border-radius: 999px;
  animation: gintroPulse 1.4s infinite ease-in-out;
}
@keyframes gintroPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* =========================================================
   학생 게임 3) 폭죽 놀이
   ========================================================= */
.fwsky {
  position: absolute; inset: 0; overflow: hidden;
  background: linear-gradient(180deg, #070a24 0%, #131040 55%, #221224 100%);
}
.fwground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 12%;
  background: linear-gradient(180deg, #1d2415, #0e1209);
  border-top: 2px solid #2c3a1e;
}
.fwlives {
  position: absolute; top: 8px; right: 14px;
  font-size: clamp(20px, 3.6vh, 30px); letter-spacing: 5px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6));
}
.rocket {
  position: absolute; bottom: 11%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.rocket .rico { font-size: clamp(30px, 5.6vh, 50px); line-height: 1; }
.rocket .rword {
  background: #fff; color: #23180a; padding: 4px 14px; border-radius: 9px;
  font-weight: 800; font-size: clamp(15px, 2.7vh, 21px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.rocket .rword .hit { color: #1fa374; }
.rocket.lock .rword { outline: 3px solid var(--accent); }
.rocket .fuse {
  width: clamp(90px, 12vw, 150px); height: 8px;
  background: #2a2a3a; border-radius: 4px; overflow: hidden;
}
.rocket .fuse i {
  display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #ffcc5c, #ff6b3d);
}
.rocket.bombitem .rword { background: #ffd7dc; color: #7d1f28; border: 2px solid #e2504f; }
.rocket.bombitem .warns { color: var(--warn); font-size: clamp(11px, 1.8vh, 13px); font-weight: 800; }
.rocket.launch { animation: launchup .7s forwards ease-in; }
@keyframes launchup {
  100% { transform: translateX(-50%) translateY(-72vh) scale(.5); opacity: 0; }
}
.fwburst {
  position: absolute; transform: translate(-50%, -50%);
  font-size: clamp(34px, 6vh, 56px);
  animation: burstpop .9s forwards ease-out; pointer-events: none;
}
@keyframes burstpop {
  0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.1); opacity: 0; }
}

@media (max-width: 1100px) {
  .student-grid { grid-template-columns: 1fr; }
  .flipwrap { grid-template-columns: repeat(8, 1fr); }
}

/* 오늘이 무슨 날인지 (마을 아래 안내줄) */
.vg-hday .d { color: var(--dim); font-weight: 600; font-size: 12.5px; }

/* =========================================================
   크롬북 — 노트북(1536px대)보다 화면이 작아 모든 것이 크게 보인다.
   교사가 재 본 결과 80% 축소가 노트북과 비슷 → 통째로 줄인다.
   학생 기기는 전부 크롬(크롬북)이라 zoom 을 써도 된다.
   전자칠판·보통 노트북(1440px 초과)은 그대로.
   ========================================================= */
@media (max-width: 1440px) {
  body { zoom: 0.8; }
  /* zoom 은 vh 단위를 못 줄이므로 앱 높이를 되채워 화면을 꽉 채운다 */
  #app { height: calc(100vh / 0.8); }
}
