/* funtools — 공통 스타일. 모바일 360px 기준. */

:root {
  --accent: #FF5B34;
  --accent-dark: #E5431E;
  --accent-soft: #FFF1EC;
  --bg: #FFFFFF;
  --surface: #F7F7F5;
  --text: #191919;
  --muted: #6B6B6B;
  --line: #E7E6E3;

  --c-money: #2E7D52;
  --c-date: #2F6BFF;
  --c-food: #F08000;
  --c-fun: #8B5CF6;
  --c-game: #7C5CFF;
  --c-life: #0E7C86;

  --r: 14px;
  --sp: 8px;
  --max: 640px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #FF7654;
    --accent-dark: #FF9070;
    --accent-soft: #2A1A15;
    --bg: #141414;
    --surface: #1E1E1E;
    --text: #F2F2F0;
    --muted: #A0A0A0;
    --line: #2E2E2E;
    --c-money: #5FBF8A;
    --c-date: #6D9BFF;
    --c-food: #FFA53D;
    --c-fun: #A98BFF;
    --c-life: #3FBFCB;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ── 헤더 ───────────────────────────── */
header.top {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
}
header.top .wrap {
  display: flex; align-items: center; gap: 10px;
  height: 52px;
}
header.top a.logo {
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none;
}
header.top a.logo span { color: var(--accent); }
header.top nav { margin-left: auto; font-size: 14px; }
header.top nav a { color: var(--muted); text-decoration: none; }

/* ── 도구 페이지 ────────────────────── */
.head { display: flex; align-items: center; gap: 12px; margin: 20px 0 8px; }
.head .hero-mascot { flex: 0 0 60px; width: 60px; height: 60px; }
.head h1 { margin: 0; }

h1 {
  font-size: 25px; line-height: 1.3; letter-spacing: -0.03em;
  margin: 24px 0 8px; font-weight: 800;
}
.lead { color: var(--muted); font-size: 15px; margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: 14px; font-weight: 700;
  margin-bottom: 6px; color: var(--text);
}

input[type="number"], input[type="text"], input[type="date"], textarea, select {
  width: 100%; padding: 12px 14px;
  font: inherit; font-size: 16px; /* iOS 확대 방지 */
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.ymd { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 6px; }
.ymd select { padding-right: 26px; background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%; }

.with-unit { position: relative; }
.with-unit .unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.with-unit input { padding-right: 46px; }

/* 버튼형 선택 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  cursor: pointer; min-height: 40px;
}
.chips button[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ── 결과 ───────────────────────────── */
.result {
  margin: 16px 0 0; padding: 24px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-align: center;
}
.result .big {
  font-size: 52px; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.04em; color: var(--accent-dark);
  overflow-wrap: anywhere; white-space: pre-line;
}
.result .big.sm { font-size: 27px; }
.result .big .u { font-size: 0.5em; font-weight: 700; margin-left: 2px; }
.result .suffix { font-size: 17px; font-weight: 700; margin-top: 2px; }
.result .note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.result .warn {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 13px; text-align: left; color: var(--text);
}

.sub { margin: 12px 0 0; padding: 0; list-style: none; }
.sub li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
  font-size: 14px;
}
.sub li b { font-weight: 700; text-align: right; }
.sub li span { color: var(--muted); flex-shrink: 0; }

.actions { display: flex; gap: 8px; margin-top: 14px; }
.actions button {
  flex: 1; font: inherit; font-size: 15px; font-weight: 700;
  padding: 13px; border-radius: 10px; cursor: pointer; min-height: 48px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.actions button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ── 다음 도구 ──────────────────────── */
.related { margin: 28px 0; }
.related h2 { font-size: 16px; margin: 0 0 10px; }
.related a {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--text); font-size: 15px; font-weight: 600;
}
.related a .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.related a .arrow { margin-left: auto; color: var(--muted); }

/* ── 광고 (반드시 결과 아래) ─────────── */
.ad {
  margin: 24px 0; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--r);
  color: var(--muted); font-size: 12px;
}

/* 애드핏은 반응형이 없어 모바일·PC 광고를 따로 두고 CSS 로 전환한다.
   광고 소재가 대부분 흰 배경이라 다크모드에서 튄다 → 카드로 감싸서 얹는다. */
