:root {
  --paper: #fffbf5; --ink: #292923; --muted: #77736b; --line: #e8e1d7;
  --gold: #e8aa2c; --slate: #adb8bc; --red: #cc393c; --green: #8dc641; --cyan: #23a9bf; --purple: #ae72b0;
  --radius: 18px; --shadow: 0 5px 0 rgba(41, 41, 35, .12), 0 12px 28px rgba(41, 41, 35, .07);
  font-family: ui-rounded, "Trebuchet MS", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f2eee7; color: var(--ink); font-size: 14px; }
.shell { max-width: 980px; margin: auto; padding: 22px 16px 60px; }
h1 { font-size: clamp(24px, 4vw, 34px); letter-spacing: -.05em; margin: 0; line-height: 1.05; }
h2 { font-size: 15px; letter-spacing: -.02em; margin: 0 0 10px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }

.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 13px; font-size: 12px; font-weight: 800; }
.pill.score b { font-size: 15px; }
label.pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

section, .panel { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; min-width: 0; }

.hint { color: var(--muted); font-size: 12px; margin: 8px 0; line-height: 1.5; }
small.mem { display: block; font-size: 10px; color: var(--muted); }

button:not(.card) {
  --btn: var(--cyan); --btn-ink: #fff;
  font: inherit; cursor: pointer; position: relative; border: 1.5px solid var(--ink); background: var(--btn); color: var(--btn-ink);
  padding: 10px 14px; margin: 3px; border-radius: 12px; font-size: 12px; letter-spacing: 0; font-weight: 900;
  box-shadow: none; transition: transform .2s, box-shadow .2s, filter .2s, background-color .2s, color .2s, opacity .2s;
  display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 38px;
}
button:not(.card):hover { filter: brightness(1.05); }
button:not(.card):active { transform: translateY(2px); box-shadow: none; }
button:not(.card):disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.25); transform: none; box-shadow: none; }
button:focus-visible, input:focus-visible { outline: 3px solid #25251f; outline-offset: 3px; }
button[data-act="leaveYes"], button[data-act="discardDraw"] { --btn: var(--red); }
button[data-act="fomo"], button.cyan { --btn: var(--cyan); --btn-ink: #fff; }
button[data-act="takeDiscard"] { --btn: var(--purple); }
button[data-act="confirmSwap"], button.primary, button.confirm, button[data-act="cancel"], button[data-act^="mode"] { --btn: var(--green); --btn-ink: var(--ink); }
button[data-act="pass"], button[data-act="next"], button[data-act="doneReveal"], button[data-act="doneLook"], button[data-act="cancelMode"], button[data-act="leaveLobby"] { --btn: var(--slate); --btn-ink: var(--ink); }
button[data-act="leaveNo"], button[data-act="copy"], button[data-act="lookDiscard"], button[data-act="forget"] { --btn: transparent; --btn-ink: var(--ink); box-shadow: none; border-color: var(--ink); }
button[data-act="leave"] { --btn: var(--slate); --btn-ink: var(--ink); min-height: 32px; padding: 6px 12px; }

input[type="text"], input:not([type]), .panel input {
  font: inherit; padding: 10px 12px; border: 1.5px solid var(--ink); border-radius: 12px; background: #fff; min-width: 16rem; max-width: 100%;
}

.card { --w: var(--cw); --r: calc(var(--w) * .21); position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: var(--w); aspect-ratio: 236 / 360; padding: 0; margin: .2rem; border: 0; border-radius: var(--r); background: transparent; font: inherit; color: inherit; vertical-align: middle; overflow: visible; }
.card.deck { margin: .2rem 16px 16px .2rem; }
.card.deck::before, .card.deck::after { filter: drop-shadow(1.5px 0 0 rgba(41, 41, 35, .22)) drop-shadow(-1.5px 0 0 rgba(41, 41, 35, .22)) drop-shadow(0 -1.5px 0 rgba(41, 41, 35, .22)) drop-shadow(0 3px 0 rgba(41, 41, 35, .22)); content: ""; position: absolute; inset: 0; background: url(/assets/img/cards/SVG/back.svg) center / 100% 100% no-repeat; }
.card.deck::before { transform: translate(5px, 5px); z-index: -1; }
.card.deck::after { transform: translate(10px, 10px); z-index: -2; }
.fan { position: relative; display: inline-block; margin: 0 14px; }
.fan > .card.fan-under { position: absolute; top: .2rem; left: .2rem; margin: 0; }
.fan > .card { transform: rotate(var(--tilt, 0deg)); }
/* (only where there is a real pointer: on a touch screen a card that was touched would stay lifted, as the touch leaves it "hovered" until something else is touched) */
@media (hover: hover) { .fan > button.card:hover:not(:disabled) { transform: translateY(-5px) rotate(calc(var(--tilt, 0deg) - 1deg)); } }
.slotrow { display: flex; align-items: center; flex-wrap: wrap; gap: .2rem; }
button.card { cursor: pointer; transition: transform .2s; }
@media (hover: hover) { button.card:hover:not(:disabled) { transform: translateY(-5px) rotate(-1deg); } }
button.card:disabled { cursor: default; }
.card.action { --r: calc(var(--w) * .21); }
.card img { filter: drop-shadow(1.5px 0 0 rgba(41, 41, 35, .22)) drop-shadow(-1.5px 0 0 rgba(41, 41, 35, .22)) drop-shadow(0 -1.5px 0 rgba(41, 41, 35, .22)) drop-shadow(0 3px 0 rgba(41, 41, 35, .22)); display: block; width: 100%; height: 100%; border-radius: 0; }
.card .num { font-size: 2.2rem; font-weight: 900; }
.card.empty { background: #eee6dc; color: var(--muted); border-radius: var(--r); filter: none; }
.card.slotempty { visibility: hidden; filter: none; }
.card.incoming { opacity: 0; }
.card.selected { transform: translateY(-8px) rotate(2deg); }
.card.selected { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: var(--r); }
.card.slot.target { outline: 1px dashed var(--card-gold-canceled, #E8AA2C); outline-offset: 2px; border-radius: var(--r); }
.card.slot.target:hover:not(:disabled) { outline-color: #FCFF2F; }
.card.slot.selected { outline: 4px solid var(--cyan); outline-offset: 2px; border-radius: var(--r); }
.card.slot.selected { box-shadow: 0 6px 14px rgba(35, 169, 191, .5); }
.card.slot.draggable { cursor: grab; }
.card.slot.draggable { outline: 1px dashed var(--card-gold-canceled, #E8AA2C); outline-offset: 2px; border-radius: var(--r); }
.card.slot.draggable:hover { outline-color: #FCFF2F; }
.card.flying { filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .35)); }
/* Opening deal: a hand card flips in the air. Back and front are two faces of one 3D card. */
.card.flying .flipcard { position: absolute; inset: 0; transform-style: preserve-3d; }
.card.flying .flipface { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.card.flying .flipface.front { transform: rotateY(180deg); }
/* In-place flips (FOMO reveal, dealt hand cards) have no drop shadow, which keeps the turn clean and smooth */
.card.flying.reveal, .card.flying.noshadow { filter: none; }
/* A dealt card's shadow: its own layer behind the picture, so only its opacity changes during the flight */
.card.flying .dshadow { position: absolute; inset: 0; z-index: -1; border-radius: 21% / 13.8%; box-shadow: 0 8px 10px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; }
.card.flying.reveal img, .card.flying.noshadow img { filter: none; }
/* Flying cards look like the real in-game cards when they land: no outline on the picture, the shadow is animated in fx.ts */
.card.flying img { filter: none; }
.card.flying.reveal .flipcard { will-change: transform; }
.card.mini { --w: min(3.6rem, calc(var(--cw) * .66)); }
.card.mini .num { font-size: 1.4rem; }
.card small.count { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); padding: 1px 9px; background: var(--ink); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 900; }
.card.slot small.mem { position: absolute; bottom: 2px; left: 0; right: 0; background: rgba(255, 255, 255, .85); border-radius: 6px; font-size: .6rem; text-align: center; }
.pulse { animation: pulse 1.25s ease-in-out 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(141, 198, 65, .3); } }

.handslot { display: inline-block; vertical-align: middle; margin: 0; }
button.card[data-act="hand"] { cursor: grab; }
.slotrow .ring { margin-right: .5rem; }
.pile { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }

.discardview { max-width: 40rem; }
.discardview .hint { margin: 0 0 .3rem; }
.discardcards { display: contents; }

#status { display: flex; align-items: center; gap: 10px; font-weight: 900; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; margin: 12px 0; }

.ring { --progress: 100%; width: 54px; height: 54px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) var(--progress), #eee6dc 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--paper); }
.ring span { z-index: 1; font-size: 16px; font-weight: 950; font-variant-numeric: tabular-nums; }
.ring.urgent { background: conic-gradient(var(--red) var(--progress), #eee6dc 0); }
.ring.urgent span { color: var(--red); }

.banner { background: #d9f2f5; border: 1.5px solid var(--cyan); border-radius: 12px; padding: 11px 13px; margin: 10px 0; font-weight: 700; }
.banner.err { background: #f9dedd; border-color: var(--red); }
.over { background: #e6f2d5; border-color: var(--green); }

#log { max-height: 12rem; overflow-y: auto; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; line-height: 1.8; color: var(--muted); }
#log div { border-bottom: 1px solid #f0ebe4; padding: 2px 0; }

.modal { position: fixed; inset: 0; background: rgba(41, 41, 35, .55); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modalbox { background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; max-width: 24rem; }
.modalbox h2 { font-size: 18px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.ring.bare { margin: 0 .8rem; }
.pile { gap: 0; }
.card.slot.target.draggable { outline: 1px dashed var(--card-gold-canceled, #E8AA2C); border-radius: var(--r); }
.card.slot.seenpick { outline: none; }
button.card.slot.seenpick:hover:not(:disabled) { transform: none; outline: none; }
.slotrow:has(.seenpick) { outline: 1.5px dashed rgba(232, 170, 44, .75); outline-offset: 4px; border-radius: 2px; cursor: pointer; transition: outline-color .15s, box-shadow .15s; }
.slotrow:has(.seenpick):hover { outline-color: #ffd23f; box-shadow: 0 6px 18px rgba(255, 150, 40, .35); }

.opp .card { --w: calc(var(--cw) * .5); }
.opp .card small.mem { font-size: .45rem; }

/* Four cards per row at any width: card size derives from the viewport. */
:root { --cw: min(5.5rem, calc((100vw - 4.6rem) / 4 - 1rem)); }
.slotrow, .slotrow .handslot { flex-wrap: wrap; }
@media (max-width: 560px) {
  .shell { padding: 14px 8px 40px; }
  section, .panel { padding: 10px; margin: 8px 0; }

  .ring.bare { margin: 0 .4rem; }
  .card.deck { margin-right: 12px; margin-bottom: 12px; }
  .fan { margin: 0 8px; }
  button { padding: 9px 11px; }
  :root { --cw: min(5.5rem, calc((100vw - 3.8rem) / 4 - .9rem)); }
}

/* Single-line header: logo + score + sound + leave */
.topbar { flex-wrap: nowrap; gap: 8px; }
.brand { flex: 0 0 auto; }
.brand img { display: block; height: 44px; width: auto; }
.top-actions { flex-wrap: nowrap; min-width: 0; justify-content: flex-end; }
.top-actions .pill, .top-actions button { white-space: nowrap; }
.top-actions .pill.score { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-actions button { margin: 0; padding: 8px 13px; font-size: 12px; }
@media (max-width: 560px) {
  .brand img { height: 34px; }
  .top-actions { gap: 5px; }
  .pill { padding: 6px 9px; font-size: 11px; }
  .top-actions button { padding: 7px 9px; font-size: 11px; }
}

/* Centre every card row and the action buttons */
#app section { text-align: center; }
.slotrow, .pile { justify-content: center; }

#app section .hint { text-align: center; }
#log { text-align: left; }
.brand { margin-right: auto; }

/* Opponent container */

.badge { background: #eee6dc; color: var(--muted); border-radius: 8px; padding: 5px 10px; font-size: 10px; font-weight: 900; letter-spacing: 0; text-transform: uppercase; }

.profile { display: flex; align-items: center; gap: 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 16px; min-width: 0; text-align: left; }
.avatar { position: relative; width: 48px; height: 48px; flex: 0 0 auto; background: var(--gold); border: 2px solid var(--ink); border-radius: 14px; display: grid; place-items: center; font-size: 24px; box-shadow: none; }
.avatar .dot { position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid #fff; }
.pinfo { display: flex; flex-direction: column; min-width: 0; }
.pinfo b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinfo small { color: var(--muted); font-size: 11px; }
.profile .ring.bare { margin: 0 0 0 6px; }
@media (max-width: 560px) {
  
  .profile { flex: 1 1 0; padding: 8px 10px; gap: 8px; border-radius: 14px; }
  .avatar { width: 34px; height: 34px; font-size: 18px; border-radius: 10px; }
  .pinfo small { font-size: 10px; }
  .profile .ring.bare { width: 38px; height: 38px; margin: 0; }
  .profile .ring.bare::before { inset: 4px; }
  .profile .ring.bare span { font-size: 12px; }
}

@media (min-width: 561px) { .profile { width: 260px; flex: 0 0 260px; box-sizing: border-box; } }

/* Reserve space so containers keep their height while cards fly around */
.slotrow { min-height: calc(var(--cw) * 1.5254 + .4rem); }
.opp .slotrow { min-height: calc(var(--cw) * .5 * 1.5254 + .4rem); }
.pile { min-height: calc(var(--cw) * 1.5254 + 1.6rem); }

/* Draw and discard piles: identical boxes, always centred; ring and button sit in side columns */
.pile { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0; }
.pilemid { display: flex; align-items: center; justify-content: center; gap: 1rem; }

.card.deck { margin: .2rem 12px 12px .2rem; }
.fan { margin: 0 12px 12px 0; }
@media (max-width: 560px) {
  .card.deck { margin: .2rem 12px 12px .2rem; }
  .fan { margin: 0 12px 12px 0; }
  .pilemid { gap: .4rem; }

}

/* Player container (you) */

.chat { flex: 1 1 auto; min-height: 8rem; background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 16px; text-align: left; font-size: 14px; }

.actionsrow { grid-area: actions; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; align-content: flex-start; min-height: 5.4rem; margin-bottom: 8px; text-align: left; }
.actionsrow .hint { flex-basis: 100%; margin: 0; }

.hiddenrow { grid-area: hidden; }

.handrow { grid-area: hand; }
.profile .ring.bare { margin: 0 0 0 auto; }
.profile { flex: 0 0 auto; }
@media (max-width: 700px) {

  .chat { display: none; }
  
  .actionsrow { justify-content: center; min-height: 3rem; }
  
}
@media (min-width: 561px) { .profile { padding: 12px 14px; gap: 10px; } .pinfo small { white-space: nowrap; } }
/* Fixed-height actions area so selecting a card never shifts the layout */
.actionsrow { height: 8rem; min-height: 8rem; overflow: auto; align-content: flex-start; }
@media (max-width: 700px) { .actionsrow { height: 9.5rem; min-height: 9.5rem; } }
/* Action contents must never widen the grid columns (that shifted the cards sideways) */
.actionsrow { contain: inline-size; }

/* Actions row: same height as the profile card; hint centred against it, options top-left with the hint beneath */
@media (min-width: 701px) {
  
  .actionsrow { height: 5.6rem; min-height: 5.6rem; margin-bottom: 12px; align-content: flex-start; }
  .actionsrow:has(> .hint:only-child) { align-content: center; }
}
#app section .actionsrow { justify-content: flex-start; text-align: left; }
#app section .actionsrow .hint { text-align: left; flex-basis: 100%; margin: 0; }
.actionsrow button { min-height: 34px; padding: 6px 14px; font-size: 12px; }
.actionsrow .hint button { min-height: 26px; padding: 3px 10px; }
[data-act="hand"], .card.slot.draggable { touch-action: none; user-select: none; -webkit-user-select: none; }
.dragghost, .dragghost * { transition: none !important; animation: none !important; }
.dropover { outline: none !important; border-radius: var(--r); transform: scale(1.07) !important; filter: brightness(1.12) drop-shadow(0 0 10px var(--cyan)); transition: transform .08s; }
[data-act="hand"].dropover { outline: none !important; }

/* Opponent: left aligned, full-size cards, profile as tall as the cards (matches my hidden set) */
@media (min-width: 701px) {
  
  .opp .card { --w: var(--cw); }
  .opp .card small.mem { font-size: .6rem; }
  .opp .slotrow { min-height: calc(var(--cw) * 1.5254 + .4rem); }
  
}

/* 30px gutter between the profile column and the cards, identical for both players */

.tablenote { min-height: 1.4rem; margin-top: 8px; text-align: center; font-size: 12px; color: var(--muted); }
.tablenote small.warn { color: var(--red); font-size: 12px; font-weight: 800; }

/* Chat card */
.chat { display: flex; flex-direction: column; min-height: 8rem; padding: 0; overflow: hidden; }
.chat > b { font-size: 18px; padding: 14px 18px 6px; }
.chatlog { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 4px 18px 10px; font-size: 14px; line-height: 1.4; }
.chatlog p { margin: 0 0 10px; overflow-wrap: anywhere; }
.chatlog .theirs b { color: #d3343b; }
.chatlog .theirs { color: #d3343b; }
.chatlog .mine { color: var(--ink); }
.chatform { display: flex; align-items: center; gap: 8px; border-top: 2px solid var(--line); padding: 0 12px 0 18px; }
.chatform input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; padding: 14px 0; color: var(--ink); }
.chatform button { all: unset; cursor: pointer; color: #1a7cc4; display: grid; place-items: center; padding: 6px; }
.chatform button:hover { color: #0f5f9e; }
.chatform input:placeholder-shown ~ button[type=submit] { color: #7bb8e0; }
.chatform input:focus::placeholder { color: transparent; }
.chatform button:focus-visible, .chatform input:focus-visible { outline: 0; }
.chatform button, .chatform button:hover, .chatform button:active, .chatform button:focus { box-shadow: none !important; transform: none !important; filter: none !important; outline: 0 !important; }

.card.flying.showcase { filter: drop-shadow(0 0 14px #ffd23f) drop-shadow(0 0 26px rgba(255, 210, 63, .85)); }
.card.flying.glow { filter: drop-shadow(0 0 14px #FAC13F); }
/* A replaced hidden card: the same pulse a number card gets when it lands in my hand, run by startSlotPulses in landfx.ts (with its settings,
   M.landNumber, and the number 4 card's gold) on the .lfx.num layers of table.css. Here it only takes the card's size and stays over the art. */
.card.slot .exfx { z-index: 3; border-radius: inherit; container-type: size; --cw: 100cqw; --ch: 100cqh; }
.card.throwglow { filter: drop-shadow(0 0 14px #FAC13F); }
.card.flying.showcase.flash { animation: cardflash .65s ease-out both; }
@keyframes cardflash {
  0% { filter: brightness(3.2) saturate(.4) drop-shadow(0 0 40px #fff) drop-shadow(0 0 70px #fff); transform-origin: center; }
  18% { filter: brightness(1.8) drop-shadow(0 0 28px #fff6c2) drop-shadow(0 0 50px rgba(255, 210, 63, .95)); }
  45% { filter: brightness(1.25) drop-shadow(0 0 18px #ffd23f) drop-shadow(0 0 32px rgba(255, 210, 63, .85)); }
  100% { filter: brightness(1) drop-shadow(0 0 14px #ffd23f) drop-shadow(0 0 26px rgba(255, 210, 63, .85)); }
}

/* Game over: winner green, loser red */

.resultbadge { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 22px; margin-left: auto; }
.resultbadge.won { background: #a9d86a; color: #3d6a12; }
.resultbadge.lost { background: #fdb3b3; color: #c0262d; }

.playagain button.primary { --btn: var(--green); --btn-ink: var(--ink); }
.playagain { display: flex; justify-content: center; gap: 16px; padding: 6px 0 4px; }

.tablestatus { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 13px; text-align: center; }
.tablestatus .spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--red); border-right-color: transparent; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
section:has(.tablestatus) .pile { opacity: .45; pointer-events: none; }

/* Ghosted: greyed-out section, chat locked */

.chatform input:disabled { background: transparent; cursor: not-allowed; }
.chatform button:disabled { opacity: .45; cursor: not-allowed; }

.chat { position: relative; }
.chatform .emojibtn { color: #4da3e8; }
.emojipop { position: absolute; right: 8px; bottom: 56px; z-index: 20; width: min(290px, calc(100% - 16px)); display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); max-height: min(220px, calc(100% - 66px)); overflow: auto; }
.emojipop button { all: unset; cursor: pointer; font-size: 22px; line-height: 1; text-align: center; padding: 5px 0; border-radius: 8px; }
.emojipop button:hover { background: #f1eee8; }
.emojipop button, .emojipop button:hover, .emojipop button:active, .emojipop button:focus, .emojipop button:focus-visible { box-shadow: none !important; transform: none !important; filter: none !important; outline: 0 !important; border: 0 !important; background: transparent !important; }
.emojipop button:hover { background: #f1eee8 !important; }

/* ---- Mobile layout (<= 700px): follows the Figma mobile frames. 12px page margins, 46x70 cards with an 8px gap ---- */
@media (max-width: 700px) {
  :root { --cw: 46px; }
  .shell { padding: 12px 12px 40px; }
  #app > section, #app > .panel { margin: 12px 0 0; padding: 12px; border: 2px solid var(--line); border-radius: 18px; }

  /* Every card row (opponent hidden, my hidden, my hand) uses the same 46x70 card and 8px gap */
  .slotrow .card, .slotrow .handslot .card, .opp .slotrow .card { --w: calc((100vw - 76px) / 4); width: 100%; height: auto; aspect-ratio: 46 / 70; margin: 0; flex: 1 1 0; min-width: 0; max-width: none; box-sizing: border-box; }
  .slotrow, .slotrow .handslot { flex-wrap: nowrap; }
  .slotrow { min-height: 70px; justify-content: center; margin: 0; gap: 8px; padding: 0; }
  .slotrow .handslot { display: block; flex: 1 1 0; width: auto; min-width: 0; margin: 0; }
  .slotrow .card img { width: 100%; height: 100%; object-fit: fill; }
  
  .card.selected { transform: translateY(-6px) rotate(2deg); }

  .profile { width: auto; height: auto; min-height: 66px; flex: none; box-sizing: border-box; padding: 12px; gap: 12px; border-radius: 14px; margin: 0; align-self: stretch; }
  .avatar { width: 39px; height: 39px; font-size: 18px; border-radius: 13px; border-width: 1.5px; box-shadow: none; background: var(--gold); }
  
  .avatar .dot { top: -4px; right: -4px; width: 10px; height: 10px; }
  .pinfo { flex: 1 1 0; }
  .pinfo b { font-size: 12px; }
  .pinfo small { font-size: 10px; white-space: normal; line-height: 1.25; }
  .profile .ring.bare { width: 39px; height: 39px; margin: 0 0 0 auto; }
  .profile .ring.bare::before { inset: 4px; background: var(--paper); }
  .profile .ring.bare span { font-size: 12px; font-weight: 700; letter-spacing: -.6px; }
  .resultbadge { width: 36px; height: 36px; margin-left: auto; }

  /* Small action buttons: 30px tall, 10px bold, ink border and 3px bottom shadow */
  .profile button, .actionsrow button { min-height: 30px; padding: 7px 10px; border-radius: 9px; border-width: 1.5px; font-size: 10px; font-weight: 700; letter-spacing: 0; white-space: nowrap; box-shadow: none; }
  .profile button:hover, .actionsrow button:hover { transform: none; box-shadow: none; }
  .profile button:disabled, .actionsrow button:disabled { box-shadow: none; }

  /* Always-present 30px row for the buttons, so nothing jumps when they appear */
  .actionsrow, #app section .actionsrow { height: 30px; min-height: 30px; margin: 0 0 20px; padding: 0; overflow: visible; contain: none; flex-wrap: nowrap; justify-content: center; align-items: center; align-content: center; gap: 8px; }
  .hiddenrow { justify-self: stretch; }

  .pile { position: relative; display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 87px; padding: 0 0 10px; }

  .actionsrow button[data-act="fomo"] { --btn: var(--cyan); --btn-ink: #fff; }
  .pilemid { gap: 12px; }
  .pile .card { --w: 57px; width: 57px; height: 87px; aspect-ratio: auto; }
  .card.deck, .pile .card.deck, .pilemid .card.deck { margin: 0 10px 10px 0; }
  .fan { margin: 0; }
  .tablenote { min-height: 14px; line-height: 14px; margin: 0; }
  .tablestatus { margin-top: 10px; }

  /* Chat: 200px log + 40px input bar */

  .chatform { height: 40px; padding: 0 12px; gap: 6px; border-top: 1.5px solid var(--line); }
  .chatform input { font-size: 12px; padding: 0 0 0 2px; }
  .chatform button svg { width: 14px; height: 14px; }
  .chatform button { color: #0076bc; opacity: .5; padding: 4px; }
}

/* DEV preview: panels show a fake state, so keep them inert */

#top select.pill { font: inherit; font-weight: 800; max-width: 200px; }

/* ---- Desktop layout (>= 701px): follows the Figma desktop frames. Opponent 288px wide and centred, piles centred, player container 800px with profile + chat | actions + cards ---- */
@media (min-width: 701px) {
  :root { --cw: 46px; }
  .shell { max-width: 880px; padding: 22px 40px 60px; }
  #app > section, #app > .panel { width: 100%; max-width: 800px; margin: 0 auto 10px; padding: 12px; border: 2px solid var(--line); border-radius: 18px; box-shadow: none; text-align: left; }

  /* Card rows stretch to their container (opponent 260px, mine 288px) with an 8px gap; cards keep the 46:70 ratio */
  .slotrow .card, .slotrow .handslot .card, .opp .slotrow .card { --w: 66px; width: 100%; height: auto; aspect-ratio: 46 / 70; margin: 0; min-width: 0; max-width: none; box-sizing: border-box; }
  .opp .slotrow .card { --w: 59px; }
  .slotrow, .slotrow .handslot { flex-wrap: nowrap; }
  .slotrow { width: 100%; min-height: 70px; margin: 0; gap: 8px; padding: 0; }
  .slotrow .handslot { display: block; flex: 1 1 0; width: auto; min-width: 0; margin: 0; }
  .slotrow .card img { width: 100%; height: 100%; object-fit: fill; }
  
  .card.selected, .card.slot.selected { transform: none; outline: 1.5px solid var(--cyan); outline-offset: -1.5px; box-shadow: none; }

  .profile { width: auto; height: 66px; flex: none; box-sizing: border-box; padding: 12px; gap: 12px; border-radius: 14px; margin: 0; align-self: stretch; }
  
  .avatar { width: 39px; height: 39px; font-size: 18px; border-radius: 13px; border-width: 1.5px; box-shadow: none; background: var(--gold); }
  .avatar .dot { top: -4px; right: -4px; width: 10px; height: 10px; }
  .pinfo { flex: 1 1 0; }
  .pinfo b { font-size: 12px; }
  .pinfo small { font-size: 10px; white-space: normal; line-height: 1.25; }
  .profile .ring.bare { width: 50px; height: 50px; margin: 0 0 0 auto; }
  .profile .ring.bare::before { inset: 5px; background: var(--paper); }
  .profile .ring.bare span { font-size: 14px; font-weight: 700; letter-spacing: -.7px; }

  /* Small action buttons: 30px tall, 10px bold, ink border and 3px bottom shadow */
  .profile button { min-height: 30px; padding: 7px 10px; margin: 0; border-radius: 9px; border-width: 1.5px; font-size: 10px; font-weight: 700; letter-spacing: 0; white-space: nowrap; box-shadow: none; }
  .profile button:hover { transform: none; box-shadow: none; }
  .profile button:disabled { box-shadow: none; }

  .hiddenrow { justify-self: stretch; }

  /* Piles: centred, with the See Pile button 16px to the right */
  .pile { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 190px; padding: 0; }

  .pilemid { gap: 20px; }
  .pile .card { --w: 93px; width: 93px; height: 141px; aspect-ratio: auto; margin: 0; }
  .pile .card.deck { margin: 0 9px 9px 0; }
  .card.deck::before { transform: translate(4.5px, 4.5px); }
  .card.deck::after { transform: translate(9px, 9px); }
  .fan { margin: 0 16px; }
  .fan > .card, .pile .fan > .card { --w: 96px; width: 96px; height: 147px; }
  .tablenote { min-height: 14px; line-height: 14px; margin: 0; }

  /* Opened discard pile (See Pile / Throwback): 46x70 cards, 8px gap */
  .pile:has(.discardview) { display: block; min-height: 0; padding: 10px 0 20px; }
  .pilemid:has(.discardview) { display: block; width: 100%; }
  .discardview { max-width: none; width: 100%; }
  /* One row while it fits: cards grow up to 80x122 (keeps the 190px table height) and shrink to 46x70 before wrapping */
  .discardcards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .discardview .hint { text-align: center; font-size: 10px; margin: 0 0 12px; }
  .discardview .hint button { margin: 0 0 0 8px; min-height: 25px; padding: 4px 10px; font-size: 10px; }
  .discardview .card.mini { --w: 80px; flex: 1 1 46px; min-width: 46px; max-width: 80px; width: auto; height: auto; aspect-ratio: 46 / 70; margin: 0; }
  
}

/* Name / waiting panels: everything centred */
#app > .panel { text-align: center; }
#app > .panel h2 { text-align: center; }
#app > .panel form { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#app > .panel form input { text-align: center; }

/* The table keeps the piles' height in every state (game over, See Pile) so nothing below jumps; it only grows if it needs to */

@media (max-width: 380px) { .tablenote { min-height: 28px; } }

/* Opening deal and DEV sound previews */
.undealt { opacity: 0 !important; pointer-events: none; }

/* Red table background (every screen size). The gradient stops are registered colours so the result background can fade in. */
@property --bg0 { syntax: "<color>"; inherits: false; initial-value: #eb2836; }
@property --bg1 { syntax: "<color>"; inherits: false; initial-value: #d22230; }
@property --bg2 { syntax: "<color>"; inherits: false; initial-value: #93131f; }
@property --bg3 { syntax: "<color>"; inherits: false; initial-value: #87111d; }
@property --bg4 { syntax: "<color>"; inherits: false; initial-value: #730c17; }
@property --bg5 { syntax: "<color>"; inherits: false; initial-value: #660914; }
body { --bg0: #eb2836; --bg1: #d22230; --bg2: #93131f; --bg3: #87111d; --bg4: #730c17; --bg5: #660914; background: var(--bg5) radial-gradient(circle farthest-corner at 50% 50%, var(--bg0) 0, var(--bg1) 18%, var(--bg2) 48%, var(--bg3) 72%, var(--bg4) 87%, var(--bg5) 100%) fixed; transition: --bg0 1s ease, --bg1 1s ease, --bg2 1s ease, --bg3 1s ease, --bg4 1s ease, --bg5 1s ease; min-height: 100vh; }
body::before { content: ""; position: fixed; inset: 0; z-index: -100; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='1200'%3E%3Cdefs%3E%3Cpattern id='p' width='8' height='8' patternUnits='userSpaceOnUse' patternTransform='rotate(45)'%3E%3Ccircle cx='4' cy='4' r='1' fill='%23000000' fill-opacity='0.15'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23p)'/%3E%3C/svg%3E") center / cover no-repeat; }

/* Chat header with collapse chevron */
.chat button.chathead { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; width: 100%; flex: none; cursor: pointer; padding: 14px 18px 6px; color: var(--ink); }
.chathead b { font-size: 18px; }
.chat button.chathead:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; border-radius: 14px; }
.chat.collapsed .chatlog, .chat.collapsed .chatform, .chat.collapsed .emojipop { display: none; }

/* ---- Desktop (>= 701px): Figma "Redesign" frames. Three columns: opponent 264 | piles 180 | me 264, 40px apart ---- */
@media (min-width: 701px) {
  .shell { max-width: none; padding: 0 0 60px; }
  .topbar { position: relative; height: 80px; margin: 0; padding: 14px 20px 0; align-items: flex-start; }
  .topbar .brand { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); margin: 0; }
  .topbar .brand img { height: 40px; }

}

/* Collapsible log */
.logsec button.loghead { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: pointer; color: var(--ink); }

.logsec button.loghead:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 8px; }

.logsec.collapsed #log { display: none; }

.donebtn { --btn: #adb8bc; --btn-ink: var(--ink); }

/* Lobby: transparent, centred, white copy on the red table */

.lobby h2 { margin: 0 0 4px; font-size: 14px; color: #fff; }
.lobby .hint { margin: 0 0 14px; font-size: 10px; line-height: 1.3; color: #fff; }
.lobby form { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lobby input { min-width: 0; width: 100%; max-width: 304px; padding: 8px 12px; font-size: 11px; border-radius: 10px; border: 1px solid var(--ink); }

.lobby button { min-height: 30px; padding: 7px 16px; border-radius: 9px; border-width: 1.5px; font-size: 10px; font-weight: 700; box-shadow: none; }
.lobby button:hover:not(:disabled) { transform: none; }
.lobby button.primary { --btn: var(--green); --btn-ink: var(--ink); }
.lobby button:disabled { opacity: 1; --btn: #a8643a; --btn-ink: #6b3a22; }
.lobby button[data-act="copy"] { --btn: #fff; --btn-ink: var(--ink); border: 3px solid var(--ink); border-radius: 14px; box-shadow: none; min-height: 44px; padding: 8px 18px; font-size: 13px; }

.lobby button.goback { --btn: transparent; --btn-ink: #fff; border-color: #fff; box-shadow: none; }

/* Seen: choose a set with the buttons or by clicking it */

#app button.seemine { --btn: var(--green); --btn-ink: var(--ink); }
#app button.seetheirs { --btn: var(--cyan); --btn-ink: #fff; }

@media (min-width: 701px) {
  /* Log: no card, white copy on the table */

  .logsec button.loghead { color: #fff; }
  
  #log { max-height: 12rem; font-family: inherit; font-size: 11px; line-height: 1.6; color: #fff; }
  #log div { border: 0; padding: 3px 0; }

  /* Swap/target cards: selected is solid and raised 2px, the others fade to 50% */
  .card.slot.selected, .card.selected { outline: 1.5px solid #E8AA2C; outline-offset: 2px; border-radius: var(--r); box-shadow: none; transform: translateY(-2px); }
  button.card.selected, button.card.selected:hover:not(:disabled) { transform: translateY(-2px); transition: none; }
  .slotrow:has(.slot.selected) .card.slot.target:not(.selected) { outline-color: rgba(232, 170, 44, .5); }
}

/* Lobby name input: thin pale border when empty and unfocused, bold dark border when active or filled */
.lobby form input { border: 1px solid rgba(255, 255, 255, .55); border-radius: 14px; padding: 9px 14px; font-size: 12px; outline: none; transition: border-color .15s; }
.lobby form input:focus, .lobby form input:not(:placeholder-shown) { border: 3px solid var(--ink); padding: 7px 12px; }

/* Pre-game countdown */
.countdown h2 { font-size: 18px; margin-bottom: 6px; }
.countdown .hint { font-size: 14px; opacity: .9; margin-bottom: 20px; }


.chatlog .sys, .chatlog .sys b { color: #2fc7e0; }

/* Hide scrollbars on the log and chat while keeping them scrollable */
.chatlog, .logsec * { scrollbar-width: none; }
.chatlog::-webkit-scrollbar, .logsec *::-webkit-scrollbar { display: none; }
#log { scrollbar-width: none; }
#log::-webkit-scrollbar { display: none; }

body[data-result="won"] { --bg0: #23a9bf; --bg1: #2096ad; --bg2: #1c7890; --bg3: #185f79; --bg4: #164f6b; --bg5: #14425e; }
body[data-result="lost"] { --bg0: #8a8a8a; --bg1: #777; --bg2: #555; --bg3: #4b4b4b; --bg4: #3a3a3a; --bg5: #2b2b2b; }

/* Lobby inputs: no shadow or focus outline in any state */
.lobby input, .lobby input:focus, .lobby input:focus-visible { box-shadow: none; outline: 0; }
/* Leave-game modal: no dark overlay */
.modal { background: transparent; }
/* Centre the game vertically on tall screens */
@media (min-width: 701px) {
  body { display: flex; flex-direction: column; }
  .shell { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; }
  .shell #app { margin-block: auto; }
}

/* Smooth 300ms log expand/collapse (height animated from fx.ts) */
.logsec.collapsed #log:not(.animating) { display: none; }
.logsec #log.animating { display: block; overflow: hidden; }

/* ---- Mobile (<= 700px): Figma mobile frame. One centred 264px column on the red table, opponent cards 45px, piles 60px, my sets 60px ---- */
@media (max-width: 700px) {
  :root { --mw: min(264px, calc(100vw - 64px)); }
  .shell { padding: 0 0 40px; }

  /* Selected and target cards share the desktop treatment */
  .card.slot.selected, .card.selected { outline: 1.5px solid #E8AA2C; outline-offset: 2px; border-radius: var(--r); box-shadow: none; transform: translateY(-2px); }
  button.card.selected, button.card.selected:hover:not(:disabled) { transform: translateY(-2px); transition: none; }
  .slotrow:has(.slot.selected) .card.slot.target:not(.selected) { outline-color: rgba(232, 170, 44, .5); }
  .dropover { outline: none !important; }
}

/* Mobile header: logo left, Rules right, and the Sound / DEV controls wrap onto their own rows so every control stays tappable */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 0; padding: 12px 16px 0; }
  .topbar .brand { margin-right: 0; }
  .topbar .top-actions { order: 3; flex: 1 0 100%; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .topbar .top-actions .pill { flex: 0 0 auto; }
  #top select.pill { flex: 1 1 140px; max-width: 100%; min-width: 0; }
  .topbar .top-actions button { flex: 0 0 auto; }
}

/* Go Back link on the name form */
.lobby a.goback { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 30px; padding: 7px 16px; border: 1.5px solid #fff; border-radius: 9px; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0; text-decoration: none; }

/* Mobile lobby: 80px logo, 32px title, 24px copy, full-width input and centred buttons, form centred in the screen */
@media (max-width: 700px) {

  .lobby h2 { margin: 0 0 6px; font-size: 32px; line-height: 1.2; }
  .lobby .hint { margin: 0 0 24px; font-size: 24px; line-height: 1.25; opacity: .85; }
  .lobby form { gap: 20px; }
  .lobby form input { margin-bottom: 20px; }
  .lobby form input, .lobby input { width: 100%; max-width: none; height: 60px; min-height: 60px; font-size: 20px; text-align: center; }
  .lobby button, .lobby a.goback { width: 180px; height: 60px; min-height: 60px; padding: 0 24px; font-size: 18px; border-radius: 14px; border-width: 3px; }
  .lobby button { box-shadow: none; }
  .lobby button.goback, .lobby a.goback { box-shadow: none; }

  .lobby button[data-act="copy"] { width: 180px; height: 60px; min-height: 60px; padding: 0 24px; font-size: 18px; border: 3px solid var(--ink); border-radius: 14px; }
  
  .lobby button.goback { border-color: #fff; }
}
/* 16px minimum on every text control so iOS never zooms the page on focus */
@media (max-width: 700px) {
  input, select, textarea, .chatform input { font-size: 16px; }
}

/* Mobile: dashed card highlight follows the card's own corner radius (outline adds the 2px offset on top) */
@media (max-width: 700px) {
  .card.slot.target, .card.slot.draggable, .card.slot.target.draggable { border-radius: var(--r); }
}

/* Help text lives in the player info card only, never above the discard pile */

.lobby .or { display: none; }

/* Mobile lobby, waiting step: one-line title, two-line copy, full-width grouped buttons */
@media (max-width: 700px) {
  .lobby.waiting h2 { font-size: min(5vw, 28px); white-space: nowrap; text-align: center; }
  .lobby.waiting .hint { font-size: min(3.9vw, 18px); line-height: 1.35; white-space: nowrap; text-align: center; margin-bottom: 20px; }
  
  .lobby.waiting button[data-act="copy"] { width: 100%; --btn: var(--green); --btn-ink: var(--ink); box-shadow: none; }

}

/* Chat input row: white icons and placeholder, 50% faded until the input is focused */

.emojipop, .emojipop * { scrollbar-width: none; }
.emojipop::-webkit-scrollbar, .emojipop *::-webkit-scrollbar { display: none; }

/* Controls live at the bottom of the page */
#top { justify-content: center; margin: 32px 0 24px; }

/* Score pill above the piles (desktop) */
.tablesec .score { display: none; }

/* Mobile game layout: 16px page margins, no header, 70px cards, 57px profile cards */
@media (max-width: 700px) {
  :root { --mw: calc(100vw - 32px); }

}

/* Score pill sits in the mobile chat header, between the title and the chevron */
.chathead .score { display: none; }

/* Phones: keep content clear of the notch / status bar and the browser toolbar at the bottom */
@media (max-width: 700px) {
  body { padding-top: env(safe-area-inset-top); }
  .shell { padding-bottom: calc(env(safe-area-inset-bottom) + 90px) !important; }
}

/* Lost player card: red panel, white text, soft pink badge with dark red X */
#app .profile:has(.resultbadge.lost) { background: #a8252b; border-color: transparent; outline: 0; box-shadow: none; }
#app .profile:has(.resultbadge.lost) .pinfo b { color: #fff; }
#app .profile:has(.resultbadge.lost) .pinfo small { color: rgba(255,255,255,.8); }
.resultbadge.lost { background: #ffb0ad; color: #a8252b; }
#app .profile:has(.resultbadge.won) { background: #e6f2d5; }
#app .profile:has(.resultbadge.won) .pinfo b { color: var(--ink); }
#app .profile:has(.resultbadge.won) .pinfo small { color: #77736b; }
/* Circular avatars with oversized emoji overlapping the ring */
#app .avatar { border-radius: 50%; font-size: 40px; line-height: 1; display: flex; align-items: center; justify-content: center; }

/* An exchange: the card coming in slides under the hidden cards, so their row is lifted above the flying cards (see raiseRow in fx.ts) */
.slotrow.over-flyers, .hiddenrow.over-flyers { position: relative; z-index: 60; }

/* ===== Card look from the "Pick pile and hand" design: one shadow for every card, the hidden set's hover, and the stacked draw pile ===== */
:root { --spring: cubic-bezier(.34, 1.5, .64, 1); --ease: cubic-bezier(.2, .8, .2, 1); --card-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 2px 2px rgba(0, 0, 0, .08); }

/* Every card casts the same soft shadow (the deck draws its own, on each card of the stack). :where keeps this weaker than the selected glow */
.card:where(:not(.slotempty):not(.empty):not(.deck)) { box-shadow: var(--card-shadow); border-radius: var(--r); }

/* Hidden set: each card is slightly lifted and enlarged on hover, with a deeper shadow, and settles back with a soft spring */
.hiddenrow .card.slot { transition: translate .6s var(--spring), rotate .6s var(--spring), scale .6s var(--spring), box-shadow .6s var(--spring), outline-color .15s; }
.hiddenrow button.card.slot:hover:not(:disabled) { transform: none; }
@media (hover: hover) {
  .hiddenrow .slotrow:not(:has(.seenpick)) .card.slot:hover:not(.selected) {
    translate: 0 -5px; scale: 1.02; box-shadow: 0 3px 6px rgba(0, 0, 0, .1), var(--card-shadow);
    transition-duration: .45s; transition-timing-function: var(--ease);
  }
  /* Seen: all four cards are being looked at, so hovering the set lifts the whole set together, not one card at a time */
  .slotrow:has(.seenpick):hover .card.slot {
    translate: 0 -5px; scale: 1.02; box-shadow: 0 3px 6px rgba(0, 0, 0, .1), var(--card-shadow);
    transition-duration: .45s; transition-timing-function: var(--ease);
  }
}

/* Draw pile: a stack of cards, each a little higher and further right than the one below. The deck's box is the top card;
   the layers underneath sit down and to the left of it. Hovering pushes up only the top card. */
.card.deck::before, .card.deck::after { content: none !important; }
.card.deck:hover:not(:disabled) { transform: none; }
.card.deck .decklayers { position: absolute; inset: 0; pointer-events: none; }
.card.deck .decklayers i { position: absolute; inset: 0; border-radius: var(--r); background: url(/assets/img/cards/SVG/back.svg) center / 100% 100% no-repeat; box-shadow: var(--card-shadow); translate: calc((var(--i) - var(--n)) * .45%) calc((var(--n) - var(--i)) * 1.2%); }
.card.deck .decktop { position: absolute; inset: 0; display: block; border-radius: var(--r); box-shadow: var(--card-shadow); transition: translate .6s var(--spring), rotate .6s var(--spring), scale .6s var(--spring); }
@media (hover: hover) {
  .card.deck:hover .decktop { translate: 0 -12%; scale: 1.05; rotate: -2deg; transition-duration: .45s; transition-timing-function: var(--ease); }
}
@media (prefers-reduced-motion: reduce) {
  .hiddenrow .card.slot, .card.deck .decktop { transition-duration: .01s !important; }
}

/* While the board shakes (a Canceled card landing) the page is clipped sideways, so the shake can't make it wider than the window and bring in a scrollbar */
html.shaking { overflow-x: clip; }

/* An empty draw pile (while a reshuffle is being acted out) is just an outline where the stack will be; the discard pile's fan can be lifted above flying cards */
.card.deck .decktop.gone { visibility: hidden; }
.card.deck:has(.decktop.gone) { outline: 1.5px dashed rgba(255, 255, 255, .35); outline-offset: -1px; border-radius: var(--r); }
.fan.over-flyers { z-index: 60; }

/* ---- DEV tools: a panel on the page, in the style of a browser's developer tools ---- */

.devtools .dt-bar { display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 8px 0 12px; background: var(--dt-bar); border-bottom: 1px solid var(--dt-line); }
.devtools .dt-name { color: var(--dt-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0; }
.devtools .dt-tabs { display: flex; align-self: stretch; overflow-x: auto; scrollbar-width: none; flex: 1; }
#app .devtools button { all: unset; box-sizing: border-box; cursor: pointer; font: inherit; color: var(--dt-text); }
#app .devtools .dt-tab { display: flex; align-items: center; padding: 0 12px; color: var(--dt-dim); border-bottom: 2px solid transparent; white-space: nowrap; }
#app .devtools .dt-tab:hover { color: var(--dt-text); background: #2a2d2e; }
#app .devtools .dt-tab.on { color: #fff; border-bottom-color: var(--dt-accent); }
#app .devtools .dt-toggle { padding: 2px 8px; border-radius: 3px; color: var(--dt-dim); }
#app .devtools .dt-toggle:hover { background: #3a3d3e; color: #fff; }
.devtools .dt-body { padding: 14px 14px 16px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 18px 32px; }
.devtools .dt-group { min-width: 0; }
.devtools .dt-wide { flex: 1 1 100%; }
.devtools .dt-title { margin-bottom: 6px; color: var(--dt-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0; }
.devtools .dt-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; }
#app .devtools button.dt { padding: 4px 10px; border: 1px solid var(--dt-line); border-radius: 3px; background: #2d2d2d; white-space: nowrap; }
#app .devtools button.dt:hover { background: #37373d; border-color: #555; }
#app .devtools button.dt:active { background: #0e639c; border-color: #0e639c; color: #fff; }
#app .devtools button.dt:disabled { opacity: .4; cursor: default; background: #2d2d2d; }
#app .devtools button.dt.on { background: #0e639c; border-color: #1177bb; color: #fff; }
#app .devtools button:focus-visible, .devtools select:focus-visible { outline: 1px solid var(--dt-accent); outline-offset: 1px; }

.devtools select { font: inherit; color: var(--dt-text); background: #3c3c3c; border: 1px solid var(--dt-line); border-radius: 3px; padding: 3px 6px; max-width: 220px; }
.devtools .dt-matrix { display: grid; grid-template-columns: max-content max-content max-content; gap: 6px 10px; align-items: center; }
.devtools .dt-colhead { color: var(--dt-dim); font-size: 11px; }
.devtools .dt-rowhead { color: #fff; }

#app .devtools .dt-matrix button.dt { min-width: 110px; text-align: center; }
#app .devtools button.dt-opp { padding: 3px 12px; border-radius: 999px; background: #5a1d1d; border: 1px solid #c0392b; color: #fff; white-space: nowrap; font-weight: 600; }
#app .devtools button.dt-opp b { margin-left: 4px; }
#app .devtools button.dt-opp.shown { background: #1d4d2b; border-color: #2ecc71; }
#app .devtools button.dt-opp:hover { filter: brightness(1.2); }

/* Nothing on a card (front or back, in the hand, the piles or flying) can be selected, highlighted or dragged out as text or picture */
.card, .card * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }

/* A phone held sideways (see rotate.ts) */
#rotatenotice { display: none; position: fixed; inset: 0; z-index: 10001; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; background: #190e0e; color: #fffbf5; text-align: center; touch-action: none; }
#rotatenotice.on { display: flex; }
#rotatenotice p { margin: 0; font: 700 18px/24px "Trebuchet MS", system-ui, sans-serif; }

/* A card that lifts on hover keeps its hover: while it is up, an invisible margin round it fills the gap it left, so the cursor at its edge
   does not drop it and lift it again in a loop (the deck lifts only its top picture, so it needs none) */
@media (hover: hover) and (pointer: fine) {
  button.card:not(.deck):hover:not(:disabled)::after, .card.slot:not(.deck):hover::after { content: ""; position: absolute; inset: -16%; }
}
