/* Süper 51 · "Kahvehane gecesi" arayüzü — v0.3.0 */
:root {
  --night: #071510;
  --felt-1: #23735a; --felt-2: #14503e; --felt-3: #0a2c22;
  --wood-1: #4a2d1b; --wood-2: #2a170d; --wood-3: #1a0e07;
  --brass: #d6aa55; --gold: #f0cf86; --gold-deep: #a97a26;
  --cream: #f7f0df; --paper: #fbf7ec; --ink: #1d2230; --muted: #6d6a60;
  --red: #c4283a; --mint: #7fd1b0;
  --text: #f5ecd6; --text-dim: rgba(245, 236, 214, .62);
  --glass: rgba(255, 255, 255, .07); --glass-line: rgba(255, 255, 255, .12);
  --radius: 18px;
  --font: "Segoe UI Variable Text", "Segoe UI", "SF Pro Text", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--night);
  background-image: radial-gradient(120% 80% at 50% 0%, #163a2e 0%, var(--night) 60%);
  overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1em; height: 1em; }
.hud svg, .act svg, .big-btn svg, .small-btn svg, .hud-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#i-play, .big-btn svg use[href="#i-play"] { fill: currentColor; }
.suit-icon { width: .95em; height: .95em; vertical-align: -.12em; fill: #22293a; }
.suit-icon.red { fill: var(--red); }
.hud .suit-icon:not(.red), .table .suit-icon:not(.red), .toast .suit-icon:not(.red), .lobby .suit-icon:not(.red) { fill: #e9e3d2; }

/* ---------- cards ---------- */
.card {

  position: relative; display: inline-block; flex: none; width: var(--cw, 64px); height: calc(var(--cw, 64px) * 1.4);
  border-radius: calc(var(--cw, 64px) * .075); padding: 0; border: 0; background: none;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 3px 8px rgba(0, 0, 0, .22);
}
.card-svg { display: block; width: 100%; height: 100%; }
.card-svg .c-rank { font-family: "Segoe UI", "SF Pro Display", Roboto, Arial, sans-serif; font-weight: 800; }
.card-svg .c-caption { font: 700 6px var(--font); letter-spacing: 1.2px; }
.card-svg .c-back-num { font: 700 21px var(--display); fill: var(--gold); }
.card.is-wild { box-shadow: 0 0 0 2px var(--brass), 0 0 14px rgba(240, 207, 134, .55), 0 3px 8px rgba(0, 0, 0, .3); }
.c-badge {
  position: absolute; display: flex; align-items: center; gap: 1px; padding: 1px 4px; border-radius: 99px;
  font: 800 calc(var(--cw, 64px) * .14)/1.25 var(--font); letter-spacing: .02em; pointer-events: none; white-space: nowrap;
}
.c-badge.okey { right: 6%; top: 4%; color: #3b2a07; background: linear-gradient(135deg, var(--gold), var(--brass)); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.c-badge.fake { right: 6%; bottom: 4%; background: #fff; color: var(--ink); box-shadow: 0 0 0 1px #d8cdb4; }
.c-badge.fake.red { color: var(--red); }
.c-badge svg { width: 1em; height: 1em; fill: currentColor; }
.card.mini { --cw: 26px; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.card.mini .c-badge { display: none; }

/* ---------- app shell ---------- */
.app {
  height: 100dvh; max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding-top: var(--safe-top);
}
.hud { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px; }
.hud-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--glass-line); font-size: 20px; transition: background .2s;
}
.hud-btn:hover { background: rgba(255, 255, 255, .12); }
.hud-center { flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px; min-width: 0; }
.hud-round, .hud-yer {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--glass-line); font-size: 13px; white-space: nowrap;
}
.hud-round small { font-size: 10px; letter-spacing: .14em; color: var(--text-dim); font-weight: 700; }
.hud-round b { font-weight: 800; }
.hud-yer .mult { color: var(--gold); font-weight: 800; }
.hud-yer b { font-weight: 650; }

/* ---------- table ---------- */
.table {
  position: relative; margin: 6px 10px 8px; min-height: 250px; border-radius: 34px;
  container-type: inline-size;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(90% 75% at 50% 45%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%);
  box-shadow:
    inset 0 0 0 7px var(--wood-2), inset 0 0 0 8px rgba(214, 170, 85, .55), inset 0 0 0 10px var(--wood-3),
    inset 0 18px 50px rgba(0, 0, 0, .45), inset 0 -10px 40px rgba(0, 0, 0, .35),
    0 14px 30px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.table::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 7px solid transparent;
  background: linear-gradient(160deg, #6b4128, var(--wood-2) 40%, #3a2212 70%, var(--wood-3)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.felt-mark {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); pointer-events: none;
  font: 700 clamp(120px, 42cqw, 320px)/1 var(--display); color: rgba(255, 255, 255, .035); letter-spacing: -.04em;
}

/* seats */
.seats { position: absolute; inset: 0; pointer-events: none; }
.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: auto; }
.seat.top { top: 16px; left: 50%; transform: translateX(-50%); flex-direction: row; gap: 10px; }
.seat.left { left: 14px; top: 46%; transform: translateY(-50%); }
.seat.right { right: 14px; top: 46%; transform: translateY(-50%); }
.seat-info { display: flex; align-items: center; gap: 8px; }
.seat.left .seat-info, .seat.right .seat-info { flex-direction: column; gap: 4px; text-align: center; }
.seat-text { display: flex; flex-direction: column; line-height: 1.2; }
.seat-text strong { font-size: 13px; font-weight: 700; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-text small { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.seat-text small b { color: var(--text); }
.level { font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mint); opacity: .85; }
.level.hard { color: #ff9b8a; } .level.easy { color: #a9c7ff; }
.seat-fan { position: relative; width: 56px; height: 40px; }
.seat-fan > span { position: absolute; left: 50%; bottom: 0; transform-origin: 50% 120%; transform: translateX(-50%) rotate(calc(var(--i) * 13deg)); }
.seat-fan .card.mini { --cw: 26px; }
.seat.current .seat-text strong { color: var(--gold); }

.avatar {
  --c: var(--brass); position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%;
  font-weight: 800; font-size: 17px; color: #1b1407;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, white), var(--c) 70%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 4px 10px rgba(0, 0, 0, .35);
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar .ring { position: absolute; inset: -5px; border-radius: 50%; opacity: 0; transition: opacity .3s; }
.seat.current .avatar .ring {
  opacity: 1; background: conic-gradient(var(--gold), transparent 35%, transparent 65%, var(--gold));
  -webkit-mask: radial-gradient(circle, transparent 23px, #000 24px); mask: radial-gradient(circle, transparent 23px, #000 24px);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
.bubble {
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, 4px); margin-top: 2px;
  padding: 5px 10px; border-radius: 99px; background: var(--cream); color: var(--ink); font-size: 11.5px; font-weight: 650; white-space: nowrap;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; z-index: 5;
}
.bubble .suit-icon:not(.red) { fill: var(--ink); }
.seat.top .bubble { top: auto; bottom: -32px; }
.bubble.show { animation: bubble 2s ease forwards; }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.9); } 12%, 75% { opacity: 1; transform: translate(-50%, 4px) scale(1); } 100% { opacity: 0; transform: translate(-50%, 0) scale(.96); } }

/* center piles */
.center {
  --pw: clamp(56px, 15cqw, 104px);
  position: absolute; left: 50%; top: 53%; transform: translate(-50%, -50%);
  display: flex; align-items: flex-start; gap: clamp(14px, 5cqw, 36px);
}
.pile-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pile-label { font-size: 11px; font-weight: 650; color: var(--text-dim); white-space: nowrap; letter-spacing: .02em; }
.pile-label.gold { color: var(--gold); }
.stock-wrap { position: relative; width: var(--pw); height: calc(var(--pw) * 1.4); }
.indicator-card { position: absolute; left: 34%; top: 30%; transform: rotate(90deg); transform-origin: 50% 50%; }
.indicator-card .card { --cw: var(--pw); box-shadow: 0 4px 10px rgba(0, 0, 0, .4); }
.stock, .discard, .okey-ref { position: relative; padding: 0; border: 0; background: none; display: block; }
.stock { width: var(--pw); height: calc(var(--pw) * 1.4); border-radius: calc(var(--pw) * .075); }
.stock .card { --cw: var(--pw); position: absolute; left: 0; top: 0; }
.stock .stack-1 { transform: translate(3px, 3px); } .stock .stack-2 { transform: translate(1.5px, 1.5px); }
.stock .top { transition: transform .2s; }
.stock-count {
  position: absolute; top: -9px; right: -12px; z-index: 3; min-width: 28px; height: 22px; padding: 0 7px; border-radius: 99px;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 800; color: #2a1c05; background: linear-gradient(135deg, var(--gold), var(--brass));
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.discard { width: var(--pw); height: calc(var(--pw) * 1.4); border-radius: calc(var(--pw) * .075); }
.discard .card { --cw: var(--pw); position: absolute; left: 0; top: 0; transform: rotate(var(--r, 0deg)); }
.discard .card.top { transform: rotate(calc(var(--r, 0deg) / 3)); }
.discard .empty, .stock .empty {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; font-size: 11px; color: var(--text-dim);
  border: 1.5px dashed rgba(255, 255, 255, .25);
}
.okey-ref .card { --cw: calc(var(--pw) * .78); }
.okey-ref { margin-top: calc(var(--pw) * .15); border-radius: 8px; }
.okey-ref::after {
  content: "?"; position: absolute; right: -8px; bottom: -8px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--ink); background: var(--cream); box-shadow: 0 2px 5px rgba(0, 0, 0, .4);
}
.arriving { visibility: hidden; }

body[data-stage="draw"] .stock:not(:disabled) .top,
body[data-stage="draw"] .discard:not(:disabled) .card.top { animation: invite 1.8s ease-in-out infinite; }
@keyframes invite { 0%, 100% { box-shadow: 0 0 0 2px rgba(240, 207, 134, .0), 0 4px 10px rgba(0, 0, 0, .35); } 50% { box-shadow: 0 0 0 3px rgba(240, 207, 134, .85), 0 0 22px rgba(240, 207, 134, .45); } }
body[data-stage="draw"] .stock:not(:disabled):hover .top { transform: translateY(-4px); }
.hinted .card.top, .stock.hinted .top { animation: hinted .5s ease-in-out 4 !important; }
@keyframes hinted { 50% { transform: translateY(-8px) scale(1.06); box-shadow: 0 0 0 4px var(--gold), 0 0 30px rgba(240, 207, 134, .8); } }
.discard.drop-ready .card.top, .discard.drop-ready .empty { box-shadow: 0 0 0 4px var(--gold), 0 0 34px rgba(240, 207, 134, .9); transform: scale(1.08); transition: .15s; }

.table-msg {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 7px 14px; border-radius: 99px; background: rgba(0, 0, 0, .38); border: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(4px);
}
.table-msg b { color: var(--text); font-weight: 700; }
.table-msg b.gold { color: var(--gold); }

/* ---------- my area ---------- */
.me {
  container-type: inline-size; position: relative;
  padding: 10px 10px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, #2f1c10 0%, #22140b 40%, #170d06 100%);
  border-radius: 26px 26px 0 0;
  box-shadow: inset 0 1px 0 rgba(214, 170, 85, .5), 0 -10px 30px rgba(0, 0, 0, .45);
}
.me-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 0 4px; }
.me-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.me-id strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-id small { font-size: 11.5px; color: var(--text-dim); }
.me-avatar { --c: var(--brass); width: 36px; height: 36px; font-size: 15px; }
.me-stat { display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: baseline; text-align: right; }
.me-stat small { grid-column: 1 / -1; font-size: 9.5px; letter-spacing: .14em; color: var(--text-dim); font-weight: 700; }
.me-stat strong { font-size: 22px; line-height: 1; font-weight: 800; color: var(--gold); }
.me-stat em { font-style: normal; font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.me-stat em b { color: #ffb4a6; }
.mode-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 99px; background: rgba(0, 0, 0, .4); border: 1px solid var(--glass-line); }
.mode-switch::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 99px; background: linear-gradient(135deg, var(--gold), var(--brass)); transition: transform .25s cubic-bezier(.3, .7, .2, 1); }
.mode-switch.pairs::before { transform: translateX(100%); }
.mode-switch button { position: relative; z-index: 1; border: 0; background: none; padding: 7px 13px; font-size: 12.5px; font-weight: 750; color: var(--text-dim); }
.mode-switch button[aria-checked="true"] { color: #2a1c05; }

.progress { display: flex; align-items: center; gap: 10px; padding: 8px 6px 2px; font-size: 11.5px; color: var(--text-dim); }
.progress b { color: var(--text); }
.progress .bar { flex: 0 0 72px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.progress .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--gold)); transition: width .35s; }
.progress .pips { display: flex; gap: 4px; }
.progress .pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.progress .pips i.on { background: var(--gold); box-shadow: 0 0 6px rgba(240, 207, 134, .6); }
.progress .pips i.gate { outline: 1.5px solid var(--mint); outline-offset: 1.5px; }

