:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --surface-2: #f2ebe2;
  --text: #2b1d14;
  --muted: #7a6656;
  --line: #e4d8cb;
  --brand: #8a4b2a;
  --brand-strong: #6e3519;
  --brand-ink: #ffffff;
  --accent: #e8a33d;
  --danger: #d2452f;
  --ok: #2f8f5b;
  --go: #1f9d55;
  --go-strong: #157a40;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(60, 30, 10, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1310;
    --surface: #241b16;
    --surface-2: #2f241d;
    --text: #f3e9df;
    --muted: #b09c8c;
    --line: #3d3027;
    --brand: #d98b5f;
    --brand-strong: #eaa47c;
    --brand-ink: #1a1310;
    --accent: #f0b65a;
    --danger: #ef6a52;
    --ok: #5cc28a;
    --go: #23a95c;
    --go-strong: #178244;
    --shadow: 0 2px 12px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  line-height: 1.6;
}
a { color: var(--brand); }
h1, h2, .logo, .game-tile strong, .result .who, .sp-who, .fl-big, .turn-banner, .clock, .distance-live b, .slot-name, .slot-title {
  font-family: "Jua", "Pretendard Variable", "Pretendard", sans-serif; font-weight: 400;
}
img, canvas { max-width: 100%; }

/* 게임 아이콘 패턴 벽지: 입력은 모두 통과, 선택·드래그·우클릭 대상 아님 */
.bg-pattern {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
  opacity: var(--bg-pattern-alpha, .12);
  animation: bg-drift 40s linear infinite;
}
@keyframes bg-drift { to { background-position: 264px 264px; } }
@media (prefers-reduced-motion: reduce) { .bg-pattern { animation: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg-pattern-alpha: .08; } }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo span { color: var(--brand); }
.nav { display: flex; gap: 4px; overflow-x: auto; }
.nav a { padding: 6px 10px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.nav a[aria-current="page"], .nav a:hover { background: var(--surface-2); color: var(--text); }

main { padding: 20px 0 40px; }
h1 { font-size: 1.6rem; line-height: 1.3; margin: 8px 0 6px; }
h2 { font-size: 1.2rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
.lead { color: var(--muted); margin: 0 0 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.stack > * + * { margin-top: 14px; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: var(--brand-ink);
  transition: transform .06s, background .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-strong); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* 참가자 입력 */
.people-input { display: flex; gap: 8px; }
.people-input input {
  flex: 1; min-width: 0;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; }
.people-input + .chips { margin-top: 12px; }
.chips + .hint { margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .95rem;
}
.chip button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 1rem; line-height: 1; padding: 4px 6px; cursor: pointer; border-radius: 999px;
}
.chip button:hover { color: var(--danger); }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.field-row label { font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; }

/* 홈 게임 목록 */
.game-list { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .game-list { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 700px) { .game-list.compact { grid-template-columns: repeat(5, 1fr); } }
.game-list.compact .game-tile { padding: 10px; text-align: center; }
.game-list.compact .game-tile p { display: none; }
.game-list.compact .game-tile .emoji { font-size: 1.5rem; }
.game-list.compact .game-tile strong { font-size: .9rem; }
.game-tile {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); transition: transform .1s, border-color .15s;
}
.game-tile:hover { transform: translateY(-2px); border-color: var(--brand); }
.game-tile .emoji { font-size: 2rem; }
.game-tile strong { display: block; font-size: 1.05rem; margin: 4px 0 2px; }
.game-tile p { margin: 0; color: var(--muted); font-size: .9rem; }

/* 게임 무대 */
.stage { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.stage canvas { display: block; margin: 0 auto; touch-action: manipulation; }

.result {
  display: none;
  text-align: center;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 2px dashed var(--accent);
}
.result.show { display: block; animation: pop .35s ease-out; }
.result .who { font-size: 1.8rem; font-weight: 800; color: var(--danger); margin: 4px 0; }
.result p { margin: 0; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 폭탄 카드 */
.turn-banner { text-align: center; font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; min-height: 1.8em; }
.turn-banner b { color: var(--brand); }
.cards { display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); }
@media (min-width: 560px) { .cards { grid-template-columns: repeat(6, 1fr); } }
.bcard {
  aspect-ratio: 3 / 4;
  border: 0; border-radius: 12px;
  font: inherit; font-size: 1.8rem; font-weight: 800;
  cursor: pointer;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  color: var(--brand-ink);
  box-shadow: var(--shadow);
  transition: transform .2s;
}
.bcard:hover:not(:disabled) { transform: translateY(-3px); }
.bcard:disabled { cursor: default; }
.bcard.safe { background: var(--surface-2); color: var(--ok); }
.bcard.safe small { display: block; font-size: .7rem; font-weight: 600; color: var(--muted); }
.bcard.boom { background: var(--danger); color: #fff; animation: shake .45s; }
.bcard.flip { animation: flip .3s ease-in-out; }
@keyframes flip { 50% { transform: rotateY(90deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px) rotate(-3deg); } 40%, 80% { transform: translateX(6px) rotate(3deg); } }

/* 차례제 기록판 */
.scoreboard { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.scoreboard li {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px; background: var(--surface-2);
}
.scoreboard .rank { font-weight: 800; color: var(--muted); }
.scoreboard .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scoreboard .score { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.scoreboard .rematch { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; }
.scoreboard li.now { outline: 2px solid var(--brand); }
.scoreboard li.loser { background: var(--danger); color: #fff; }
.scoreboard li.loser .rank, .scoreboard li.loser .rematch { color: #fff; }
.turn-banner small { color: var(--muted); font-weight: 600; }

/* 큰 액션 버튼 (잡기, 멈추기 등) */
.btn.big { font-size: 1.25rem; padding: 18px; }

/* 주사위 */
.dice-row { display: flex; justify-content: center; gap: 18px; padding: 18px 0; }
.die {
  width: 84px; height: 84px; border-radius: 16px; background: #fff; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12), var(--shadow);
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 12px; gap: 2px;
}
.die i { width: 14px; height: 14px; border-radius: 50%; background: #2b1d14; place-self: center; visibility: hidden; }
.die i.on { visibility: visible; }
.die.one i.on { background: var(--danger); width: 18px; height: 18px; }
.die.rolling { animation: roll .14s linear infinite; }
@keyframes roll { 0% { transform: rotate(0) } 50% { transform: rotate(12deg) translateY(-4px) } 100% { transform: rotate(0) } }

/* 업다운 */
.range-view { text-align: center; padding: 10px 0; }
.range-view .nums { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.range-view .nums span { color: var(--muted); font-size: 1.4rem; margin: 0 8px; }
.range-bar { height: 12px; border-radius: 999px; background: var(--surface-2); position: relative; overflow: hidden; margin: 6px 0 14px; }
.range-bar div { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; transition: left .4s, width .4s; }
.guess-row { display: flex; gap: 8px; }
.guess-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.4rem; font-weight: 700; text-align: center;
  padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--text);
}

/* 풍선 */
.balloon-box { height: 300px; display: flex; align-items: flex-end; justify-content: center; position: relative; overflow: hidden; }
.balloon {
  width: 60px; height: 72px; border-radius: 50% 50% 48% 48%;
  background: radial-gradient(circle at 32% 30%, #ff9a8a, #e4412d 60%, #b22a19);
  position: relative; margin-bottom: 40px; transition: width .18s, height .18s;
  transform-origin: 50% 100%;
}
.balloon::after { content: ''; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); border: 6px solid transparent; border-bottom-color: #b22a19; }
.balloon.wobble { animation: wobble .5s ease-in-out infinite; }
.balloon.pop { animation: popb .25s forwards; }
@keyframes wobble { 50% { transform: scaleX(1.04) scaleY(.97) rotate(1.5deg); } }
@keyframes popb { to { transform: scale(1.6); opacity: 0; } }
.boom-text { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 4rem; font-weight: 900; color: var(--danger); }
.boom-text.show { display: flex; animation: pop .3s ease-out; }
.pump-count { text-align: center; color: var(--muted); font-weight: 600; }

/* 새우튀김: 실시간 남은 거리 */
.distance-live {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  margin: 0 auto 8px; padding: 6px 16px; border-radius: 14px; width: fit-content;
  background: var(--surface-2); font-variant-numeric: tabular-nums;
}
.distance-live span { color: var(--muted); font-weight: 700; font-size: .95rem; }
.distance-live b { font-size: 2.6rem; font-weight: 900; line-height: 1.1; min-width: 4ch; text-align: right; }
.distance-live em { font-style: normal; font-weight: 800; color: var(--muted); }
.distance-live.safe b { color: var(--ok); }
.distance-live.warn b { color: var(--accent); }
.distance-live.danger b { color: var(--danger); }
.distance-live.final { animation: pop .35s ease-out; outline: 3px solid var(--accent); }
.distance-live.fail b { color: var(--danger); }
.distance-live.fail { outline: 3px solid var(--danger); }

/* 10초 */
.clock { text-align: center; font-size: 4rem; font-weight: 800; font-variant-numeric: tabular-nums; padding: 20px 0 6px; letter-spacing: -1px; }
.clock.hidden-time { color: var(--muted); }
.clock.dq { color: var(--danger); }

/* 결과 강조 연출 */
.spotlight {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 50% 45%, rgba(110, 53, 25, .93), rgba(20, 10, 5, .95) 70%);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .25s; cursor: pointer; overflow: hidden;
}
.spotlight.in { opacity: 1; }
.spotlight.out { opacity: 0; }
.sp-card { position: relative; text-align: center; color: #fff; max-width: 100%; }
.sp-emoji { font-size: 4.5rem; line-height: 1; }
.spotlight.in .sp-emoji { animation: sp-drop .55s cubic-bezier(.3, 1.6, .5, 1) both; }
.sp-title { margin: 12px 0 4px; font-weight: 700; opacity: .85; }
.sp-who {
  font-size: clamp(2.6rem, 13vw, 4.6rem); font-weight: 900; line-height: 1.15;
  color: #fff; word-break: keep-all; overflow-wrap: anywhere;
  text-shadow: 0 0 24px rgba(232, 163, 61, .9), 0 4px 0 #6e3519;
}
.spotlight.in .sp-who { animation: sp-zoom .6s .25s cubic-bezier(.2, 1.7, .4, 1) both; }
.sp-sub { margin: 10px 0 0; font-size: 1.1rem; font-weight: 800; color: #f0b65a; min-height: 1.4em; }
.spotlight.in .sp-sub { animation: pop .4s .7s both; }
.sp-hint { margin: 22px 0 0; font-size: .8rem; opacity: .6; }
.sp-rain span { position: absolute; top: -40px; animation-name: sp-fall; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes sp-drop { from { transform: translateY(-60px) scale(.4); opacity: 0; } }
@keyframes sp-zoom { from { transform: scale(3); opacity: 0; filter: blur(6px); } 60% { opacity: 1; filter: none; } }
@keyframes sp-fall { to { transform: translateY(110vh) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spotlight.in .sp-emoji, .spotlight.in .sp-who, .spotlight.in .sp-sub { animation: none; }
  .sp-rain { display: none; }
}

/* 시작·재대결·차례 알림 */
.flash {
  position: fixed; inset: 0; z-index: 19;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20, 10, 5, .88); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  opacity: 0; transition: opacity .22s; overflow: hidden;
}
.flash.start { background: radial-gradient(circle at 50% 45%, rgba(31, 122, 64, .94), rgba(8, 30, 16, .95) 70%); }
.flash.rematch { background: radial-gradient(circle at 50% 45%, rgba(150, 40, 25, .94), rgba(30, 8, 5, .95) 70%); }
.flash.turn { background: radial-gradient(circle at 50% 45%, rgba(36, 84, 160, .94), rgba(6, 16, 36, .95) 70%); }
.flash.in { opacity: 1; }
.fl-list { list-style: none; margin: 16px auto 0; padding: 0; width: min(300px, 86vw); display: grid; gap: 4px; text-align: left; }
.fl-list li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, .1); font-weight: 700; }
.fl-list li span { color: #ffd37a; }
.fl-list li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-list li em { font-style: normal; font-variant-numeric: tabular-nums; }
.fl-list li.me { background: #ffd37a; color: #2b1d14; }
.fl-list li.me span { color: #2b1d14; }
.flash.in .fl-list { animation: pop .35s .6s both; }
.flash.out { opacity: 0; }
.fl-card { text-align: center; color: #fff; max-width: 100%; }
.fl-emoji { font-size: 4rem; line-height: 1; }
.fl-title { margin: 10px 0 0; font-weight: 800; font-size: 1.15rem; opacity: .9; }
.fl-big {
  font-size: clamp(2.4rem, 12vw, 4.4rem); font-weight: 900; line-height: 1.15; letter-spacing: -1px;
  text-shadow: 0 0 22px rgba(255, 255, 255, .45); word-break: keep-all; overflow-wrap: anywhere;
}
.fl-sub { margin: 8px 0 0; font-weight: 800; font-size: 1.05rem; color: #ffd37a; min-height: 1.3em; }
.flash.in .fl-emoji { animation: sp-drop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.flash.in .fl-big { animation: fl-slam .5s .12s cubic-bezier(.2, 1.6, .4, 1) both; }
.flash.in .fl-sub { animation: pop .35s .45s both; }
.flash.rematch.in .fl-big { animation: fl-slam .5s .12s cubic-bezier(.2, 1.6, .4, 1) both, shake .45s .6s; }
@keyframes fl-slam { from { transform: scale(2.6); opacity: 0; filter: blur(5px); } 60% { opacity: 1; filter: none; } }
@media (prefers-reduced-motion: reduce) { .flash.in .fl-emoji, .flash.in .fl-big, .flash.in .fl-sub { animation: none; } }

/* 시작 버튼은 눈에 띄게 초록색 */
.btn#start, .btn#spin { background: var(--go); color: #fff; box-shadow: 0 3px 0 var(--go-strong); }
.btn#start:hover:not(:disabled), .btn#spin:hover:not(:disabled) { background: var(--go-strong); }

/* 폭탄 카드 줌인 */
.bzoom {
  position: fixed; inset: 0; z-index: 18; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 10, 5, 0); transition: background .3s; perspective: 900px;
}
.bzoom.in { background: rgba(20, 10, 5, .82); }
.bzoom .bcard { width: min(52vw, 220px); font-size: 4rem; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: none; }
.bzoom .bcard small { font-size: 1rem; }
.bzoom-cap { position: absolute; left: 0; right: 0; bottom: 14%; text-align: center; color: #fff; font-weight: 800; font-size: 1.2rem; }

/* 다트 남은 개수 */
.dart-left { text-align: center; font-weight: 700; color: var(--muted); min-height: 1.6em; margin: -4px 0 6px; }
.dart-left b { color: var(--text); font-variant-numeric: tabular-nums; }

/* 다른 게임 */
.more-games { margin-top: 28px; }

/* 광고 */
.ad-slot { margin: 22px 0; min-height: 0; text-align: center; }
.ad-slot.dev {
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: .8rem;
}

/* 본문 */
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.2em; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
details summary { cursor: pointer; font-weight: 600; }

.site-footer { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: .85rem; }
.site-footer a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: .25s; font-size: .9rem; z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 링크로 쓰는 버튼 */
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.result a.btn.ghost { background: var(--surface); border: 2px solid var(--line); color: var(--text); }
.result a.btn.ghost:hover { border-color: var(--brand); }

/* 빠른 시작 타일 */
.game-tile.quick {
  font: inherit; text-align: left; cursor: pointer; width: 100%;
  background: linear-gradient(135deg, var(--go), var(--go-strong)); border-color: transparent; color: #fff;
}
.game-tile.quick p { color: rgba(255, 255, 255, .85); }
.game-tile.quick:hover { border-color: transparent; filter: brightness(1.06); }

/* 빠른 시작 룰렛 */
.slot {
  position: fixed; inset: 0; z-index: 21; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; color: #fff; text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(31, 122, 64, .95), rgba(8, 30, 16, .97) 70%);
  opacity: 0; transition: opacity .2s; user-select: none; -webkit-user-select: none;
}
.slot.in { opacity: 1; }
.slot-title { font-size: 1.3rem; margin: 0 0 18px; opacity: .9; }
.slot-card {
  width: min(78vw, 300px); padding: 26px 16px 22px; border-radius: 22px;
  background: rgba(255, 255, 255, .12); border: 3px solid rgba(255, 255, 255, .25);
}
.slot-card.tick { animation: slot-tick .09s ease-out; }
.slot-card.win { background: #fff; color: #2b1d14; border-color: #ffd37a; box-shadow: 0 0 0 6px rgba(255, 211, 122, .35), 0 0 60px rgba(255, 211, 122, .7); animation: slot-win .6s cubic-bezier(.2, 1.7, .4, 1); }
.slot-emoji { font-size: 5rem; line-height: 1.1; }
.slot-name { font-size: 2.2rem; margin-top: 6px; }
.slot-sub { margin: 18px 0 0; font-weight: 800; color: #ffd37a; min-height: 1.4em; }
@keyframes slot-tick { from { transform: translateY(-26px); filter: blur(3px); opacity: .5; } }
@keyframes slot-win { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .slot-card.tick, .slot-card.win { animation: none; } }

/* 커피 브랜드 고르기 버튼 */
.brand-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; margin: 26px 0 0; padding: 14px 16px;
  border: 0; border-radius: var(--radius); cursor: pointer; text-align: left; font: inherit;
  background: linear-gradient(135deg, #8a4b2a, #5b2c14); color: #fff; box-shadow: var(--shadow);
  transition: transform .1s, filter .15s;
}
.brand-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.brand-btn .emoji { font-size: 2rem; }
.brand-btn strong { display: block; font-family: "Jua", "Pretendard Variable", sans-serif; font-weight: 400; font-size: 1.15rem; }
.brand-btn small { display: block; opacity: .85; font-size: .88rem; }
.brand-btn .arrow { margin-left: auto; font-size: 1.8rem; opacity: .8; }

/* 팝업 */
.modal {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20, 10, 5, .6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fade-in .18s;
}
.modal-box {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); color: var(--text); border-radius: 18px; padding: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
  animation: pop .25s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h2 { margin: 0; }
.modal-x { border: 0; background: var(--surface-2); color: var(--text); width: 36px; height: 36px; border-radius: 999px; font-size: 1.3rem; cursor: pointer; }
.modal .hint { margin: 6px 0 10px; }
.brand-tools .btn { padding: 8px 12px; font-size: .9rem; flex: 0 0 auto; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin: 12px 0 14px; }
.brand-chip {
  font: inherit; font-weight: 700; font-size: .92rem; padding: 10px 8px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--line); background: var(--bg); color: var(--muted); transition: .12s;
}
.brand-chip.on { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.brand-chip.on::before { content: '✓ '; }
@keyframes fade-in { from { opacity: 0; } }
/* 팝업은 제목·버튼을 고정하고 브랜드 목록만 스크롤 */
.modal-box { display: flex; flex-direction: column; overflow: hidden; }
.modal-box .brand-grid { overflow-y: auto; min-height: 0; flex: 1 1 auto; padding: 2px; }
#brand-go { background: var(--go); color: #fff; flex: 0 0 auto; }
#brand-go:hover:not(:disabled) { background: var(--go-strong); }
.die { transition: opacity .2s; }
.die.idle { opacity: .3; }
.dice-sum { text-align: center; font-weight: 800; font-size: 1.3rem; min-height: 1.6em; color: var(--muted); font-variant-numeric: tabular-nums; }
.dice-sum b { color: var(--text); font-size: 1.6rem; }
/* 버튼에 오늘 당첨 브랜드 표시 */
.brand-win {
  margin-left: auto; flex: 0 0 auto; max-width: 42%; text-align: center;
  padding: 6px 12px; border-radius: 12px; background: #ffd37a; color: #2b1d14;
}
.brand-win small { display: block; font-size: .7rem; font-weight: 700; opacity: .75; }
.brand-win b { display: block; font-family: "Jua", "Pretendard Variable", sans-serif; font-weight: 400; font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.brand-win.new { animation: slot-win .6s cubic-bezier(.2, 1.7, .4, 1); }
.brand-win:not([hidden]) + .arrow { margin-left: 4px; }
.brand-btn > span:nth-child(2) { min-width: 0; }
.brand-btn strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-btn .emoji { flex: 0 0 auto; }
@media (max-width: 380px) { .brand-btn .emoji { display: none; } }
/* 내 주변 2km 찾기 */
.near { margin: 10px 0 4px; padding: 12px; border-radius: 14px; background: var(--surface-2); display: grid; gap: 8px; }
.near-row { display: flex; gap: 6px; }
.near-row input {
  flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.near .btn { padding: 10px 14px; }
.near .hint { margin: 0; }
.hint.error { color: var(--danger); }
.brand-chip small { display: block; font-size: .72rem; font-weight: 600; opacity: .8; }
.brand-chip.far { opacity: .55; }
.brand-win .store { margin-top: 2px; font-size: .66rem; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-btn small#brand-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 현재 위치 버튼: 회색 상자 안에서도 버튼으로 보이게 */
.near .near-gps {
  background: var(--surface); color: var(--brand); border: 2px solid var(--brand);
  box-shadow: 0 2px 0 var(--line);
}
.near .near-gps:hover:not(:disabled) { background: var(--brand); color: var(--brand-ink); }

/* 업다운 말하기 기록 */
.log-head, .updown-log li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 52px 78px 76px; align-items: center; gap: 6px;
}
.log-head { margin: 14px 0 4px; padding: 0 10px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.log-head span:nth-child(n+3), .updown-log li span:nth-child(n+3) { text-align: center; }
.updown-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 300px; overflow-y: auto; }
.updown-log li { padding: 7px 10px; border-radius: 10px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.updown-log .no { font-weight: 800; color: var(--muted); }
.updown-log .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.updown-log .num { font-weight: 900; font-size: 1.15rem; }
.updown-log .res { font-weight: 800; font-size: .85rem; }
.updown-log .up .res { color: var(--ok); }
.updown-log .down .res { color: #2e86ab; }
.updown-log .range { font-size: .85rem; color: var(--muted); font-weight: 700; }
.updown-log li.latest { outline: 2px solid var(--accent); background: var(--surface); animation: pop .3s ease-out; }
.updown-log li.boom, .updown-log li.forced { background: var(--danger); color: #fff; outline: none; }
.updown-log li.boom .no, .updown-log li.forced .no, .updown-log li.boom .res, .updown-log li.forced .res, .updown-log li.boom .range, .updown-log li.forced .range { color: #fff; }
.updown-log { padding: 2px; }

/* 개발자 커피 사주기 */
.support-btn {
  margin-left: auto; border: 2px solid var(--accent); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 800; font-size: .9rem; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  white-space: nowrap; transition: background .15s, transform .1s;
}
.support-btn:hover { background: var(--accent); color: #2b1d14; transform: translateY(-1px); }
.support-btn[hidden] { display: none; }
@media (max-width: 380px) { .support-btn span { display: none; } }
.support-box p { margin: 10px 0 0; }
.support-links { display: grid; gap: 8px; margin-top: 16px; }
.support-link.toss { background: #0064ff; color: #fff; }
.support-link.kakao { background: #fee500; color: #191919; }
.support-link.bmc { background: #ffdd00; color: #0d0c22; }
.support-link:hover { filter: brightness(1.05); }
.support-qr { margin: 16px auto 0; text-align: center; }
.support-qr img { display: block; margin: 0 auto; width: 200px; height: 200px; border-radius: 14px; border: 1px solid var(--line); background: #fff; padding: 6px; }
.support-qr figcaption { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.support-link { font-size: .95rem; white-space: normal; }
.toast { z-index: 25; }

/* 의견·버그 제보 */
.feedback-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--brand); font-weight: 700; cursor: pointer; text-decoration: underline; }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.fb-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kinds span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--bg); font-weight: 700; font-size: .9rem; cursor: pointer; }
.fb-kinds input:checked + span { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.fb-kinds input:focus-visible + span { outline: 2px solid var(--accent); }
.feedback-box textarea {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 12px; resize: vertical;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); margin-bottom: 10px;
}
.feedback-box [data-send] { background: var(--go); color: #fff; }
.fb-addr { margin: 12px 0 0; font-size: .85rem; color: var(--muted); }
.fb-addr b { color: var(--text); }
.fb-addr .btn { padding: 4px 10px; font-size: .8rem; margin-left: 4px; }

/* 404 */
.notfound { text-align: center; padding: 24px 0 8px; }
.notfound .nf-emoji { font-size: 4rem; }
.notfound .lead { margin: 6px 0 16px; }
