/* The table — the only game layout. A phone held sideways (740–932 × 360–430 stage px): a slim top line, the arena with
   the other seats around a light wooden table, and the fanned hand along the bottom edge with a narrow action column at
   the right. A portrait touch device only ever sees the rotate screen at the end of this file. */
/* The screen itself is full bleed — the hand strip's wood has to reach both edges even beside a notch (0.12.1). The
   safe area is padded inside each row instead: the top line, the table (its seats) and the hand strip's content. */
.table-screen{height:100%;display:grid;grid-template-rows:34px minmax(0,1fr) 150px;padding:var(--sa-t) 0 0;background:#3d2414 url(art/room-game.webp) center 30%/cover no-repeat;color:var(--cream);overflow:hidden}
.table-top{position:relative;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:6px;padding:0 calc(6px + var(--sa-r)) 0 calc(10px + var(--sa-l));min-width:0}
.topline-status{display:flex;align-items:center;gap:6px;min-width:0;overflow:hidden}
.round-no{padding:3px 10px;border-radius:999px;background:#2a1a12cc;color:var(--cream);font-size:11px;line-height:1.3;font-weight:800;white-space:nowrap;font-variant-numeric:tabular-nums}
.topline-status .pill{max-width:150px;overflow:hidden;text-overflow:ellipsis}
.table-tools{display:flex;align-items:center;gap:6px;flex-shrink:0}
.table-tools .icon-button{width:34px;height:30px;border-radius:10px;box-shadow:0 2px 0 var(--ink)}
.table-tools .icon-button .icon{width:18px;height:18px}
#turn-clock{padding:1px 7px;border-radius:999px;background:#2a1a12cc;font-size:12px;font-weight:800;color:var(--yellow);min-width:28px;text-align:right;font-variant-numeric:tabular-nums}
#turn-clock:empty{display:none}
/* My turn's seconds, beside the 내 차례 pill; the last ten turn coral. */
.topline-status .turn-seconds{min-width:34px;padding:2px 7px;background:var(--cream);color:var(--ink);font-family:var(--font-num);font-size:12px;font-variant-numeric:tabular-nums;transition:background-color var(--t-quick),color var(--t-quick)}
.topline-status .turn-seconds.warn{background:var(--coral);color:var(--ink)}
.topline-status .turn-seconds[hidden],.turn-fuse[hidden]{display:none}
.connection{display:block;width:10px;height:10px;margin:0 2px;border-radius:50%;background:var(--jade);border:2px solid var(--ink)}.connection.lost{background:var(--coral)}

/* The table: the kotatsu (art/kotatsu.webp, alpha) at its own proportions, whole inside the arena — the futon's hem
   settles on the tatami above the hand strip. */
.arena{position:relative;min-height:0;margin:0 var(--sa-r) 0 var(--sa-l)}
.deck-table{position:absolute;z-index:0;left:50%;top:0;height:100%;aspect-ratio:1500/480;transform:translateX(-50%);background:url(art/kotatsu.webp) center/contain no-repeat;pointer-events:none}
.opponent{position:absolute;z-index:2;display:flex;align-items:center;gap:5px;transform:translateX(-50%)}
.opponent.finished{opacity:.72}
/* Seats: the medal wears the post's face and the seat number, the plaque holds name · post · cards left. */
/* The pack's avatar frame (ui/avatar-normal.svg, ui/avatar-turn.svg) around the round portrait. */
.seat-medal{position:relative;flex-shrink:0;width:42px;height:42px;background:url(ui/avatar-normal.svg) center/100% no-repeat}
.opponent.current .seat-medal{background-image:url(ui/avatar-turn.svg)}
.seat-medal>.portrait{position:absolute;inset:11%;width:auto;height:auto;border:0}
.seat-no{position:absolute;z-index:1;left:-5px;top:-4px;display:grid;place-items:center;width:17px;height:17px;border-radius:50%;background:var(--yellow);border:2px solid var(--ink);font-family:var(--font-num);font-size:10px;font-weight:900;color:var(--ink);line-height:1}
.seat-prop{position:absolute;z-index:2;pointer-events:none}.prop-crown.seat-prop{right:-8px;top:-15px;width:32px;height:20px;transform:rotate(12deg)}.prop-bowl.seat-prop{left:-8px;bottom:-7px;width:22px;height:22px}
.seat-plaque{display:flex;flex-direction:column;align-items:flex-start;gap:1px;min-width:70px;min-height:38px;justify-content:center;padding:3px 8px 4px;border:2px solid var(--ink);border-radius:9px;background:var(--cream);color:var(--ink);box-shadow:0 2px 0 var(--ink);line-height:1.15}
.seat-plaque strong{display:block;max-width:72px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;font-weight:900;letter-spacing:-.01em}
.seat-line{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;white-space:nowrap}
.seat-title{font-style:normal;font-size:10px;line-height:1.2;font-weight:900;color:var(--seat)}
.seat-count{display:inline-flex;align-items:center;gap:1px;font-family:var(--font-num);font-size:11px;font-weight:900;font-variant-numeric:tabular-nums}

.seat-place{padding:1px 5px;border-radius:5px;background:var(--teal);color:var(--cream);font-size:10px;line-height:1.2;font-weight:900}
/* The seat whose turn it is carries a yellow ring that breathes (opacity/scale only). --phase is set once per paint from
   the clock, so a repaint never restarts the breath. */
.seat-medal:after{content:'';position:absolute;inset:-5px;border-radius:50%;border:3px solid var(--yellow);opacity:0;pointer-events:none}
.opponent.current .seat-medal:after{animation:turn-ring 2.4s ease-in-out infinite;animation-delay:var(--phase,0ms)}
@keyframes turn-ring{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.45;transform:scale(1.1)}}
.opponent.current .seat-plaque{background:var(--yellow)}
.seat-me{left:50%;bottom:1%;top:auto}.seat-me .seat-medal{width:38px;height:38px}
.seat-0{left:max(10%,84px);top:40%}.seat-1{left:24%;top:1%}.seat-2{left:50%;top:0}.seat-3{left:76%;top:1%}.seat-4{left:min(90%,100% - 84px);top:40%}

.table-center:has(.pile-zone){top:50%}
.table-center{position:absolute;z-index:1;left:50%;top:46%;width:54%;max-height:92%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;text-align:center;color:var(--ink)}
.center-label{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 7px;border-radius:999px;background:#2a1a1299;color:#fff8e9d9;font-size:10px;font-weight:800}
/* Who leads (선 · 이름) and the other middle captions: small and low-contrast so the played cards carry the eye. */
.table-center h2{padding:1px 9px;border-radius:8px;background:#fff8e9cc;border:1.5px solid #3b2a2455;box-shadow:none;font-family:var(--font-display);font-size:11px;font-weight:800;color:#3b2a24cc}
.table-center p{padding:1px 8px;border-radius:7px;background:#fff8e9b3;font-size:10.5px;line-height:1.4;font-weight:800;color:#3b2a24}
.center-mark{display:grid;place-items:center}
.center-mark .portrait{width:38px;height:38px;border-width:2.5px;box-shadow:0 2px 0 var(--ink)}
.center-crest{width:62px;height:52px}
.pile{height:66px}
/* The pile (0.10.0): the newest set in the centre; the earlier sets of the trick lie under it to the left, turned as they
   were played, each one deeper a little further aside and fainter (pile.js). A cleared trick adds a face-down card to
   the stack at the right. */
.pile-zone{position:relative;display:flex;justify-content:center}
.pile-zone>.pile{position:relative;z-index:20}
.old-sets{position:absolute;inset:0;pointer-events:none}
.old-set{position:absolute;left:50%;top:0;height:100%;display:flex;align-items:center;padding-left:24px;opacity:var(--o);filter:brightness(calc(1 - (1 - var(--o)) * 4.5));transform:translate(calc(-50% + var(--x)),var(--y)) rotate(var(--r)) scale(.94)}
.motion-layer .ghost-set{position:absolute;right:auto;margin:0;display:flex;align-items:center;justify-content:center;padding-left:14px}
.spent-stack{position:absolute;z-index:1;left:calc(50% + 150px);top:45%;width:34px;height:47px;transform:translate(-50%,-50%);pointer-events:none}
.spent-stack i{position:absolute;inset:0;border-radius:6px;border:2px solid var(--ink);background:#1f3561 url(art/card-back.webp) center/cover no-repeat;box-shadow:0 1px 0 var(--ink);transform:translate(calc(var(--i) * -1.3px),calc(var(--i) * -1.6px)) rotate(calc((var(--i) - 2.5) * 2.2deg))}
.spent-stack i:nth-child(odd){rotate:-3deg}
.pile-caption{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:3px 8px;font-size:11px;font-weight:800;color:var(--ink)}
.pile-caption>span:not(.trick-title){padding:1px 8px;border-radius:999px;background:var(--cream);border:1.5px solid var(--ink)}
.pile-caption>span.pile-who{background:var(--ink);color:var(--cream)}
.winner{display:flex;align-items:center;gap:8px}
.winner .portrait{width:40px;height:40px;border-width:2.5px}
/* The tribute: two lines, each one arrow up the kotatsu (last → first 2, second-to-last → second 1). */
.tribute-list{list-style:none;margin:2px 0 0;padding:0;display:grid;gap:5px}
.tribute-list li{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:6px;padding:3px 8px;border:2px solid var(--ink);border-radius:12px;background:var(--cream);box-shadow:0 2px 0 var(--ink);font-size:11px}
.tribute-list li.mine{background:#fff0b3}
.tribute-seat{display:flex;align-items:center;gap:4px;min-width:0}.tribute-seat b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:900}
.tribute-seat:last-child{justify-content:flex-end}
.tribute-arrow{display:inline-flex;align-items:center;gap:2px;padding:1px 7px;border-radius:999px;background:var(--coral);border:2px solid var(--ink);font-family:var(--font-num);font-weight:900}
.tribute-arrow .cards-icon{width:12px;height:12px}.tribute-arrow i{font-style:normal;font-size:14px;line-height:1}

/* Bottom strip: a plank shelf. The fan takes the width; a slim column at the right holds my count, one status line and
   the buttons. */
.hand-panel{position:relative;z-index:3;display:grid;grid-template-columns:minmax(0,1fr) 184px;gap:0 12px;min-height:0;padding:0 calc(8px + var(--sa-r)) calc(4px + var(--sa-b)) var(--sa-l);border-top:3px solid var(--ink);background:linear-gradient(#8a5328,#6b3d1d 60%,#5a321a);box-shadow:inset 0 3px 0 #b8743b}
.hand-fan{align-self:stretch;margin-left:18px}
.hand-side{position:relative;z-index:30;display:flex;flex-direction:column;justify-content:flex-end;gap:3px;min-width:0;padding-top:4px}
.hand-heading{display:flex;align-items:center;gap:6px;min-width:0;height:22px}
.hand-heading .pill{padding:1px 8px}
.hand-heading h2{font-size:12px;font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;color:var(--cream)}
.hand-heading .pill{flex-shrink:0}
.hand-heading .role-badge{padding:0 5px 0 0;border-radius:999px;background:var(--cream)}
.action-message{height:16px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:11px;font-weight:800;line-height:16px;color:var(--cream)}
.action-message.error{color:#ffc7b6}
/* Actions: 추천 | 패스 in a row on top, one wide action below (내기 · Tribute · 버리기 · Revolution · 준비). Every target ≥44px. */
.actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px 5px;overflow:visible}
.actions>:only-child,.actions>.wide{grid-column:1/-1}
.actions .text-button,.actions .secondary,.actions .primary{min-height:46px;padding:0 6px 5px;font-size:14px}
.actions .text-button:not(:disabled):active,.actions .secondary:not(:disabled):active,.actions .primary:not(:disabled):active{padding:5px 6px 0}
.actions .play-button{min-height:50px;font-size:16px;letter-spacing:.01em}
.actions.duo{grid-template-columns:minmax(0,5fr) minmax(0,7fr);gap:0 6px;align-items:stretch}
.actions.duo>button{min-height:58px;padding:0 4px 6px;font-size:16px;letter-spacing:0;line-height:1;white-space:nowrap}
.actions.duo>button:not(:disabled):active{padding:6px 4px 0}
.actions.duo>.play-button{font-size:17px}
.actions:has([data-target]){grid-template-columns:repeat(3,minmax(0,1fr))}
.actions [data-target]{min-height:44px;padding:0 3px 5px;font-size:11px;overflow:hidden;text-overflow:ellipsis}
/* My seat's countdown: the strip's top edge burns down from the right while the table waits on me. */
.turn-fuse{position:absolute;z-index:31;left:0;right:0;top:-4px;height:5px;border-radius:0 3px 3px 0;background:var(--yellow);border-bottom:1.5px solid var(--ink);transform-origin:0 50%;transform:scaleX(var(--p,1));transition:transform var(--t-tick) linear,background-color var(--t-quick);pointer-events:none}
.turn-fuse.warn{background:var(--coral)}
.spectator-hand .hand-fan{display:none}.spectator-hand{grid-template-columns:1fr}.spectator-hand .hand-side{align-items:center;justify-content:center}
/* I am out: the place is the whole message. */
.spectator-hand .hand-heading{height:auto;gap:0;flex-direction:column}.spectator-hand .hand-heading .pill{display:none}
.spectator-hand .hand-heading h2{max-width:none;font-family:var(--font-display);font-size:46px;line-height:1.05;letter-spacing:-.02em;color:var(--yellow);-webkit-text-stroke:5px var(--ink);paint-order:stroke fill;text-shadow:0 4px 0 var(--ink)}
.spectator-hand .hand-heading h2 small{display:block;margin-top:6px;font-family:var(--font-body);font-size:13px;letter-spacing:0;color:var(--cream);-webkit-text-stroke:0;text-shadow:none}
.spectator-hand .action-message{display:none}
/* The results strip rises in after the last card has landed; --age keeps a later repaint from replaying it. */
.results-hand{grid-template-columns:minmax(0,1fr) 150px;grid-template-rows:26px minmax(0,1fr);gap:5px 12px;padding:6px calc(10px + var(--sa-r)) calc(6px + var(--sa-b)) calc(10px + var(--sa-l));animation:results-in var(--t-move) var(--ease-out) both;animation-delay:calc(var(--t-move) + var(--age,0ms))}
.results-hand .seat-ladder li{animation-delay:calc(var(--t-move) + var(--i) * var(--t-stagger-slow) + var(--age,0ms))}
@keyframes results-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.results-hand .hand-heading{grid-column:1;grid-row:1;justify-content:space-between}
.results-hand .text-button{position:relative;min-height:24px;margin:0;padding:0 9px;font-size:11px;line-height:1;box-shadow:0 2px 0 var(--ink)}.results-hand .text-button:before{content:'';position:absolute;inset:-10px -6px}
.result-strip{grid-column:1;grid-row:2;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);min-height:0}
.result-strip li{grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:repeat(2,minmax(0,1fr));gap:0 8px;padding:3px 10px;min-height:0;overflow:visible;font-size:11px;line-height:1.2}
.result-strip li>b{grid-row:1/3;min-width:14px;font-size:18px;text-align:center}
.result-strip li>.role-badge{justify-self:start}
.result-strip li>span:not(.role-badge){grid-row:2;grid-column:2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:800}
.result-strip li>em{grid-row:1/3;grid-column:3;display:inline-flex;align-items:center;gap:5px;font-size:11px}
.result-actions{grid-column:2;grid-row:1/3;display:flex;align-items:center;justify-content:center}
.result-actions .primary{width:100%;min-height:54px;font-size:16px}
.waiting-host{font-size:12px;font-weight:800;color:var(--cream);text-align:center}


/* A portrait touch device presents a pause screen, never a sideways or cropped table. Desktop windows are never gated. */
body.rotate-needed{background:var(--room)}
.rotate-screen{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;text-align:center;padding:24px;background:var(--room) url(art/room-game.webp) center/cover;color:var(--cream)}
.rotate-screen h1{padding:4px 16px;border-radius:12px;background:var(--cream);color:var(--ink);border:3px solid var(--ink);box-shadow:0 3px 0 var(--ink);font-family:var(--font-display);font-size:20px;font-weight:900}
.rotate-screen small{padding:1px 9px;border-radius:999px;background:#2a1a12cc;font-size:12px;font-weight:800;color:var(--cream)}
.rotate-phone{width:112px;height:66px;border:3px solid var(--ink);background:var(--cream);border-radius:15px;display:grid;place-items:center;position:relative;animation:phone-landscape 2.8s ease-in-out infinite}
.rotate-phone:before{content:'';position:absolute;left:7px;top:22px;width:4px;height:18px;border-radius:4px;background:var(--ink)}
.rotate-phone span{display:grid;place-items:center;width:29px;height:38px;border-radius:6px;background:var(--yellow);border:2px solid var(--ink);color:var(--ink);font-family:var(--font-num);font-size:22px;font-weight:900;transform:rotate(-8deg)}
@keyframes phone-landscape{0%,15%{transform:rotate(-90deg)}45%,85%,100%{transform:rotate(0)}}
@media(prefers-reduced-motion:reduce){.rotate-phone{animation:none}}
/* 선잡기 (seat draw): the draws in order, a tie drawing again, then the seats they gave. */
.draw-dialog{max-width:min(720px,calc(var(--sw) - 32px))}
.draw-note{margin:0 0 6px;font-size:12px;color:var(--ink-soft);font-weight:800}
.draw-rounds{list-style:none;margin:0 0 8px;padding:0;display:flex;flex-wrap:wrap;gap:6px 18px}
.draw-round{display:flex;flex-direction:column;align-items:flex-start;gap:3px}
.draw-round>b{font-size:11px;color:var(--ink-soft)}
.draw-cards{display:flex;flex-wrap:wrap;gap:6px}
.draw-pick{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:10px;font-weight:800}
.draw-pick.me small{color:var(--seat,#c8372d)}
.draw-card{width:30px;height:42px}

.draw-seats{grid-template-columns:repeat(6,minmax(0,1fr));margin-bottom:8px}
.draw-seats li{grid-template-columns:auto minmax(0,1fr);padding:2px 6px;font-size:11px}
.draw-seats li>span:last-child{grid-column:1/-1;text-align:center}
.draw-seats li>b{display:none}
.tribute-list li.done{opacity:.5;box-shadow:none}.tribute-list li.done .tribute-arrow{background:var(--paper)}
/* 선잡기 by hand: the face-down cards lie in a gentle arc; a taken card turns up and wears its taker's name. */
.table-screen[data-phase="draw"] .spent-stack{display:none}
.seat-spread{display:flex;justify-content:center;align-items:flex-start;height:92px;margin:6px 0 2px;padding-top:4px}
.spread-card{position:relative;flex:none;width:44px;height:62px;margin:0 -4px;padding:0;border-radius:7px;box-shadow:0 3px 0 var(--ink),0 6px 10px #3a241455;transform:translateY(calc(var(--off) * var(--off) * 1.5px)) rotate(calc(var(--off) * 3.2deg));transition:transform var(--t-quick) var(--ease-out),box-shadow var(--t-quick)}
.spread-card.card-back{cursor:pointer;-webkit-tap-highlight-color:transparent}
.spread-card.card-back:not(:disabled):hover,.spread-card.card-back:not(:disabled):focus-visible{transform:translateY(calc(var(--off) * var(--off) * 1.5px - 8px)) rotate(calc(var(--off) * 3.2deg));box-shadow:0 3px 0 var(--ink),0 0 0 3px var(--yellow)}
.spread-card.card-back:not(:disabled):active{transform:translateY(calc(var(--off) * var(--off) * 1.5px - 3px)) rotate(calc(var(--off) * 3.2deg)) scale(.96)}
.spread-card.card-back:disabled{cursor:default;filter:saturate(.85)}
.spread-card.taken{z-index:2;transform:translateY(calc(var(--off) * var(--off) * 1.5px - 6px)) rotate(calc(var(--off) * 3.2deg));animation:spread-flip var(--t-quick) var(--ease-out) both}
.spread-card.taken>.card-face{position:absolute;inset:0;border-radius:7px}
.spread-card.taken.me{z-index:3}.spread-card.taken.me>.card-face{box-shadow:0 0 0 3px var(--yellow)}
.spread-who{position:absolute;left:50%;bottom:-17px;transform:translateX(-50%);max-width:64px;padding:1px 6px;border-radius:999px;background:var(--ink);color:var(--cream);font-size:10px;font-weight:900;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.spread-card.taken.me .spread-who{background:var(--yellow);color:var(--ink)}
.spread-note{margin-top:10px;padding:1px 10px;border-radius:999px;background:#fff8e9d9;font-size:11px;font-weight:900;color:var(--ink)}
@keyframes spread-flip{from{transform:translateY(calc(var(--off) * var(--off) * 1.5px)) rotate(calc(var(--off) * 3.2deg)) rotateY(90deg)}}
.draw-hand .hand-side{align-items:center;justify-content:center}.draw-hand .hand-heading{height:auto;flex-direction:column}
.draw-hand .hand-heading h2{font-family:var(--font-display);font-size:30px;line-height:1.1;color:var(--yellow);-webkit-text-stroke:4px var(--ink);paint-order:stroke fill;text-shadow:0 3px 0 var(--ink);text-align:center}
.draw-hand .hand-heading h2 small{display:block;margin-top:6px;font-family:var(--font-body);font-size:13px;color:var(--cream);-webkit-text-stroke:0;text-shadow:none}
.draw-pick.left{opacity:.45}
@media(prefers-reduced-motion:reduce){.spread-card.taken{animation:none}}
.table-screen[data-phase="draw"] .seat-line{display:none}
/* 2026-11 audit: in a fan dense enough to overlap (6+ cards) a card's name shows only on the front card; under a
   neighbour it was a clipped half-letter. The number box stays on every card. */
.hand-fan.dense>.fan-card:not(:last-child) .face-name{visibility:hidden}
/* The remaining-cards mark is a small two-card fan (not an empty box), a little larger. */
.seat-count .cards-icon{width:13px;height:13px}
/* The turn clock says what it is: a stopwatch before the seconds. */
.topline-status .turn-seconds{display:inline-flex;align-items:center;gap:3px}
.topline-status .turn-seconds:before{content:'';width:12px;height:12px;background:url(ui/icon-timer.svg) center/contain no-repeat}
