/* 웹도리에서 새로 만든 게임(origin='webdori')의 공용 모양. 게임별 스타일은 아래에 접두어로 나눠 둔다.
   이 문서는 게임 화면의 iframe 안에서 열리므로 폭은 바깥 화면이 정한다(휴대폰 약 360~430px, PC 최대 980px). */
:root {
  --wk-blue: #2563eb; --wk-blue-dark: #1d4ed8; --wk-blue-soft: #dbeafe;
  --wk-ink: #111827; --wk-ink-2: #4b5563; --wk-muted: #6b7280;
  --wk-line: #e5e7eb; --wk-bg: #f1f5f9; --wk-card: #ffffff;
  --wk-good: #16a34a; --wk-bad: #dc2626;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--wk-bg); color: var(--wk-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.wk-wrap { max-width: 480px; margin: 0 auto; padding: 14px 12px 16px; }

.wk-stats { display: flex; gap: 8px; margin-bottom: 12px; }
.wk-stat { flex: 1 1 0; min-width: 0; padding: 8px 6px; background: var(--wk-card); border: 1px solid var(--wk-line); border-radius: 12px; text-align: center; }
.wk-stat-label { display: block; font-size: 12px; font-weight: 600; color: var(--wk-muted); white-space: nowrap; }
.wk-stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.3; color: var(--wk-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wk-stat.is-low b { color: var(--wk-bad); }

.wk-actions { display: flex; gap: 8px; margin-top: 12px; }
.wk-btn {
  flex: 1 1 0; min-height: 52px; padding: 0 16px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--wk-blue); color: #fff; font-size: 17px; font-weight: 700; touch-action: manipulation;
  transition: background .12s ease, transform .06s ease;
}
.wk-btn:hover { background: var(--wk-blue-dark); }
.wk-btn:active { transform: scale(.98); }
.wk-btn:disabled { background: #cbd5e1; cursor: default; transform: none; }
.wk-btn-ghost { background: var(--wk-card); color: var(--wk-ink-2); border: 1px solid var(--wk-line); }
.wk-btn-ghost:hover { background: #f8fafc; }
.wk-btn-ghost:disabled { background: #f8fafc; color: #cbd5e1; }
.wk-btn:focus-visible, .wk-focus:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

.wk-panel { background: var(--wk-card); border: 1px solid var(--wk-line); border-radius: 18px; padding: 16px; }
.wk-note { margin: 10px 0 0; min-height: 1.5em; text-align: center; font-size: 15px; font-weight: 600; color: var(--wk-ink-2); word-break: keep-all; }
.wk-note.is-good { color: var(--wk-good); }
.wk-note.is-bad { color: var(--wk-bad); }
.wk-result { text-align: center; }
.wk-result-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--wk-muted); }
.wk-result-score { margin: 2px 0 0; font-size: 40px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.wk-result-sub { margin: 4px 0 0; font-size: 15px; color: var(--wk-ink-2); word-break: keep-all; }
.wk-result-new { display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 13px; font-weight: 700; }
[hidden] { display: none !important; }
@keyframes wk-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.wk-shake { animation: wk-shake .3s ease; }

/* ── 반응 속도 테스트 ─────────────────── */
.rx-pad {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 300px; padding: 20px; border: 0; border-radius: 20px; cursor: pointer;
  color: #fff; text-align: center; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background: var(--wk-blue); transition: background .08s linear;
}
.rx-pad.is-waiting { background: #dc2626; }
.rx-pad.is-go { background: #16a34a; }
.rx-pad.is-lap, .rx-pad.is-early, .rx-pad.is-done { background: #334155; }
.rx-title { font-size: 34px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; word-break: keep-all; }
.rx-sub { font-size: 16px; font-weight: 500; opacity: .92; word-break: keep-all; }
.rx-laps { display: flex; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.rx-laps li { flex: 1 1 0; min-width: 0; padding: 6px 2px; background: var(--wk-card); border: 1px solid var(--wk-line); border-radius: 10px; text-align: center; font-size: 13px; color: var(--wk-muted); font-variant-numeric: tabular-nums; }
.rx-laps li b { display: block; font-size: 15px; color: var(--wk-ink); }

/* ── 색깔 글자 ────────────────────────── */
.st-word {
  display: flex; align-items: center; justify-content: center; min-height: 170px; padding: 16px;
  background: #0f172a; border-radius: 20px; color: #e2e8f0; text-align: center;
  font-size: 64px; font-weight: 800; letter-spacing: .04em; line-height: 1.1;
}
.st-word.is-text { font-size: 20px; font-weight: 600; letter-spacing: 0; line-height: 1.5; word-break: keep-all; }
.st-word.is-wrong { box-shadow: inset 0 0 0 4px #f87171; }
.st-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.st-choice {
  min-height: 60px; border: 1px solid var(--wk-line); border-radius: 14px; background: var(--wk-card); cursor: pointer;
  font-size: 20px; font-weight: 700; color: var(--wk-ink); touch-action: manipulation;
}
.st-choice:active { background: var(--wk-blue-soft); }
.st-choice:disabled { color: #cbd5e1; cursor: default; }
.st-choice kbd { margin-right: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--wk-muted); }
@media (hover: none) { .st-choice kbd { display: none; } }

/* ── 숫자 순서 누르기 ─────────────────── */
.no-sizes { display: flex; gap: 6px; margin-bottom: 12px; }
.no-size { flex: 1 1 0; min-height: 44px; border: 1px solid var(--wk-line); border-radius: 12px; background: var(--wk-card); cursor: pointer; font-size: 15px; font-weight: 700; color: var(--wk-ink-2); touch-action: manipulation; }
.no-size[aria-pressed="true"] { background: var(--wk-blue); border-color: var(--wk-blue); color: #fff; }
.no-grid { display: grid; gap: 6px; padding: 10px; background: var(--wk-card); border: 1px solid var(--wk-line); border-radius: 18px; }
.no-cell {
  aspect-ratio: 1 / 1; min-width: 0; border: 0; border-radius: 12px; background: var(--wk-blue-soft); cursor: pointer;
  font-size: 24px; font-weight: 800; color: var(--wk-blue-dark); font-variant-numeric: tabular-nums;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: background .1s ease, color .1s ease;
}
.no-grid[data-size="3"] .no-cell { font-size: 32px; }
.no-grid[data-size="5"] .no-cell { font-size: 20px; border-radius: 10px; }
.no-cell.is-done { background: #f1f5f9; color: #cbd5e1; cursor: default; }
.no-cell.is-wrong { background: #fecaca; color: #b91c1c; }

/* ── 다른 색 찾기 ─────────────────────── */
.oc-grid { display: grid; gap: 6px; padding: 10px; aspect-ratio: 1 / 1; background: var(--wk-card); border: 1px solid var(--wk-line); border-radius: 18px; }
.oc-cell { min-width: 0; min-height: 0; border: 0; border-radius: 12px; cursor: pointer; padding: 0; touch-action: manipulation; }
.oc-grid[data-size="6"] .oc-cell, .oc-grid[data-size="7"] .oc-cell { border-radius: 8px; }
.oc-cell.is-answer { outline: 4px solid var(--wk-ink); outline-offset: -4px; }
.oc-cell:disabled { cursor: default; }
.oc-cover { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; padding: 20px; background: var(--wk-card); border: 1px solid var(--wk-line); border-radius: 18px; }

/* ── 암산 OX ──────────────────────────── */
.mx-eq {
  display: flex; align-items: center; justify-content: center; min-height: 170px; padding: 16px;
  background: var(--wk-card); border: 2px solid var(--wk-line); border-radius: 20px; text-align: center;
  font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap;
  transition: border-color .1s ease, background .1s ease;
}
.mx-eq.is-text { font-size: 20px; font-weight: 600; white-space: normal; word-break: keep-all; color: var(--wk-ink-2); }
.mx-eq.is-good { border-color: var(--wk-good); background: #f0fdf4; }
.mx-eq.is-bad { border-color: var(--wk-bad); background: #fef2f2; }
.mx-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.mx-choice { min-height: 84px; border: 0; border-radius: 18px; cursor: pointer; color: #fff; font-size: 44px; font-weight: 800; line-height: 1; touch-action: manipulation; }
.mx-choice small { display: block; margin-top: 6px; font-size: 13px; font-weight: 600; opacity: .85; }
.mx-o { background: #2563eb; }
.mx-x { background: #e11d48; }
.mx-choice:active { transform: scale(.98); }
.mx-choice:disabled { background: #cbd5e1; cursor: default; transform: none; }
@media (hover: none) { .mx-choice small { display: none; } }

/* ── 초성 퀴즈 ────────────────────────── */
.cs-card { text-align: center; padding: 20px 16px; }
.cs-cat { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--wk-blue-soft); color: var(--wk-blue-dark); font-size: 14px; font-weight: 700; }
.cs-cho { margin: 12px 0 0; font-size: 52px; font-weight: 800; letter-spacing: .14em; margin-right: -.14em; line-height: 1.2; word-break: break-all; }
.cs-cho.is-long { font-size: 40px; }
.cs-hint { margin: 6px 0 0; min-height: 1.5em; font-size: 15px; color: var(--wk-muted); }
.cs-form { display: flex; gap: 8px; margin-top: 12px; }
.cs-input {
  flex: 1 1 0; min-width: 0; min-height: 52px; padding: 0 14px; border: 2px solid var(--wk-line); border-radius: 14px; background: var(--wk-card);
  font: inherit; font-size: 20px; font-weight: 700; color: var(--wk-ink); text-align: center;
}
.cs-input:focus { outline: none; border-color: var(--wk-blue); }
.cs-form .wk-btn { flex: 0 0 auto; min-width: 84px; }

/* ── 별똥별 피하기 ────────────────────── */
.dg-stage { position: relative; max-width: 420px; margin: 0 auto; border-radius: 18px; overflow: hidden; background: #0b1020; }
.dg-canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; touch-action: none; cursor: pointer; }
.dg-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 24px; background: rgba(11, 16, 32, .72); color: #fff; text-align: center;
}
.dg-cover .wk-result-title { color: #cbd5e1; }
.dg-cover .wk-result-sub { color: #e2e8f0; }
.dg-cover .wk-btn { flex: 0 0 auto; min-width: 180px; margin-top: 14px; }