.ad-live {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); min-height: 0; padding: 12px;
  overflow: hidden; text-align: center;
}
.ad-live::before {
  content: '광고'; display: block;
  font-size: 11px; color: var(--muted); text-align: left;
  margin-bottom: 8px; letter-spacing: 0.02em;
}
.ad-live ins { max-width: 100%; }
.adfit-pc { display: none !important; }
@media (min-width: 760px) {
  .adfit-m { display: none !important; }
  .adfit-pc { display: inline-block !important; }
}

/* ── 쿠팡 추천 상품 ─────────────────── */
.shop { margin: 28px 0; }
.shop h2 { font-size: 16px; margin: 0 0 10px; }
.shop a {
  display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--text);
}
.shop a .ico { flex: 0 0 48px; }
.shop a .ico svg { display: block; width: 48px; height: 48px; }
.shop a .txt { min-width: 0; }
.shop a strong { display: block; font-size: 15px; font-weight: 700; }
.shop a em {
  display: block; font-style: normal; font-size: 13px;
  color: var(--muted); margin-top: 3px;
}
.shop a .arrow {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--accent-dark); margin-top: 8px;
}
.shop .disc { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ── 설명 ───────────────────────────── */
.about { margin: 28px 0; }
.about h2 { font-size: 16px; margin: 0 0 10px; }
.about details {
  border-top: 1px solid var(--line); padding: 12px 0;
}
.about details summary {
  font-size: 15px; font-weight: 600; cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.about details summary::-webkit-details-marker { display: none; }
.about details summary::after { content: '+'; margin-left: auto; color: var(--muted); }
.about details[open] summary::after { content: '−'; }
.about details p { font-size: 14px; color: var(--muted); margin: 8px 0 0; }

/* ── 홈 ─────────────────────────────── */
.hero { padding: 28px 0 20px; }
.hero .mascot { display: block; width: 72px; height: 72px; margin: 0 0 10px -4px; }
.hero h1 { font-size: 30px; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0; }

.search { margin: 4px 0 24px; }
.search input { font-size: 16px; }

.group { margin-bottom: 26px; }
.group h2 {
  font-size: 15px; margin: 0 0 10px;
  display: flex; align-items: center; gap: 7px;
}
.group h2 .dot { width: 9px; height: 9px; border-radius: 50%; }
.grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 520px) { .grid { grid-template-columns: 1fr 1fr; } }
.grid a {
  display: block; padding: 14px;
  border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--text);
}
.grid a strong { display: block; font-size: 15px; font-weight: 700; }
.grid a em {
  display: block; font-style: normal; font-size: 13px;
  color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty { color: var(--muted); font-size: 14px; padding: 20px 0; }

/* ── 푸터 ───────────────────────────── */
footer {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 20px 0 40px; font-size: 13px; color: var(--muted);
}
footer a { color: var(--muted); }
footer .disc { margin-top: 8px; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50;
}
.toast.on { opacity: 1; }

article h2 { letter-spacing: -0.02em; }


/* ── 쿠팡 카드 — 광고인 걸 숨기지 않는다. 대신 누르고 싶게 만든다 ── */
.shop { margin: 30px 0 24px; }
.shop h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; margin: 0 0 12px;
}
.shop h2 .tag {
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: var(--muted);
  padding: 3px 8px; border-radius: 99px;
}
.shop a {
  display: grid; grid-template-columns: 66px 1fr; gap: 14px; align-items: center;
  padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--card); text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.shop a:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.10); }
.shop a:active { transform: translateY(0); }
.shop .ico {
  width: 66px; height: 66px; border-radius: 16px;
  background: var(--accent-soft); display: grid; place-items: center;
}
.shop .ico svg { width: 44px; height: 44px; }
.shop .txt strong { display: block; font-size: 16.5px; font-weight: 700; color: var(--text); line-height: 1.35; }
.shop .txt em { display: block; font-style: normal; font-size: 13.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.shop .go {
  grid-column: 1 / -1; margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 800;
  padding: 13px; border-radius: 13px;
}
.shop .go b { font-weight: 800; }
.shop .disc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 10px; }