.rack {
  --cw: clamp(44px, calc((100cqw - 26px) / 6.5), 96px);
  --ov: calc(var(--cw) * -.3);
  display: flex; flex-wrap: wrap; align-items: flex-end; align-content: flex-start;
  row-gap: 6px; padding: 4px 4px 6px calc(var(--cw) * .3 + 4px);
  min-height: calc(var(--cw) * 2.8 + 46px);
  margin-top: 4px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .28), rgba(0, 0, 0, .12));
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .5), inset 0 -1px 0 rgba(214, 170, 85, .18);
}
.meld { display: flex; flex-direction: column; margin: 0 calc(var(--cw) * .38) 0 var(--ov); }
.meld-tag {
  height: 17px; padding: 0 2px 3px; font-size: 10.5px; font-weight: 750; color: var(--gold); white-space: nowrap; letter-spacing: .02em;
  display: flex; align-items: center; gap: 3px;
}
.meld-tag .suit-icon:not(.red) { fill: #e9e3d2; }
.meld-tag .suit-icon.red { fill: #ff7d8a; }
.loose-tag { color: var(--text-dim); }
.meld-cards {
  display: flex; padding: 3px; border-radius: 10px;
  background: rgba(240, 207, 134, .1); box-shadow: inset 0 0 0 1px rgba(240, 207, 134, .4);
}
.meld.pair .meld-cards { background: rgba(127, 209, 176, .1); box-shadow: inset 0 0 0 1px rgba(127, 209, 176, .45); }
.meld.pair .meld-tag { color: var(--mint); }
.meld-cards .card + .card { margin-left: calc(var(--cw) * -.52); }
.loose { display: flex; flex-direction: column; margin-left: var(--ov); padding-top: 17px; position: relative; }
.loose.first { padding-top: 0; }
.meld + .loose.first { margin-left: 0; }
.loose.free { padding-top: 0; }
.rack.manual { padding-top: 10px; row-gap: 10px; }
.rack .card {
  cursor: pointer; touch-action: none; transition: transform .18s cubic-bezier(.3, .7, .2, 1), box-shadow .18s;
  box-shadow: -2px 0 6px rgba(0, 0, 0, .28), 0 3px 6px rgba(0, 0, 0, .3);
}
.rack .card:hover { transform: translateY(-5px); }
.rack .card.selected { transform: translateY(-16%); z-index: 4; box-shadow: 0 0 0 2.5px var(--gold), 0 12px 20px rgba(0, 0, 0, .45); }
.rack .card.in-meld::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: -5px; height: 3px; border-radius: 99px; background: var(--mint); }
.rack .meld-cards .card.in-meld::after { display: none; }
.rack .card.new::before {
  content: "YENİ"; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); z-index: 2;
  padding: 1px 6px; border-radius: 99px; font-size: 9px; font-weight: 800; letter-spacing: .08em; color: #2a1c05; background: var(--gold);
}
.rack .card.can-finish { animation: can-finish 1.4s ease-in-out infinite; }
@keyframes can-finish { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 20px rgba(240, 207, 134, .9); } }
.rack .card.dragging { z-index: 60; pointer-events: none; transition: none; box-shadow: 0 22px 36px rgba(0, 0, 0, .55), 0 0 0 2px var(--gold); }
.rack .card.drop-target { box-shadow: -5px 0 0 var(--mint), 0 3px 6px rgba(0, 0, 0, .3); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

.actions { display: grid; grid-template-columns: 1fr 1fr 2.2fr 1.3fr; gap: 8px; margin-top: 10px; }
body.left-handed .actions { direction: rtl; }
body.left-handed .actions .act { direction: ltr; }
.act {
  display: flex; align-items: center; justify-content: center; gap: 7px; height: 50px; border-radius: 16px; border: 1px solid var(--glass-line);
  background: var(--glass); font-size: 14px; font-weight: 750; transition: transform .12s, background .2s, opacity .2s, box-shadow .2s;
}
.act svg { width: 20px; height: 20px; flex: none; }
.act:active:not(:disabled) { transform: scale(.96); }
.act:disabled { opacity: .38; }
.act.ghost { flex-direction: column; gap: 2px; font-size: 10.5px; font-weight: 700; color: var(--text-dim); }
.act.ghost svg { color: var(--text); }
.act.primary { background: linear-gradient(180deg, #fff6df, #e8d3a3); color: #2a1c05; border-color: rgba(255, 255, 255, .5); box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.act.primary:disabled { background: rgba(255, 255, 255, .1); color: var(--text); border-color: var(--glass-line); box-shadow: none; }
.act.finish { background: linear-gradient(135deg, #f5d98f, #c99a3b 55%, #9a6d1e); color: #2a1c05; border-color: rgba(255, 230, 170, .6); }
.act.finish:disabled { background: rgba(255, 255, 255, .06); color: var(--text); border-color: var(--glass-line); }
.act.finish.glow:disabled { opacity: .7; box-shadow: 0 0 0 1px rgba(240, 207, 134, .6); }
.act.finish:not(:disabled) { animation: finish-pulse 1.3s ease-in-out infinite; }
@keyframes finish-pulse { 50% { box-shadow: 0 0 0 3px rgba(240, 207, 134, .45), 0 0 26px rgba(240, 207, 134, .7); } }

/* ---------- lobby ---------- */
.lobby {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  padding: calc(24px + var(--safe-top)) 22px calc(18px + var(--safe-bottom));
  background:
    radial-gradient(70% 50% at 50% 30%, rgba(35, 115, 90, .9), transparent 70%),
    radial-gradient(120% 90% at 50% 100%, #1b0f07, transparent 60%),
    var(--night);
  opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
  overflow: hidden auto;
}
body.lobby-open .lobby { opacity: 1; visibility: visible; }
.lobby-glow { position: absolute; width: 480px; height: 480px; top: 6%; left: 50%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle, rgba(240, 207, 134, .16), transparent 65%); pointer-events: none; }
.lobby-fan { position: relative; width: 260px; height: 150px; flex: none; }
.lobby-fan > span { position: absolute; left: 50%; bottom: 0; transform-origin: 50% 140%; transform: translateX(-50%) rotate(calc(var(--i) * 14deg)); animation: fan-in .9s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc((var(--i) + 2) * 70ms); }
.lobby-fan .card { --cw: 96px; box-shadow: 0 12px 26px rgba(0, 0, 0, .5); }
@keyframes fan-in { from { transform: translateX(-50%) rotate(0deg) translateY(30px); opacity: 0; } }
.lobby-brand { text-align: center; }
.lobby-brand span { font-size: 11px; font-weight: 800; letter-spacing: .32em; color: var(--gold); }
.lobby-brand h1 { margin: 6px 0 8px; font: 600 clamp(46px, 13vw, 74px)/1 var(--display); letter-spacing: -.01em; }
.lobby-brand h1 b { font-weight: 700; background: linear-gradient(180deg, #fff1c9, var(--brass)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lobby-brand p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-dim); }
.lobby-actions { display: grid; gap: 10px; width: min(380px, 100%); }
.big-btn {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-radius: 20px; text-align: left;
  border: 1px solid var(--glass-line); background: var(--glass); transition: transform .12s, background .2s;
}
.big-btn:active { transform: scale(.98); }
.big-btn svg { width: 26px; height: 26px; flex: none; }
.big-btn span { display: flex; flex-direction: column; gap: 2px; }
.big-btn b { font-size: 17px; }
.big-btn small { font-size: 12.5px; color: var(--text-dim); }
.big-btn.primary, #lobby-continue[hidden] + #lobby-new { background: linear-gradient(180deg, #fff6df, #e3cb94); color: #2a1c05; border-color: transparent; box-shadow: 0 10px 26px rgba(0, 0, 0, .4); }
.big-btn.primary small, #lobby-continue[hidden] + #lobby-new small { color: #6b5428; }
.big-btn[hidden] { display: none; }
.lobby-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.small-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 16px; border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .04); font-size: 12px; font-weight: 650; color: var(--text-dim); }
.small-btn svg { width: 22px; height: 22px; color: var(--text); }
.lobby-foot { font-size: 11px; color: rgba(245, 236, 214, .35); }

/* ---------- sheets ---------- */
dialog {
  width: min(560px, 100%); max-width: 100%; max-height: min(88dvh, 860px); margin: auto auto 0; padding: 0 18px calc(18px + var(--safe-bottom));
  border: 0; border-radius: 26px 26px 0 0; color: var(--ink); background: var(--paper);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .5); overflow: hidden auto; user-select: text; -webkit-user-select: text;
}
dialog[open] { animation: sheet-up .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
dialog::backdrop { background: rgba(3, 10, 8, .62); backdrop-filter: blur(3px); }
.sheet-grip { width: 42px; height: 5px; border-radius: 99px; background: #d9cfb8; margin: 9px auto 4px; }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0 10px; background: var(--paper); }
.modal-header h2 { margin: 3px 0 0; font: 600 25px/1.15 var(--display); }
.modal-header .hud-btn { background: #efe7d4; border-color: transparent; color: var(--ink); }
.eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: .2em; color: var(--gold-deep); }
#modal-content { font-size: 14.5px; line-height: 1.5; }
.lead { margin: 2px 0 14px; color: #514d43; }
.fine { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.warn { padding: 11px 13px; border-radius: 14px; background: #fbe9e3; color: #7a2b1f; font-size: 13.5px; margin-bottom: 4px; }
.sheet-actions { position: sticky; bottom: calc(-18px - var(--safe-bottom)); display: grid; gap: 8px; margin: 16px -18px calc(-18px - var(--safe-bottom)); padding: 12px 18px calc(16px + var(--safe-bottom)); background: linear-gradient(transparent, var(--paper) 22%); }
.btn { height: 52px; border-radius: 16px; border: 1px solid #ddd2bb; background: #fff; font-weight: 750; font-size: 15.5px; color: var(--ink); }
.btn.primary { border: 0; color: #f8f1df; background: linear-gradient(180deg, #1f6b52, #0f3b2e); box-shadow: 0 8px 18px rgba(15, 59, 46, .35); }
.btn:active { transform: scale(.98); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; background: #efe7d4; font-size: 12.5px; font-weight: 700; }
.chip.gold { background: linear-gradient(135deg, var(--gold), var(--brass)); color: #2a1c05; }
.chip .suit-icon:not(.red) { fill: var(--ink); }
.star { color: var(--gold-deep); }

/* fields */
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 12px; font-weight: 750; letter-spacing: .04em; color: #6a6253; }
input:not([type]), input[type="text"] { width: 100%; height: 46px; padding: 0 14px; border-radius: 13px; border: 1px solid #ddd2bb; background: #fff; font: 600 15.5px var(--font); color: var(--ink); }
input:focus { outline: 2px solid #1f6b52; outline-offset: 0; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: #eee5d1; }
.segmented button { height: 38px; border: 0; border-radius: 10px; background: none; font-weight: 700; font-size: 13.5px; color: #6a6253; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .1); }
.bot-rows { display: grid; gap: 8px; }
.bot-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; padding: 10px; border-radius: 16px; background: #f3ecdc; }
.bot-row .segmented { grid-column: 1 / -1; }
.bot-row input { height: 40px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid #ece3cf; }
.toggle-row b { display: block; font-size: 14.5px; }
.toggle-row small { color: var(--muted); font-size: 12.5px; }
.toggle { appearance: none; flex: none; width: 50px; height: 30px; border-radius: 99px; background: #d8cdb6; position: relative; cursor: pointer; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.toggle:checked { background: #1f6b52; }
.toggle:checked::after { transform: translateX(20px); }
.opponent-preview { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 4px; }
.opponent-preview > span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 99px; background: #f3ecdc; font-size: 13px; font-weight: 650; }

/* results */
.champion { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; border-radius: 18px; color: #f8f1df; background: linear-gradient(135deg, #1f6b52, #0f3b2e); }
.champion svg { width: 38px; height: 38px; fill: none; stroke: var(--gold); stroke-width: 1.6; }
.champion small { font-size: 10.5px; letter-spacing: .2em; font-weight: 800; color: var(--gold); }
.champion strong { display: block; font: 600 24px/1.1 var(--display); }
.champion span { font-size: 12.5px; opacity: .8; }
.result-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.result-head, .result-row summary { display: grid; grid-template-columns: minmax(0, 1fr) 64px 64px; align-items: center; gap: 8px; }
.result-head { padding: 0 12px 6px; font-size: 11px; font-weight: 750; color: var(--muted); letter-spacing: .05em; }
.result-head span:not(:first-child) { text-align: right; }
.result-row { border-radius: 16px; background: #f3ecdc; margin-bottom: 7px; overflow: hidden; }
.result-row summary { grid-template-columns: auto minmax(0, 1fr) 64px 64px; padding: 10px 12px; cursor: pointer; list-style: none; }
.result-row summary::-webkit-details-marker { display: none; }
.result-row.winner { background: linear-gradient(135deg, #fff3cf, #f2dea8); }
.result-row.me .r-name { font-weight: 800; }
.r-name { display: flex; flex-direction: column; font-weight: 650; min-width: 0; }
.r-name small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.r-change, .r-total { text-align: right; font-weight: 800; font-size: 16px; }
.r-change.good { color: #1f7a4d; } .r-change.bad { color: #b3261e; }
.r-total { color: #555; font-weight: 700; }
.mini-hand { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 12px 12px; }
.mini-meld { display: flex; padding: 3px; border-radius: 7px; background: rgba(31, 107, 82, .12); }
.mini-meld.loose-mini { background: rgba(179, 38, 30, .1); }
.mini-meld .card { --cw: 30px; }
.mini-meld .card + .card { margin-left: -14px; }

.ledger-wrap { overflow-x: auto; margin: 0 -4px; }
.ledger { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.ledger th, .ledger td { padding: 9px 8px; text-align: right; border-bottom: 1px solid #ece3cf; white-space: nowrap; }
.ledger thead th { font-size: 12px; color: #6a6253; font-weight: 700; vertical-align: bottom; }
.ledger thead th .avatar { display: grid; margin: 0 0 4px auto; }
.ledger th:first-child { text-align: left; color: var(--muted); }
.ledger td.won { font-weight: 800; color: #1f7a4d; }
.ledger tfoot td, .ledger tfoot th { font-weight: 800; font-size: 16px; border-bottom: 0; }
.empty-row { text-align: center !important; color: var(--muted); }

/* rules / gallery */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { position: relative; padding: 10px 12px 10px 46px; border-radius: 14px; background: #f3ecdc; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: #f8f1df; background: #1f6b52; }
.rule-list { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.score-grid span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: #f3ecdc; font-size: 12.5px; }
.score-grid b { font-size: 17px; }
.gallery-title { display: flex; align-items: center; gap: 6px; margin: 18px 0 8px; font: 600 18px var(--display); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.gallery .card { --cw: 100%; height: auto; aspect-ratio: 5 / 7; }
.okey-explainer { display: grid; grid-template-columns: 1fr auto 1fr 1fr; align-items: center; gap: 8px; padding: 14px; border-radius: 18px; background: radial-gradient(circle at 50% 30%, #23735a, #0f3b2e); color: #f8f1df; }
.okey-explainer figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 12px; font-weight: 650; }
.okey-explainer figure small { display: block; font-size: 10px; letter-spacing: .14em; color: var(--gold); font-weight: 800; text-transform: uppercase; }
.okey-explainer .card { --cw: min(78px, 20vw); }
.okey-explainer .arrow { color: var(--gold); font-size: 20px; }

/* ---------- toast / fx ---------- */
.toast {
  position: fixed; left: 50%; top: calc(64px + var(--safe-top)); z-index: 80; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 16px; font-size: 13.5px; text-align: center;
  background: rgba(20, 16, 10, .92); color: var(--text); border: 1px solid rgba(240, 207, 134, .3); box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  transition: opacity .25s, transform .25s;
}
.toast b { color: var(--gold); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.flyer { position: fixed; transform-origin: 0 0; z-index: 90; will-change: transform; }
.flyer .card { --cw: 100%; width: 100%; height: 100%; box-shadow: 0 14px 26px rgba(0, 0, 0, .5); }
.flyer .c-badge { font-size: 9px; }
.confetti { position: fixed; top: -12px; width: 8px; height: 13px; border-radius: 2px; z-index: 95; animation: confetti 2.3s cubic-bezier(.2, .6, .4, 1) forwards; }
@keyframes confetti { to { transform: translate(var(--x), 105vh) rotate(var(--r)); opacity: .6; } }

/* ---------- responsive ---------- */
@media (max-height: 720px) {
  .rack { --cw: clamp(40px, calc((100cqw - 26px) / 7.2), 80px); }
  .act { height: 44px; }
  .table { min-height: 210px; }
  .seat-fan { height: 30px; }
}
@media (min-width: 760px) {
  .hud { padding: 14px 20px 6px; }
  .table { margin: 8px 20px 14px; }
  .me { margin: 0 20px; border-radius: 28px 28px 0 0; padding: 14px 18px calc(14px + var(--safe-bottom)); }
  .rack { --cw: clamp(56px, calc((100cqw - 30px) / 9.5), 96px); min-height: calc(var(--cw) * 2.8 + 46px); }
  .actions { grid-template-columns: 110px 110px 1fr 200px; max-width: 760px; margin-inline: auto; }
  .avatar { width: 50px; height: 50px; font-size: 20px; }
  .seat.current .avatar .ring { -webkit-mask: radial-gradient(circle, transparent 27px, #000 28px); mask: radial-gradient(circle, transparent 27px, #000 28px); }
  .seat-text strong { font-size: 15px; max-width: 140px; }
  .seat-fan { width: 80px; height: 54px; }
  .seat-fan .card.mini { --cw: 36px; }
  .seat.left { left: 28px; } .seat.right { right: 28px; }
  dialog { margin: auto; border-radius: 26px; padding-bottom: 22px; }
  .sheet-grip { visibility: hidden; height: 2px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- phone layout: opponents in a row, piles below ---------- */
@media (max-width: 759px), (max-height: 859px) {
  .seat, .seat.top, .seat.left, .seat.right { top: 16px; transform: none; flex-direction: column; gap: 2px; }
  .seat.top { left: 50%; transform: translateX(-50%); }
  .seat.left { left: 14px; } .seat.right { right: 14px; }
  .seat .seat-info { flex-direction: row; gap: 6px; text-align: left; }
  .seat.left .seat-info, .seat.right .seat-info { flex-direction: row; text-align: left; }
  .seat .avatar { width: 34px; height: 34px; font-size: 14px; }
  .seat.current .avatar .ring { -webkit-mask: radial-gradient(circle, transparent 19px, #000 20px); mask: radial-gradient(circle, transparent 19px, #000 20px); }
  .seat-text strong { font-size: 12px; max-width: 64px; }
  .seat-text small { font-size: 10.5px; }
  .seat-fan { width: 46px; height: 30px; }
  .seat-fan .card.mini { --cw: 22px; }
  .seat .bubble, .seat.top .bubble { top: 100%; bottom: auto; }
  .seat.left .bubble { left: 0; transform: translate(0, 4px); }
  .seat.right .bubble { left: auto; right: 0; transform: translate(0, 4px); }
  .seat.left .bubble.show, .seat.right .bubble.show { animation-name: bubble-side; }
  .center { top: auto; bottom: 54px; transform: translateX(-50%); --pw: clamp(50px, 14.5cqw, 76px); }
  .felt-mark { top: 60%; }
}
@keyframes bubble-side { 0% { opacity: 0; } 12%, 75% { opacity: 1; } 100% { opacity: 0; } }
.indicator-card { left: calc(var(--pw) * -.62); top: calc(var(--pw) * .2); transform: rotate(-90deg); }
.stock-wrap { margin-left: calc(var(--pw) * .5); }
.rack { --ov: calc(var(--cw) * -.4); padding-left: calc(var(--cw) * .4 + 4px); }
.meld-cards .card + .card { margin-left: calc(var(--cw) * -.56); }
.meld { margin-right: calc(var(--cw) * .48); }
.table { min-height: 268px; }
.rack { --cw: clamp(44px, calc((100cqw - 26px) / 6.6), 96px); --ov: calc(var(--cw) * -.47); padding-left: calc(var(--cw) * .47 + 4px); }
.meld-cards .card + .card { margin-left: calc(var(--cw) * -.6); }
.meld { margin-right: calc(var(--cw) * .52); }
.act .suit-icon { width: 15px; height: 15px; stroke: none; }
.rack { --cw: clamp(44px, calc((100cqw - 26px) / 5.7), 96px); --ov: calc(var(--cw) * -.5); padding-left: calc(var(--cw) * .5 + 4px); min-height: calc(var(--cw) * 2.8 + 42px); }
@media (min-width: 760px) { .rack { --cw: clamp(56px, calc((100cqw - 30px) / 9), 100px); } }
.app { grid-template-columns: minmax(0, 1fr); }
.hud-center { overflow: hidden; gap: 6px; }
@media (max-width: 400px) {
  .hud { gap: 6px; padding-inline: 10px; }
  .hud-round, .hud-yer { padding: 0 10px; font-size: 12.5px; }
  .hud-round small { display: none; }
}
.toast { top: calc(150px + var(--safe-top)); }
.r-name b { font-weight: inherit; }
.mini-meld .card { --cw: 34px; }
.mini-meld .card + .card { margin-left: -17px; }
.rack { --cw: clamp(40px, min(calc((100cqw - 26px) / 5.7), calc((100dvh - 540px) / 2.8)), 96px); }
@media (min-width: 760px) { .rack { --cw: clamp(48px, min(calc((100cqw - 30px) / 9), calc((100dvh - 540px) / 2.8)), 100px); } }

/* ---------- v0.3 table: centre pile, okey tag, tracker ---------- */
.center, .center[class] { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -38%); display: block; }
.center .stock-col { position: absolute; right: calc(100% + clamp(18px, 6cqw, 44px)); top: 0; }
.felt-ring {
  position: absolute; left: 50%; top: 50%; width: min(64%, 420px); aspect-ratio: 2.1; transform: translate(-50%, -32%);
  border-radius: 50%; border: 1.5px dashed rgba(240, 207, 134, .16); box-shadow: inset 0 0 40px rgba(0, 0, 0, .18); pointer-events: none;
}
.discard .card { --cw: var(--pw); }
.table-msg { bottom: 54px; }
.okey-tag, .track-btn {
  position: absolute; bottom: 16px; z-index: 3; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px;
  border-radius: 99px; border: 1px solid rgba(240, 207, 134, .35); background: rgba(0, 0, 0, .35); font-size: 12.5px; font-weight: 800; color: var(--text);
}
.okey-tag { right: 18px; }
.okey-tag small { font-size: 9.5px; letter-spacing: .14em; color: var(--gold); margin-right: 2px; }
.okey-tag .suit-icon { width: 13px; height: 13px; }
.track-btn { left: 18px; font-weight: 650; color: var(--text-dim); }
.track-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.track-btn b { min-width: 20px; height: 18px; padding: 0 5px; border-radius: 99px; display: grid; place-items: center; font-size: 11px; color: #2a1c05; background: var(--gold); }
.seat-throws { display: flex; gap: 0; min-height: 20px; }
.seat-throws .card.mini { --cw: 18px; }
.seat-throws .card.mini + .card.mini { margin-left: -6px; }
.seat-throws .card.mini:last-child { box-shadow: 0 0 0 1.5px var(--gold); }
@media (min-width: 760px) and (min-height: 860px) { .seat-throws .card.mini { --cw: 24px; } }
.table { min-height: 290px; }

/* ---------- v0.3 rack: two shelves, free clusters ---------- */
.rack { display: flex; flex-direction: column; gap: 4px; padding: 6px 7px 8px; min-height: 0; }
.shelf {
  position: relative; display: flex; align-items: flex-end; min-height: calc(var(--cw) * 1.4 + 20px); padding-top: 18px;
  border-bottom: 3px solid rgba(214, 170, 85, .22); border-radius: 0 0 6px 6px; transition: background .15s;
}
.shelf.drop-shelf { background: rgba(127, 209, 176, .08); }
.shelf-hint { align-self: center; margin: 0 auto; font-size: 12px; color: rgba(245, 236, 214, .32); pointer-events: none; }
.seg { position: relative; display: flex; flex-direction: column; }
.seg + .seg { margin-left: calc(var(--cw) * .32); }
.seg .meld-tag { position: absolute; left: 2px; bottom: 100%; height: 17px; padding: 0; }
.seg-cards { display: flex; border-radius: 9px; }
.seg-cards .card + .card { margin-left: calc(var(--cw) * -.5); }
.seg.valid .seg-cards { box-shadow: 0 0 0 2px rgba(240, 207, 134, .55); background: rgba(240, 207, 134, .12); }
.seg.valid.k-pair .seg-cards { box-shadow: 0 0 0 2px rgba(127, 209, 176, .6); }
.seg.valid.k-pair .meld-tag { color: var(--mint); }
.rack .card.drop-before { box-shadow: -4px 0 0 var(--mint), 0 3px 6px rgba(0, 0, 0, .3); }
.rack .card.drop-after { box-shadow: 4px 0 0 var(--mint), 0 3px 6px rgba(0, 0, 0, .3); }

/* ---------- tracker ---------- */
.tracker { display: grid; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.tr-row { display: grid; grid-template-columns: 22px repeat(13, minmax(22px, 1fr)); gap: 3px; align-items: center; }
.tr-suit { display: grid; place-items: center; }
.tr-cell { display: flex; flex-direction: column; align-items: center; padding: 4px 0 3px; border-radius: 7px; background: #f3ecdc; font-size: 12.5px; line-height: 1.1; }
.tr-cell b { font-weight: 800; color: var(--ink); }
.tr-cell.red b { color: var(--red); }
.tr-cell i { font-style: normal; font-size: 7px; letter-spacing: 1px; color: #1f6b52; }
.tr-cell.left-0 { background: #e7dfcc; opacity: .45; }
.tr-cell.left-0 b { text-decoration: line-through; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: #f3ecdc; font-size: 13.5px; font-weight: 650; }
.history em { font-style: normal; font-weight: 500; color: var(--muted); }
.history .card.mini { --cw: 28px; }

/* ---------- studio intro ---------- */
.studio {
  position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(60% 40% at 50% 50%, #16392d, var(--night)); opacity: 0; visibility: hidden; transition: opacity .5s, visibility .5s;
}
body.intro .studio { opacity: 1; visibility: visible; }
.studio-mark { display: flex; align-items: baseline; gap: 10px; animation: studio-in 1.2s cubic-bezier(.2, .8, .2, 1) both; }
.studio-star { color: var(--gold); font-size: 26px; align-self: center; }
.studio-mark strong { font: 600 44px/1 var(--display); color: var(--text); }
.studio-mark em { font-style: normal; font-size: 15px; font-weight: 800; letter-spacing: .34em; color: var(--gold); }
.studio small { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--text-dim); animation: studio-in 1.2s .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes studio-in { from { opacity: 0; transform: translateY(14px) scale(.96); letter-spacing: .02em; } }
.rack { align-items: stretch; align-content: stretch; flex-wrap: nowrap; }
.shelf { justify-content: flex-start; }
.decision {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 7px 7px 7px 12px; border-radius: 14px;
  background: rgba(240, 207, 134, .12); border: 1px solid rgba(240, 207, 134, .4); font-size: 12.5px; color: var(--text-dim); animation: sheet-up .25s ease;
}
.decision[hidden] { display: none; }
.decision span { flex: 1; min-width: 0; }
.decision b { color: var(--gold); }
.decision button { height: 34px; padding: 0 14px; border-radius: 10px; border: 0; font-weight: 800; font-size: 13px; color: #2a1c05; background: linear-gradient(135deg, var(--gold), var(--brass)); }
.decision button.alt { background: rgba(255, 255, 255, .1); color: var(--text); border: 1px solid var(--glass-line); }
input[type="range"] { width: 100%; accent-color: #1f6b52; height: 28px; }
@media (max-width: 400px) { .hud-btn { width: 36px; height: 36px; border-radius: 12px; font-size: 18px; } }
.card-svg .c-maker { font: 800 5.2px var(--font); letter-spacing: .5px; fill: #f0cf86; }
.privacy-note { margin: 14px 0 0; padding: 11px 13px; border-radius: 14px; background: #eef4ee; color: #2f4a3c; font-size: 13px; }
.privacy-note a { color: #1f6b52; font-weight: 700; }

/* ---------- v0.4: one clear message line ---------- */
.table-msg {
  display: flex; flex-direction: column; align-items: center; gap: 1px; white-space: nowrap; text-align: center;
  padding: 6px 16px; border-radius: 16px; line-height: 1.35; max-width: calc(100% - 32px); min-width: 200px;
}
.msg-event { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.msg-next { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.table-msg .suit-icon { width: 12px; height: 12px; }
.bubble { display: none; }
.pile-label { display: none; }
.score-table-wrap { margin: 0 0 4px; }
.score-rules { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.score-rules th { font-weight: 700; color: #6a6253; text-align: left; font-size: 12px; }
.score-rules thead th { text-align: center; }
.score-rules td { text-align: center; padding: 6px 2px; border-radius: 10px; background: #f3ecdc; line-height: 1.15; }
.score-rules td b { display: block; font-size: 14px; }
.score-rules td small { color: #8a6a2a; font-weight: 700; }
body.four-color .suit-icon.s-diamond { fill: #1d5fc4; }
body.four-color .suit-icon.s-club { fill: #16804a; }
body.four-color .hud .suit-icon.s-diamond, body.four-color .table .suit-icon.s-diamond, body.four-color .meld-tag .suit-icon.s-diamond { fill: #6fa3ff; }
body.four-color .hud .suit-icon.s-club, body.four-color .table .suit-icon.s-club, body.four-color .meld-tag .suit-icon.s-club { fill: #5fd08f; }
.partner-tag { padding: 0 5px; border-radius: 99px; background: var(--gold); color: #2a1c05; font-size: 8.5px; letter-spacing: .08em; }
.team-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.team-totals span { display: flex; flex-direction: column; padding: 9px 12px; border-radius: 14px; background: #f3ecdc; font-size: 12px; color: var(--muted); }
.team-totals b { color: var(--ink); font-size: 13px; }
.team-totals strong { font-size: 20px; color: var(--ink); }
.team-totals .lead { background: linear-gradient(135deg, #fff3cf, #f2dea8); }
.ledger .team-row td { text-align: center; font-size: 14px; color: #1f6b52; }
#teams-field[hidden] { display: none; }
.lobby-row { grid-template-columns: repeat(4, 1fr); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid div { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-radius: 14px; background: #f3ecdc; text-align: center; }
.stat-grid strong { font: 600 20px/1.1 var(--display); }
.stat-grid span { font-size: 11.5px; color: var(--muted); }

/* ---------- landscape phones: table left, rack right ---------- */
@media (orientation: landscape) and (max-height: 620px) {
  .app { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-rows: auto minmax(0, 1fr); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); max-width: none; }
  .hud { grid-column: 1 / -1; padding: 4px 12px 2px; }
  .hud-btn { width: 34px; height: 34px; border-radius: 11px; font-size: 17px; }
  .hud-round, .hud-yer { height: 30px; }
  .table { grid-column: 1; grid-row: 2; margin: 2px 6px 8px 10px; min-height: 0; border-radius: 26px; }
  .me { grid-column: 2; grid-row: 2; margin: 2px 10px 8px 0; border-radius: 22px; padding: 8px 10px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .rack { flex: 1; min-height: 0; margin-top: 2px; }
  .progress { padding: 4px 6px 0; }
  .actions { margin-top: 6px; }
  .act { height: 40px; }
  .act.ghost span { display: none; }
  .seat-fan { display: none; }
  .seat .avatar { width: 28px; height: 28px; font-size: 12px; }
  .seat-text strong { font-size: 11.5px; max-width: 58px; }
  .seat-text small, .level { font-size: 9.5px; }
  .seat, .seat.top, .seat.left, .seat.right { top: 10px; }
  .seat.left { left: 10px; } .seat.right { right: 10px; }
  .center { --pw: clamp(40px, 12cqw, 64px); transform: translate(-50%, -42%); }
  .table-msg { bottom: 44px; min-width: 160px; }
  .okey-tag, .track-btn { bottom: 10px; height: 26px; font-size: 11.5px; }
  .track-btn span { display: none; }
  .felt-ring { width: 72%; }
  .me-avatar { width: 30px; height: 30px; }
  .me-stat strong { font-size: 18px; }
}
@media (orientation: landscape) and (max-height: 620px) {
  .actions { grid-template-columns: 52px 52px minmax(0, 2fr) minmax(0, 1.3fr); max-width: none; margin-inline: 0; }
  .act { font-size: 13px; white-space: nowrap; }
}

/* ---------- landscape tablets / wide screens: same side-by-side layout, roomier ---------- */
@media (orientation: landscape) and (min-height: 621px) and (min-aspect-ratio: 5/4) {
  .app { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: auto minmax(0, 1fr); max-width: 1500px; }
  .hud { grid-column: 1 / -1; }
  .table { grid-column: 1; grid-row: 2; margin: 6px 8px 16px 18px; min-height: 0; }
  .me { grid-column: 2; grid-row: 2; margin: 6px 18px 16px 0; border-radius: 26px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .rack { flex: 1; min-height: 0; }
  .actions { grid-template-columns: 90px 90px minmax(0, 2fr) minmax(0, 1.3fr); max-width: none; margin-inline: 0; }
  .center { --pw: clamp(60px, 15cqw, 104px); }
}
.card-svg .c-maker-face { font: 800 5.4px var(--font); letter-spacing: .5px; fill: #8a6a2a; opacity: .9; }

/* ---------- v0.5: supporter ---------- */
body[data-felt="bordo"] { --felt-1: #8a2a3a; --felt-2: #5e1726; --felt-3: #300a12; }
body[data-felt="navy"] { --felt-1: #24477a; --felt-2: #172f55; --felt-3: #0a1730; }
.support-link { border: 0; background: none; color: var(--gold); font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 99px; }
.support-link span { color: #ff8a9a; }
body.supporter .support-link::after { content: " ✓"; }
.supporter-hero { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 18px; background: linear-gradient(135deg, #fff3cf, #f2dea8); margin-bottom: 12px; }
.supporter-hero span { font-size: 32px; color: #a97a26; }
.supporter-hero p { margin: 0; font-size: 14px; color: #4a3a1a; }
.perk-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.perk-list li { padding: 10px 12px; border-radius: 12px; background: #f3ecdc; font-weight: 650; font-size: 14px; }
.locked { opacity: .5; pointer-events: none; }
.lock { font-style: normal; color: #a97a26; }

/* ---------- v0.5: Normal 51 (Açmalı) ---------- */
body.acmali .okey-tag, body.acmali .indicator-card, body.acmali .mode-switch, body.acmali .decision { display: none !important; }
body.acmali .stock-wrap { margin-left: 0; }
.melds {
  position: absolute; left: 12px; right: 12px; top: 112px; z-index: 2; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden;
  padding: 4px 2px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.melds[hidden] { display: none; }
.tmeld { flex: none; display: flex; padding: 3px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .28); box-shadow: inset 0 0 0 1.5px var(--c); cursor: pointer; }
.tmeld .card.mini { --cw: 24px; }
.tmeld .card + .card { margin-left: -11px; }
.tmeld.is-pair { box-shadow: inset 0 0 0 1.5px var(--mint); }
.tmeld:hover, .tmeld:focus-visible { background: rgba(240, 207, 134, .2); }
body.is-dragging.acmali .tmeld { outline: 1.5px dashed rgba(240, 207, 134, .6); }
.melds-empty { align-self: center; margin: 0 auto; font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.opened-tag { padding: 0 5px; border-radius: 99px; background: var(--mint); color: #0b2a20; font-size: 8.5px; letter-spacing: .08em; }
body.acmali .center { transform: translate(-50%, -18%); }
@media (orientation: landscape) and (max-height: 620px) { .melds { top: 62px; } .tmeld .card.mini { --cw: 20px; } body.acmali .center { transform: translate(-50%, -10%); } }
@media (min-width: 760px) and (min-height: 860px) { .melds { top: 150px; left: 22%; right: 22%; flex-wrap: wrap; justify-content: center; overflow: visible; } }
.install-btn { flex-direction: row; justify-content: center; width: min(380px, 100%); padding: 10px; } .install-btn[hidden] { display: none; }

/* ---------- v0.6: lobby with two games ---------- */
.lobby { gap: 18px; justify-content: flex-start; padding-top: calc(28px + var(--safe-top)); }
.lobby-fan { height: 104px; width: 220px; margin-top: 4px; }
.lobby-fan .card { --cw: 70px; }
.lobby-brand h1 { font-size: clamp(40px, 11vw, 64px); margin: 4px 0 6px; }
.lobby-brand p { font-size: 15px; color: var(--text); }
.lobby-brand p small { display: inline-block; margin-top: 4px; font-size: 12px; letter-spacing: .12em; color: var(--text-dim); text-transform: uppercase; }
.lobby-actions { width: min(720px, 100%); }
.game-cards { display: grid; gap: 12px; }
@media (min-width: 640px) { .game-cards { grid-template-columns: 1fr 1fr; } }
.game-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px; border-radius: 22px; text-align: left;
  background: linear-gradient(160deg, rgba(35, 115, 90, .55), rgba(10, 44, 34, .85)); border: 1px solid rgba(240, 207, 134, .28);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
}
.game-card.gc-acmali { background: linear-gradient(160deg, rgba(138, 42, 58, .55), rgba(48, 10, 18, .85)); }
.gc-badge { align-self: flex-start; padding: 3px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #2a1c05; background: linear-gradient(135deg, var(--gold), var(--brass)); }
.game-card h2 { margin: 0; font: 600 26px/1.1 var(--display); }
.game-card h2 em { font-style: normal; font-size: 17px; color: var(--gold); margin-left: 4px; }
.game-card p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-dim); }
.gc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.gc-tags span { padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 650; background: rgba(0, 0, 0, .28); color: var(--text); }
.gc-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 4px; }
.gc-play { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 16px; border: 0; text-align: left; color: #2a1c05; background: linear-gradient(180deg, #fff6df, #e3cb94); box-shadow: 0 8px 18px rgba(0, 0, 0, .35); }
.gc-play svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.gc-play span { display: flex; flex-direction: column; }
.gc-play b { font-size: 16px; }
.gc-play small { font-size: 11.5px; color: #6b5428; }
.gc-new { display: flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--glass-line); background: rgba(0, 0, 0, .25); font-size: 13px; font-weight: 700; color: var(--text); }
.gc-new svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.gc-play:active, .gc-new:active { transform: scale(.97); }

/* ---------- v0.6: Açmalı table = board of opened melds ---------- */
body.acmali .melds {
  top: 104px; bottom: 70px; left: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px;
  overflow-x: hidden; overflow-y: auto; padding: 4px 4px 8px; flex-wrap: nowrap;
}
.board-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 5px; border-radius: 12px; background: rgba(0, 0, 0, .18); }
.board-who { display: flex; flex-direction: column; justify-content: center; min-width: 52px; padding: 2px 8px 2px 6px; border-left: 3px solid var(--c); font-size: 11.5px; font-weight: 750; line-height: 1.15; color: var(--text); }
.board-who small { font-size: 10px; color: var(--gold); font-weight: 700; }
body.acmali .tmeld { padding: 3px; }
body.acmali .tmeld .card.mini { --cw: 30px; }
body.acmali .tmeld .card + .card { margin-left: -15px; }
body.acmali .melds-empty { margin: auto; white-space: normal; text-align: center; line-height: 1.5; font-size: 12.5px; }
body.acmali .melds-empty b { color: var(--gold); }
body.acmali .felt-ring, body.acmali .felt-mark { display: none; }
body.acmali .center, body.acmali .center[class] { left: 12px; top: auto; bottom: 12px; transform: none; display: flex; gap: 10px; --pw: 42px; }
body.acmali .center .stock-col { position: static; }
body.acmali .stock-count { top: -7px; right: -9px; min-width: 22px; height: 18px; font-size: 10px; }
body.acmali .table-msg { left: auto; right: 12px; bottom: 12px; transform: none; max-width: calc(100% - 140px); min-width: 0; align-items: flex-end; text-align: right; }
body.acmali .track-btn { left: auto; right: 12px; top: 104px; bottom: auto; z-index: 3; }
body.acmali .track-btn span { display: none; }
body.acmali .melds { right: 52px; }
@media (orientation: landscape) and (max-height: 620px) {
  body.acmali .melds { top: 60px; bottom: 60px; }
  body.acmali .track-btn { top: 60px; }
  body.acmali .tmeld .card.mini { --cw: 24px; }
  body.acmali .tmeld .card + .card { margin-left: -12px; }
}
@media (min-width: 760px) and (min-height: 860px) { body.acmali .melds { top: 150px; bottom: 90px; left: 24px; right: 70px; } body.acmali .tmeld .card.mini { --cw: 40px; } body.acmali .tmeld .card + .card { margin-left: -20px; } body.acmali .center { --pw: 60px; } }

/* ---------- v0.6: lighter effects (less jank on phones) ---------- */
.table-msg { backdrop-filter: none; background: rgba(0, 0, 0, .5); }
dialog::backdrop { backdrop-filter: none; background: rgba(3, 10, 8, .72); }
body[data-stage="draw"] .stock:not(:disabled) .top, body[data-stage="draw"] .discard:not(:disabled) .card.top { animation: none; }
.stock::after, .discard::after { content: ""; position: absolute; inset: -4px; border-radius: 10px; box-shadow: 0 0 0 3px rgba(240, 207, 134, .85), 0 0 16px rgba(240, 207, 134, .45); opacity: 0; pointer-events: none; }
body[data-stage="draw"] .stock:not(:disabled)::after, body[data-stage="draw"] .discard:not(:disabled)::after { animation: glow-o 1.8s ease-in-out infinite; }
@keyframes glow-o { 50% { opacity: 1; } }
.rack .card.can-finish { animation: none; box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(240, 207, 134, .8); }
.act.finish:not(:disabled) { animation: none; box-shadow: 0 0 0 3px rgba(240, 207, 134, .45), 0 0 18px rgba(240, 207, 134, .55); }
.rack { contain: layout paint; }
.table { contain: paint; }
.rack .card { transition: transform .15s ease; }
.decision.undo { border-color: rgba(127, 209, 176, .45); background: rgba(127, 209, 176, .1); } .decision.undo b { color: var(--mint); } .decision.undo button { background: rgba(255,255,255,.12); color: var(--text); border: 1px solid var(--glass-line); }

/* ---------- v0.7: friendlier rules sheet ---------- */
.how-tabs { margin-bottom: 14px; }
.how-goal { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: #eef4ee; color: #2f4a3c; font-size: 14.5px; }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.how-steps div { display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: 14px; background: #f3ecdc; }
.how-steps span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: #f8f1df; background: #1f6b52; }
.how-steps b { font-size: 15px; }
.how-steps small { font-size: 12px; line-height: 1.35; color: #5e584b; }
.ex-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ex { margin: 0; display: flex; flex-direction: column; gap: 5px; max-width: 160px; }
.ex-cards { display: flex; padding: 6px; border-radius: 12px; background: radial-gradient(circle at 50% 30%, #23735a, #0f3b2e); }
.ex-cards .card.mini { --cw: 40px; }
.ex-cards .card + .card { margin-left: -14px; }
.ex figcaption { font-size: 12px; line-height: 1.3; color: #5e584b; }
.how-more { margin-top: 10px; border-radius: 14px; background: #f3ecdc; padding: 2px 12px; }
.how-more summary { padding: 10px 0; font-weight: 750; cursor: pointer; }
.how-more[open] { padding-bottom: 10px; }
.how-list li { margin-bottom: 4px; }
@media (max-width: 380px) { .how-steps { grid-template-columns: 1fr; } }
/* Centre the stock + discard pair (the stock hangs to the left of the discard). */
.center[class] { left: calc(50% + var(--pw) * .6 + 8px); }

/* ---------- v0.8: podium, rating, light mode ---------- */
.podium { display: grid; gap: 8px; margin-bottom: 8px; }
.podium-row { display: grid; grid-template-columns: 40px auto 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: #f3ecdc; }
.podium-row.place-1 { background: linear-gradient(135deg, #fff3cf, #f2dea8); box-shadow: 0 6px 16px rgba(169, 122, 38, .25); }
.podium-row.me { outline: 2.5px solid #1f6b52; }
.podium-row .medal { font-size: 26px; text-align: center; font-weight: 800; color: #6a6253; }
.p-name { display: flex; flex-direction: column; min-width: 0; }
.p-name b { font-size: 16px; }
.p-name small { font-size: 12px; color: var(--muted); }
.p-score { font: 700 22px var(--display); }
.podium-actions { gap: 8px; }
.podium-small { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ghost-btn { background: transparent; border: 1px solid #ddd2bb; height: 44px; font-size: 14px; }
.link-btn { display: grid; place-items: center; text-decoration: none; }
.rate-invite { width: 100%; margin: 4px 0 6px; padding: 10px; border-radius: 14px; border: 1px dashed #c9a24f; background: #fff8e6; color: #7a5a1a; font-weight: 700; font-size: 13.5px; }
.lobby .support-link + .support-link { margin-top: -10px; }
/* Light mode: same game, far less paint work for older phones. */
body.lite *, body.lite *::before, body.lite *::after { animation: none !important; transition: none !important; }
body.lite .card, body.lite .rack .card { box-shadow: 0 0 0 1px rgba(0, 0, 0, .18) !important; }
body.lite .table { background: radial-gradient(90% 75% at 50% 45%, var(--felt-1) 0%, var(--felt-2) 60%, var(--felt-3) 100%); box-shadow: inset 0 0 0 7px var(--wood-2); }
body.lite .table::before, body.lite .felt-ring, body.lite .felt-mark, body.lite .seat-fan, body.lite .lobby-glow { display: none; }
body.lite .me, body.lite .act.primary, body.lite .gc-play, body.lite .game-card { box-shadow: none; }
body.lite dialog[open] { animation: none; }
/* Two sort buttons: Seri diz / Çift diz, the current layout highlighted. */
.actions { grid-template-columns: 1fr 1fr 1fr 2fr 1.3fr; }
.act.sort-btn.on { border-color: rgba(240, 207, 134, .6); color: var(--gold); background: rgba(240, 207, 134, .1); }
.act.sort-btn.on svg { color: var(--gold); }
.act.ghost span { white-space: nowrap; }
@media (max-width: 400px) { .actions { gap: 5px; } .act.ghost { font-size: 9.5px; } .act { font-size: 13px; } }
@media (min-width: 760px) { .actions { grid-template-columns: 96px 96px 96px 1fr 180px; } }
@media (orientation: landscape) and (max-height: 620px) { .actions { grid-template-columns: 46px 46px 46px minmax(0, 2fr) minmax(0, 1.3fr); } }
@media (orientation: landscape) and (min-height: 621px) and (min-aspect-ratio: 5/4) { .actions { grid-template-columns: 80px 80px 80px minmax(0, 2fr) minmax(0, 1.3fr); } }
.mode-switch { display: none !important; }
/* Masa defteri */
.lobby-row { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.lobby-row .small-btn { font-size: 11px; padding: 10px 2px; text-align: center; }
.defter-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.defter-scores { display: grid; gap: 6px; }
.d-row { display: grid; grid-template-columns: 1fr 90px auto; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: #f3ecdc; }
.d-row[hidden] { display: none; }
.d-row input[type="number"] { width: 100%; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid #ddd2bb; font: 700 16px var(--font); }
.d-flag { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.d-note { display: block; font-size: 10px; color: var(--muted); font-weight: 600; }
#modal .segmented[data-setting="dwin"] { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
/* Streak and badges (local, no notifications) */
.streak-chip { margin-top: 8px; padding: 5px 12px; border-radius: 99px; border: 1px solid rgba(240, 207, 134, .4); background: rgba(240, 207, 134, .12); color: var(--gold); font-weight: 800; font-size: 13px; }
.streak-chip[hidden] { display: none; }
.streak-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, #fff3cf, #f2dea8); margin-bottom: 4px; }
.streak-box > span { font-size: 30px; }
.streak-box b { font-size: 17px; display: block; }
.streak-box small { font-size: 12px; color: #6b5428; }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: #f3ecdc; text-align: center; opacity: .45; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; background: linear-gradient(160deg, #fff8e6, #f2dea8); }
.badge span { font-size: 24px; }
.badge b { font-size: 11.5px; line-height: 1.2; }
.badge small { font-size: 10px; color: var(--muted); line-height: 1.2; }
@media (max-width: 380px) { .badge-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- v0.9: Açmalı table like Süper 51 — piles centred, melds above ---------- */
body.acmali .center, body.acmali .center[class] {
  --pw: clamp(50px, 13cqw, 84px);
  left: calc(50% + var(--pw) * .5 + 8px); top: auto; bottom: 62px; transform: translateX(-50%); display: block;
}
body.acmali .center .stock-col { position: absolute; right: calc(100% + clamp(16px, 5cqw, 40px)); top: 0; }
body.acmali .stock-count { top: -9px; right: -12px; min-width: 28px; height: 22px; font-size: 11.5px; }
body.acmali .melds { top: 104px; bottom: calc(74px + var(--pw-a, 84px) * 1.4); left: 10px; right: 52px; }
body.acmali .table { --pw-a: clamp(50px, 13cqw, 84px); }
body.acmali .table-msg { left: 50%; right: auto; bottom: 12px; transform: translateX(-50%); max-width: calc(100% - 32px); min-width: 200px; align-items: center; text-align: center; }
body.acmali .melds-empty { font-size: 13px; }
@media (orientation: landscape) and (max-height: 620px) {
  body.acmali .center, body.acmali .center[class] { --pw: clamp(38px, 10cqw, 56px); bottom: 50px; }
  body.acmali .table { --pw-a: clamp(38px, 10cqw, 56px); }
  body.acmali .melds { top: 58px; bottom: calc(58px + var(--pw-a) * 1.4); }
}
@media (orientation: landscape) and (max-height: 620px) {
  body.acmali .center, body.acmali .center[class] { --pw: clamp(34px, 8.5cqw, 48px); bottom: 60px; }
  body.acmali .table { --pw-a: clamp(34px, 8.5cqw, 48px); }
  body.acmali .melds { bottom: calc(66px + var(--pw-a) * 1.4); }
  body.acmali .table-msg { bottom: 8px; padding-block: 4px; }
}

/* ---------- v0.10: İşle button, clearer end-of-match ranking ---------- */
.act[hidden] { display: none !important; }
body.acmali .actions { grid-template-columns: 1fr 1fr 1fr 1.2fr 1.8fr 1.2fr; }
.act.layoff-btn.ready { border-color: rgba(240, 207, 134, .7); color: var(--gold); background: rgba(240, 207, 134, .14); }
.act.layoff-btn.ready svg { color: var(--gold); }
.podium-stage { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 4px 0 14px; }
.podium-stage .step { flex: 0 1 120px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; }
.podium-stage .step b { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-stage .step small { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.podium-stage .avatar { width: 42px; height: 42px; font-size: 18px; margin-bottom: 2px; }
.podium-stage .step.is-me .avatar { box-shadow: 0 0 0 3px #1f6b52; }
.podium-stage .block { width: 100%; display: grid; place-items: center; border-radius: 12px 12px 4px 4px; font: 700 26px var(--display); color: #fff; }
.podium-stage .place-1 .block { height: 86px; background: linear-gradient(180deg, #e8c25a, #b8862a); }
.podium-stage .place-2 .block { height: 62px; background: linear-gradient(180deg, #c9ced6, #8f97a3); }
.podium-stage .place-3 .block { height: 46px; background: linear-gradient(180deg, #d9a27a, #9c6440); }
.podium-stage .place-1 .avatar { width: 52px; height: 52px; font-size: 22px; }
ol.podium { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: 1fr !important; gap: 6px; }
.podium-row { grid-template-columns: 34px auto 1fr auto; padding: 10px 14px; }
.podium-row .place-no { font: 700 22px var(--display); color: #6a6253; text-align: center; }
.podium-row.place-1 .place-no { color: #a97a26; }
.podium-row.is-me { box-shadow: inset 0 0 0 2.5px #1f6b52; }
.p-score { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.p-score small { font-size: 11px; font-family: inherit; color: var(--muted); margin-top: 3px; }
.you-tag { font-style: normal; font-size: 10px; letter-spacing: .08em; padding: 2px 6px; border-radius: 6px; background: #1f6b52; color: #fff; vertical-align: 2px; margin-left: 4px; }

@media (max-width: 420px) { body.acmali .act span { font-size: 11.5px; white-space: nowrap; } }
/* Lobby covers the table: keep the table out of layout work and layout-shift scoring. */
body.lobby-open .table, body.lobby-open .me { visibility: hidden; }
/* Legibility: smallest UI labels at least 12px. */
.gc-tags span, .lobby-row .small-btn, .lobby-foot { font-size: 12px; }
.seat-text small { font-size: 11.5px; }
/* Very small screens (320 wide / 320 tall): Açmalı's six buttons — helper buttons show icons only. */
@media (max-width: 340px), (max-height: 340px) {
  body.acmali .actions { gap: 4px; }
  body.acmali .act.ghost span { display: none; }
}

.lobby-foot a { color: inherit; text-decoration: underline; }
