@font-face { font-family: 'Paperlogy'; src: url('Paperlogy-5Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Paperlogy'; src: url('Paperlogy-9Black.woff2') format('woff2'); font-weight: 900; font-display: swap; }

:root {
  --bg: #12123a;
  --bg2: #1d1d52;
  --card: #ffffff;
  --ink: #1f1f3d;
  --ink-soft: #5b5b7e;
  --white: #ffffff;
  --purple: #5b3df5;
  --cyan: #00b8d9;
  --pink: #ff5fa2;
  --yellow: #ffd23f;
  --green: #2ec27e;
  --orange: #ff8a3d;
  --radius: 22px;
  --shadow: 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Paperlogy', 'Malgun Gothic', sans-serif;
  font-weight: 500;
  background: radial-gradient(circle at 20% 0%, #2c2a7a 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--white);
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
h1, h2, h3, .black { font-weight: 900; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ── 공통 버튼 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .7em 1.3em; border-radius: 999px;
  font-size: clamp(16px, min(2.4vh, 2.2vw), 22px); font-weight: 900;
  background: var(--white); color: var(--ink);
  box-shadow: 0 5px 0 rgba(0,0,0,.25);
  transition: transform .1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn.purple { background: var(--purple); color: #fff; }
.btn.pink { background: var(--pink); color: #fff; }
.btn.yellow { background: var(--yellow); color: var(--ink); }
.btn.cyan { background: var(--cyan); color: #fff; }
.btn.ghost { background: rgba(255,255,255,.15); color: #fff; box-shadow: none; }

/* ── 체험 화면 상단바 ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(rgba(10,10,40,.75), rgba(10,10,40,0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar .title { font-weight: 900; font-size: clamp(18px, min(3vh, 2.6vw), 28px); text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.topbar .spacer { flex: 1; }
.round-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 24px; display: grid; place-items: center;
  box-shadow: var(--shadow);
}

/* ── 배움 카드(모달) ── */
.modal-bg {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8,8,30,.7);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--card); color: var(--ink);
  border-radius: var(--radius); padding: clamp(20px, 3vh, 34px);
  width: min(620px, 100%); max-height: 92vh; overflow: auto;
  box-shadow: var(--shadow); text-align: center;
  animation: pop .35s cubic-bezier(.2,1.4,.4,1);
}
.modal .emoji { font-size: clamp(48px, min(8vh, 9vw), 80px); line-height: 1.1; }
.modal h2 { font-size: clamp(22px, min(3.6vh, 4vw), 34px); margin: 8px 0 10px; }
.modal .body { font-size: clamp(16px, min(2.4vh, 2.6vw), 21px); line-height: 1.65; color: var(--ink-soft); }
.modal .body b { color: var(--purple); }
.modal .btn { margin-top: 18px; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── 토스트 ── */
.toast {
  position: fixed; left: 50%; bottom: 120px; z-index: 120;
  transform: translateX(-50%) translateY(20px);
  background: var(--yellow); color: var(--ink);
  padding: 12px 22px; border-radius: 999px; font-weight: 900;
  font-size: clamp(16px, min(2.4vh, 2.6vw), 22px);
  box-shadow: var(--shadow); opacity: 0; transition: .3s; pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 로딩 ── */
.loading {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--bg); text-align: center; padding: 20px;
}
.loading.hide { display: none; }
.spinner { width: 64px; height: 64px; border-radius: 50%; border: 7px solid rgba(255,255,255,.2); border-top-color: var(--yellow); animation: spin 1s linear infinite; }
.loading p { font-size: clamp(18px, min(2.8vh, 3vw), 26px); font-weight: 900; }
.loading small { font-size: 16px; opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 배움 카드 안의 작은 그림 칸 ── */
.minigrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.minigrid > div { background: #f2f0ff; border-radius: 16px; padding: 12px 8px; font-size: .9em; color: var(--ink); line-height: 1.4; }
.minigrid > div span { display: block; font-size: 2em; margin-bottom: 4px; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.vs > div { border-radius: 16px; padding: 14px 10px; color: var(--ink); line-height: 1.45; }
.vs .ar { background: #e3f8fc; }
.vs .vr { background: #ffe8f2; }
.vs strong { display: block; font-size: 1.3em; font-weight: 900; margin-bottom: 4px; }
