/* style.css */
:root {
  color-scheme: dark;
  --bg:#071512;
  --surface:#0d2520;
  --surface-2:#14372e;
  --felt:#19533f;
  --felt-deep:#103a2d;
  --line:rgba(209,242,222,.22);
  --text:#f7fbf8;
  --muted:#c0d0c7;
  --accent:#f4bd4f;
  --accent-strong:#ffda80;
  --human:#75dfbd;
  --ai:#ff9b8e;
  --shadow:rgba(0,0,0,.32);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}

@media (prefers-color-scheme:light) {
  :root {
    color-scheme:light;
    --bg:#e8f1ec;
    --surface:#fbfdfb;
    --surface-2:#e7f2eb;
    --felt:#286b52;
    --felt-deep:#1d563f;
    --line:rgba(22,72,52,.23);
    --text:#10251d;
    --muted:#47675a;
    --accent:#935b00;
    --accent-strong:#714300;
    --human:#126c54;
    --ai:#ad4139;
    --shadow:rgba(25,65,45,.15);
  }
}

:root[data-theme="dark"] { color-scheme:dark; }
:root[data-theme="light"] {
  color-scheme:light;
  --bg:#e8f1ec;
  --surface:#fbfdfb;
  --surface-2:#e7f2eb;
  --felt:#286b52;
  --felt-deep:#1d563f;
  --line:rgba(22,72,52,.23);
  --text:#10251d;
  --muted:#47675a;
  --accent:#935b00;
  --accent-strong:#714300;
  --human:#126c54;
  --ai:#ad4139;
  --shadow:rgba(25,65,45,.15);
}

* { box-sizing:border-box; }
body {
  min-width:320px;
  min-height:100vh;
  margin:0;
  color:var(--text);
  background:radial-gradient(circle at 50% -20%,rgba(91,180,142,.18),transparent 43rem),var(--bg);
  font-size:16px;
}

button { font:inherit; }
button:focus-visible { outline:3px solid var(--accent-strong); outline-offset:3px; }
button:disabled { cursor:not-allowed; }

.app-shell { width:min(1120px,100%); margin:auto; padding:18px clamp(12px,3vw,28px) 34px; }
.topbar,.scoreboard,.status-row,.hand-header,.modal-heading,.result-strip { display:flex; align-items:center; }

.topbar { justify-content:space-between; gap:16px; margin-bottom:15px; }
.brand-block { display:flex; align-items:center; gap:12px; min-width:0; }
.brand-number {
  display:grid;
  place-items:center;
  width:52px;
  height:52px;
  flex:0 0 52px;
  border:1px solid rgba(244,189,79,.65);
  border-radius:16px;
  color:var(--accent);
  background:var(--surface);
  box-shadow:inset 0 0 20px rgba(244,189,79,.1);
  font-size:1.5rem;
  font-weight:900;
}

h1,h2,h3,p { margin:0; }
h1 { font-size:clamp(1.15rem,3vw,1.45rem); letter-spacing:-.02em; }
.brand-block p { margin-top:4px; color:var(--muted); font-size:.87rem; }
.top-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:7px; }

.utility-button,.deal-button,.pass-button,.bid-option,.trump-option,.next-button,.close-button,.primary-modal-button {
  min-height:44px;
  border:1px solid var(--line);
  border-radius:12px;
  cursor:pointer;
  color:var(--text);
  background:var(--surface);
  transition:transform .14s ease,border-color .14s ease,filter .14s ease;
}

.utility-button:hover,.pass-button:hover,.bid-option:hover,.trump-option:hover,.close-button:hover {
  transform:translateY(-1px);
  border-color:var(--accent);
}

.utility-button {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:0 12px;
  color:var(--text);
  font-size:.84rem;
  font-weight:650;
}

.utility-button img { width:17px; height:17px; filter:invert(1); }

.scoreboard {
  justify-content:space-between;
  gap:10px;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:17px;
  background:var(--surface);
  box-shadow:0 12px 28px var(--shadow);
}

.team-score { display:grid; grid-template-columns:auto auto; align-items:baseline; column-gap:8px; }
.team-score strong { grid-row:span 2; font-size:clamp(1.9rem,7vw,2.55rem); line-height:.9; }
.human-score strong { color:var(--human); }
.ai-score { text-align:right; }
.ai-score strong { color:var(--ai); }
.team-label,.marks-label,.match-status span { color:var(--muted); font-size:.78rem; font-weight:700; }
.marks-label { align-self:start; margin-top:3px; }
.match-status { display:grid; gap:4px; text-align:center; }
.match-status strong { color:var(--accent); font-size:.86rem; }

