/* NEBULA'S EDGE — STYLE FORMULA: void-violet + charcoal metal, neon suit colours
   (DM purple, BT pink, PL cyan, ME amber), bright-cyan active accents, soft glow,
   high contrast, flat frontal perspective. */

:root {
  --ui-scale: 1;
  --card-w: calc(64px * var(--ui-scale));
  --card-h: calc(90px * var(--ui-scale));
  --bg0: #0a0712; --bg1: #120a22;
  --panel: rgba(20, 14, 36, 0.92);
  --line: rgba(150, 110, 230, 0.35);
  --cyan: #46e6ff; --violet: #b06bff; --pink: #ff4fa3; --amber: #ffb44d; --gold: #ffd36b;
  --ink: #e9e6ff; --dim: #9b93c4;
  --us: #46e6ff; --them: #ff7a5a;
  --shake-x: 0px; --shake-y: 0px;
  --dm: #b06bff; --bt: #ff4fa3; --pl: #46e6ff; --me: #ffb44d;
  font-family: "Rajdhani", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg0); color: var(--ink); }
body { user-select: none; touch-action: manipulation; }

#bg, #fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#fx { pointer-events: none; z-index: 5; }
#app { position: fixed; inset: 0; z-index: 2; transform: translate(var(--shake-x), var(--shake-y)); }