/* ── 게임 ── */
.gamebox { margin: 8px 0 4px; }
.ghud {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 12px 16px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.ghud .lab { font-size: 12px; font-weight: 600; color: var(--muted); display: block; }
.ghint { font-size: 13px; color: var(--muted); text-align: center; margin-top: 12px; line-height: 1.6; }
.ghint b { color: var(--accent); }

/* 사과게임 — 납작한 그림체 사과 (외부 이미지 없이 SVG) */
.apples {
  display: grid; grid-template-columns: repeat(10, 1fr);
  gap: 2px; touch-action: none; user-select: none; -webkit-user-select: none;
}
.apples button {
  aspect-ratio: 1; border: 0; background: transparent;
  color: #fff; font-size: clamp(13px, 3.9vw, 21px); font-weight: 800;
  display: grid; place-items: center; cursor: pointer; position: relative;
  /* 숫자를 사과 몸통 한가운데로 내린다 (위쪽은 줄기·잎이 차지한다) */
  padding: 14% 0 2%;
  text-shadow: 0 1px 3px rgba(0,0,0,.35);
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50 32 C 49 25, 49 19, 53 14' stroke='%233E3E3E' stroke-width='3.4' fill='none' stroke-linecap='round'/><path d='M52 22 C 58 14, 68 9, 79 10 C 79 20, 70 26, 60 25 C 56 25, 53 24, 52 22 Z' fill='%237CB342'/><path d='M50 31 C 43 22, 28 21, 20 30 C 12 39, 13 58, 21 73 C 27 84, 36 91, 43 91 C 46 91, 48 88, 50 88 C 52 88, 54 91, 57 91 C 64 91, 73 84, 79 73 C 87 58, 88 39, 80 30 C 72 21, 57 22, 50 31 Z' fill='%23E5231F'/></svg>");
  background-size: 100% 100%; background-repeat: no-repeat; background-position: center;
  transition: transform .09s ease, opacity .2s ease, filter .12s ease;
}
.apples button.sel { transform: scale(.82); filter: brightness(1.2) saturate(1.25); }
.apples button.ok {
  transform: scale(.9);
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50 32 C 49 25, 49 19, 53 14' stroke='%233E3E3E' stroke-width='3.4' fill='none' stroke-linecap='round'/><path d='M52 22 C 58 14, 68 9, 79 10 C 79 20, 70 26, 60 25 C 56 25, 53 24, 52 22 Z' fill='%237CB342'/><path d='M50 31 C 43 22, 28 21, 20 30 C 12 39, 13 58, 21 73 C 27 84, 36 91, 43 91 C 46 91, 48 88, 50 88 C 52 88, 54 91, 57 91 C 64 91, 73 84, 79 73 C 87 58, 88 39, 80 30 C 72 21, 57 22, 50 31 Z' fill='%2322A06B'/></svg>");
}
.apples button.dead { opacity: 0; transform: scale(.4); cursor: default; }
.apples button.gone { animation: pop .28s ease forwards; }
@keyframes pop { 0% { transform: scale(1); opacity: 1; } 45% { transform: scale(1.25); } 100% { transform: scale(.3); opacity: 0; } }

/* 슐테표 · 카드짝 */
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.grid5 button {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text);
  font-size: clamp(18px, 5.2vw, 27px); font-weight: 700; cursor: pointer;
}
.grid5 button.done { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 380px; margin: 0 auto; }
.grid4 button {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 14px;
  background: var(--accent); color: transparent;
  font-size: clamp(28px, 8.5vw, 44px); cursor: pointer;
  transition: background .15s ease;
}
.grid4 button.up { background: var(--card); color: var(--text); }
.grid4 button.got { background: var(--accent-soft); color: var(--text); pointer-events: none; }

