/* ==========================================================================
   복불복 놀이터 — 공용 스타일
   외부 폰트/이미지 없이 시스템 폰트와 CSS 만 사용합니다.
   ========================================================================== */

/* ---------- 디자인 토큰 ---------- */
:root {
  --bg: #fff8f1;
  --bg-grad: radial-gradient(1200px 500px at 10% -10%, #ffe7d6 0%, transparent 60%),
             radial-gradient(900px 400px at 100% 0%, #ffeec2 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #fff2e6;
  --surface-3: #ffe8d6;
  --text: #1d2030;
  --text-2: #595e72;
  --text-3: #8a8fa3;
  --border: #eedfd0;
  --border-strong: #dcc8b5;
  --primary: #ff5a36;
  --primary-hover: #f0461f;
  --primary-ink: #ffffff;
  --primary-soft: #ffe2d8;
  --accent: #ffb020;
  --accent-soft: #fff0cc;
  --blue: #2f80ed;
  --green: #17a673;
  --red: #e5383b;
  --purple: #8b5cf6;
  --success: #17a673;
  --danger: #e5383b;
  --shadow-sm: 0 1px 2px rgba(60, 35, 10, .06), 0 2px 8px rgba(60, 35, 10, .05);
  --shadow: 0 2px 6px rgba(60, 35, 10, .06), 0 12px 32px rgba(60, 35, 10, .08);
  --shadow-lg: 0 20px 60px rgba(30, 15, 5, .22);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR",
          "Malgun Gothic", "맑은 고딕", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif,
          "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --font-num: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, var(--font);
  --container: 1120px;
  --header-h: 60px;
  --focus: 0 0 0 3px rgba(255, 90, 54, .35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12131a;
    --bg-grad: radial-gradient(1200px 500px at 10% -10%, #2a1a17 0%, transparent 60%),
               radial-gradient(900px 400px at 100% 0%, #262112 0%, transparent 55%);
    --surface: #1b1d27;
    --surface-2: #232633;
    --surface-3: #2c3040;
    --text: #f2f3f7;
    --text-2: #b0b4c6;
    --text-3: #7f849a;
    --border: #2f3344;
    --border-strong: #41465b;
    --primary: #ff6b4a;
    --primary-hover: #ff8266;
    --primary-soft: #3a221c;
    --accent-soft: #3a3016;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 2px 6px rgba(0, 0, 0, .25), 0 12px 32px rgba(0, 0, 0, .3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12131a;
  --bg-grad: radial-gradient(1200px 500px at 10% -10%, #2a1a17 0%, transparent 60%),
             radial-gradient(900px 400px at 100% 0%, #262112 0%, transparent 55%);
  --surface: #1b1d27;
  --surface-2: #232633;
  --surface-3: #2c3040;
  --text: #f2f3f7;
  --text-2: #b0b4c6;
  --text-3: #7f849a;
  --border: #2f3344;
  --border-strong: #41465b;
  --primary: #ff6b4a;
  --primary-hover: #ff8266;
  --primary-soft: #3a221c;
  --accent-soft: #3a3016;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 2px 6px rgba(0, 0, 0, .25), 0 12px 32px rgba(0, 0, 0, .3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img, svg, canvas { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: var(--primary-soft); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 2000;
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px;
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 24px; } }

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 12px; min-height: var(--header-h); }
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 800; font-size: 18px; letter-spacing: -0.03em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.main-nav { display: flex; gap: 2px; margin-left: auto; }
.main-nav a {
  color: var(--text-2); font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 999px; white-space: nowrap;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--border); background: var(--surface); border-radius: 12px; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
@media (max-width: 899px) {
  .header-inner { flex-wrap: wrap; gap: 0 8px; padding-top: 6px; }
  .theme-toggle { margin-left: auto; }
  .main-nav {
    order: 3; width: calc(100% + 32px); margin: 2px -16px 0; padding: 0 12px 8px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { font-size: 14px; padding: 7px 11px; }
}

/* ---------- 푸터 ---------- */
.site-footer {
  margin-top: 72px; background: var(--surface); border-top: 1px solid var(--border);
  color: var(--text-2); font-size: 14px; padding: 40px 0 32px;
}
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand .logo { font-size: 17px; margin-bottom: 10px; }
.footer-brand p { margin: 0 0 6px; }
.footer-col h2 { font-size: 14px; color: var(--text); margin-bottom: 10px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-col a { color: var(--text-2); }
.footer-col a:hover { color: var(--text); }
.footer-bottom { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.footer-bottom p { margin: 0 0 4px; }

/* ---------- 공통 섹션 ---------- */
.section { margin-top: 48px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head .more { font-size: 14px; font-weight: 600; white-space: nowrap; }
.section-desc { color: var(--text-2); margin: -8px 0 18px; font-size: 15px; }

.breadcrumb { font-size: 13px; color: var(--text-3); margin: 18px 0 8px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--text-3); }
.breadcrumb a { color: var(--text-2); }

/* ---------- 홈 히어로 ---------- */
.hero { text-align: center; padding: 48px 0 8px; }
.hero h1 { font-size: clamp(30px, 6vw, 48px); font-weight: 900; letter-spacing: -0.04em; margin-bottom: 12px; }
.hero h1 .hl { color: var(--primary); }
.hero .lead { color: var(--text-2); font-size: clamp(15px, 2.4vw, 18px); margin: 0 auto 26px; max-width: 620px; }
.search-box { position: relative; max-width: 560px; margin: 0 auto; }
.search-box input {
  width: 100%; height: 56px; border-radius: 999px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 17px; padding: 0 22px 0 52px;
  box-shadow: var(--shadow-sm);
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.search-box svg { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--text-3); pointer-events: none; }
.quick-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.quick-tags a {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px;
}
.quick-tags a:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.search-empty { text-align: center; color: var(--text-2); padding: 32px 0; display: none; }
.search-empty.show { display: block; }

.cat-pills { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.cat-pills::-webkit-scrollbar { display: none; }

/* ---------- 게임 카드 ---------- */
.card-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 960px) { .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.game-card {
  --c: var(--primary);
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 45%, var(--border)); text-decoration: none; }
.game-card .gc-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); margin-bottom: 4px;
}
.game-card .gc-name { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.game-card .gc-desc { font-size: 13px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.game-card .gc-badge {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 800; color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); padding: 2px 8px; border-radius: 999px;
}
.game-card[hidden] { display: none; }

/* 상황별 추천 */
.scenario-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .scenario-grid { grid-template-columns: repeat(2, 1fr); } }
.scenario {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.scenario h3 { font-size: 17px; display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.scenario p { color: var(--text-2); font-size: 14px; margin-bottom: 10px; }
.scenario .links { display: flex; flex-wrap: wrap; gap: 6px; }
.scenario .links a {
  font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
}
.scenario .links a:hover { text-decoration: none; filter: brightness(.97); }

.feature-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .feature-grid { grid-template-columns: repeat(4, 1fr); } }
.feature { background: var(--surface-2); border-radius: var(--radius-lg); padding: 18px; }
.feature .f-emoji { font-size: 26px; }
.feature h3 { font-size: 16px; margin: 8px 0 4px; }
.feature p { font-size: 13.5px; color: var(--text-2); margin: 0; }

.guide-list { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .guide-list { grid-template-columns: repeat(2, 1fr); } }
.guide-item {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm);
}
.guide-item:hover { text-decoration: none; border-color: var(--primary); }
.guide-item .gi-emoji { font-size: 28px; line-height: 1; flex: none; margin-top: 2px; }
.guide-item h3 { font-size: 16px; margin: 0 0 4px; }
.guide-item p { font-size: 13.5px; color: var(--text-2); margin: 0; }

/* ---------- 페이지 헤드 (카테고리/정적 페이지) ---------- */
.page-head { padding: 12px 0 8px; }
.page-head h1 { font-size: clamp(26px, 5vw, 36px); font-weight: 900; }
.page-head .lead { color: var(--text-2); font-size: 16px; max-width: 760px; }

/* ---------- 게임 페이지 ---------- */
.game-hero { display: flex; align-items: center; gap: 14px; margin: 6px 0 16px; }
.game-hero .gh-icon {
  width: 58px; height: 58px; border-radius: 18px; flex: none; display: grid; place-items: center; font-size: 32px;
  background: color-mix(in srgb, var(--c, var(--primary)) 15%, var(--surface)); border: 1px solid var(--border);
}
.game-hero h1 { font-size: clamp(24px, 5vw, 34px); font-weight: 900; margin: 0; }
.game-hero .lead { margin: 2px 0 0; color: var(--text-2); font-size: 15px; }

.game-shell {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow); overflow: hidden;
}
.game-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.game-toolbar .gt-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.game-toolbar .gt-title span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-toolbar .gt-actions { display: flex; gap: 6px; }
.game-toolbar .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.game-root { padding: 20px; min-height: 360px; }
@media (max-width: 520px) { .game-root { padding: 16px 14px; } }
.game-root noscript p { text-align: center; color: var(--text-2); padding: 40px 0; }

.game-shell.is-full {
  position: fixed; inset: 0; z-index: 900; border-radius: 0; border: 0;
  display: flex; flex-direction: column; overflow: auto;
}
.game-shell.is-full .game-root { flex: 1; display: flex; flex-direction: column; }
.game-shell.is-full .game-root > * { width: 100%; }
body.no-scroll { overflow: hidden; }

/* ---------- 본문(설명 글) ---------- */
.content-wrap { display: grid; gap: 32px; margin-top: 36px; }
.prose { max-width: 780px; font-size: 16.5px; line-height: 1.85; color: var(--text); }
.prose h2 { font-size: 22px; margin: 2.2em 0 .7em; padding-top: .2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 18px; margin: 1.8em 0 .6em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--primary); font-weight: 700; }
.prose strong { font-weight: 800; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
.prose blockquote { margin: 0 0 1.2em; padding: 12px 18px; border-left: 4px solid var(--primary); background: var(--surface-2); border-radius: 0 12px 12px 0; color: var(--text-2); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose .callout, .callout {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 14px; padding: 14px 18px; margin: 0 0 1.2em; font-size: 15.5px;
}
.callout p:last-child { margin-bottom: 0; }
.howto-list { counter-reset: step; list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.howto-list li {
  counter-increment: step; position: relative; padding: 12px 14px 12px 52px; margin: 0 !important;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; line-height: 1.65;
}
.howto-list li::before {
  content: counter(step); position: absolute; left: 12px; top: 11px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 14px; display: grid; place-items: center;
}
.faq { display: grid; gap: 10px; margin-bottom: 1.2em; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 18px; }
.faq summary {
  cursor: pointer; list-style: none; font-weight: 700; padding: 14px 28px 14px 0; position: relative; line-height: 1.5;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "Q."; color: var(--primary); margin-right: 6px; font-weight: 900; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 12px; font-size: 20px; color: var(--text-3); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .faq-a { padding: 0 0 14px; color: var(--text-2); font-size: 15.5px; line-height: 1.8; }
.faq .faq-a p:last-child { margin-bottom: 0; }

.article-meta { color: var(--text-3); font-size: 14px; margin: 4px 0 24px; }
.related-box { margin-top: 12px; }

/* 본문 뒤의 수동 광고 준비 영역. 일반 빌드에서는 template 안에 있어 공간을 차지하지 않음. */
.ad-slot {
  position: static; width: 100%; max-width: 780px; min-width: 0;
  margin: 160px auto; text-align: center;
}
.ad-slot .ad-label { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 8px; }
.ad-frame { width: 100%; min-height: 250px; display: grid; place-items: center; }
.ad-frame:has(.ad-preview-note) { border: 1px dashed var(--border-strong); background: var(--surface-2); }
.ad-preview-note { padding: 16px; color: var(--text-3); font-size: 13px; }
/* 전체화면·결과 모달 뒤에서 클릭 가능한 광고가 남지 않도록 영역은 보존하고 가림. */
body.no-scroll .ad-slot, body:has(.bb-modal-backdrop) .ad-slot { visibility: hidden; }
@media (min-width: 860px) { .ad-frame { min-height: 90px; } }

/* ==========================================================================
   게임 UI 키트 (게임 스크립트에서 공통으로 사용)
   ========================================================================== */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.center { text-align: center; }
.muted { color: var(--text-2); }
.hint { font-size: 13px; color: var(--text-3); margin: 0; }
.grow { flex: 1 1 auto; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }
.hidden, [hidden] { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 4px 0; border: 0; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer;
  transition: background .15s, transform .08s, box-shadow .15s, border-color .15s; user-select: none;
  -webkit-tap-highlight-color: transparent; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-dark:hover { background: var(--text); opacity: .9; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: var(--primary-soft); filter: brightness(.97); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 18px; border-radius: 16px; }
.btn-xl { min-height: 64px; padding: 0 32px; font-size: 20px; border-radius: 18px; }
.btn-block { width: 100%; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-weight: 700; font-size: 14px; color: var(--text); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; padding: 0 14px;
}
.textarea { padding: 10px 14px; min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input-sm { min-height: 36px; font-size: 15px; padding: 0 10px; border-radius: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

/* 목록 입력 (칩) */
.list-input { display: flex; flex-direction: column; gap: 10px; }
.li-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.li-label { font-weight: 800; font-size: 15px; }
.li-label b { color: var(--primary); }
.li-tools { display: flex; gap: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; }
.chip {
  --c: var(--text-3);
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  height: 36px; padding: 0 4px 0 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; font-size: 15px;
  animation: bb-pop .18s ease-out;
}
.chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.chip .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
.chip .chip-x {
  width: 28px; height: 28px; border: 0; background: transparent; border-radius: 50%; cursor: pointer;
  color: var(--text-3); font-size: 18px; line-height: 1; display: grid; place-items: center;
}
.chip .chip-x:hover { background: var(--surface-3); color: var(--danger); }
.chips-empty { color: var(--text-3); font-size: 14px; align-self: center; }
.li-add { display: flex; gap: 8px; }
.li-add .input { flex: 1; min-width: 0; }
.li-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.li-quick .hint { margin-right: 2px; }
.chip-btn {
  height: 30px; padding: 0 11px; border-radius: 999px; border: 1px dashed var(--border-strong);
  background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip-btn:hover { border-style: solid; border-color: var(--primary); color: var(--primary); }

/* 스테퍼 */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 20px; font-weight: 700; cursor: pointer; color: var(--text-2); }
.stepper button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.stepper button:disabled { opacity: .3; cursor: not-allowed; }
.stepper output { min-width: 56px; text-align: center; font-weight: 800; font-size: 17px; font-family: var(--font-num); }
.stepper-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* 세그먼트 */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 14px; border: 1px solid var(--border); flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 0 14px; min-height: 36px; border-radius: 10px; font-weight: 700; font-size: 14px;
  color: var(--text-2); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* 패널 & 무대 */
.panel { background: var(--surface-2); border-radius: var(--radius-lg); padding: 16px; }
.panel-title { font-weight: 800; font-size: 15px; margin: 0 0 10px; }
.stage {
  position: relative; border-radius: var(--radius-lg); background: var(--surface-2);
  min-height: 280px; display: grid; place-items: center; overflow: hidden; padding: 16px;
}
.stage-dark { background: #1c1f2b; color: #f3f4f8; }
.big-text { font-size: clamp(34px, 9vw, 64px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.15; text-align: center; font-family: var(--font-num); }
.mid-text { font-size: clamp(20px, 5vw, 28px); font-weight: 800; text-align: center; }
.result-card {
  background: var(--surface); border: 2px solid var(--primary); border-radius: var(--radius-lg);
  padding: 20px; text-align: center; animation: bb-pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.result-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 600;
}
.result-list li .rank { font-family: var(--font-num); font-weight: 900; min-width: 2em; color: var(--text-3); }
.result-list li.is-hit { border-color: var(--primary); background: var(--primary-soft); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.tag-hit { background: var(--primary); color: #fff; }
.tag-ok { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); font-size: .85em; font-family: ui-monospace, monospace; }

/* 차례 표시 */
.turn-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 800; font-size: 16px; margin: 0 auto; width: fit-content; max-width: 100%;
}
.turn-banner .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--primary)); }

/* ---------- 모달 ---------- */
.bb-modal-backdrop {
  position: fixed; inset: 0; z-index: 1500; background: rgba(12, 12, 20, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; animation: bb-fade .2s ease-out;
}
.bb-modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); color: var(--text); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 28px 24px 22px; text-align: center; animation: bb-modal-in .35s cubic-bezier(.2, 1.3, .4, 1);
}
.bb-modal .m-emoji { font-size: 60px; line-height: 1.1; margin-bottom: 8px; }
.bb-modal .m-title { font-size: 26px; font-weight: 900; margin: 0 0 8px; letter-spacing: -0.03em; }
.bb-modal .m-body { color: var(--text-2); font-size: 16px; margin-bottom: 20px; }
.bb-modal .m-body:empty { display: none; }
.bb-modal .m-body .result-list { text-align: left; margin-top: 8px; }
.bb-modal .m-actions { display: flex; flex-direction: column; gap: 8px; }
.bb-modal .m-actions-row { display: flex; gap: 8px; }
.bb-modal .m-actions-row .btn { flex: 1; }

/* 토스트 */
.bb-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 2000;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 700; font-size: 14.5px;
  box-shadow: var(--shadow-lg); animation: bb-toast-in .25s ease-out; max-width: calc(100vw - 32px); text-align: center;
}

/* 폭죽 캔버스 */
.bb-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1600; width: 100%; height: 100%; }

/* ---------- 애니메이션 ---------- */
@keyframes bb-pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes bb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bb-modal-in { 0% { transform: translateY(24px) scale(.92); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes bb-toast-in { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes bb-shake {
  0%, 100% { transform: translateX(0); } 15% { transform: translateX(-8px) rotate(-2deg); } 30% { transform: translateX(7px) rotate(2deg); }
  45% { transform: translateX(-6px) rotate(-1deg); } 60% { transform: translateX(5px) rotate(1deg); } 75% { transform: translateX(-3px); }
}
@keyframes bb-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bb-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes bb-spin { to { transform: rotate(360deg); } }
@keyframes bb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bb-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.anim-pop { animation: bb-pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.anim-shake { animation: bb-shake .5s ease-in-out; }
.anim-bounce { animation: bb-bounce .6s ease-in-out infinite; }
.anim-pulse { animation: bb-pulse 1s ease-in-out infinite; }
.anim-float { animation: bb-float 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 정적 페이지 ---------- */
.sitemap-cols { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.sitemap-cols h2 { font-size: 17px; }
.sitemap-cols ul { padding-left: 1.1em; margin: 0; }
.sitemap-cols li { margin: 4px 0; }
.not-found { text-align: center; padding: 72px 0 24px; }
.not-found .nf-emoji { font-size: 72px; }

@media print {
  .site-header, .site-footer, .game-toolbar, .ad-slot, .related-box { display: none !important; }
  body { background: #fff; }
}

/* ---------- 추가: 홈/가이드 보조 ---------- */
.hero-eyebrow {
  display: inline-block; margin: 0 0 14px; padding: 6px 14px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 14px; letter-spacing: -0.01em;
}
.guide-item h2, .guide-item h3 { font-size: 16px; margin: 0 0 4px; line-height: 1.4; }
.guide-title { font-size: clamp(26px, 5vw, 36px); font-weight: 900; margin: 8px 0 6px; line-height: 1.3; }
.guide-article { margin: 0 auto; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.chip-btn[aria-pressed="true"] { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.quick-tags a[aria-current="page"] { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.cat-pills.quick-tags { justify-content: flex-start; flex-wrap: nowrap; margin-top: 8px; }
.cat-pills.quick-tags a { white-space: nowrap; }
/* ---------- 홈 첫 화면: 배경 그림 + 순환 문구 ---------- */
.hero { position: relative; overflow: hidden; }
.hero-inner { position: relative; z-index: 1; }
.hero-art {
  position: absolute; z-index: 0; pointer-events: none; user-select: none; opacity: .62;
  -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
}
.hero-hands { display: inline-block; transform-origin: 50% 90%; animation: bb-cheer 1.8s ease-in-out infinite; }
@keyframes bb-cheer { 0%, 100% { transform: rotate(0) translateY(0); } 20% { transform: rotate(-10deg) translateY(-4px); } 40% { transform: rotate(8deg) translateY(-2px); } 60% { transform: rotate(0) translateY(0); } }
.hero-quote { min-height: 3.4em; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.hq-text { display: inline-block; transition: opacity .4s ease, transform .4s ease; }
.hq-text.is-out { opacity: 0; transform: translateY(10px); }
.hq-emoji { margin-right: 2px; }

/* 휴대폰·태블릿: 그림을 제목 위쪽에, 흐려지는 아랫부분만 글자 뒤로 */
@media (max-width: 899px) {
  .hero.has-art { padding-top: 150px; }
  .hero-art { top: 6px; left: 50%; transform: translateX(-50%); height: 200px; width: auto; max-width: none; }
}
/* 데스크톱: 글은 왼쪽, 그림은 오른쪽에 조금만 겹치게 */
@media (min-width: 900px) {
  .hero { text-align: left; padding: 64px 0 36px; }
  .hero-inner > * { max-width: 580px; }
  .hero .lead { margin-left: 0; margin-right: 0; }
  .hero-quote { justify-content: flex-start; }
  .hero .search-box { margin: 0; }
  .hero .quick-tags { justify-content: flex-start; }
  .hero-art {
    right: max(8px, calc((100% - var(--container)) / 2 + 8px)); bottom: 0;
    width: min(48%, 560px); height: auto;
  }
}

/* 그리드 안의 넓은 표가 페이지를 가로로 늘리지 않도록 */
.content-wrap > * { min-width: 0; }
.prose table { max-width: 100%; }
