body { background-attachment:fixed; }
.brand-button { border:0; background:none; padding:0; text-align:left; min-height:44px; }
.back-button { border:0; background:transparent; color:var(--ink-soft); font-size:12px; padding:6px 12px; }
.primary-button,.secondary-button { display:inline-flex; justify-content:center; align-items:center; gap:14px; min-height:48px; padding:13px 24px; font-family:inherit; font-size:13px; font-weight:700; line-height:1.4; border-radius:11px; border:1px solid var(--ink); }
.primary-button { color:var(--cream); background:var(--ink); box-shadow:0 4px 0 #194f4920; }
.primary-button:hover { background:#24665c; }
.secondary-button { color:var(--ink); background:var(--cream); }
button:disabled { opacity:.4; cursor:not-allowed; }
.flow-view { min-height:calc(100dvh - 110px); display:flex; flex-direction:column; justify-content:center; padding:30px 0; }
.flow-heading { margin:0 0 30px; text-align:center; }
.flow-heading h1 { margin:12px 0 8px; font-size:clamp(24px,3vw,34px); letter-spacing:.04em; }
.flow-heading p { font-size:12px; color:var(--ink-soft); line-height:1.8; }
body[data-view="title"],body[data-view="loading"] { height:100dvh; min-height:0; overflow:hidden; }
body[data-view="title"] main,body[data-view="loading"] main { width:100%; height:100%; }
.title-view { min-height:0; height:100%; display:grid; grid-template-columns:1fr 1fr; align-items:center; position:relative; padding-bottom:65px; }
.title-kicker { font-size:9px; letter-spacing:.21em; font-weight:700; color:var(--ink-soft); }
.title-copy h1 { margin:22px 0 16px; }
.title-copy h1>span { display:block; font-size:clamp(34px,4.3vw,59px); font-weight:850; letter-spacing:.04em; white-space:nowrap; }
.title-copy h1 small { display:block; margin-top:10px; font-size:12px; letter-spacing:.33em; }
.title-copy p { font-size:15px; color:var(--ink-soft); margin:28px 0; }
.start-button { min-width:235px; justify-content:space-between; min-height:57px; font-size:16px; }
.title-players { display:block; margin-top:16px; font-size:10px; color:var(--ink-soft); letter-spacing:.08em; }
.title-stack { height:min(420px,55dvh); position:relative; margin-left:10px; }
.title-stack .playing-card { --card-width:clamp(120px,16vw,200px); position:absolute; pointer-events:none; top:15%; left:30%; box-shadow:0 15px 25px #1b584024; }
.title-stack .playing-card:nth-child(1) { transform:translateX(-55%) translateY(18px) rotate(-18deg); }
.title-stack .playing-card:nth-child(2) { transform:translateX(25%) translateY(18px) rotate(16deg); }
.title-stack .playing-card:nth-child(3) { transform:rotate(-2deg); z-index:2; }
.title-stack .card-number { width:43px; height:43px; }
.title-stack .card-name { font-size:16px; min-height:27px; bottom:9px; }
.title-footer { position:absolute; bottom:18px; left:0; right:0; display:flex; align-items:center; justify-content:space-between; border-top:1px solid #9cbbab77; padding-top:8px; }
.title-footer>span { font-size:9px; letter-spacing:.2em; }
.menu-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:22px; }
.menu-tile { background:var(--cream); border:1px solid #a9c1af; border-radius:21px; padding:26px; position:relative; text-align:left; box-shadow:0 4px 0 #688e7720; transition:transform .15s; }
.menu-tile:hover { transform:translateY(-5px); }
.menu-art { height:190px; display:block; margin-bottom:22px; }
.menu-art img { width:100%; height:100%; object-fit:contain; }
.menu-number { font:16px Georgia,serif; opacity:.5; }
.menu-tile h2 { font-size:21px; margin:9px 0; }
.menu-tile p { font-size:11px; color:var(--ink-soft); }
.tile-arrow { position:absolute; right:24px; bottom:27px; font-size:24px; }
.resume-button { align-self:center; margin-top:22px; }
.match-layout { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1.15fr); gap:30px; width:min(850px,100%); margin:auto; }
.setup-panel,.lobby-panel { background:var(--cream); border:1px solid #a9c1af; border-radius:20px; padding:28px; }
.setup-panel h2,.lobby-panel h2 { font-size:19px; margin:0 0 22px; }
.form-label { display:block; font-size:11px; color:var(--ink-soft); margin:20px 0 8px; }
.text-input { display:block; width:100%; border:1px solid #a5bfae; border-radius:9px; padding:12px 14px; font:inherit; font-size:15px; color:var(--ink); background:#fffef8; min-height:46px; }
.room-input { text-transform:uppercase; letter-spacing:.2em; font-weight:700; }
.player-count { display:flex; gap:9px; }
.player-count button { flex:1; min-height:47px; border-radius:8px; border:1px solid #a5bfae; background:#f0f4e8; }
.player-count button.active { color:var(--cream); background:var(--ink); border-color:var(--ink); }
.setup-panel>.primary-button,.setup-panel>.secondary-button { width:100%; margin-top:22px; }
.match-actions { display:flex; gap:12px; justify-content:center; margin-top:22px; flex-wrap:wrap; }
.seat-list { display:flex; flex-direction:column; gap:10px; }
.lobby-seat { display:flex; align-items:center; gap:12px; padding:12px; border:1px solid #d1dfce; border-radius:12px; background:#f2f4e9; min-height:65px; }
.seat-avatar { width:34px; height:39px; border-radius:5px; display:grid; place-items:center; background:#d5e6d6; font:700 22px Georgia,serif; }
.lobby-seat strong { font-size:13px; display:block; }
.lobby-seat small { display:block; font-size:9px; color:var(--ink-soft); margin-top:4px; }
.seat-status { margin-left:auto; font-size:9px; color:var(--ink-soft); }
.lobby-seat .text-button { font-size:10px; padding:3px; }
.room-code { display:flex; align-items:center; gap:15px; padding:14px; border-radius:10px; border:1px dashed #8cb39c; background:#edf4e8; margin:20px 0; }
.room-code strong { font-size:24px; letter-spacing:.2em; }
.room-code button { margin-left:auto; }
.room-note { color:var(--ink-soft); font-size:11px; line-height:1.8; }
.loading-view { min-height:0; height:100%; align-items:center; text-align:center; }
.loading-card { width:72px; margin-bottom:32px; animation:loading-bob 1.4s ease-in-out infinite; }
.loading-sparkle { color:var(--cream); font-size:25px; }
.loading-view h1 { font-size:20px; margin:0 0 10px; }
.loading-view p { font-size:12px; color:var(--ink-soft); }
.loading-track { width:min(290px,80vw); height:7px; border:1px solid #9db8a3; border-radius:10px; overflow:hidden; margin:22px 0 10px; }
#loading-fill { display:block; height:100%; width:0; background:var(--ink); transition:width .2s; }
#loading-percent { font-size:10px; color:var(--ink-soft); font-variant-numeric:tabular-nums; }
#loading-retry { margin-top:20px; }
@keyframes loading-bob { 0%,100%{transform:translateY(0) rotate(-4deg)}50%{transform:translateY(-7px) rotate(4deg)} }
.current-seat { border-color:#6eaa91; box-shadow:0 0 0 2px #83baa52e; }
.skip-status { font-size:8px; color:#76678d; background:#e9e2ec; border-radius:4px; padding:3px; margin-left:4px; }
.turn-badge.waiting { background:#779b8b; }
.empty-card { background:#e8eddf; border:1px dashed #94af9e; box-shadow:none; }
.empty-card::after { display:none; }
.empty-card .empty-digit { font:500 25px Georgia,serif; opacity:.35; display:block; }
.pile-count { position:absolute; right:-6px; bottom:-4px; min-width:16px; padding:2px 3px; border-radius:5px; font-size:7px; line-height:1; background:#fff8e6; border:1px solid #adc4b0; z-index:3; }
.round-tokens { font-size:10px; color:var(--ink-soft); }
#decision-button { position:absolute; right:0; bottom:0; z-index:4; }
.choice-dialog { max-width:460px; }
.choice-dialog h2 { font-size:19px; margin:12px 0 22px; }
.choice-options { display:grid; gap:9px; }
.choice-options button { min-height:48px; padding:10px 14px; background:#ecf2e5; border:1px solid #a6c1ad; color:var(--ink); border-radius:9px; text-align:left; }
.choice-options button:hover { background:#dbe9d8; }
.result-dialog { max-width:470px; text-align:center; }
.result-badge { font-size:38px; color:#b29445; display:block; margin-bottom:13px; }
.result-dialog h2 { font-size:25px; margin:12px 0 22px; }
.result-list { display:grid; gap:7px; margin:22px 0; }
.result-row { display:flex; align-items:center; padding:11px 14px; gap:12px; background:#eaf0e1; border-radius:9px; text-align:left; }
.result-row.winner { background:#f0e8cd; }
.result-row strong { flex:1; font-size:14px; }
.result-score { font:28px Georgia,serif; }
.result-wins { font-size:10px; min-width:34px; }
.dialog-actions { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
.result-dialog .text-button { display:block; margin:12px auto 0; }
.battle-footer #result-button { margin:auto; }
#battle-view .opponents[data-count="1"] { grid-template-columns:minmax(0,1fr); max-width:500px; width:100%; margin:0 auto; }
#battle-view .opponents[data-count="2"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
#battle-view .opponent .playing-card { --card-width:min(calc((100cqh - 64px) * .715909),calc((100cqw / var(--opponents,3) - 110px) / 2),91px); }
body[data-view="battle"] .back-button { display:none; }
#battle-menu { margin-left:auto; }
.reduce-motion .loading-card { animation:none; }
@media(prefers-reduced-motion:reduce) { .loading-card { animation:none; } }
@media(max-width:720px) {
  .app-header { flex-wrap:nowrap; padding:10px 14px; }
  .back-button { font-size:10px; padding:4px; }
  .flow-view { padding:22px 0; min-height:calc(100dvh - 80px); }
  .flow-heading { margin-bottom:20px; }
  .flow-heading h1 { font-size:24px; }
  .title-view { grid-template-columns:1fr; grid-template-rows: .9fr 1fr; text-align:center; padding:20px 0 65px; min-height:0; }
  .title-copy { grid-row:2; align-self:start; }
  .title-stack { grid-row:1; width:270px; height:100%; max-height:280px; margin:0 auto; }
  .title-stack .playing-card { --card-width:min(110px,20dvh); left:29%; top:8%; }
  .title-stack .card-number { width:30px; height:30px; }
  .title-stack .card-name { font-size:10px; min-height:18px; }
  .title-copy h1 { margin:10px 0 14px; }
  .title-copy h1>span { font-size:34px; }
  .title-copy h1 small { font-size:9px; letter-spacing:.25em; }
  .title-kicker { font-size:7px; }
  .title-copy p { font-size:12px; margin:16px 0 22px; }
  .start-button { min-height:49px; min-width:210px; font-size:14px; }
  .title-players { margin-top:13px; font-size:9px; }
  .title-footer { bottom:10px; }
  .menu-grid { grid-template-columns:1fr; gap:13px; }
  .menu-tile { padding:18px 18px 18px 115px; min-height:135px; border-radius:16px; }
  .menu-art { position:absolute; width:90px; height:112px; top:10px; left:12px; margin:0; }
  .menu-number { font-size:12px; }
  .menu-tile h2 { font-size:18px; margin:6px 0; }
  .menu-tile p { font-size:10px; margin:4px 0; }
  .tile-arrow { right:16px; bottom:18px; font-size:19px; }
  .match-layout { grid-template-columns:1fr; gap:15px; }
  .setup-panel,.lobby-panel { padding:20px; border-radius:16px; }
  .lobby-seat { min-height:59px; padding:9px; }
  .loading-view { min-height:0; }
  #battle-view .opponents[data-count="1"],#battle-view .opponents[data-count="2"] { max-width:none; grid-template-columns:1fr; grid-template-rows:repeat(var(--opponents,3),minmax(0,1fr)); }
  #battle-view .opponent .playing-card { --card-width:min(calc((100cqh - 15px) * .715909),47px); }
  body[data-view="battle"] .app-header { flex-wrap:nowrap; min-height:48px; }
  #battle-view .round-tokens { font-size:8px; }
}
@media(max-width:720px) and (max-height:700px) {
  #battle-view .opponents[data-count] { grid-template-columns:repeat(var(--opponents,3),minmax(0,1fr)); grid-template-rows:minmax(0,1fr); }
  #battle-view .opponent .playing-card { --card-width:min(calc((100cqh - 42px) * .715909),calc((100cqw - 5px) / 2),44px); }
  .title-copy h1>span { font-size:29px; }
  .title-copy p { margin:12px 0 16px; }
}
@media(min-width:721px) and (max-height:500px) {
  .title-stack { height:260px; }
  .title-stack .playing-card { --card-width:120px; }
  .title-copy h1>span { font-size:35px; }
  .title-copy p { margin:12px 0; }
  .title-copy h1 { margin:12px 0; }
  #battle-view .opponents[data-count] { grid-template-columns:1fr; grid-template-rows:repeat(var(--opponents,3),minmax(0,1fr)); }
  #battle-view .opponent .playing-card { --card-width:min(calc((100cqh - 13px) * .715909),43px); }
  #battle-view .round-tokens { display:none; }
}