/* 반응속도 */
.react {
  height: 240px; border-radius: 18px; display: grid; place-items: center;
  font-size: 20px; font-weight: 800; color: #fff; cursor: pointer;
  background: var(--muted); text-align: center; padding: 20px; line-height: 1.5;
}
.react.wait { background: #E03131; }
.react.go { background: #22A06B; }
.react.done { background: var(--accent); }

/* 게임 결과 */
.gover {
  text-align: center; padding: 28px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
}
.gover .n { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1.2; }
.gover .m { font-size: 15px; color: var(--muted); margin-top: 8px; }
.gover .new { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 700; color: #fff; background: #22A06B; padding: 5px 12px; border-radius: 99px; }

/* 지뢰찾기 */
.mines { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; touch-action: none; user-select: none; -webkit-user-select: none; }
.mines button {
  aspect-ratio: 1; border: 0; border-radius: 7px; cursor: pointer;
  background: var(--accent-soft); color: var(--text);
  font-size: clamp(15px, 4.4vw, 23px); font-weight: 800;
}
.mines button.open { background: var(--card); border: 1px solid var(--line); }
.mines button[data-n="1"] { color: #2F6FEB; }
.mines button[data-n="2"] { color: #22A06B; }
.mines button[data-n="3"] { color: #E03131; }
.mines button[data-n="4"] { color: #7C5CFF; }
.mines button[data-n="5"], .mines button[data-n="6"], .mines button[data-n="7"], .mines button[data-n="8"] { color: #B54708; }

/* 소리 켜기·끄기 버튼 */
.actions .icon {
  flex: 0 0 auto; width: 52px; padding: 0;
  font-size: 20px; line-height: 1;
}

/* ── 몬스터 진화 (스플렌더식) ── */
.ev-bank { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.ev-bank button {
  padding: 10px 4px; border: 2px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--text); cursor: pointer;
  display: grid; place-items: center; gap: 2px; position: relative;
}
.ev-bank button:not(:disabled):hover { border-color: var(--c); }
.ev-bank button:disabled { opacity: .35; cursor: default; }
.ev-bank button em { font-style: normal; font-size: 30px; line-height: 1; }
.ev-bank button span { font-size: 11px; color: var(--muted); }
.ev-bank button b { font-size: 14px; color: var(--c); }
.ev-bank button i {
  position: absolute; top: -6px; right: -4px; font-style: normal;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  padding: 1px 6px; border-radius: 99px;
}
.ev-bank .ev-turn { font-size: 13px; font-weight: 700; background: var(--accent); color: #fff; border-color: transparent; }
.ev-bank .ev-turn:disabled { background: var(--line); color: var(--muted); }

.ev-hand { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.ev-hand span {
  font-size: 15px; font-weight: 700; color: var(--text);
  background: var(--accent-soft); padding: 5px 10px; border-radius: 99px;
}
.ev-hand span i { font-style: normal; font-size: 11px; color: var(--accent); margin-left: 3px; }
.ev-hand .ev-cnt { background: transparent; color: var(--muted); font-weight: 500; margin-left: auto; }

.ev-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.ev-tier { grid-column: 1 / -1; font-size: 11px; color: var(--muted); font-weight: 700; }
.ev-row button {
  border: 2px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 10px 6px; cursor: pointer; display: grid; gap: 3px; place-items: center;
  color: var(--text); min-height: 132px;
}
.ev-row button.ok { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.ev-row button em { font-style: normal; font-size: 40px; line-height: 1; }
.ev-row button strong { font-size: 12.5px; font-weight: 700; line-height: 1.25; text-align: center; }
.ev-pt { font-size: 12px; font-weight: 800; color: var(--c); }
.ev-pt.zero { color: var(--muted); font-weight: 600; font-size: 10.5px; }
.ev-cost { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.ev-cost i { font-style: normal; font-size: 12px; font-weight: 700; color: var(--c); }
.ev-empty { border: 2px dashed var(--line); border-radius: 14px; display: grid; place-items: center; font-size: 11px; color: var(--muted); min-height: 132px; }

/* ── 게임 방법 팝업 ── */
.gmodal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.gmodal[hidden] { display: none; }
.gmodal-in {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 26px 24px 22px; max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: gpop .22s ease;
}
@keyframes gpop { from { transform: translateY(12px) scale(.97); opacity: 0; } }
.gmodal-in h3 { font-size: 20px; margin: 0 0 16px; color: var(--text); }
.gmodal-in ol { margin: 0 0 4px; padding: 0; list-style: none; counter-reset: g; }
.gmodal-in li {
  counter-increment: g; position: relative;
  padding: 0 0 14px 38px; font-size: 15px; line-height: 1.6; color: var(--text);
}
.gmodal-in li::before {
  content: counter(g); position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 800;
  display: grid; place-items: center;
}
.gmodal-in li b { color: var(--accent); }
.gmodal-tip {
  font-size: 13.5px; color: var(--muted); line-height: 1.6;
  background: var(--accent-soft); padding: 12px 14px; border-radius: 12px; margin: 8px 0 18px;
}
.gmodal-in .primary { width: 100%; }

/* ? 버튼 */
.actions #help { font-weight: 800; font-size: 19px; }

/* ── 한글 단어 맞히기 ── */
.wd-grid { display: grid; gap: 6px; margin-bottom: 14px; }
.wd-row { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 6px; }
.wd-c {
  aspect-ratio: 1; border: 2px solid var(--line); border-radius: 10px;
  display: grid; place-items: center;
  font-size: clamp(18px, 5.5vw, 28px); font-weight: 800; color: var(--text);
  background: var(--card);
}
.wd-c.hit  { background: #22A06B; border-color: #22A06B; color: #fff; }
.wd-c.near { background: #E8A317; border-color: #E8A317; color: #fff; }
.wd-c.miss { background: var(--line); border-color: transparent; color: var(--muted); }
.wd-input { display: flex; gap: 8px; }
.wd-input input { flex: 1; font-size: 20px; text-align: center; font-weight: 700; }
.wd-input button { flex: 0 0 88px; }
.wd-art {
  font-size: 20px; line-height: 1.25; margin: 14px 0 10px;
  font-family: inherit; letter-spacing: 2px;
}


/* 친구 대결 */
.wd-rival {
  background: var(--accent-soft); color: var(--text);
  padding: 12px 14px; border-radius: 12px; margin-bottom: 12px;
  font-size: 14px; text-align: center;
}
.wd-rival b { color: var(--accent); }
.wd-win  { font-size: 16px; font-weight: 800; color: #22A06B; margin-top: 8px; }
.wd-lose { font-size: 16px; font-weight: 800; color: var(--muted); margin-top: 8px; }
.wd-tie  { font-size: 16px; font-weight: 800; color: #E8A317; margin-top: 8px; }

/* 몬스터 진화 — 모드 고르기 */
.ev-modes { display: grid; gap: 10px; margin: 8px 0 4px; }
.ev-modes button {
  display: grid; grid-template-columns: 54px 1fr; gap: 14px; align-items: center;
  padding: 18px 16px; border: 2px solid var(--line); border-radius: 18px;
  background: var(--card); color: var(--text); cursor: pointer; text-align: left;
}
.ev-modes button:hover { border-color: var(--accent); }
.ev-modes button em { font-style: normal; font-size: 34px; line-height: 1; text-align: center; }
.ev-modes button strong { display: block; font-size: 17px; }
.ev-modes button span { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

/* 대결 점수판 */
.ev-vs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.ev-vs span {
  padding: 10px; border-radius: 12px; text-align: center;
  background: var(--card); border: 2px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.ev-vs span.on { border-color: var(--accent); color: var(--text); }
.ev-vs span b { color: var(--accent); font-size: 15px; }

/* 도전장 링크 버튼 */
.ev-link {
  width: 100%; margin-top: 10px; padding: 12px;
  border: 1px dashed var(--line); border-radius: 12px;
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ev-link:hover { border-color: var(--accent); color: var(--accent); }

/* ── 공식 조회처 (광고 아님) ── */
.official { margin: 30px 0 24px; }
.official h2 { font-size: 17px; margin: 0 0 12px; }
.official a {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 14px 16px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); text-decoration: none;
}
.official a:hover { border-color: var(--accent); }
.official .txt strong { display: block; font-size: 15.5px; font-weight: 700; color: var(--text); }
.official .txt em { display: block; font-style: normal; font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.official .go { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--accent); }

/* ── 내 주변 점심 뽑기 ── */
.ln-top { margin-bottom: 14px; }
.ln-top .primary { width: 100%; }
.ln-or { text-align: center; font-size: 12.5px; color: var(--muted); margin: 12px 0 10px; }
.ln-addr { display: flex; gap: 8px; }
.ln-addr input { flex: 1; }
.ln-addr button { flex: 0 0 76px; }
.ln-opt { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ln-wait, .ln-err {
  padding: 18px; text-align: center; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 14px; color: var(--muted); line-height: 1.6;
}
.ln-pick {
  padding: 26px 20px; border-radius: 20px; text-align: center;
  background: var(--card); border: 2px solid var(--accent);
}
.ln-name { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1.25; }
.ln-meta { font-size: 14px; color: var(--accent); font-weight: 700; margin-top: 8px; }
.ln-addr-t { font-size: 13px; color: var(--muted); margin-top: 6px; }
.ln-map {
  display: inline-block; margin-top: 16px; padding: 11px 18px;
  background: var(--accent); color: #fff; border-radius: 12px;
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.ln-again {
  width: 100%; margin-top: 10px; padding: 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--text); font-size: 15px; font-weight: 700; cursor: pointer;
}
.ln-again:hover { border-color: var(--accent); }
.ln-alt { margin-top: 16px; }
.ln-alt b { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ln-alt a {
  display: flex; justify-content: space-between; padding: 11px 14px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 12px; text-decoration: none;
  color: var(--text); font-size: 14px;
}
.ln-alt a span { color: var(--muted); font-size: 13px; }
.ln-note { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 12px; }
.appbox { margin-bottom: 4px; }

/* ── 한글 단어 순위표 배너 ── */
#topbanner:empty { display: none; }
.wd-board {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; margin: 16px 0 4px;
}
.wd-board.empty { text-align: center; font-size: 14px; color: var(--muted); }
.wd-board.empty b { color: var(--accent); }
.wd-b-head { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.wd-b-head span { float: right; font-weight: 500; }
.wd-b-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wd-b-row > div {
  background: var(--accent-soft); border-radius: 12px; padding: 10px 12px;
}
.wd-b-lab { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.wd-b-row b { font-size: 15px; color: var(--text); }
.wd-b-more { margin-top: 10px; }
.wd-b-more summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.wd-b-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.wd-b-cols em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.wd-b-cols span { display: block; font-size: 13px; color: var(--text); padding: 3px 0; }
.wd-b-cols i { font-style: normal; color: var(--muted); font-size: 12px; }

/* 닉네임 등록 */
.wd-reg { margin: 16px 0 4px; padding: 16px; background: var(--accent-soft); border-radius: 14px; }
.wd-reg-t { font-size: 14px; color: var(--text); margin-bottom: 10px; line-height: 1.5; }
.wd-reg-t b { color: var(--accent); }
.wd-reg-in { display: flex; gap: 8px; }
.wd-reg-in input { flex: 1; text-align: center; font-size: 15px; }
.wd-reg-in button { flex: 0 0 74px; }

/* ── 공유 시트 ── */
.sheet {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet[hidden] { display: none; }
.sheet-in {
  background: var(--card); width: 100%; max-width: 460px;
  border-radius: 22px 22px 0 0; padding: 22px 18px 18px;
  border: 1px solid var(--line); border-bottom: 0;
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } }
.sheet-in h3 { font-size: 18px; margin: 0 0 16px; text-align: center; color: var(--text); }
.sheet-b {
  width: 100%; display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center;
  padding: 14px; margin-bottom: 8px; text-align: left;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--text); cursor: pointer;
}
.sheet-b:hover { border-color: var(--accent); }
.sheet-b em { font-style: normal; font-size: 26px; text-align: center; line-height: 1; }
.sheet-b b { display: block; font-size: 15.5px; font-weight: 700; }
.sheet-b i { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.sheet-x {
  width: 100%; margin-top: 6px; padding: 13px;
  border: 0; border-radius: 14px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer;
}
@media (min-width: 560px) {
  .sheet { align-items: center; }
  .sheet-in { border-radius: 22px; border-bottom: 1px solid var(--line); }
}

.sheet-b.kko { background: #FEE500; border-color: #FEE500; color: #191600; }
.sheet-b.kko i { color: #5B5300; }
.sheet-b.kko:hover { filter: brightness(.96); border-color: #FEE500; }

/* 공유창 카드 미리보기 */
.sheet-pre { margin-bottom: 14px; }
.sheet-pre[hidden] { display: none; }
.sheet-pre img {
  width: 100%; max-width: 260px; display: block; margin: 0 auto;
  border-radius: 16px; border: 1px solid var(--line);
}
.wd-reg-share { width: 100%; margin-top: 12px; }

/* ── 게임 결과 팝업 ── */
.rmodal {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  overflow-y: auto;
}
.rmodal[hidden] { display: none; }
.rmodal-in {
  position: relative; width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: 30px 22px 24px;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
  animation: gpop .24s ease;
}
.rmodal-x {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 16px; cursor: pointer;
}
.rmodal-x:hover { background: var(--accent-soft); color: var(--text); }
.rmodal-cap {
  font-size: 13px; font-weight: 800; letter-spacing: .06em;
  color: var(--accent); margin-bottom: 6px;
}
.rmodal-in .gover { background: transparent; border: 0; padding: 0; }

/* ── 광고 자리 ── */
/* 광고는 답을 본 뒤에만 나온다. 계산기 위에 올리면 사람이 바로 나간다. */
.ad { margin: 28px 0; position: relative; }
.ad-tag {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .04em; margin-bottom: 6px;
}
.ad-live { min-height: 100px; }
.ad-live ins { display: block; }
.ad-empty {
  border: 1px dashed var(--line); border-radius: 14px;
  padding: 26px; text-align: center;
}
.ad-empty span { font-size: 13px; color: var(--muted); }
/* 홈 목록 아래 광고는 위아래 여백을 더 준다 */
.ad-home { margin: 36px 0 12px; }
@media (max-width: 560px) {
  .ad { margin: 22px 0; }
}
