:root {
  --bg: #161512; --panel: #262421; --line: #3a3733; --text: #bababa; --bright: #e8e6e3;
  --accent: #629924; --hot: #f0c040; --slam: #e0482f;
  --felt: #1f5a37; --felt2: #123821; --wood: #5b3a1e;
  --tile: #f7f3e8; --tile-edge: #bdb39b; --pip: #161616;
  --skin: #8d5524; --skin-shade: #6e4019;
  --t: 34px;  /* half-tile size; boards and hands override it */
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, sans-serif; overflow-x: hidden; }
header { display: flex; align-items: center; gap: 22px; padding: 0 20px; border-bottom: 1px solid var(--line); height: 52px; }
.brand { color: var(--bright); font-weight: 700; font-size: 20px; text-decoration: none; }
.brand span { color: var(--accent); }
.muted { color: #8a8784; } .small { font-size: 13px; } .mt { margin-top: 22px; }
.hidden { display: none !important; }
button, .btn { background: #3a3733; color: var(--bright); border: 0; border-radius: 6px; padding: 10px 14px; font-size: 15px; cursor: pointer; display: inline-block; }
button:hover, .btn:hover { filter: brightness(1.2); }
button.primary { background: var(--accent); }
button.big { padding: 14px; font-size: 17px; width: 100%; margin-bottom: 10px; }
button.ghost { background: transparent; border: 1px solid var(--line); }
input { background: #1f1d1a; border: 1px solid var(--line); color: var(--bright); padding: 8px; border-radius: 6px; width: 100%; margin-top: 4px; font-size: 15px; }
.panel { background: var(--panel); border-radius: 8px; padding: 18px; }
h2, h3 { margin: 0 0 12px; color: var(--bright); font-weight: 500; }
h3 { font-size: 15px; margin-top: 4px; }
.label { margin: 14px 0 6px; font-size: 13px; color: #9a9794; }
.row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- avatars ---------- */
.avatar { width: 46px; height: 46px; border-radius: 50%; background: #2f2c29; display: grid; place-items: center;
  font-size: 28px; overflow: hidden; flex: none; box-shadow: 0 0 0 3px #0004; position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { width: 104px; height: 104px; font-size: 62px; }
.turn .avatar { box-shadow: 0 0 0 3px var(--hot); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #f0c04066; } }

/* ---------- lobby ---------- */
#lobby { display: grid; grid-template-columns: 380px 1fr; gap: 20px; padding: 20px; max-width: 1050px; margin: auto; }
.me { display: flex; gap: 16px; align-items: center; }
.me-fields { flex: 1; }
.emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emojis button { font-size: 24px; padding: 4px; background: #1f1d1a; }
.emojis button.on { outline: 2px solid var(--hot); }
.skins { display: flex; gap: 8px; }
.skins button { width: 32px; height: 32px; border-radius: 50%; padding: 0; }
.skins button.on { outline: 3px solid var(--hot); outline-offset: 2px; }
.games { list-style: none; margin: 0; padding: 0; }
.games li { display: flex; justify-content: space-between; padding: 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.games li:hover { background: #2f2c29; }
.games .empty { cursor: default; color: #8a8784; }

/* ---------- table ---------- */
#table { display: grid; grid-template-columns: 1fr 250px; gap: 14px; padding: 14px; height: calc(100vh - 52px); }
.felt { position: relative; display: grid; border-radius: 18px; padding: 10px; min-height: 0;
  background: radial-gradient(ellipse at center, var(--felt), var(--felt2) 75%);
  border: 12px solid var(--wood); box-shadow: inset 0 0 40px #0008, 0 6px 20px #0008;
  grid-template: "top top top" auto "left board right" 1fr "bottom bottom bottom" 250px / 150px 1fr 150px; gap: 6px; }
.felt.quake { animation: quake .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes quake {
  10% { transform: translate(-6px, 3px) rotate(-.6deg); } 20% { transform: translate(7px, -4px) rotate(.6deg); }
  30% { transform: translate(-8px, 2px) rotate(-.4deg); } 40% { transform: translate(6px, 3px) rotate(.4deg); }
  55% { transform: translate(-4px, -2px); } 70% { transform: translate(3px, 1px); } 85% { transform: translate(-1px, 0); }
}

.seat { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--bright); min-width: 0; }
.seat.top { grid-area: top; } .seat.left { grid-area: left; } .seat.right { grid-area: right; }
.seat.bottom { grid-area: bottom; flex-direction: row; align-items: flex-end; justify-content: center; gap: 24px; }
.plate { display: flex; align-items: center; gap: 10px; background: #0005; padding: 6px 12px 6px 6px; border-radius: 30px; position: relative; }
.plate .who { display: flex; flex-direction: column; line-height: 1.2; }
.plate .nm { font-weight: 600; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.plate .meta { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.pts { background: #000a; padding: 0 8px; border-radius: 10px; font-weight: 700; }
.tag { font-size: 10px; background: #555; padding: 0 5px; border-radius: 3px; }
.clock { font-variant-numeric: tabular-nums; } .clock.low { color: #ff6b6b; font-weight: 700; }
.seat.left .plate, .seat.right .plate { flex-direction: column; border-radius: 14px; padding: 8px; text-align: center; }
.seat.left .plate .who, .seat.right .plate .who { align-items: center; }
.seat.bottom .plate { margin-bottom: 18px; }

.bubble { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 8px; z-index: 30;
  background: #fff; color: #111; font-weight: 900; padding: 6px 12px; border-radius: 14px; white-space: nowrap;
  animation: bubble 1.6s ease-out forwards; font-size: 18px; }
.bubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
@keyframes bubble { 0% { transform: translateX(-50%) scale(.3); opacity: 0; } 15% { transform: translateX(-50%) scale(1.15); opacity: 1; }
  25% { transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* ---------- board ---------- */
.board { grid-area: board; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; min-width: 0; overflow: hidden; }
.handInfo { color: #eef3ee; font-size: 14px; background: #0007; padding: 4px 12px; border-radius: 12px; }
.line { --t: var(--bt, 34px); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px; max-width: 100%; }
.line .tile.hop { animation: hop .45s ease-out; }
@keyframes hop { 30% { transform: translateY(calc(var(--t) * -.35)) rotate(var(--hr, 3deg)); } 60% { transform: translateY(2px); } }

.zone { display: none; align-items: center; justify-content: center; border-radius: 8px; border: 3px dashed #ffffff70;
  min-width: calc(var(--t) * 2.3); min-height: calc(var(--t) * 2.3); color: #fff; font-weight: 800; font-size: calc(var(--t) * .7);
  background: #ffffff10; cursor: pointer; transition: background .15s, transform .15s; }
.line.zones-on .zone.legal { display: inline-flex; animation: glow 1.1s infinite; }
.zone.hot { background: #f0c04055; border-color: var(--hot); transform: scale(1.08); }
.zone.preview { display: inline-flex !important; border-style: solid; border-color: var(--hot); animation: none; }
.zone.preview .tile { opacity: .75; }
@keyframes glow { 50% { border-color: var(--hot); background: #f0c04022; } }

/* ---------- tiles: off-white with depth, an engraved centre line and sunken pips ---------- */
.tile { position: relative; display: flex; flex: none; padding: calc(var(--t) * .07);
  border-radius: calc(var(--t) * .2);
  background:
    radial-gradient(120% 90% at 30% 15%, #fffefb 0%, #fbf8f0 45%, #efe9da 100%);
  box-shadow:
    inset 0 1px 0 #ffffff, inset 0 -1px 2px #0000001a, inset 1px 0 1px #ffffffaa,
    0 1px 0 #e4dcc8, 0 2px 0 #d6ccb4, 0 3px 0 #c9bea4, 0 calc(var(--t) * .12) 0 #bdb196,
    0 calc(var(--t) * .2) calc(var(--t) * .28) #0000004d, 0 1px calc(var(--t) * .06) #00000040; }
.tile.h { flex-direction: row; } .tile.v { flex-direction: column; }
.tile .half { width: var(--t); height: var(--t); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: calc(var(--t) * .1); }
/* engraved bar between the halves: a dark groove with a light lip */
.tile:not(.back)::before { content: ''; position: absolute; border-radius: 2px; pointer-events: none; }
.tile.h:not(.back)::before { left: 50%; top: 14%; bottom: 14%; width: max(2px, calc(var(--t) * .055)); transform: translateX(-50%);
  background: linear-gradient(90deg, #8c836e 0 50%, #ffffff 50% 100%); opacity: .75; }
.tile.v:not(.back)::before { top: 50%; left: 14%; right: 14%; height: max(2px, calc(var(--t) * .055)); transform: translateY(-50%);
  background: linear-gradient(180deg, #8c836e 0 50%, #ffffff 50% 100%); opacity: .75; }
/* pips: sunken, painted black, with a soft highlight on the lower lip */
.cell.pip { border-radius: 50%; margin: 15%;
  background: radial-gradient(circle at 50% 62%, #2a2a2a 0%, #0b0b0b 55%, #000 100%);
  box-shadow: inset 0 calc(var(--t) * .03) calc(var(--t) * .03) #000, 0 1px 0 #ffffffcc; }
/* backs: same off-white with an embossed CT monogram */
.tile.back { width: calc(var(--t) * 1.15); height: calc(var(--t) * 2.15); display: grid; place-items: center; padding: 0; }
.tile.back .logo { font: 800 calc(var(--t) * .5)/1 Georgia, serif; color: #cfc5ad; letter-spacing: -.02em;
  text-shadow: 0 1px 0 #fff, 0 -1px 0 #a99e84; writing-mode: vertical-rl; }
.tile.back::after { content: ''; position: absolute; inset: 12%; border: 1px solid #d9d0bb; border-radius: calc(var(--t) * .12); box-shadow: 0 1px 0 #fff; }

.tile.land { animation: land .25s ease-out; }
@keyframes land { from { transform: translateY(-16px) scale(1.1); opacity: 0; } }
.tile.land-slam { animation: landSlam .42s cubic-bezier(.2,.9,.3,1.3); z-index: 5; }
@keyframes landSlam {
  0% { transform: translateY(-120px) scale(2.2) rotate(-12deg); opacity: .3; }
  55% { transform: translateY(0) scale(.9) rotate(2deg); opacity: 1; }
  75% { transform: scale(1.06); } 100% { transform: none; } }
.tile.land-slam::after { content: ''; position: absolute; inset: -4px; border-radius: 10px; border: 4px solid #fff;
  animation: ring .6s .2s ease-out forwards; opacity: 0; pointer-events: none; }
@keyframes ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }

/* ---------- your hand ---------- */
.rack { position: relative; width: 520px; height: 240px; flex: none; }
.rack .handwrap { position: absolute; inset: 0; animation: breathe 3.6s ease-in-out infinite; transform-origin: 50% 100%; }
.rack.myturn .handwrap { animation: breathe 3.6s ease-in-out infinite, lift .4s ease-out forwards; }
@keyframes breathe { 50% { rotate: -1.4deg; translate: 0 -3px; } }
@keyframes lift { to { top: -14px; } }
.rack svg.hand-back, .rack svg.hand-front { position: absolute; left: 50%; bottom: -28px; width: 300px; transform: translateX(-50%); pointer-events: none; }
.rack svg.hand-front { z-index: 20; }
.fan { position: absolute; inset: 0; --t: 44px; }
.slot { position: absolute; left: 50%; bottom: 44px; transform-origin: 50% 120%; transition: transform .25s; }
.slot .tile { cursor: grab; touch-action: none; animation: bob 2.8s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes bob { 50% { translate: 0 -3px; } }
.slot .tile.legal { outline: 3px solid var(--hot); outline-offset: 1px; }
.slot .tile.dim { filter: brightness(.88) saturate(.7); opacity: .82; cursor: default; }
.slot:hover:has(.legal) { z-index: 15; }
.slot:has(.legal):hover .tile, .slot.sel .tile { translate: 0 -22px; animation: none; }
.slot.sel .tile { outline: 4px solid #fff; outline-offset: 1px; filter: drop-shadow(0 0 10px var(--hot)); }
.slot.dragging .tile { opacity: .25; animation: none; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) rotate(-4deg) scale(1.08); filter: drop-shadow(0 12px 14px #000a); --t: 44px; }

/* opponents: small fanned backs */
.ofan { position: relative; --t: 13px; width: 120px; height: 46px; }
.seat.left .ofan, .seat.right .ofan { width: 46px; height: 120px; }
.ofan .tile { position: absolute; left: 50%; top: 50%; }
.ofan.open { --t: 11px; }

/* ---------- prompt ---------- */
.prompt { position: absolute; z-index: 40; display: flex; gap: 8px; padding: 8px; background: #111d; border-radius: 12px;
  box-shadow: 0 8px 24px #000a; transform: translate(-50%, -100%); animation: pop .15s ease-out; }
.prompt button { font-weight: 700; padding: 12px 18px; font-size: 16px; }
.slam-btn { background: var(--slam); letter-spacing: 1px; }
.slam-btn:hover { animation: jitter .15s infinite; }
@keyframes jitter { 25% { transform: translate(-1px, 1px) rotate(-1deg); } 75% { transform: translate(1px, -1px) rotate(1deg); } }
@keyframes pop { from { transform: translate(-50%, -100%) scale(.7); opacity: 0; } }

/* ---------- overlay & side ---------- */
.overlay { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: #000c; border-radius: 6px; color: var(--bright); text-align: center; padding: 20px; --t: 17px; }
.overlay .big { font-size: 32px; font-weight: 800; }
.overlay .sixlove { font-size: 54px; color: var(--hot); letter-spacing: 3px; font-weight: 900; animation: pop .4s; }
.overlay .reveal { display: grid; grid-template-columns: auto auto auto auto; gap: 8px 14px; align-items: center; text-align: left; }
.overlay .reveal .tiles { display: flex; gap: 4px; }
.overlay .avatar { width: 34px; height: 34px; font-size: 20px; }
.overlay .choice { display: flex; gap: 10px; }

.side { display: flex; flex-direction: column; min-height: 0; }
.scores { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.scores td { padding: 4px; border-bottom: 1px solid var(--line); }
.scores td:first-child { width: 26px; font-size: 18px; }
.scores td:last-child { text-align: right; font-weight: 700; color: var(--bright); }
.log { flex: 1; overflow: auto; margin: 0 0 12px; padding-left: 38px; font-family: ui-monospace, monospace; font-size: 13px; }
.log li { padding: 1px 0; } .log .pass { color: #8a8784; } .log .auto { color: #e0a050; } .log .slammed { color: #ff8a70; font-weight: 700; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #b33; color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 2000; }

@media (max-width: 900px) {
  #lobby { grid-template-columns: 1fr; }
  #table { grid-template-columns: 1fr; height: auto; }
  .felt { grid-template-columns: 70px 1fr 70px; grid-template-rows: auto minmax(300px, 1fr) 210px; min-height: 86vh; border-width: 6px; }
  .seat.bottom { gap: 4px; }
  .seat.bottom .plate { position: absolute; left: 0; bottom: 0; margin: 0; z-index: 25; padding: 3px 8px 3px 3px; }
  .seat.bottom .plate .avatar { width: 32px; height: 32px; font-size: 18px; }
  .seat.bottom .plate .nm { display: none; }
  .rack { width: 100%; max-width: 420px; }
  .fan { --t: 30px; }
  .slot { bottom: 40px; }
  .rack svg.hand-back, .rack svg.hand-front { width: 240px; bottom: -20px; }
  .seat.left .plate .who, .seat.right .plate .who { display: none; }
}

/* ---------- modes, teams, table themes ---------- */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; background: #1f1d1a; padding: 4px; border-radius: 8px; }
.modes button { background: transparent; padding: 10px 6px; line-height: 1.15; }
.modes button small { display: block; font-size: 11px; color: #9a9794; }
.modes button.on { background: #3d3a36; box-shadow: inset 0 0 0 2px var(--accent); }
.tables { display: flex; gap: 8px; }
.tables button { width: 54px; height: 34px; border-radius: 6px; padding: 0; border: 3px solid #0000; }
.tables button.on { outline: 3px solid var(--hot); outline-offset: 2px; }
.mode-tag { font-size: 11px; background: #3d3a36; padding: 1px 6px; border-radius: 4px; margin-right: 6px; }
.plate.team-0 { box-shadow: inset 0 0 0 2px #f0c040; }
.plate.team-1 { box-shadow: inset 0 0 0 2px #4aa3ff; }
.tag.partner { background: #2e7d32; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot.team-0 { background: #f0c040; } .dot.team-1 { background: #4aa3ff; }
.scores .team td:first-child { width: auto; font-size: 14px; }

/* ---------- navigation & accounts ---------- */
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a { color: var(--text); text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.mainnav a:hover, .mainnav a.on { background: #2f2c29; color: var(--bright); }
header .right { display: flex; align-items: center; gap: 12px; }
#userBox { display: flex; gap: 8px; align-items: center; }
button.small, .btn.small { padding: 6px 10px; font-size: 13px; }
a { color: #8fc3ff; }
.ulink { color: inherit; text-decoration: none; font-weight: 600; } .ulink:hover { text-decoration: underline; }
.me-link { display: flex; align-items: center; gap: 8px; color: var(--bright); }
.avatar.sm { width: 26px; height: 26px; font-size: 15px; box-shadow: none; }
.avatar.empty { color: #777; font-size: 22px; border: 2px dashed #555; background: none; }
.error { color: #ff7b72; min-height: 1em; }
.toast.ok { background: #2e7d32; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.seeking { background: #b8860b; }
button.danger, .danger { color: #ff8a80; }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.tag.danger { background: #8b1e1e; color: #fff; }
.tag.away { background: #7a5b00; }
.rated-tag { font-size: 11px; color: #f0c040; margin-left: 8px; }
.live-tag { background: #c62828; color: #fff; font-weight: 800; font-size: 11px; padding: 1px 6px; border-radius: 4px; animation: pulse2 1.5s infinite; }
@keyframes pulse2 { 50% { opacity: .55; } }
.ok-tag { color: #81c784; font-weight: 600; }
.online-dot { color: #66bb6a; font-size: 14px; margin-left: 10px; font-weight: 400; }
.plate .rt { color: #f0c040; font-weight: 400; font-size: 12px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 22px; width: min(420px, 92vw); }
dialog::backdrop { background: #000a; }
dialog form label { display: block; margin-bottom: 12px; }
dialog select, .grid-form select { width: 100%; background: #1f1d1a; color: var(--bright); border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-top: 4px; font-size: 15px; }
label.check { display: flex !important; gap: 8px; align-items: center; } label.check input { width: auto; margin: 0; }

/* ---------- waiting room ---------- */
#waiting { padding: 20px; }
.waitroom { max-width: 760px; margin: auto; display: flex; flex-direction: column; gap: 14px; }
.invite { display: flex; gap: 8px; } .invite input { margin: 0; }
.wseats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.wseat { background: #1f1d1a; border-radius: 10px; padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-height: 170px; border: 2px solid transparent; }
.wseat.mine { border-color: var(--accent); }
.wseat.team-0 { box-shadow: inset 0 3px 0 #f0c040; } .wseat.team-1 { box-shadow: inset 0 3px 0 #4aa3ff; }
.wlabel { font-size: 12px; color: #8a8784; }
.wname { color: var(--bright); font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; }

/* ---------- game side panel: tabs, chat, shouts ---------- */
#gameMeta { margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; margin: 6px 0 8px; }
.tabs button { flex: 1; padding: 6px; background: #1f1d1a; font-size: 13px; }
.tabs button.on { background: #3d3a36; box-shadow: inset 0 -2px 0 var(--accent); }
.tabs.wide { flex-wrap: wrap; } .tabs.wide button { flex: none; padding: 8px 14px; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chatlog { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 0; font-size: 14px; min-height: 80px; }
.chatlog li { padding: 3px 2px; word-wrap: break-word; position: relative; }
.chatlog li.sys { color: #8a8784; font-style: italic; }
.chatlog .report { display: none; position: absolute; right: 0; top: 0; padding: 0 6px; background: none; color: #8a8784; }
.chatlog li:hover .report { display: inline; }
.shouts { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.shouts .shout { font-size: 12px; padding: 4px 7px; background: #1f1d1a; }
.chatform { display: flex; gap: 6px; } .chatform input { margin: 0; } .chatform button { padding: 8px 12px; }
.side .row { margin-top: 8px; }
.rdiffs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rdiff { padding: 4px 10px; border-radius: 12px; background: #333; } .rdiff.up { color: #81c784; } .rdiff.down { color: #ff8a80; }

/* ---------- pages ---------- */
#page { padding: 20px; }
.pagewrap { max-width: 1000px; margin: auto; }
table.list { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.list th { text-align: left; color: #8a8784; font-weight: 500; font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 8px; border-bottom: 1px solid #312e2b; vertical-align: middle; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover { background: #2f2c29; }
table.list td.who { display: flex; gap: 8px; align-items: center; }
table.list .btns { display: flex; gap: 4px; flex-wrap: wrap; }
.strong { color: var(--bright); font-weight: 700; } .rank { width: 40px; }
.win { color: #81c784; } .loss { color: #ff8a80; }
.phead { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; } .phead h2 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; }
.rcards { display: flex; gap: 12px; flex-wrap: wrap; }
.rcard { background: #1f1d1a; border-radius: 10px; padding: 14px 18px; min-width: 180px; }
.rbig { font-size: 34px; font-weight: 800; color: var(--bright); }
.tcols { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-top: 12px; }
.createbox { background: #1f1d1a; padding: 12px; border-radius: 8px; margin: 12px 0; }
.createbox summary { cursor: pointer; color: var(--bright); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; margin-top: 10px; }

/* replay */
.rhead h2 { margin-bottom: 4px; }
.rplayers { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.rplayer { display: flex; align-items: center; gap: 6px; background: #1f1d1a; padding: 4px 10px 4px 4px; border-radius: 20px; }
.rplayer.team-0 { box-shadow: inset 0 0 0 2px #f0c040; } .rplayer.team-1 { box-shadow: inset 0 0 0 2px #4aa3ff; }
.handtabs button { font-size: 12px; }
.rboard { display: grid; grid-template: "top top top" auto "left center right" minmax(180px, auto) "bottom bottom bottom" auto / 150px 1fr 150px;
  gap: 8px; padding: 12px; border-radius: 14px; border: 10px solid var(--wood); background: radial-gradient(ellipse at center, var(--felt), var(--felt2) 75%); }
.rseat { display: flex; flex-direction: column; align-items: center; gap: 6px; --t: 15px; padding: 6px; border-radius: 8px; }
.rseat.top { grid-area: top; } .rseat.bottom { grid-area: bottom; } .rseat.left { grid-area: left; } .rseat.right { grid-area: right; }
.rseat.active { background: #0004; box-shadow: 0 0 0 2px var(--hot); }
.rseat.team-0 .rlabel { box-shadow: inset 0 0 0 2px #f0c040; } .rseat.team-1 .rlabel { box-shadow: inset 0 0 0 2px #4aa3ff; }
.rlabel { display: flex; gap: 6px; align-items: center; background: #0006; color: #fff; padding: 3px 10px 3px 3px; border-radius: 14px; font-size: 13px; }
.rtiles { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.rseat.left .rtiles, .rseat.right .rtiles { max-width: 110px; }
.rcenter { grid-area: center; display: flex; align-items: center; justify-content: center; }
.rline { --t: 20px; }
.rline .tile.last { outline: 3px solid var(--hot); outline-offset: 1px; }
.rcaption { margin: 10px 0; color: var(--bright); min-height: 1.4em; }
.rcontrols { display: flex; gap: 6px; }
.rcontrols button { min-width: 48px; }

@media (max-width: 900px) {
  header { gap: 10px; padding: 0 10px; } .mainnav a { padding: 6px; font-size: 13px; } #status { display: none; }
  .brand span { display: none; }
  .wseats { grid-template-columns: 1fr 1fr; }
  .tcols { grid-template-columns: 1fr; }
  .rboard { grid-template-columns: 70px 1fr 70px; } .rseat { --t: 10px; }
  .side { display: flex; } #table .side { order: 2; }
}

/* ---------- shuffle & draw ---------- */
.dealarea { position: absolute; inset: 0; z-index: 3; touch-action: none; }
.board { position: relative; }
.dealarea .dtile { position: absolute; --t: 17px; transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  transition: left .45s cubic-bezier(.3,.7,.4,1), top .45s cubic-bezier(.3,.7,.4,1), transform .45s, opacity .4s; }
.dealarea.shuffling { cursor: grab; }
.dealarea.washing { cursor: grabbing; }
.dealarea.washing .dtile { transition-duration: .38s; }
.dealarea.drawing .dtile { transition-duration: .6s; }
.dealarea .dtile.can { cursor: pointer; box-shadow: 0 0 0 2px #f0c04099, 0 3px 6px #0008; }
.dealarea .dtile.can:hover { transform: translate(-50%, -58%) rotate(var(--r, 0deg)) scale(1.12); box-shadow: 0 0 0 3px var(--hot), 0 6px 10px #0009; z-index: 5; }
.dealarea .dtile.taken { opacity: 0; pointer-events: none; }
.dealarea .dtile.to-bottom { top: 115% !important; } .dealarea .dtile.to-top { top: -15% !important; }
.dealarea .dtile.to-left { left: -15% !important; } .dealarea .dtile.to-right { left: 115% !important; }
.shufflectl { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 12px; align-items: center;
  background: #000a; padding: 8px 12px; border-radius: 12px; }
.tag.shuffler { background: #6a4bc4; }
.handInfo b { color: var(--hot); }

/* reveal: your tiles flip into your hand */
.rack.reveal .slot .tile { animation: flipIn .55s cubic-bezier(.2,.8,.3,1.2) var(--fd, 0s) backwards, bob 2.8s ease-in-out var(--d, 0s) infinite; }
@keyframes flipIn { 0% { transform: rotateY(90deg) translateY(-30px) scale(.6); filter: brightness(.4); } 100% { transform: none; } }

/* winning slams */
.prompt.winning { flex-wrap: wrap; max-width: 520px; justify-content: center; }
.slam-btn.x2 { background: #c2185b; } .slam-btn.x3 { background: #8e24aa; }
.slam-btn.x4 { background: linear-gradient(90deg, #ff6f00, #d50000); animation: jitter .2s infinite; }
.line .tile.knock { transition: transform .35s cubic-bezier(.2,.9,.3,1.4); }
.line .tile.scatter { transition: transform .9s cubic-bezier(.15,.9,.25,1.05); }
.felt.quake-big { animation: quakeBig .9s cubic-bezier(.36,.07,.19,.97); }
@keyframes quakeBig {
  8% { transform: translate(-14px, 8px) rotate(-1.6deg); } 16% { transform: translate(16px, -10px) rotate(1.8deg); }
  26% { transform: translate(-16px, 6px) rotate(-1.4deg); } 36% { transform: translate(14px, 8px) rotate(1.2deg); }
  48% { transform: translate(-10px, -6px) rotate(-.8deg); } 60% { transform: translate(8px, 4px) rotate(.5deg); }
  74% { transform: translate(-4px, -2px); } 88% { transform: translate(2px, 1px); } }
.bubble.big { font-size: 24px; background: #ffeb3b; }
.bubble.huge { font-size: 30px; background: linear-gradient(90deg, #ffeb3b, #ff9800); animation-duration: 2.6s; }
.slam-2, .slam-3, .slam-4 { z-index: 6; }

.handInfo { position: relative; z-index: 7; }
.board.scattered { overflow: visible; z-index: 8; }
