:root {
  --bg: #000;
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --dim: #6b7280;
  --pill: #1c2027;
  --pill-hover: #272c35;
  --panel: #0e131b;
  --panel-line: #1f2733;
  --accent: #f6b13d;
  --accent-2: #ff8a3d;
  --font: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: #000;
}

/* ── 배경(술집 분위기 보케) ─────────────────────────── */
#bg { position: absolute; inset: 0; z-index: 0; transition: opacity .9s ease; }
#bg .glow { position: absolute; inset: 0; }
#bg .bokeh {
  position: absolute;
  border-radius: 50%;
  filter: blur(var(--blur, 22px));
  opacity: var(--o, .3);
  animation: drift var(--d, 26s) ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes drift {
  to { transform: translate(var(--dx, 20px), var(--dy, -14px)) scale(1.08); }
}

#scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; display: block; }

#blush {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0;
  background:
    radial-gradient(ellipse 30% 22% at 18% 62%, rgba(255, 80, 110, .30), transparent 70%),
    radial-gradient(ellipse 30% 22% at 82% 62%, rgba(255, 80, 110, .30), transparent 70%),
    radial-gradient(ellipse at center, transparent 50%, rgba(255, 60, 90, .28) 100%);
  transition: opacity 1.5s ease;
}

/* ── 거품처럼 떠오르는 채팅 ─────────────────────────── */
#bubbles { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.bubble-msg {
  position: absolute;
  left: 0; top: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
  color: #eef0f3;
  white-space: pre-line;
  max-width: 15em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-shadow: 0 0 4px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .6);
  animation: bubbleRise var(--dur, 7s) cubic-bezier(.2, .6, .35, 1) forwards;
  will-change: transform, opacity;
}
.bubble-msg .in { display: block; animation: sway var(--sw, 2.6s) ease-in-out infinite alternate; }
.bubble-msg .nick { display: block; font-size: 11px; opacity: .9; margin-bottom: 1px; }
.bubble-msg.me { color: #ffe2a8; }
.bubble-msg.shout { font-size: 22px; font-weight: 800; color: #ffd36b; letter-spacing: .02em; --dur: 2.4s; }
.bubble-msg.shout.big { font-size: 28px; }
@keyframes bubbleRise {
  0% { opacity: 0; transform: translate(-50%, -100%) translateY(14px) scale(.8); }
  10% { opacity: .96; }
  70% { opacity: .8; }
  100% { opacity: 0; transform: translate(-50%, -100%) translate(var(--dx, 0px), var(--rise, -340px)) scale(1.04); }
}
@keyframes sway { from { transform: translateX(-4px); } to { transform: translateX(4px); } }

/* ── 상단 ─────────────────────────────────────────── */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) 10px 0;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top-left, .top-right { display: flex; align-items: center; gap: 2px; }
.top-right[hidden] { display: none; }
.icon-btn {
  appearance: none; border: 0; background: transparent; color: #cfd3da;
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 9px; cursor: pointer; padding: 0;
}
.icon-btn:hover { background: rgba(255, 255, 255, .07); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn svg { width: 19px; height: 19px; }
#timer { font-size: 12px; color: #cbd2dc; font-variant-numeric: tabular-nums; margin-right: 2px; }

.menu {
  position: absolute; z-index: 30;
  top: calc(50px + env(safe-area-inset-top)); left: 10px;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 11px;
  padding: 5px; min-width: 176px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .65);
}
.menu[hidden] { display: none; }
.menu button {
  display: flex; gap: 10px; align-items: center; width: 100%;
  padding: 8px 10px; border: 0; background: transparent; color: #e5e7eb;
  font: inherit; font-size: 13px; border-radius: 7px; cursor: pointer; text-align: left;
}
.menu button:hover { background: rgba(255, 255, 255, .06); }
.menu svg { width: 15px; height: 15px; color: #8b93a1; flex: none; }

/* ── 힌트 · 캡션 ─────────────────────────────────── */
.hint {
  position: absolute; left: 0; right: 0; top: 24%; z-index: 4;
  margin: 0; padding: 0 20px;
  text-align: center; color: #a5a5a5; font-size: 13px; letter-spacing: .01em;
  pointer-events: none; transition: opacity .45s ease;
}
.hint.fade { opacity: 0; }
.caption {
  position: absolute; left: 0; right: 0; top: 70%; z-index: 4;
  text-align: center; pointer-events: none;
  font-size: 12px; color: #8d929b; letter-spacing: .03em;
  transition: opacity .3s;
}
.caption .dots { display: flex; justify-content: center; gap: 6px; margin-top: 7px; }
.caption .dots i { width: 5px; height: 5px; border-radius: 50%; background: #3a3f48; transition: background .3s, transform .3s; }
.caption .dots i.on { background: #c9ccd2; transform: scale(1.15); }
.caption b { color: #c3c7ce; font-weight: 600; }

/* 잔 양옆의 술 바꾸기 버튼 — 위치는 app.js가 잔 크기에 맞춰 잡는다 */
.nav-btn {
  position: absolute; z-index: 5; left: 0; top: 0;
  width: 44px; height: 44px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(28, 32, 39, .55); color: #c9ced6;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background .2s, color .2s, opacity .3s, scale .15s;
}
.nav-btn:hover { background: rgba(44, 50, 60, .85); color: #fff; }
.nav-btn:active { scale: .9; }
.nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-btn svg { width: 20px; height: 20px; }

/* ── 하단 ─────────────────────────────────────────── */
.bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.toolbar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-wrap: wrap; padding: 0 16px;
}
.pill {
  appearance: none; border: 0; background: var(--pill); color: #d1d5db;
  font: inherit; font-size: 12px; line-height: 1;
  padding: 8px 11px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.pill:hover { background: var(--pill-hover); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pill.on { color: var(--accent); }
.pill .chev { font-size: 10px; opacity: .7; margin-left: 2px; }

#size {
  -webkit-appearance: none; appearance: none;
  width: 76px; height: 5px; border-radius: 4px; cursor: pointer; margin: 0 4px;
  background: linear-gradient(to right, #4b5563 var(--p, 75%), #23272e var(--p, 75%));
  outline: none;
}
#size::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%; background: #c7cbd1; border: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
#size::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #c7cbd1; border: 0; }

.dropdown { position: relative; }
.room-list {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  list-style: none; margin: 0; padding: 5px; min-width: 168px;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 11px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .65); z-index: 30;
}
.room-list[hidden] { display: none; }
.room-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: #e5e7eb; white-space: nowrap;
}
.room-list li:hover, .room-list li:focus-visible { background: rgba(255, 255, 255, .06); outline: none; }
.room-list li.cur { color: var(--accent); font-weight: 700; }
.room-list li .chk { width: 12px; font-size: 11px; }

.status {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 4px 6px; padding: 0 16px;
  font-size: 11px; color: #8d939c; letter-spacing: .02em;
}
.status .num { font-variant-numeric: tabular-nums; }
.status .dot { opacity: .6; }
.bac { padding: 2px 7px; border-radius: 99px; background: rgba(255, 255, 255, .05); transition: color .6s, background .6s; }
.bac.lv1 { color: #ffd59a; }
.bac.lv2 { color: #ffb36b; background: rgba(255, 140, 60, .10); }
.bac.lv3 { color: #ff8a8a; background: rgba(255, 80, 80, .12); }
.bac.lv4 { color: #ff6b9a; background: rgba(255, 60, 120, .16); }

.ticker {
  position: relative; width: 100%; height: 32px;
  background: #171717; border-top: 1px solid #242424;
  display: flex; align-items: center; overflow: hidden;
  box-sizing: content-box; padding-bottom: env(safe-area-inset-bottom);
}
.ticker[hidden] { display: none; }
.ticker-track {
  display: flex; gap: 90px; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: #f1f1f1;
  animation: marquee 34s linear infinite;
  will-change: transform;
}
.ticker-track b { color: var(--accent-2); font-weight: 700; margin-right: 4px; }
@keyframes marquee { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }
#ticker-close {
  position: absolute; right: 8px; top: 16px; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0;
  background: #3a3a3a; color: #ddd; font-size: 13px; line-height: 20px; cursor: pointer;
  box-shadow: -14px 0 12px 4px #171717;
}

/* ── 채팅 ─────────────────────────────────────────── */
.chat {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  width: min(460px, calc(100% - 32px));
  background: rgba(16, 19, 24, .94);
  border: 1px solid #262c35; border-radius: 13px;
  padding: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}
.chat[hidden] { display: none; }
.chat input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: #f3f4f6; font: inherit; font-size: 16px; padding: 7px 4px;
  user-select: text; -webkit-user-select: text;
}
.chat input::placeholder { color: #6b7280; }
.chat input:disabled::placeholder { color: #f87171; }
.chat-icon {
  flex: none; width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: transparent; color: #cfd3da; font-size: 17px; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.chat-icon:hover { background: rgba(255, 255, 255, .06); }
.chat-icon.send { background: var(--accent); color: #2a1a00; }
.chat-icon.send:hover { background: #ffc35c; }
.chat-icon svg { width: 18px; height: 18px; }
.quick {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
}
.quick[hidden] { display: none; }
.quick button {
  appearance: none; border: 1px solid #2a303a; background: rgba(20, 24, 30, .95);
  color: #e5e7eb; font: inherit; font-size: 13px; padding: 7px 11px; border-radius: 99px; cursor: pointer;
}
.quick button:hover { border-color: #3d4552; }
.quick button.special { color: var(--accent); border-color: rgba(246, 177, 61, .4); }

/* ── 토스트 ───────────────────────────────────────── */
.toast {
  position: absolute; z-index: 40; left: 50%; top: calc(58px + env(safe-area-inset-top));
  transform: translate(-50%, -8px);
  max-width: calc(100% - 32px); width: max-content;
  padding: 9px 15px; border-radius: 11px;
  background: rgba(22, 26, 33, .96); border: 1px solid #2c333e; color: #f3f4f6;
  font-size: 13px; text-align: center; line-height: 1.45;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 모달 ─────────────────────────────────────────── */
.modal {
  position: absolute; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .62);
  animation: fadeIn .18s ease;
}
.modal[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.card {
  position: relative; width: min(380px, 100%); max-height: calc(100% - 24px); overflow: auto;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 16px;
  padding: 22px 20px 20px; color: #e5e7eb;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
  user-select: text; -webkit-user-select: text;
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.card h2 { margin: 0 0 12px; font-size: 17px; font-weight: 700; }
.card h3 { margin: 16px 0 6px; font-size: 14px; color: #f3f4f6; }
.card .close {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 8px;
  border: 0; background: transparent; color: #9ca3af; font-size: 20px; cursor: pointer;
}
.card .close:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.cta {
  width: 100%; margin-top: 12px; padding: 12px; border-radius: 11px; border: 0;
  background: var(--accent); color: #2a1a00; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.cta:hover { background: #ffc35c; }
.soup-card { text-align: center; }
.soup-emoji { font-size: 46px; margin-bottom: 4px; }
.soup-card h2 { margin-bottom: 2px; }
.soup-card .lead { margin: 0 0 6px; color: #d1d5db; font-size: 15px; }
.soup-card .note { margin: 12px 0 0; font-size: 12px; color: #9ca3af; line-height: 1.6; }
.soup-card .note span { color: #6b7280; }

.field { display: block; font-size: 12px; color: #9ca3af; margin: 0 0 12px; border: 0; padding: 0; }
.field legend { padding: 0; margin-bottom: 6px; }
.field input[type=text], .field textarea {
  display: block; width: 100%; margin-top: 6px;
  background: #151b24; border: 1px solid #263040; border-radius: 9px;
  color: #f3f4f6; font: inherit; font-size: 14px; padding: 9px 10px; resize: none;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.reasons label {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: #e5e7eb;
  background: #151b24; border: 1px solid #263040; border-radius: 9px; padding: 8px 10px; cursor: pointer;
}
.reasons input { accent-color: var(--accent); margin: 0; }

.prose p, .prose li { font-size: 13.5px; line-height: 1.65; color: #d1d5db; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0; padding-left: 18px; }
.prose li { margin-bottom: 3px; }
.prose b { color: #fff; }
.prose .warn { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 138, 61, .08); color: #ffb98a; font-size: 12.5px; }
.kbd-line { font-size: 12.5px !important; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; margin: 0 1px;
  border-radius: 5px; border: 1px solid #333b47; border-bottom-width: 2px;
  background: #151b24; font: inherit; font-size: 11px; text-align: center; color: #e5e7eb;
}
.notes { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13.5px; }
.notes dt { color: var(--accent); font-weight: 700; }
.notes dd { margin: 0; color: #d1d5db; line-height: 1.55; }

.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;
}

@media (max-width: 420px) {
  .toolbar { gap: 6px; }
  .pill { padding: 8px 9px; }
  #size { width: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble-msg .in, #bg .bokeh { animation: none; }
}