.table-wrap { margin-top:16px; }
.felt-table {
  position:relative;
  min-height:470px;
  overflow:hidden;
  border:1px solid rgba(193,238,212,.25);
  border-radius:24px;
  background:
    radial-gradient(ellipse at center,rgba(72,150,113,.6),transparent 55%),
    repeating-radial-gradient(circle at 22% 32%,rgba(255,255,255,.025) 0 1px,transparent 1px 5px),
    linear-gradient(145deg,var(--felt),var(--felt-deep));
  box-shadow:inset 0 0 0 8px rgba(1,17,11,.12),0 17px 36px var(--shadow);
}

.felt-table::before {
  content:"";
  position:absolute;
  inset:11px;
  border:1px solid rgba(232,250,238,.17);
  border-radius:17px;
  pointer-events:none;
}

.seat {
  position:absolute;
  z-index:2;
  min-width:108px;
  padding:10px 12px;
  border:1px solid rgba(236,255,243,.2);
  border-radius:13px;
  background:rgba(3,22,15,.39);
  transition:border-color .15s ease,box-shadow .15s ease;
}

.active-seat { border-color:var(--accent); box-shadow:0 0 0 3px rgba(244,189,79,.18); }
.seat-north { top:20px; left:50%; transform:translateX(-50%); text-align:center; }
.seat-west { top:50%; left:16px; transform:translateY(-50%); }
.seat-east { top:50%; right:16px; transform:translateY(-50%); text-align:right; }
.seat-south { bottom:17px; left:50%; transform:translateX(-50%); text-align:center; }
.seat-name-row { display:flex; justify-content:center; align-items:center; gap:5px; }
.seat-name { font-size:.95rem; font-weight:800; }
.seat-role,.seat-count { display:block; margin-top:3px; color:rgba(248,253,250,.78); font-size:.72rem; }
.bidder-tag { padding:2px 6px; border-radius:999px; color:#271800; background:var(--accent); font-size:.64rem; font-weight:850; }

.back-stack { position:relative; width:46px; height:26px; margin:8px auto 0; }
.back-domino {
  position:absolute;
  top:0;
  left:calc(var(--stack) * 5px);
  width:20px;
  height:30px;
  border:2px solid rgba(239,249,242,.86);
  border-radius:5px;
  background:linear-gradient(45deg,transparent 44%,rgba(239,249,242,.3) 45% 55%,transparent 56%),#286852;
  box-shadow:1px 2px 4px rgba(0,0,0,.23);
}

.back-stack b { position:absolute; top:6px; right:-12px; color:var(--accent-strong); font-size:.78rem; }

.table-center {
  position:absolute;
  inset:94px 115px 90px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}

.contract-line {
  position:absolute;
  top:8px;
  max-width:100%;
  padding:7px 12px;
  border:1px solid rgba(242,248,244,.16);
  border-radius:999px;
  color:#f7fbf8;
  background:rgba(1,24,15,.4);
  font-size:.8rem;
  font-weight:700;
  text-align:center;
}

.trick-area { position:relative; width:min(270px,100%); height:220px; }
.empty-trick {
  position:absolute;
  top:50%;
  left:50%;
  display:grid;
  place-items:center;
  gap:4px;
  width:152px;
  padding:17px 9px;
  border:1px dashed rgba(245,249,246,.38);
  border-radius:16px;
  color:#f4faf6;
  transform:translate(-50%,-50%);
  font-size:.84rem;
  font-weight:650;
  text-align:center;
}

.empty-trick small { color:rgba(245,249,246,.7); font-size:.7rem; font-weight:500; }
.trick-card { position:absolute; display:grid; justify-items:center; gap:5px; }
.trick-name { color:#f4faf6; font-size:.7rem; font-weight:800; }
.trick-seat-0 { bottom:0; left:50%; transform:translateX(-50%); }
.trick-seat-1 { top:50%; left:0; transform:translateY(-50%); }
.trick-seat-2 { top:0; left:50%; transform:translateX(-50%); }
.trick-seat-3 { top:50%; right:0; transform:translateY(-50%); }

.trick-points {
  position:absolute;
  bottom:2px;
  max-width:100%;
  color:#f2faf5;
  font-size:.74rem;
  font-weight:600;
  text-align:center;
}

.play-panel {
  margin-top:15px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--surface);
  box-shadow:0 14px 30px var(--shadow);
}

.status-row { justify-content:space-between; gap:12px; }
.status-copy { color:var(--text); font-size:1rem; font-weight:700; line-height:1.35; }

.deal-button {
  display:inline-flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
  padding:0 14px;
  border-color:rgba(244,189,79,.75);
  color:#2a1900;
  background:url("https://assets.popchat.com/assets/kenney/mobile-controls/Sprites/Highlights%20A/Default/button_bean_highlight.png") center/cover,linear-gradient(135deg,var(--accent-strong),var(--accent));
  font-size:.86rem;
  font-weight:850;
}

.deal-button:hover,.next-button:hover,.primary-modal-button:hover { transform:translateY(-1px); filter:brightness(1.07); }
.deal-button img { width:18px; height:18px; }

.decision-panel:empty { display:none; }
.decision-panel { margin-top:14px; padding:14px; border:1px solid var(--line); border-radius:14px; background:var(--surface-2); }
.decision-copy { display:grid; gap:4px; margin-bottom:11px; }
.eyebrow { color:var(--accent); font-size:.71rem; font-weight:850; letter-spacing:.09em; text-transform:uppercase; }
.decision-copy strong { font-size:1rem; }
.bid-controls { display:flex; align-items:start; gap:9px; }
.pass-button { padding:0 15px; font-weight:750; }
.bid-grid { display:flex; flex-wrap:wrap; gap:6px; }
.bid-option { min-width:45px; padding:0 8px; font-size:.86rem; font-weight:800; }
.trump-controls { display:grid; grid-template-columns:repeat(7,minmax(42px,1fr)); gap:7px; }
.trump-option { display:grid; justify-items:center; gap:3px; min-height:62px; padding:6px 3px; font-size:.72rem; font-weight:750; }
.trump-pip { color:var(--accent); font-size:1.35rem; font-weight:900; }
.result-strip { justify-content:space-between; gap:14px; }
.result-strip strong { max-width:70%; font-size:.93rem; line-height:1.4; }

.next-button,.primary-modal-button {
  padding:0 15px;
  border-color:rgba(244,189,79,.75);
  color:#2a1900;
  background:var(--accent);
  font-size:.85rem;
  font-weight:850;
}

.hand-header { justify-content:space-between; gap:10px; margin-top:18px; }
.hand-header strong { display:block; margin-top:4px; font-size:1rem; }
.tap-indicator { padding:9px 11px; border-radius:999px; color:var(--muted); background:var(--surface-2); font-size:.75rem; font-weight:650; white-space:nowrap; }

.human-hand {
  display:flex;
  justify-content:center;
  gap:clamp(4px,1.3vw,10px);
  min-height:106px;
  margin-top:13px;
  overflow-x:auto;
  padding:5px 4px 10px;
}

.domino {
  display:inline-flex;
  position:relative;
  flex-direction:column;
  width:clamp(44px,10vw,66px);
  height:clamp(78px,17vw,108px);
  flex:0 0 auto;
  overflow:hidden;
  padding:0;
  border:2px solid #d9e4dc;
  border-radius:7px;
  color:#18211c;
  background:#f8faf7;
  box-shadow:0 4px 0 #8d9a91,0 7px 10px rgba(0,0,0,.28);
}

button.domino { cursor:pointer; }
.domino.disabled { opacity:.48; filter:saturate(.58); }

.domino.playable {
  border-color:#f4c25e;
  box-shadow:0 4px 0 #9e7017,0 0 0 3px rgba(244,189,79,.23),0 7px 10px rgba(0,0,0,.3);
  animation:ready-card 1.9s ease-in-out infinite;
}

.domino.playable:hover { transform:translateY(-6px); }
.compact-domino { width:43px; height:69px; box-shadow:0 3px 0 #8d9a91,0 5px 8px rgba(0,0,0,.25); }
.domino-half { position:relative; display:block; flex:1; min-height:0; }
.domino-divider { height:2px; flex:0 0 2px; background:#94a098; }
.pip { position:absolute; width:14%; aspect-ratio:1; border-radius:50%; background:#17211b; transform:translate(-50%,-50%); }

@keyframes ready-card {
  50% { box-shadow:0 4px 0 #9e7017,0 0 0 5px rgba(244,189,79,.36),0 7px 12px rgba(0,0,0,.34); }
}

.round-log { margin-top:15px; padding:15px 16px; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.round-log h2 { margin-bottom:8px; color:var(--accent); font-size:.8rem; letter-spacing:.08em; text-transform:uppercase; }
.round-log p { padding:8px 0; border-top:1px solid var(--line); color:var(--muted); font-size:.87rem; line-height:1.45; }

.modal-backdrop {
  position:fixed;
  z-index:10;
  inset:0;
  display:grid;
  place-items:center;
  overflow-y:auto;
  padding:18px;
  background:rgba(1,13,9,.76);
  backdrop-filter:blur(5px);
}

.rules-modal,.tutorial-modal {
  width:min(730px,100%);
  max-height:calc(100vh - 36px);
  overflow-y:auto;
  padding:clamp(20px,4vw,30px);
  border:1px solid rgba(244,189,79,.52);
  border-radius:22px;
  background:var(--surface);
  box-shadow:0 30px 80px rgba(0,0,0,.44);
}

.modal-heading { justify-content:space-between; gap:12px; margin-bottom:20px; }
.modal-heading h2,.tutorial-modal h2 { margin-top:5px; font-size:clamp(1.4rem,4vw,1.85rem); }
.close-button { padding:0 13px; color:var(--text); font-size:.84rem; }

.rules-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.rules-grid article { padding:14px; border:1px solid var(--line); border-radius:13px; background:var(--surface-2); }
.rules-grid h3 { margin-bottom:6px; color:var(--accent); font-size:.95rem; }
.rules-grid p { color:var(--muted); font-size:.87rem; line-height:1.48; }
.primary-modal-button { width:100%; margin-top:18px; }

.tutorial-modal { width:min(540px,100%); text-align:center; }
.tutorial-progress { margin-bottom:15px; color:var(--muted); font-size:.82rem; font-weight:750; }
.tutorial-visual { display:flex; justify-content:center; align-items:center; height:102px; margin-bottom:12px; }

.tutorial-domino {
  display:grid;
  grid-template-rows:1fr 2px 1fr;
  width:55px;
  height:90px;
  padding:8px;
  border:2px solid #d9e4dc;
  border-radius:8px;
  background:#f8faf7;
  box-shadow:0 6px 0 #8d9a91,0 10px 16px rgba(0,0,0,.22);
  transform:rotate(-9deg);
}

.tutorial-domino.tilted { margin-left:-9px; transform:rotate(12deg) translateY(5px); }
.tutorial-domino b,.tutorial-domino i { display:block; position:relative; }

.tutorial-domino b::after,.tutorial-domino i::after {
  content:"";
  position:absolute;
  width:10px;
  height:10px;
  border-radius:50%;
  background:#17211b;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
}

.tutorial-domino b { border-bottom:2px solid #94a098; }

.tutorial-modal > p {
  max-width:430px;
  margin:15px auto 6px;
  color:var(--muted);
  font-size:1rem;
  line-height:1.55;
}

.tutorial-actions { display:grid; grid-template-columns:1fr 1.45fr; gap:10px; margin-top:22px; }
.tutorial-actions .primary-modal-button { margin:0; }

@media (max-width:620px) {
  .app-shell { padding-top:12px; }
  .topbar { align-items:flex-start; }
  .top-actions { gap:5px; }
  .utility-button { min-width:44px; padding:0 10px; font-size:.75rem; }
  .desktop-action { display:none; }

  .felt-table { min-height:434px; border-radius:19px; }
  .seat { min-width:84px; padding:8px 9px; }
  .seat-name { font-size:.8rem; }
  .seat-role,.seat-count { font-size:.62rem; }
  .seat-west { left:9px; }
  .seat-east { right:9px; }

  .table-center { inset:89px 74px 82px; }
  .trick-area { width:208px; height:200px; }
  .trick-points { width:230px; bottom:0; }

  .status-copy { font-size:.88rem; }
  .deal-button { padding:0 11px; }
  .trump-controls { grid-template-columns:repeat(4,minmax(42px,1fr)); }
  .tap-indicator { display:none; }

  .result-strip { align-items:stretch; flex-direction:column; }
  .result-strip strong { max-width:100%; }
  .next-button { width:100%; }
}

@media (max-width:430px) {
  .brand-number { width:44px; height:44px; flex-basis:44px; border-radius:13px; }
  .brand-block p { display:none; }
  .sound-button img { display:none; }
  .team-label { max-width:70px; line-height:1.1; }
  .match-status strong { font-size:.7rem; }

  .felt-table { min-height:407px; }
  .seat-north { top:12px; }
  .seat-south { bottom:12px; }
  .seat-west,.seat-east { top:52%; }

  .table-center { inset:79px 55px 74px; }
  .trick-area { width:184px; height:186px; }
  .compact-domino { width:37px; height:60px; }
  .trick-points { width:195px; font-size:.62rem; }

  .bid-controls { flex-direction:column; }
  .pass-button,.bid-grid { width:100%; }
  .bid-option { flex:1 0 40px; }
  .rules-grid { grid-template-columns:1fr; }
  .tutorial-actions { grid-template-columns:1fr; }
}
