:root {
  --ink: #181714;
  --muted: #777268;
  --paper: #f8f5ed;
  --card: #fffdf7;
  --line: #ded8ca;
  --orange: #ff4f33;
  --orange-dark: #d93721;
  --yellow: #ffd65a;
  --mint: #85d8ba;
  --blue: #4767d7;
  --shadow: 0 12px 34px rgba(54, 40, 21, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 214, 90, .35), transparent 25rem),
    radial-gradient(circle at 88% 78%, rgba(133, 216, 186, .20), transparent 28rem),
    var(--paper);
  font-family: "Gowun Dodum", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button { color: inherit; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .18; z-index: -1; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; max-width: 1160px; margin: auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: "Jua", sans-serif; font-size: 20px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: #fff9e8; border: 2px solid var(--ink); border-radius: 50%; transform: rotate(-4deg); box-shadow: 3px 3px 0 var(--ink); font-size: 23px; line-height: 1; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.prototype-pill { font-size: 11px; font-weight: 800; letter-spacing: .12em; padding: 6px 10px; background: var(--yellow); border: 1.5px solid var(--ink); border-radius: 99px; }
.icon-btn { width: 36px; height: 36px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--card); cursor: pointer; }
.app-shell { min-height: calc(100vh - 72px); padding: 42px 24px 80px; }
.screen { width: min(100%, 1060px); margin: 0 auto; animation: enter .35s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
.eyebrow { margin: 0 0 10px; color: var(--orange-dark); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, .display { font-family: "Jua", sans-serif; font-weight: 400; }
h1 { max-width: 720px; margin: 0; font-size: clamp(40px, 7vw, 74px); line-height: .98; letter-spacing: -.03em; }
h2 { margin: 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; }
h3 { margin: 0; font-size: 22px; }
.subcopy { max-width: 630px; margin: 20px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.hero { display: grid; grid-template-columns: 1.18fr .82fr; gap: 52px; align-items: center; padding-top: 30px; }
.hero-art { position: relative; min-height: 450px; display: grid; place-items: center; }
.plate { position: relative; width: 340px; height: 340px; border: 3px solid var(--ink); border-radius: 50%; background: var(--card); box-shadow: 12px 14px 0 var(--yellow), var(--shadow); }
.plate::after { content: "?"; position: absolute; inset: 40px; display: grid; place-items: center; border: 3px dashed var(--line); border-radius: 50%; color: var(--orange); font-family: "Jua"; font-size: 150px; transform: rotate(7deg); }
.sticker { position: absolute; padding: 12px 16px; border: 2px solid var(--ink); border-radius: 14px; background: white; font-family: "Jua"; box-shadow: 5px 6px 0 var(--ink); }
.sticker.one { top: 40px; right: 6px; transform: rotate(8deg); background: var(--mint); }
.sticker.two { bottom: 48px; left: 0; transform: rotate(-8deg); background: var(--orange); color: white; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn { min-height: 48px; padding: 0 20px; border: 2px solid var(--ink); border-radius: 12px; background: var(--card); font-weight: 800; cursor: pointer; box-shadow: 3px 4px 0 var(--ink); transition: .14s ease; }
.btn:hover { transform: translate(-1px,-1px); box-shadow: 5px 6px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { color: white; background: var(--orange); }
.btn.dark { color: white; background: var(--ink); }
.btn.ghost { box-shadow: none; border-color: var(--line); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.btn:disabled { cursor: not-allowed; filter: grayscale(.5); opacity: .45; transform: none; box-shadow: none; }
.stepper { display: flex; justify-content: center; gap: 8px; margin-bottom: 30px; }
.stepper span { width: 34px; height: 6px; border-radius: 99px; background: var(--line); }
.stepper span.done { background: var(--ink); }
.stepper span.active { width: 58px; background: var(--orange); }
.panel { background: rgba(255,253,247,.92); border: 2px solid var(--ink); border-radius: 20px; box-shadow: 7px 8px 0 var(--ink); padding: clamp(22px, 4vw, 38px); }
.panel.soft { border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.narrow { max-width: 700px; }
.center { margin-left: auto; margin-right: auto; text-align: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 28px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 800; }
.field input, .field select { width: 100%; height: 50px; padding: 0 14px; color: var(--ink); background: white; border: 1.5px solid var(--line); border-radius: 10px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,79,51,.12); }
.hint { color: var(--muted); font-size: 12px; }
.rule-note { grid-column: 1/-1; display: flex; gap: 10px; padding: 13px 15px; background: #fff2ca; border-radius: 10px; text-align: left; font-size: 13px; line-height: 1.5; }
.room-grid { display: grid; grid-template-columns: .72fr 1.28fr; gap: 26px; align-items: stretch; }
.room-grid > *, .round-head > *, .section-head > *, .split-actions > * { min-width: 0; }
.qr-card { text-align: center; }
.qr-frame { width: 210px; height: 210px; padding: 12px; margin: 22px auto 14px; display: grid; place-items: center; background: white; border: 2px solid var(--ink); border-radius: 16px; }
.qr-frame img, .qr-frame canvas { max-width: 100%; height: auto; }
.room-code { display: inline-block; margin: 4px 0 12px; font-family: "Jua"; font-size: 29px; letter-spacing: .1em; }
.copy-link { width: 100%; min-width: 0; padding: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; text-align: left; }
.members { display: grid; gap: 10px; }
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--yellow); font-family: "Jua"; }
.member:nth-child(3n+2) .avatar { background: var(--mint); }
.member:nth-child(3n) .avatar { background: #b6c3ff; }
.member-info { flex: 1; text-align: left; }
.member-name { display: block; font-weight: 800; }
.member-status { color: var(--muted); font-size: 12px; }
.badge { padding: 5px 8px; border-radius: 99px; background: var(--paper); color: var(--muted); font-size: 11px; font-weight: 800; }
.badge.ready { background: #d9f6e9; color: #25795b; }
.room-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 22px; }
.room-rules { display: flex; gap: 8px; flex-wrap: wrap; }
.rule-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; background: var(--paper); }
.round-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.role-switch { min-width: 180px; }
.role-switch label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.role-switch select { width: 100%; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.progress-wrap { margin-bottom: 22px; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.progress { height: 9px; overflow: hidden; background: var(--line); border-radius: 99px; }
.progress i { display: block; height: 100%; background: var(--orange); border-radius: inherit; transition: width .35s ease; }
.input-stack { display: grid; gap: 12px; margin: 22px 0; }
.menu-input-row { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 8px; align-items: center; min-width: 0; }
.menu-input-row b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); }
.menu-input-row input { width: 100%; min-width: 0; max-width: 100%; height: 44px; padding: 0 10px; font-size: 16px; border: 1.5px solid var(--line); border-radius: 10px; }
.menu-input-row.needs-reselect input { border-color: var(--orange); background: #fff0ed; }
.ban-history { margin-top: 16px; padding: 14px; background: #fff2ca; border-radius: 12px; text-align: left; font-size: 14px; overflow-wrap: anywhere; }
.ban-history p { margin: 8px 0 0; }
.score-input { width: 110px; max-width: 100%; min-width: 0; min-height: 46px; padding: 8px; border: 1.5px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font-size: 16px; text-align: center; }
.score-input:focus { outline: 2px solid var(--orange); outline-offset: 2px; }
.score-input[aria-invalid="true"] { border-color: var(--orange-dark); }
.status-board { display: grid; grid-template-columns: repeat(auto-fit,minmax(135px,1fr)); gap: 10px; margin: 22px 0; }
.status-person { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; text-align: center; }
.status-person strong { display: block; margin-top: 6px; }
.status-person small { color: var(--muted); }
.status-person.sent { border-color: var(--mint); background: #f1fcf7; }
.secret { margin: 24px 0; padding: 25px; color: var(--muted); background: repeating-linear-gradient(135deg,#f2eee5,#f2eee5 12px,#f8f5ed 12px,#f8f5ed 24px); border: 1.5px dashed #aaa398; border-radius: 14px; text-align: center; }
.menu-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 24px 0; }
.menu-card { position: relative; min-height: 124px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; text-align: left; background: white; border: 2px solid var(--ink); border-radius: 15px; cursor: pointer; transition: .15s ease; }
.menu-card:hover { transform: translateY(-2px); }
.menu-card.selected { background: #ffe0da; box-shadow: 4px 5px 0 var(--orange); }
.menu-card.banned { opacity: .36; text-decoration: line-through; transform: rotate(-2deg); }
.menu-card .restaurant { font-family: "Jua"; font-size: 21px; }
.menu-card .meta { color: var(--muted); font-size: 12px; }
.duplicate-box { padding: 18px; margin: 20px 0; border: 2px solid var(--orange); border-radius: 14px; background: #fff0ed; text-align: left; }
.duplicate-box strong { color: var(--orange-dark); }
.host-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.host-note::before { content: "♛"; color: var(--orange); font-size: 15px; }
.roulette-stage { position: relative; margin: 26px 0; padding: 30px 18px; overflow: hidden; background: var(--ink); border-radius: 18px; color: white; }
.roulette-window { min-height: 96px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.22); border-radius: 14px; background: rgba(255,255,255,.08); }
.roulette-name { font-family: "Jua"; font-size: clamp(42px, 12vw, 72px); color: var(--yellow); }
.roulette-stage.spinning .roulette-name { animation: roulette .14s linear infinite alternate; }
@keyframes roulette { from { transform: translateY(-7px) scale(.96); opacity: .55; } to { transform: translateY(7px) scale(1.04); opacity: 1; } }
.turn-order { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.turn-chip { padding: 7px 10px; color: var(--muted); background: white; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; }
.turn-chip.current { color: white; background: var(--orange); border-color: var(--orange); }
.turn-chip.done { color: #25795b; background: #d9f6e9; border-color: #b8e7d3; }
.turn-banner { margin: 16px 0 22px; padding: 14px; background: #fff2ca; border-radius: 12px; font-weight: 800; }
.split-actions { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 22px; }
.score-table { display: grid; gap: 12px; margin: 24px 0; }
.score-row { display: grid; grid-template-columns: 1fr 135px; align-items: center; gap: 16px; padding: 14px 16px; background: white; border: 1px solid var(--line); border-radius: 12px; text-align: left; }
.score-control { display: grid; grid-template-columns: 58px 56px 58px; align-items: center; justify-content: end; }
.score-control button { width: 58px; height: 38px; border: 1px solid var(--ink); background: var(--paper); cursor: pointer; font-size: 12px; }
.score-control output { text-align: center; font-family: "Jua"; font-size: 20px; }
.budget { display: flex; justify-content: space-between; padding: 14px 16px; background: var(--ink); color: white; border-radius: 12px; }
.budget.bad { background: var(--orange-dark); }
.reveal-stage { min-height: 520px; display: grid; place-items: center; text-align: center; }
.countdown { font-family: "Jua"; font-size: clamp(120px, 25vw, 250px); color: var(--orange); line-height: .8; animation: pulse .75s ease infinite alternate; text-shadow: 9px 10px 0 var(--yellow); }
@keyframes pulse { to { transform: scale(1.04) rotate(2deg); } }
.winner { animation: winnerIn .7s cubic-bezier(.2,.9,.2,1.2) both; }
@keyframes winnerIn { from { opacity:0; transform: scale(.7) rotate(-6deg); } }
.winner-crown { font-size: 52px; }
.winner-name { margin: 8px 0; color: var(--orange); font-size: clamp(54px, 10vw, 104px); line-height: .9; }
.winner-score { font-family: "Jua"; font-size: 26px; }
.confetti { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 18px; background: var(--c); animation: fall var(--d) linear forwards; transform: rotate(var(--r)); }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.ranking { max-width: 560px; margin: 30px auto 0; display: grid; gap: 8px; }
.rank-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; background: white; border: 1px solid var(--line); border-radius: 10px; text-align: left; }
.rank-row:first-child { border-color: var(--yellow); background: #fff9df; }
.empty-note { color: var(--muted); padding: 20px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; }
.toast { min-width: 250px; display: flex; align-items: center; gap: 10px; padding: 13px 16px; color: white; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow); animation: toastIn .25s ease; }
.toast span { color: var(--mint); font-weight: 900; }
.toast p { margin: 0; }
@keyframes toastIn { from { opacity:0; transform: translateY(10px); } }
.micro { color: var(--muted); font-size: 12px; }

@media (max-width: 780px) {
  .topbar { height: 64px; padding: 0 18px; }
  .app-shell { min-height: calc(100vh - 64px); padding: 18px 16px calc(70px + env(safe-area-inset-bottom)); }
  .hero { grid-template-columns: 1fr; gap: 30px; }
  .hero-art { min-height: 286px; order: -1; }
  .plate { width: min(68vw, 250px); height: min(68vw, 250px); }
  .plate::after { font-size: 110px; inset: 30px; }
  .sticker { padding: 9px 12px; font-size: 14px; }
  .room-grid { grid-template-columns: 1fr; }
  .room-grid > * { width: 100%; min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .rule-note { grid-column: auto; }
  .round-head { align-items: stretch; flex-direction: column; }
  .section-head, .room-footer, .split-actions { align-items: stretch; flex-direction: column; }
  .btn { width: 100%; }
  .btn.small { min-height: 44px; }
  .panel > .btn + .btn { margin-left: 0 !important; margin-top: 10px; }
  .room-footer > div:last-child { display: grid !important; width: 100%; }
  .role-switch { width: 100%; }
  .menu-cards { grid-template-columns: 1fr 1fr; }
  .menu-card { min-width: 0; min-height: 116px; overflow-wrap: anywhere; }
  .score-row { grid-template-columns: minmax(0,1fr) 96px; padding: 12px; gap: 8px; }
  .score-row h3 { font-size: 18px; overflow-wrap: anywhere; }
  .score-input { width: 96px; }
  .round-head { gap: 12px; margin-bottom: 16px; }
  .round-head h2 { font-size: 28px; line-height: 1.18; }
  .round-head .subcopy { font-size: 14px; margin-top: 12px; }
  .role-switch { min-width: 0; display: flex; gap: 10px; align-items: center; }
  .role-switch label { margin: 0; }
  .status-board { grid-template-columns: repeat(auto-fit,minmax(88px,1fr)); gap: 6px; margin: 14px 0; }
  .status-person { padding: 8px 4px; font-size: 13px; }
  .status-person .avatar { width: 28px; height: 28px; margin: auto; }
  .status-person small { font-size: 11px; }
  .input-stack { gap: 8px; margin: 16px 0; }
  .score-control { justify-content: start; }
  .score-control button { width: 64px; height: 44px; }
  .score-control { grid-template-columns: 64px 60px 64px; }
  .split-actions > div { display: grid; gap: 10px; }
  .split-actions > div .btn { margin-left: 0 !important; }
  .toast-region { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; width: 100%; }
  .prototype-pill { display: none; }
}

@media (max-width: 380px) {
  h1 { font-size: 38px; }
  .panel { padding: 19px; border-radius: 16px; box-shadow: 5px 6px 0 var(--ink); }
  .menu-cards { grid-template-columns: 1fr; }
  .qr-frame { width: 190px; height: 190px; }
}
