@font-face { font-family: 'Jua'; src: url('font/jua.woff2') format('woff2'); font-display: swap; }
:root { --ink: #3a1430; --cream: #fff8ec; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1b0f3a; overflow: hidden; }
body { font-family: 'Jua', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }

#app { position: relative; width: 100%; height: 100%; overflow: hidden; }
.bg { position: absolute; inset: 0; background: #2a1760 url('img/bg-quiz.webp') center/cover no-repeat; }
@media (max-aspect-ratio: 4/5) { .bg { background-image: url('img/bg-quiz-tall.webp'); } }
section { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 2.2vmin; padding: 3vmin; }
#app[data-scene=title] #title, #app[data-scene=howto] #howto, #app[data-scene=pick] #pick,
#app[data-scene=micset] #micset, #app[data-scene=play] #play, #app[data-scene=result] #result { display: flex; }

/* ---------- 광택 버튼 ---------- */
.gbtn { --c1: #ffe36e; --c2: #ffb51f; --edge: #8a4a00;
  position: relative; min-width: 14em; padding: .55em 1.6em .65em; border: .22em solid var(--ink); border-radius: 999px;
  font-size: clamp(18px, 4vmin, 34px); color: #fff; letter-spacing: .02em;
  text-shadow: 0 .09em 0 var(--ink), .06em 0 0 var(--ink), -.06em 0 0 var(--ink), 0 -.06em 0 var(--ink);
  background: linear-gradient(var(--c1), var(--c2)); box-shadow: inset 0 -.28em 0 var(--edge), 0 .3em 0 var(--ink); transition: transform .08s; }
.gbtn::before { content: ''; position: absolute; left: 12%; right: 12%; top: .18em; height: .42em; border-radius: 999px; background: rgba(255,255,255,.55); }
.gbtn:active { transform: translateY(.2em); box-shadow: inset 0 -.18em 0 var(--edge), 0 .1em 0 var(--ink); }
.gbtn.small { min-width: 9em; font-size: clamp(15px, 3vmin, 24px); }
.gbtn.pink { --c1: #ff8fc0; --c2: #ff3d8b; --edge: #a3104d; }
.gbtn.blue { --c1: #8fe0ff; --c2: #3aa8ff; --edge: #135e9e; }
.gbtn.gray { --c1: #e6dcf2; --c2: #a99bc4; --edge: #5c4d7a; }
.gbtn[hidden] { display: none; }
.btns { display: flex; flex-wrap: wrap; gap: 2vmin; justify-content: center; align-items: center; }

/* ---------- 첫 화면 ---------- */
.logo { width: min(64vw, 70vmin); max-height: 34vh; object-fit: contain; filter: drop-shadow(0 1vmin 0 rgba(0,0,0,.25)); animation: bob 2.4s ease-in-out infinite; }
.lineup { display: flex; align-items: flex-end; justify-content: center; width: min(98vw, 1000px); height: 30vh; margin-top: -2vh; }
.lineup img { flex: 1 1 0; min-width: 0; height: 100%; object-fit: contain; object-position: 50% 100%; margin: 0 -1.5vmin; filter: drop-shadow(0 .8vmin 0 rgba(0,0,0,.25)); }
.lineup .l-muscle { flex-grow: 1.35; height: 118%; z-index: 1; }
.lineup .l-baby { height: 78%; }
.hint { margin: 0; color: #fff; font-size: clamp(12px, 2.3vmin, 18px); opacity: .85; text-shadow: 0 1px 2px #000; }
@keyframes bob { 50% { transform: translateY(-1.2vmin) rotate(-1deg); } }

/* ---------- 판 ---------- */
.panel { background: var(--cream); border: .5vmin solid var(--ink); border-radius: 3vmin; box-shadow: 0 1vmin 0 var(--ink); padding: 3vmin 4vmin; max-width: min(92vw, 720px); max-height: 92%; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 2vmin; }
.panel h2, .ttl { margin: 0; font-size: clamp(24px, 5.5vmin, 44px); font-weight: normal; }
.ttl { color: #fff; text-shadow: 0 .08em 0 var(--ink), .05em 0 0 var(--ink), -.05em 0 0 var(--ink), 0 -.05em 0 var(--ink); }
.panel ol { margin: 0; padding-left: 1.3em; font-size: clamp(15px, 3vmin, 22px); line-height: 1.55; }
.panel b { color: #e0287a; font-weight: normal; }

/* ---------- 상대 고르기 ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2vmin; width: min(96vw, 1100px); }
@media (max-aspect-ratio: 4/5) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pickcard { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3em; padding: 1.5vmin 1vmin 2vmin; border: .45vmin solid var(--ink); border-radius: 2.5vmin;
  background: linear-gradient(#fff, #ffe9f3); box-shadow: 0 .8vmin 0 var(--ink); color: var(--ink); transition: transform .1s; }
.pickcard:hover { transform: translateY(-.6vmin) rotate(-1deg); }
.pickcard img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.pickcard b { font-weight: normal; font-size: clamp(16px, 3.6vmin, 30px); }
.pickcard small { font-size: clamp(11px, 2vmin, 16px); opacity: .75; min-height: 2.6em; }
.pickcard .tag { position: absolute; top: 1vmin; left: 1vmin; padding: .1em .6em; border-radius: 999px; background: #3aa8ff; color: #fff; font-size: clamp(11px, 2vmin, 16px); border: 2px solid var(--ink); }
.pickcard.c-muscle { background: linear-gradient(#fff6c2, #ffcf4a); }
.pickcard.c-muscle .tag { background: #ff3d8b; }
.pickcard .won { position: absolute; top: 1vmin; right: 1vmin; font-style: normal; background: #2fc46b; color: #fff; padding: .1em .5em; border-radius: 999px; border: 2px solid var(--ink); font-size: clamp(11px, 2vmin, 16px); }

/* ---------- 마이크 준비 ---------- */
.panel.wide { width: min(92vw, 760px); }
.msg { margin: 0; text-align: center; font-size: clamp(14px, 2.8vmin, 20px); min-height: 1.4em; }


/* ---------- 결과 ---------- */
.result-box { display: flex; flex-direction: column; align-items: center; gap: 1vmin; background: var(--cream); border: .5vmin solid var(--ink); border-radius: 3vmin; box-shadow: 0 1vmin 0 var(--ink); padding: 2vmin 5vmin 3vmin; animation: stamp2 .4s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes stamp2 { from { transform: scale(.6); opacity: 0; } }
.result-box img { height: 38vh; }
.result-box h2 { margin: 0; font-weight: normal; font-size: clamp(36px, 10vmin, 90px); -webkit-text-stroke: .04em var(--ink); paint-order: stroke fill; }
.result-box.won h2 { color: #ffcf4a; } .result-box.lost h2 { color: #8fa3ff; }
.result-box p { margin: 0 0 1vmin; font-size: clamp(15px, 3vmin, 24px); }

/* ---------- 판 고르기: 얼굴 여럿 ---------- */
.cards.three, .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-aspect-ratio: 4/5) { .cards { grid-template-columns: 1fr; width: min(92vw, 420px); } .pickcard .faces img { width: 26%; } .pickcard small { min-height: 0; } }
.pickcard .faces { display: flex; justify-content: center; width: 100%; }
.pickcard .faces img { width: 34%; margin: 0 -2%; aspect-ratio: 1; }
.pickcard.t-boss { background: linear-gradient(#fff6c2, #ffcf4a); }
.pickcard.t-boss .tag { background: #ff3d8b; }
.live { margin: 0; font-size: clamp(14px, 3vmin, 22px); color: #3aa8ff; min-height: 1.3em; }

.ranks { list-style: none; margin: 0 0 1vmin; padding: 0; display: flex; flex-wrap: wrap; gap: .4em 1em; justify-content: center; font-size: clamp(14px, 2.8vmin, 22px); }
.ranks li.last { color: #e0287a; }

/* ---------- 마이크 연습 ---------- */
.try { display: flex; gap: 3vmin; justify-content: center; }
.try figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .3em; padding: 1.5vmin; border-radius: 2vmin; border: .4vmin dashed #c9b6d8; transition: transform .2s; }
.try img { width: 15vmin; height: 15vmin; object-fit: contain; }
.try figcaption { font-size: clamp(15px, 3vmin, 24px); }
.try figure.done { border: .4vmin solid #2fc46b; background: #e6ffef; transform: scale(1.06); }
.try figure.done figcaption::before { content: '✔ '; color: #2fc46b; }

/* ---------- 판 ---------- */
.seats { position: absolute; top: 1.5vmin; left: 2vmin; right: 2vmin; display: flex; justify-content: center; gap: 4vmin; z-index: 1; }
.seat { display: flex; align-items: center; gap: 1vmin; padding: .8vmin 1.6vmin .8vmin .8vmin; background: rgba(255,248,236,.9); border: .4vmin solid var(--ink); border-radius: 3vmin; box-shadow: 0 .6vmin 0 var(--ink); position: relative; }
.seat .who { display: flex; flex-direction: column; align-items: center; }
.seat .face { width: 15vmin; height: 15vmin; object-fit: contain; }
.seat .friend { width: 11vmin; height: 11vmin; margin: 2vmin; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(#8fe0ff, #3aa8ff); border: .5vmin solid var(--ink); color: #fff; font-size: 6vmin; text-shadow: 0 .5vmin 0 var(--ink); }
.nm { font-weight: normal; margin-top: -1vmin; padding: .05em .7em; background: #ffcf4a; border: .3vmin solid var(--ink); border-radius: 999px; font-size: clamp(12px, 2.3vmin, 20px); z-index: 1; }
.seat .mini { width: 13vmin; height: 13vmin; }
.cnt { position: absolute; right: -1vmin; top: -1vmin; font-style: normal; font-size: clamp(11px, 2.1vmin, 17px); color: #fff; background: #e0287a; border: .3vmin solid var(--ink); padding: .05em .6em; border-radius: 999px; }

.table { position: absolute; left: 0; right: 0; top: 23vmin; bottom: 9vmin; display: flex; align-items: center; justify-content: center; gap: 6vmin; }
.slot { display: flex; flex-direction: column-reverse; align-items: center; gap: 1.2vmin; }   /* 가로: 이름표를 카드 위로 (아래는 알림 자리) */
.disc-wrap { width: min(calc(100vh - 32vmin - 3em), 42vw, 56vmin); aspect-ratio: 1; }
.tagline { font-style: normal; padding: .15em .9em; border-radius: 999px; background: rgba(58,20,48,.78); color: #fff; font-size: clamp(13px, 2.6vmin, 22px); }
.tagline.me { background: #e0287a; border: .3vmin solid var(--ink); }

.disc { position: relative; width: 100%; height: 100%; background: url('img/card.webp') center/contain no-repeat; filter: drop-shadow(0 1vmin 0 rgba(0,0,0,.3)); }
.disc.empty { background: none; border: .5vmin dashed rgba(255,255,255,.6); border-radius: 50%; filter: none; }
.disc.small { filter: drop-shadow(0 .4vmin 0 rgba(0,0,0,.3)); }
.sym { position: absolute; padding: 0; border: 0; background: none; aspect-ratio: 1; touch-action: none; }
.sym img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; transition: transform .1s; }
.disc.small .sym { pointer-events: none; }
.disc.big { touch-action: none; }
.sym.tap img { animation: tap .18s ease-out; }
@keyframes tap { 50% { transform: scale(.85); } }
.sym.miss img { animation: hit .5s ease-out 2 alternate; filter: drop-shadow(0 0 1vmin #8fe0ff) drop-shadow(0 0 .8vmin #3aa8ff); }
.sym.hit img { animation: hit .6s ease-out infinite alternate; filter: drop-shadow(0 0 1.2vmin #fff) drop-shadow(0 0 1vmin #ffcf4a); }
@keyframes hit { to { transform: scale(1.25); } }
.disc.deal { animation: deal .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes deal { from { transform: scale(.4) rotate(-90deg); opacity: 0; } }
.disc.fly-me { animation: flyme .5s .7s ease-in forwards; }
.disc.fly-up { animation: flyup .5s .7s ease-in forwards; }
@keyframes flyme { to { transform: translateX(50vmin) scale(.9) rotate(30deg); opacity: 0; } }
@keyframes flyup { to { transform: translateY(-40vmin) scale(.3) rotate(-30deg); opacity: 0; } }
.disc.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-2vmin) rotate(-4deg); } 75% { transform: translateX(2vmin) rotate(4deg); } }

.banner { position: absolute; left: 50%; top: calc(100% - 13vmin); transform: translate(-50%, -50%); pointer-events: none; z-index: 3; text-align: center; max-width: 92vw; width: max-content; padding: .2em .9em; border-radius: 999px; background: rgba(58,20,48,.6); opacity: 0; color: #fff; -webkit-text-stroke: .05em var(--ink); paint-order: stroke fill; text-shadow: 0 .07em 0 var(--ink); font-size: clamp(17px, 4.2vmin, 38px); }
.banner.good { color: #6dff9e; } .banner.bad { color: #ff5d7a; }
.banner.go { animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1) forwards, fade .4s 2.2s forwards; }
@keyframes fade { to { opacity: 0; } }
@keyframes stamp { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.micbar { position: absolute; left: 50%; bottom: 1.5vmin; transform: translateX(-50%); display: flex; align-items: center; gap: 1vmin; max-width: 90vw; padding: .3em 1.2em .3em .4em; background: rgba(255,248,236,.92); border: .35vmin solid var(--ink); border-radius: 999px; font-size: clamp(13px, 2.6vmin, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.micbar img { width: 5vmin; height: 5vmin; min-width: 24px; min-height: 24px; filter: grayscale(1) opacity(.5); }
#app.voice .micbar img { filter: none; animation: bob 1s infinite; }

@media (max-aspect-ratio: 4/5) {
  .seats { gap: 2vw; }
  .seat { flex-direction: row; padding: 1vw 1.5vw 1vw 1vw; gap: 1vw; }
  .seat .face { width: 11vw; height: 11vw; }
  .seat .friend { width: 9vw; height: 9vw; margin: 1vw; font-size: 5vw; }
  .seat .nm { font-size: 11px; padding: 0 .5em; white-space: nowrap; }
  .seat .mini { width: 13vw; height: 13vw; }
  .seats { left: 1vw; right: 1vw; gap: 1.5vw; }
  /* 폰 세로: 자리 줄 → 카드 둘 → 마이크 줄을 위에서부터 쌓는다 (자리 줄 높이가 폰마다 달라 겹치던 것) */
  #play { justify-content: flex-start; gap: 1.5vh; padding: max(1.5vw, env(safe-area-inset-top)) 2vw calc(13vw + env(safe-area-inset-bottom)); }
  .seats { position: static; flex: none; }
  .table { position: static; flex: 1; min-height: 0; width: 100%; flex-direction: column; gap: 1vh; }
  .slot { flex: 1 1 0; min-height: 0; width: 100%; container-type: size; justify-content: center; flex-direction: column; }
  .disc-wrap { width: min(72vw, calc(100cqh - 2.6em)); }
  .micbar { bottom: max(1.5vw, env(safe-area-inset-bottom)); }
  .slot.mine { flex-direction: column-reverse; }
  .banner { top: calc(100% - 7vw - env(safe-area-inset-bottom)); font-size: 16px; }   /* 폰 세로: 마이크 줄 자리에 (카드 이름표를 안 가리게) */
  .disc.fly-me { animation-name: flydown; }
  @keyframes flydown { to { transform: translateY(40vh) scale(.9); opacity: 0; } }
}