.hidden { display: none !important; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- buttons ---------- */
.btn {
  font: 600 15px/1 "Rajdhani", system-ui, sans-serif; letter-spacing: 1px;
  color: var(--ink); background: linear-gradient(180deg, rgba(70,50,120,0.5), rgba(30,20,55,0.6));
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 22px; cursor: pointer;
  text-transform: uppercase; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.btn:hover { border-color: var(--cyan); box-shadow: 0 0 18px rgba(70,230,255,0.3); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, rgba(70,230,255,0.25), rgba(40,30,90,0.6)); border-color: var(--cyan); box-shadow: 0 0 22px rgba(70,230,255,0.25); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.icon-btn { background: rgba(30,20,55,0.6); border: 1px solid var(--line); color: var(--ink); width: 38px; height: 38px; border-radius: 9px; font-size: 18px; cursor: pointer; }
.icon-btn:hover { border-color: var(--cyan); }

/* ---------- menu ---------- */
#screen-menu { align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 24px; }
.menu-art { width: min(420px, 80vw); height: 150px; border-radius: 16px;
  background:
    radial-gradient(120px 80px at 30% 40%, rgba(176,107,255,0.5), transparent),
    radial-gradient(140px 90px at 72% 60%, rgba(70,230,255,0.4), transparent),
    radial-gradient(120px 80px at 55% 30%, rgba(255,79,163,0.3), transparent);
  filter: blur(4px); margin-bottom: -90px; opacity: .9;
}
.game-title { font-size: clamp(38px, 9vw, 74px); margin: 0; letter-spacing: 6px; font-weight: 700;
  background: linear-gradient(180deg, #fff, var(--violet) 55%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(176,107,255,0.45); position: relative; z-index: 1; }
.game-sub { color: var(--cyan); letter-spacing: 4px; font-size: clamp(10px, 2.6vw, 14px); margin-bottom: 18px; }
.menu-config { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 8px 0 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: none; color: var(--dim); padding: 10px 16px; cursor: pointer; font: 600 13px "Rajdhani", sans-serif; letter-spacing: 1px; }
.seg button.on { background: rgba(70,230,255,0.18); color: var(--ink); }
.chk { color: var(--dim); font-size: 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.chk input { accent-color: var(--cyan); width: 16px; height: 16px; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: min(320px, 80vw); }
.menu-foot { color: var(--dim); font-size: 12px; margin-top: 18px; letter-spacing: 1px; }

/* ---------- game / HUD ---------- */
#hud-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; z-index: 4;
  background: linear-gradient(180deg, rgba(10,7,18,0.85), transparent); }
.hud-hand { color: var(--dim); font-weight: 600; letter-spacing: 2px; font-size: 13px; min-width: 70px; }
.hud-scores { display: flex; gap: 10px; flex: 1; justify-content: center; }
.score-card { display: flex; flex-direction: column; align-items: center; padding: 5px 16px; border-radius: 10px; border: 1px solid var(--line); min-width: 110px; background: rgba(18,12,34,0.7); }
.score-card.us { border-color: rgba(70,230,255,0.5); }
.score-card.them { border-color: rgba(255,122,90,0.5); }
.score-name { font-size: 10px; letter-spacing: 2px; color: var(--dim); }
.score-card.us .score-name { color: var(--us); }
.score-card.them .score-name { color: var(--them); }
.score-val { font-size: 24px; font-weight: 700; line-height: 1; }
.bags { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.bag-count { font-size: 10px; color: var(--amber); }
.bag-pips { display: inline-flex; gap: 2px; }
.bag-pips i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,180,77,0.18); }
.bag-pips i.f { background: var(--amber); box-shadow: 0 0 4px var(--amber); }
.bag-count.risk { color: #ff9a4d; font-weight: 700; animation: bagRisk 1.1s ease-in-out infinite; }
.bag-warn { font-size: 8px; letter-spacing: 1px; font-weight: 700; color: #ff7a4d;
  border: 1px solid rgba(255,122,77,0.6); border-radius: 5px; padding: 1px 4px; animation: bagRisk 1.1s ease-in-out infinite; }
@keyframes bagRisk { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* contract tracker (bid vs won, per team) */
.contract { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; letter-spacing: .5px; color: var(--dim); }
.contract:empty { display: none; }
.contract .ctxt { font-weight: 600; }
.contract.made .ctxt { color: #6ee7a0; }
.contract.bagging .ctxt { color: var(--amber); }
.nilchip { font-size: 9px; font-weight: 700; letter-spacing: 1px; padding: 1px 5px; border-radius: 5px; }
.nilchip.ok { color: var(--cyan); background: rgba(70,230,255,0.16); }
.nilchip.broke { color: #ff7a7a; background: rgba(255,90,90,0.16); }

/* ---------- table ---------- */
#table { position: relative; flex: 1; min-height: 0; }
.seat-area { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat-area.north { top: 8px; left: 50%; transform: translateX(-50%); }
.seat-area.south { bottom: 6px; left: 50%; transform: translateX(-50%); }
.seat-area.west { left: 10px; top: 46%; transform: translateY(-50%); }
.seat-area.east { right: 10px; top: 46%; transform: translateY(-50%); }

.nameplate { position: relative; padding: 7px 14px; border-radius: 12px; background: rgba(16,11,30,0.82);
  border: 1px solid var(--line); min-width: 116px; text-align: center; transition: box-shadow .2s, border-color .2s; }
.nameplate.team-us { border-left: 3px solid var(--us); }
.nameplate.team-them { border-left: 3px solid var(--them); }
.nameplate.active { border-color: var(--cyan); box-shadow: 0 0 22px rgba(70,230,255,0.4); }
.seat-name { font-weight: 700; letter-spacing: 1px; font-size: 14px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.seat-stats { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 3px; }
.bidstat { font-size: 12px; color: var(--dim); }
.tag { font-size: 9px; padding: 2px 6px; border-radius: 5px; letter-spacing: 1px; font-weight: 700; }
.tag.dealer { background: rgba(255,211,107,0.18); color: var(--gold); }
.tag.bot { background: rgba(120,90,200,0.22); color: var(--violet); }
.tag.nil { background: rgba(70,230,255,0.18); color: var(--cyan); }
.tag.partner { background: rgba(70,230,255,0.22); color: var(--cyan); border: 1px solid rgba(70,230,255,0.5); }
.turn-ring { position: absolute; top: -7px; right: -7px; width: 26px; height: 26px; }
.turn-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.turn-ring .ring-bg { fill: none; stroke: rgba(70,230,255,0.18); stroke-width: 3; }
.turn-ring .ring-fg { fill: none; stroke: var(--cyan); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
.turn-ring .ring-fg.urgent { stroke: #ff5a5a; }

/* per-seat trick rail */
.trick-pips { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; margin-top: 4px; max-width: 96px; }
.trick-pips:empty { display: none; }
.trick-pips i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 4px var(--cyan); }
.nameplate.team-them .trick-pips i { background: var(--them); box-shadow: 0 0 4px var(--them); }
.trick-pips.nil i { background: #ff5a5a; box-shadow: 0 0 5px #ff5a5a; }

/* last-trick review popover */
#last-trick-pop { position: fixed; left: 50%; bottom: calc(var(--card-h) + 44px); transform: translateX(-50%);
  z-index: 15; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 30px rgba(120,80,200,0.18); }
.lt-title { text-align: center; font-size: 12px; letter-spacing: 1px; color: var(--cyan); margin-bottom: 8px; }
.lt-cards { display: flex; gap: 10px; }
.lt-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lt-slot .lt-name { font-size: 10px; letter-spacing: 1px; color: var(--dim); }
.lt-slot.win .lt-card { box-shadow: 0 0 0 2px var(--cyan), 0 0 16px rgba(70,230,255,0.6); }
.lt-slot.win .lt-name { color: var(--cyan); }

/* opponent / partner card backs */
.hand-backs { display: flex; }
.hand-backs.north, .hand-backs.south { flex-direction: row; }
.hand-backs.west, .hand-backs.east { flex-direction: row; }
.mini-back { width: calc(15px * var(--ui-scale)); height: calc(22px * var(--ui-scale)); margin-left: -8px;
  border-radius: 3px; border: 1px solid rgba(120,90,200,0.5);
  background: repeating-linear-gradient(45deg, #1a1030, #1a1030 3px, #241640 3px, #241640 6px); box-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.mini-back:first-child { margin-left: 0; }

/* ---------- center / trick ---------- */
#center { position: absolute; left: 50%; top: 46%; transform: translate(-50%,-50%);
  width: min(46vh, 340px); height: min(46vh, 340px); border-radius: 50%;
  border: 1px solid rgba(120,90,200,0.28);
  background: radial-gradient(circle, rgba(70,230,255,0.06), rgba(20,12,40,0.35) 60%, transparent);
  display: flex; align-items: center; justify-content: center; }
#status-line { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  color: var(--ink); font-size: 14px; letter-spacing: 1px; background: rgba(12,8,24,0.8);
  padding: 6px 16px; border-radius: 20px; border: 1px solid var(--line); }
#status-line.flash { animation: statusFlash .5s ease; }
@keyframes statusFlash { 0% { transform: translateX(-50%) scale(1.12); color: var(--cyan); } 100% { transform: translateX(-50%) scale(1); } }
#break-badge { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  color: var(--violet); font-weight: 700; letter-spacing: 2px; font-size: 12px;
  border: 1px solid var(--violet); padding: 4px 12px; border-radius: 16px; background: rgba(40,20,70,0.7);
  box-shadow: 0 0 14px rgba(176,107,255,0.4); }
#break-badge.pulse { animation: breakPulse .6s ease; }
@keyframes breakPulse { 0% { transform: translateX(-50%) scale(0.6); opacity: 0; } 50% { transform: translateX(-50%) scale(1.25); } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }

#trick { position: relative; width: 200px; height: 200px; }
.trick-card { position: absolute; left: 50%; top: 50%; width: var(--card-w); height: var(--card-h); }
.trick-card.from-south { top: 70%; transform: translate(-50%,-50%) rotate(2deg); }
.trick-card.from-north { top: 30%; transform: translate(-50%,-50%) rotate(-2deg); }
.trick-card.from-west { left: 32%; transform: translate(-50%,-50%) rotate(-4deg); }
.trick-card.from-east { left: 68%; transform: translate(-50%,-50%) rotate(4deg); }
.trick-card.thrown.from-south { animation: thS .34s ease-out; }
.trick-card.thrown.from-north { animation: thN .34s ease-out; }
.trick-card.thrown.from-west { animation: thW .34s ease-out; }
.trick-card.thrown.from-east { animation: thE .34s ease-out; }
@keyframes thS { from { transform: translate(-50%, 320%) rotate(8deg); opacity: 0; } to { transform: translate(-50%,-50%) rotate(2deg); opacity: 1; } }
@keyframes thN { from { transform: translate(-50%,-420%) rotate(-8deg); opacity: 0; } to { transform: translate(-50%,-50%) rotate(-2deg); opacity: 1; } }
@keyframes thW { from { transform: translate(-360%,-50%) rotate(-12deg); opacity: 0; } to { transform: translate(-50%,-50%) rotate(-4deg); opacity: 1; } }
@keyframes thE { from { transform: translate(260%,-50%) rotate(12deg); opacity: 0; } to { transform: translate(-50%,-50%) rotate(4deg); opacity: 1; } }
.trick-card.winner { box-shadow: 0 0 0 2px var(--cyan), 0 0 26px rgba(70,230,255,0.7); animation: winnerPulse .5s ease; }
@keyframes winnerPulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }

/* ---------- cards ---------- */
.card { --suit-color: var(--violet);
  width: var(--card-w); height: var(--card-h); border-radius: calc(8px * var(--ui-scale));
  background: linear-gradient(155deg, #2a2140, #16101f 70%); position: relative;
  border: 1px solid color-mix(in srgb, var(--suit-color) 55%, #3a2f55);
  box-shadow: 0 3px 10px rgba(0,0,0,0.55), inset 0 0 12px color-mix(in srgb, var(--suit-color) 18%, transparent);
  overflow: hidden; color: var(--suit-color); }
.card .center-sig { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.card .center-sig .sigil { width: 58%; height: 58%; }
.card .sigil path { fill: var(--suit-color); }
.card .center-sig .sigil { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--suit-color) 70%, transparent)); opacity: .92; }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .9; }
.card .corner .rank { font-weight: 700; font-size: calc(15px * var(--ui-scale)); }
.card .corner .sigil { width: calc(11px * var(--ui-scale)); height: calc(11px * var(--ui-scale)); }
.card .corner.tl { top: 4px; left: 5px; }
.card .corner.br { bottom: 4px; right: 5px; transform: rotate(180deg); }
.card.back { background: #1a1030; border-color: rgba(120,90,200,0.5); display: flex; align-items: center; justify-content: center; }
.card.back .back-sig { width: 70%; height: 70%; }
.card.back .back-sig circle { fill: none; stroke: rgba(176,107,255,0.5); stroke-width: 1.5; }
.card.back .back-sig path { fill: rgba(176,107,255,0.55); }

/* ---------- hand dock ---------- */
#hand-dock { display: flex; justify-content: center; align-items: flex-end; padding: 6px 8px 12px;
  min-height: calc(var(--card-h) + 26px); z-index: 3; }
#hand-dock.hidden-blind .card { background: #1a1030 !important; color: transparent; }
#hand-dock.hidden-blind .card > * { visibility: hidden; }
.card.in-hand { margin-left: -22px; transform: translateY(var(--lift, 0)) rotate(var(--rot, 0)); transform-origin: bottom center;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease; }
.card.in-hand:first-child { margin-left: 0; }
.card.in-hand.suit-start { margin-left: 8px; }
.card.in-hand.suit-start:first-child { margin-left: 0; }
.card.in-hand.legal { cursor: pointer; }
.card.in-hand.legal:hover { transform: translateY(calc(var(--lift, 0) - 22px)) rotate(var(--rot, 0)) scale(1.04);
  box-shadow: 0 0 0 2px var(--cyan), 0 0 22px rgba(70,230,255,0.6); z-index: 10; }
.card.in-hand.illegal { filter: brightness(.5) saturate(.6); }
.card.in-hand.selected { transform: translateY(calc(var(--lift, 0) - 26px)) rotate(var(--rot, 0)) scale(1.05);
  box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(255,211,107,0.7); z-index: 11; }

/* ---------- overlays / panels ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(5,3,12,0.74); backdrop-filter: blur(3px); padding: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px;
  max-width: min(520px, 92vw); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(120,80,200,0.18); }
.panel h1, .panel h2 { margin: 0 0 14px; letter-spacing: 2px; text-align: center; }
.panel h2 { color: var(--cyan); font-size: 20px; }

/* bid */
.bid-panel { width: min(460px, 92vw); }
.bid-note { text-align: center; margin-bottom: 12px; min-height: 20px; }
.bid-note .dim { color: var(--dim); font-size: 12px; }
.bid-hints { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.bid-hints .hint { font-size: 11px; letter-spacing: .5px; color: var(--ink); background: rgba(70,230,255,0.10);
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; }
.bid-partner { font-size: 12px; color: var(--dim); }
.bid-partner { margin-top: 2px; }
.bid-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 14px; }
.bid-num { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: rgba(40,28,70,0.7);
  color: var(--ink); font-size: 19px; font-weight: 700; cursor: pointer; transition: transform .1s, box-shadow .1s, border-color .1s; }
.bid-num:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(70,230,255,0.4); transform: translateY(-2px); color: var(--cyan); }
.bid-num.suggested { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 14px rgba(255,211,107,0.4); position: relative; }
.bid-num.suggested::after { content: "★"; position: absolute; top: -7px; right: -5px; font-size: 11px; color: var(--gold); }
.bid-special { display: flex; gap: 10px; }
.bid-special-btn { flex: 1; border-radius: 12px; padding: 12px; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; gap: 4px; font-weight: 700; letter-spacing: 1px; }
.bid-special-btn small { font-weight: 400; font-size: 11px; color: var(--dim); letter-spacing: 0; }
.bid-special-btn.nil { background: rgba(70,230,255,0.12); border: 1px solid var(--cyan); }
.bid-special-btn.blind { background: rgba(176,107,255,0.12); border: 1px solid var(--violet); }
.bid-special-btn:disabled { opacity: .4; cursor: not-allowed; }
.bid-special-btn:not(:disabled):hover { box-shadow: 0 0 18px rgba(70,230,255,0.35); }

/* score recap */
#score-breakdown { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.team-score { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.team-score.us { border-left: 3px solid var(--us); }
.team-score.them { border-left: 3px solid var(--them); }
.team-head { display: flex; justify-content: space-between; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.team-head .dim, .dim { color: var(--dim); font-weight: 400; font-size: 12px; }
.sl { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; }
.sl.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 7px; font-weight: 700; }
.sl.match { color: var(--dim); font-size: 12px; }
.pos { color: #6ee7a0; } .neg { color: #ff7a7a; }
#btn-next-hand { width: 100%; }

/* match end */
.end-panel { text-align: center; }
#end-title { font-size: 48px; letter-spacing: 6px; }
#end-title.win { color: var(--cyan); text-shadow: 0 0 30px rgba(70,230,255,0.6); }
#end-title.lose { color: var(--them); text-shadow: 0 0 30px rgba(255,122,90,0.5); }
#end-sub { color: var(--dim); margin: 6px 0 18px; }
#end-score { display: flex; justify-content: center; gap: 30px; margin-bottom: 20px; }
#end-score .fs { display: flex; flex-direction: column; gap: 4px; }
#end-score .fs span { color: var(--dim); font-size: 12px; letter-spacing: 2px; }
#end-score .fs b { font-size: 34px; }
.end-buttons { display: flex; gap: 12px; justify-content: center; }

/* bidding: float panel to the top, keep the hand crisp & readable below the overlay */
#overlay-bid { align-items: flex-start; padding-top: 4vh; }
body.bidding #hand-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 26;
  background: linear-gradient(0deg, rgba(8,5,16,0.96), rgba(8,5,16,0.75) 70%, transparent);
  padding-top: 16px;
}
body.bidding #hand-dock::before {
  content: ""; position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: .6;
}

/* tutorial */
.tutorial-panel { position: relative; text-align: center; width: min(480px, 92vw); }
.tut-skip { position: absolute; top: 10px; right: 12px; background: transparent; border: none; color: var(--dim);
  font: 600 12px "Rajdhani", sans-serif; letter-spacing: 1px; cursor: pointer; }
.tut-skip:hover { color: var(--ink); }
.tut-demo { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 12px;
  min-height: 118px; margin: 6px 0 14px; }
.tut-card { width: calc(56px * var(--ui-scale)); height: calc(78px * var(--ui-scale)); }
.tut-cap { font-size: 10px; letter-spacing: 1px; color: var(--dim); }
.tut-cap.trump { color: var(--violet); }
.tut-suit, .tut-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tut-slot.win .tut-card { box-shadow: 0 0 0 2px var(--cyan), 0 0 16px rgba(70,230,255,0.6); }
.tut-teams { display: flex; align-items: center; gap: 14px; }
.tut-team { display: flex; flex-direction: column; gap: 4px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); }
.tut-team.us { border-left: 3px solid var(--us); }
.tut-team.them { border-left: 3px solid var(--them); }
.tut-tlabel { font-size: 10px; letter-spacing: 1px; color: var(--dim); }
.tut-seat { font-weight: 700; letter-spacing: 1px; }
.tut-seat.you { color: var(--cyan); }
.tut-vs { color: var(--dim); font-weight: 700; letter-spacing: 2px; }
.tut-bidrow { display: flex; gap: 8px; }
.tut-bid { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
.tut-bid.suggested { border-color: var(--gold); color: var(--gold); position: relative; box-shadow: 0 0 12px rgba(255,211,107,0.35); }
.tut-bid.suggested::after { content: "★"; position: absolute; top: -7px; right: -5px; font-size: 11px; color: var(--gold); }
.tut-follow { display: flex; gap: 10px; }
.tut-card.tut-dim { filter: brightness(.5) saturate(.6); }
.tut-card.tut-legal { box-shadow: 0 0 0 2px var(--cyan), 0 0 16px rgba(70,230,255,0.5); }
.tut-score { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.tut-score .pos { color: #6ee7a0; } .tut-score .neg { color: #ff7a7a; }
.tut-score .bag { color: var(--amber); } .tut-score .acc { color: var(--cyan); }
.tut-features { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.tut-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; color: var(--dim); }
.tut-chip.contract.made .ctxt { color: #6ee7a0; font-weight: 600; }
.tut-chip .tp { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 4px var(--cyan); }
.tut-body { color: var(--ink); line-height: 1.5; font-size: 14px; margin-bottom: 14px; min-height: 44px; }
.tut-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.tut-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(150,110,230,0.3); transition: background .2s; }
.tut-dots i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.tut-nav { display: flex; gap: 10px; justify-content: center; }
.tut-nav .btn { min-width: 130px; }

/* howto / settings */
.howto-body p { color: var(--ink); line-height: 1.5; font-size: 14px; margin: 0 0 12px; }
.howto-panel .btn, .settings-panel .btn { width: 100%; margin-top: 8px; }
#settings-body { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.setting { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid rgba(150,110,230,0.12); font-size: 14px; }
.setting input[type=range] { width: 130px; accent-color: var(--cyan); }
.setting input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--cyan); }

/* splash */
#splash { position: fixed; inset: 0; z-index: 30; background: var(--bg0); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; transition: opacity .5s; }
#splash.gone { opacity: 0; pointer-events: none; }
.splash-title { font-size: clamp(34px, 9vw, 70px); letter-spacing: 8px; font-weight: 700;
  background: linear-gradient(180deg, #fff, var(--violet), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: glowPulse 2s ease-in-out infinite; }
.splash-tap { color: var(--cyan); letter-spacing: 4px; font-size: 14px; animation: blink 1.4s ease-in-out infinite; }
@keyframes glowPulse { 0%,100% { filter: drop-shadow(0 0 20px rgba(176,107,255,0.4)); } 50% { filter: drop-shadow(0 0 40px rgba(70,230,255,0.6)); } }
@keyframes blink { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

#dev { position: fixed; top: 4px; right: 6px; z-index: 40; color: #0f0; font: 12px monospace; display: none; }

/* ---------- accessibility variants ---------- */
body.high-contrast .card { background: #0c0814; border-width: 2px; box-shadow: 0 3px 10px #000, 0 0 0 1px #000; }
body.high-contrast .card .sigil path { fill: #fff; }
body.high-contrast .card .corner .rank, body.high-contrast .card { color: #fff; }
body.high-contrast .card[data-suit="BIOTECH"] .sigil path, body.high-contrast .card[data-suit="PLASMA"] .sigil path { fill: #ff5d5d; }
body.high-contrast .card[data-suit="BIOTECH"], body.high-contrast .card[data-suit="PLASMA"] { color: #ff5d5d; }

body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after {
  animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .05s !important; }

/* ---------- responsive: phone portrait ---------- */
@media (max-width: 620px) {
  :root { --card-w: calc(52px * var(--ui-scale)); --card-h: calc(74px * var(--ui-scale)); }
  .score-card { min-width: 88px; padding: 4px 10px; }
  .score-val { font-size: 20px; }
  #center { width: min(58vw, 260px); height: min(58vw, 260px); top: 44%; }
  #trick { width: 150px; height: 150px; }
  .nameplate { min-width: 92px; padding: 5px 9px; }
  .seat-name { font-size: 12px; }
  .card.in-hand { margin-left: -26px; }
  .bid-grid { grid-template-columns: repeat(5, 1fr); }
  .seat-area.west { left: 2px; } .seat-area.east { right: 2px; }
}
@media (max-height: 560px) {
  #center { top: 42%; width: 40vh; height: 40vh; }
  #hand-dock { min-height: calc(var(--card-h) + 14px); }
}
