/* Tetarti — dusk over the dunes.
   Moody sea-and-sand palette with a low sun and pyramid silhouettes. */

:root {
  --sky-1: #0d2b34;      /* deep petrol dusk */
  --sky-2: #17505a;      /* teal near the horizon */
  --sea: #123c42;
  --sand-1: #4d3d28;     /* dark shoreline sand */
  --sand-2: #2b2317;
  --sun: #e8b45e;        /* low golden sun */
  --sun-soft: rgba(232, 180, 94, 0.4);
  --terracotta: #b8452f; /* red suits */
  --ink: #2a251c;        /* black suits — warm ink */
  --lapis: #3b5bb5;      /* jokers */
  --papyrus: #f4e9cf;    /* card faces */
  --panel: rgba(8, 26, 29, 0.84);
  --panel-edge: rgba(232, 180, 94, 0.22);
  --text: #ece4d2;
  --cw: 96px;  --ch: 134px;   /* hand cards */
  --cw-sm: 76px; --ch-sm: 106px; /* board & center */
  --cw-xs: 44px; --ch-xs: 62px; /* opponent board */
  --step: 34px;    /* vertical offset between stacked board cards */
  --step-xs: 19px;
  --step-sliver: 8px; /* buried opponent cards when ladders are slimmed */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg,
    var(--sky-1) 0%, var(--sky-2) 30%,
    #7c5030 42%, #a06a3c 46%,      /* sunset band */
    var(--sea) 52%, #10333a 62%,   /* the sea */
    var(--sand-1) 74%, var(--sand-2) 100%) fixed;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ---------- backdrop scene ---------- */

.scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }

.scene .sun {
  position: absolute;
  top: 7%; left: 76%;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, #f6d38c 0 40%, var(--sun) 70%, rgba(232,180,94,0));
  box-shadow: 0 0 90px 40px rgba(232, 180, 94, 0.25);
  opacity: 0.85;
}

.scene .pyramid {
  position: absolute;
  bottom: 52%;
  left: 12%;
  width: 0; height: 0;
  border-left: 170px solid transparent;
  border-right: 170px solid transparent;
  border-bottom: 130px solid rgba(16, 14, 10, 0.5);
}
.scene .pyramid.far {
  left: 33%;
  border-left-width: 100px;
  border-right-width: 100px;
  border-bottom-width: 76px;
  opacity: 0.7;
}

.scene .sea {
  position: absolute;
  top: 48%; height: 14%; width: 100%;
  background: linear-gradient(180deg, rgba(232,180,94,0.10), transparent 60%);
}
.scene .sand { display: none; }

#app { max-width: 1200px; margin: 0 auto; padding: 0 14px 30px; }

/* ---------- header ---------- */

header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 4px 10px;
  border-bottom: 1px solid var(--panel-edge);
  margin-bottom: 10px;
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  letter-spacing: 6px;
  color: var(--sun);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.brand .pyr { font-size: 0.72em; margin-right: 10px; vertical-align: 2px; color: #c98d4f; }
.brand.xl { font-size: 42px; margin-bottom: 6px; }

/* The sun is deliberately oversized — it is the loudest thing in the header —
   but line-height:1 keeps it inside the .brand line box, so the header does not
   grow. Vertical space in this game is scarce; horizontal space here is not. */
.strong-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1;
  background: rgba(6, 20, 22, 0.45);
  border: 1px solid var(--sun-soft);
  border-radius: 999px;
  padding: 2px 14px 2px 10px;
  color: var(--sun);
}
.strong-badge b { color: var(--text); }
.strong-badge .suit-chip { font-size: 20px; }
.sb-label { letter-spacing: 0.5px; text-transform: uppercase; font-size: 11px; opacity: 0.85; }
.sun-icon {
  font-size: 26px;
  line-height: 1;
  border-radius: 50%;
  text-shadow: 0 0 14px var(--sun-soft);
  animation: sunGlow 3.4s ease-in-out infinite;
}
@keyframes sunGlow {
  0%, 100% { text-shadow: 0 0 10px var(--sun-soft); }
  50% { text-shadow: 0 0 22px rgba(232, 180, 94, 0.85); }
}

.scores { margin-left: auto; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.score { opacity: 0.65; padding: 4px 10px; border-radius: 999px; }
.score.turn {
  opacity: 1;
  background: rgba(232, 180, 94, 0.16);
  border: 1px solid var(--sun-soft);
}
.score b { color: var(--sun); }
.score-sep { opacity: 0.4; }
/* Completed Biribi, one ✦ each — the count used to have a line of its own. */
.biriba-pips { color: var(--sun); letter-spacing: 1px; margin-right: 5px; font-size: 12px; }
.score .thinking { margin-left: 7px; }

.header-btns { display: flex; gap: 8px; }

/* ---------- cards ---------- */

.card {
  width: var(--cw);
  height: var(--ch);
  border-radius: 9px;
  background: var(--papyrus);
  border: 1px solid #c4b48b;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45);
  position: relative;
  color: var(--ink);
  flex-shrink: 0;
  font-weight: 700;
}
.card.red { color: var(--terracotta); }
.card.sm { width: var(--cw-sm); height: var(--ch-sm); border-radius: 7px; }
.card.xs { width: var(--cw-xs); height: var(--ch-xs); border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.4); }

.corner {
  position: absolute;
  font-size: 19px;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.corner span { font-size: 17px; }
.corner.tl { top: 6px; left: 8px; }
.corner.br { bottom: 6px; right: 8px; transform: rotate(180deg); }
/* stacked board cards: rank+suit side by side so both peek out */
.card.sm .corner { font-size: 15px; flex-direction: row; gap: 2px; }
.card.sm .corner span { font-size: 14px; }
.card.xs .corner { font-size: 12px; flex-direction: row; gap: 1px; }
.card.xs .corner span { font-size: 11px; }
.card.sm .corner.br, .card.xs .corner.br { display: none; }

.pip {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 46px;
}
.card.sm .pip { font-size: 34px; }
.card.xs .pip { font-size: 20px; }

.card.joker { color: var(--lapis); }
.card.joker .pip { font-size: 40px; }
.joker-label {
  position: absolute;
  bottom: 20px;
  width: 100%;
  text-align: center;
  font-size: 10px;
  letter-spacing: 2px;
}
.card.sm .joker-label, .card.xs .joker-label { display: none; }

.ace-dir {
  position: absolute;
  bottom: 4px;
  width: 100%;
  text-align: center;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.75;
}

/* card back: a pyramid under a small sun, on papyrus sand */
.card.back {
  background:
    radial-gradient(circle at 50% 22%, var(--sun) 0 14%, rgba(232,180,94,0.35) 20%, transparent 30%),
    linear-gradient(to top right, #7d5b34 49.6%, transparent 50%) no-repeat 0 100% / 50% 58%,
    linear-gradient(to top left, #7d5b34 49.6%, transparent 50%) no-repeat 100% 100% / 50% 58%,
    #cfb083;
  border: 2px solid #8a6438;
}

.card.outline {
  background: rgba(244, 233, 207, 0.05);
  border: 1.5px dashed rgba(244, 233, 207, 0.3);
  box-shadow: none;
}
.ghost-suit {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  opacity: 0.35;
}
.ghost-suit.red { color: #f3a58c; }
.ghost-suit.black { color: #ded5c0; }

/* interactive states */
.clickable { cursor: pointer; }
[data-act] { cursor: pointer; }

.target.glow, .card.glow {
  outline: 2px solid var(--sun);
  outline-offset: 2px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px 1px var(--sun-soft); }
  50% { box-shadow: 0 0 14px 4px var(--sun-soft); }
}

/* Informational halos: "look here" (just drawn / just played), distinct from
   .glow which marks an actionable target. box-shadow only — never transform,
   so it doesn't fight the translateX(-50%) centering on stacked board cards. */
.card.halo {
  animation: cardHaloPulse 1.3s ease-in-out infinite;
}
@keyframes cardHaloPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--sun), 0 0 14px 3px var(--sun-soft); }
  50% { box-shadow: 0 0 0 2px var(--sun), 0 0 24px 7px rgba(232, 180, 94, 0.6); }
}

/* A completed Biriba: a bigger initial flash, then a thicker, slower pulse. */
.card.halo-complete {
  z-index: 4;
  animation: cardHaloFlash 0.8s ease-out 1, cardHaloBig 1.5s ease-in-out infinite 0.8s;
}
@keyframes cardHaloFlash {
  0% { box-shadow: 0 0 0 3px var(--sun), 0 0 18px 5px var(--sun-soft); }
  35% { box-shadow: 0 0 0 8px var(--sun), 0 0 64px 22px rgba(232, 180, 94, 0.8); }
  100% { box-shadow: 0 0 0 5px var(--sun), 0 0 34px 10px rgba(232, 180, 94, 0.5); }
}
@keyframes cardHaloBig {
  0%, 100% { box-shadow: 0 0 0 5px var(--sun), 0 0 28px 8px rgba(232, 180, 94, 0.45); }
  50% { box-shadow: 0 0 0 5px var(--sun), 0 0 46px 15px rgba(232, 180, 94, 0.7); }
}

/* ---------- opponent area ---------- */
/* Ladders only. The name, the turn indicator and the Biriba count live in the
   header; the hand is always seven cards. */

.opp-area {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 8px 14px 10px;
  margin-bottom: 12px;
}

.pname { font-weight: 700; letter-spacing: 0.5px; }

.thinking { font-size: 12px; color: var(--sun); font-style: italic; }
.thinking .dots::after {
  content: '…';
  animation: dots 1.4s steps(3) infinite;
}
@keyframes dots { 0% { content: '.'; } 50% { content: '..'; } 100% { content: '…'; } }

/* padding-right keeps a long recap out from under the ladders chip. */
.recap-line { font-size: 12px; opacity: 0.75; padding: 0 88px 4px 0; }

.opp-area .board.mini { margin-top: 0; }
/* Rides the panel's top edge, in the gap under the header: costs zero vertical
   space, and can't collide with the last column's n/7 count. */
.opp-toggle {
  position: absolute;
  top: -11px;
  right: 14px;
  z-index: 3;
  padding: 2px 11px;
  font-size: 11px;
  border-radius: 999px;
  white-space: nowrap;
  background: #0a2126;
  border: 1px solid var(--panel-edge);
}

/* ---------- boards ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.column {
  min-width: 0;
  background: rgba(244, 233, 207, 0.05);
  border: 1px solid rgba(244, 233, 207, 0.1);
  border-radius: 12px;
  padding: 8px;
  transition: background 0.15s;
}
/* The strong suit is worth 150, so it gets a warm tint and a brighter sun in
   its head — visible at a glance on both boards, at no cost in height. */
.column.strong { background: rgba(232, 180, 94, 0.07); border-color: rgba(232, 180, 94, 0.3); }
.column.target { background: rgba(232, 180, 94, 0.10); }
.column.complete { border-color: var(--sun); box-shadow: 0 0 12px rgba(232, 180, 94, 0.25) inset; }

.col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 7px;
}
.col-head .count { margin-left: auto; opacity: 0.65; font-size: 12px; }
/* line-height:0.8 keeps the enlarged sun inside the 13px head line box. */
.strong-star { color: var(--sun); font-size: 17px; line-height: 0.8; text-shadow: 0 0 10px var(--sun-soft); }
.column.xs .strong-star { font-size: 14px; }

.suit-chip { font-size: 16px; }
.suit-chip.red { color: #ff9d84; }
.suit-chip.black { color: #efe8d8; }

.stack { position: relative; height: calc(var(--ch-sm) + 6 * var(--step)); }
.column.xs .stack { height: calc(var(--ch-xs) + 6 * var(--step-xs)); }
/* Slimmed opponent ladder: buried cards show only a sliver each, so the top
   (last-played) card stays fully readable and the sliver count tells you how
   deep the ladder is. Expanding restores the full --step-xs spacing. */
.column.xs.slim .stack { height: calc(var(--ch-xs) + 6 * var(--step-sliver)); }
.column.xs.slim .card { box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.5); }
.stack .card { position: absolute; left: 50%; transform: translateX(-50%); }

.empty-slot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: var(--cw-sm);
  height: var(--ch-sm);
  border: 1.5px dashed rgba(244, 233, 207, 0.25);
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 22px;
  opacity: 0.5;
}
.column.xs .empty-slot { width: var(--cw-xs); height: var(--ch-xs); font-size: 15px; }
.empty-slot.red { color: #f3a58c; }

.col-foot { font-size: 11px; opacity: 0.85; margin-top: 6px; text-align: center; min-height: 16px; }

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 4px;
  padding: 1px 6px;
}
.tag.done { background: var(--sun); color: #2b2005; }
.tag.wild { background: var(--lapis); color: #fff; }

/* ---------- center strip ---------- */

.center-area {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  padding: 12px 8px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

/* Draw phase: halo the whole center strip so it's obvious where to look. */
.center-area.draw-ready {
  border-color: var(--sun);
  animation: centerHalo 1.5s ease-in-out infinite;
}
@keyframes centerHalo {
  0%, 100% { box-shadow: 0 0 20px 4px rgba(232, 180, 94, 0.25), 0 0 0 1px var(--sun-soft) inset; }
  50% { box-shadow: 0 0 44px 12px rgba(232, 180, 94, 0.45), 0 0 0 1px var(--sun) inset; }
}

.pile { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pile-label { font-size: 11px; opacity: 0.75; display: flex; gap: 4px; align-items: center; }
.pile-sep { width: 1px; align-self: stretch; background: rgba(244, 233, 207, 0.14); }

/* ---------- action bar + hand ---------- */

.hand-area { margin-top: 14px; }

.prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  text-align: center;
  font-size: 14px;
  background: rgba(6, 20, 22, 0.78);
  border: 1px solid var(--sun-soft);
  border-radius: 999px;
  padding: 8px 18px;
  margin: 0 auto 12px;
  max-width: 760px;
  min-height: 20px;
}
.prompt b { color: var(--sun); }
.bar-btns { display: inline-flex; gap: 8px; }

.hand-row { display: flex; align-items: center; gap: 16px; }
.pname.mine { font-size: 13px; opacity: 0.85; width: 90px; text-align: right; }

.hand { display: flex; padding-top: 18px; flex: 1; flex-wrap: wrap; row-gap: 20px; }
.hand .card.in-fan { margin-left: -30px; transition: transform 0.12s, box-shadow 0.12s; }
.hand .card.in-fan:first-child { margin-left: 0; }
.hand .card.clickable:hover { transform: translateY(-12px); z-index: 2; }
.hand .card.selected {
  transform: translateY(-20px);
  outline: 2.5px solid var(--sun);
  z-index: 3;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
}
.hand .card.resting { opacity: 0.92; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }

.btn.primary {
  background: linear-gradient(180deg, #f0c26a, #c99640);
  color: #2b2005;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn.ghost {
  background: rgba(244, 233, 207, 0.08);
  border: 1px solid rgba(244, 233, 207, 0.28);
  color: var(--text);
}
.btn.small { padding: 6px 14px; font-size: 12px; }

.btn.suit-btn {
  font-size: 22px;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  background: var(--papyrus);
}
.btn.suit-btn.small { width: 38px; height: 38px; font-size: 19px; }
.btn.suit-btn.red { color: var(--terracotta); }
.btn.suit-btn.black { color: var(--ink); }

.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* ---------- transient flash note ---------- */
/* Mounted on <body>, outside #app, so a re-render can't restart it mid-flight
   (see showFlash in ui.js). Never interactive — it must not eat a click. */

.flash-note {
  position: fixed;
  top: 28%;
  left: 50%;
  z-index: 60;
  pointer-events: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 5vw, 40px);
  letter-spacing: 2px;
  white-space: nowrap;
  color: var(--sun);
  /* A dark plaque, because the note can land over papyrus card faces. */
  background: rgba(5, 15, 17, 0.82);
  border: 1px solid var(--sun-soft);
  border-radius: 999px;
  padding: 10px 26px;
  box-shadow: 0 0 40px 8px rgba(232, 180, 94, 0.28), 0 10px 30px rgba(0, 0, 0, 0.55);
  text-shadow: 0 0 18px rgba(232, 180, 94, 0.55);
  animation: flashPunch 2.6s ease-out forwards;
}
@keyframes flashPunch {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(0.7); }
  9% { opacity: 1; transform: translate(-50%, 0) scale(1.12); }
  16% { transform: translate(-50%, 0) scale(1); }
  75% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .flash-note { animation: flashFade 2.6s ease-out forwards; transform: translateX(-50%); }
  .sun-icon { animation: none; }
  @keyframes flashFade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
}

/* ---------- overlays (start / game over / rules) ---------- */

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 15, 17, 0.8);
  z-index: 50;
  padding: 18px;
}

.panel {
  background: linear-gradient(180deg, #173c40, #0d272b);
  border: 1px solid var(--sun-soft);
  border-radius: 18px;
  padding: 30px 34px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}
.panel h2 { font-family: Georgia, serif; font-weight: 600; letter-spacing: 1px; margin-bottom: 14px; line-height: 1.35; }
.panel p { font-size: 14px; line-height: 1.55; margin-bottom: 10px; }
.panel .btn { margin-top: 8px; }

.gold { color: var(--sun); }
.tagline { opacity: 0.85; font-size: 14px; margin-bottom: 18px; line-height: 1.6; }
/* First-launch nudge under the start buttons — never a gate (see howto.js §5.4). */
.hint { opacity: 0.6; font-size: 12px; margin-top: 14px; line-height: 1.5; }

.name-inputs { display: flex; gap: 10px; justify-content: center; margin-bottom: 6px; }
.name-inputs input {
  font: inherit;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(244, 233, 207, 0.28);
  background: rgba(5, 15, 17, 0.4);
  color: var(--text);
  width: 170px;
  text-align: center;
}
.name-inputs input:focus { outline: 2px solid var(--sun-soft); }

.score-table {
  margin: 14px auto 10px;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 300px;
}
.score-table th, .score-table td { padding: 7px 14px; }
.score-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.65; }
.score-table tr + tr { border-top: 1px solid rgba(244, 233, 207, 0.12); }
.score-table td:first-child { text-align: left; }
.winner-row td { color: var(--sun); }

/* ---------- How to Play hub ---------- */

.panel.wide { max-width: 720px; }

.howto-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.howto-head h2 { margin: 0; flex: 1; }
.howto-head .btn { margin-top: 0; flex: 0 0 auto; }
.howto-spacer { flex: 0 0 auto; width: 62px; }

.howto-body {
  text-align: left;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 8px;
}
.howto-body b { color: var(--sun); }
.howto-body h3 {
  font-family: Georgia, serif;
  font-size: 15px;
  color: var(--sun);
  letter-spacing: 0.5px;
  margin: 18px 0 6px;
}
.howto-body h3:first-child { margin-top: 0; }

/* the four hub cards */
.hub-cards { display: flex; flex-direction: column; gap: 10px; }
.hub-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(244, 233, 207, 0.18);
  background: rgba(5, 15, 17, 0.35);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.hub-card:hover { border-color: var(--sun-soft); background: rgba(232, 180, 94, 0.08); }
.hub-card:active { transform: scale(0.99); }
.hub-icon { font-size: 20px; width: 26px; text-align: center; flex: 0 0 auto; }
.hub-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.hub-text b { color: var(--sun); font-size: 15px; letter-spacing: 0.5px; }
.hub-text span { font-size: 13px; opacity: 0.8; }
.hub-badge {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(244, 233, 207, 0.2);
  opacity: 0.85;
}
.hub-badge.done { background: var(--sun); color: #2b2005; border-color: transparent; }

/* accordions (Learn + FAQ) */
.acc + .acc { margin-top: 6px; }
.acc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(244, 233, 207, 0.14);
  background: rgba(5, 15, 17, 0.3);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.acc.open .acc-head { border-color: var(--sun-soft); color: var(--sun); }
.acc-head:hover { border-color: var(--sun-soft); }
.acc-mark { opacity: 0.6; font-size: 16px; flex: 0 0 auto; }
.acc-body { padding: 10px 13px 4px; font-size: 14px; line-height: 1.6; }
.acc-body p { margin-bottom: 9px; }
.learn-list { margin: 0 0 4px 18px; }
.learn-list li { margin-bottom: 8px; line-height: 1.55; }

/* reference tables */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0 14px;
}
.ref-table th, .ref-table td { padding: 7px 10px; text-align: left; vertical-align: top; }
.ref-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}
.ref-table tr + tr { border-top: 1px solid rgba(244, 233, 207, 0.1); }
.ref-table td:first-child { color: var(--sun); white-space: nowrap; }
.ref-table td:first-child b { color: inherit; }

/* inline diagrams — real cards, so they can never drift from the board */
.demo-figure {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  flex-wrap: wrap;
  margin: 12px 0 6px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(5, 15, 17, 0.3);
}
.column.demo { cursor: default; flex: 0 0 auto; width: calc(var(--cw-sm) + 16px); }
/* --n = cards in the diagram, so a 3-card ladder isn't 7 cards tall */
.column.demo .stack { height: calc(var(--ch-sm) + (var(--n) - 1) * var(--step)); }
.demo-cands { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.demo-cand { text-align: center; }
.card.faded { opacity: 0.4; }
.demo-verdict { font-size: 11px; margin-top: 5px; line-height: 1.3; max-width: 84px; }
.demo-cand.yes .demo-verdict { color: #8fd6a0; }
.demo-cand.no .demo-verdict { color: var(--terracotta); }
.demo-verdict span { display: block; opacity: 0.8; }
.demo-callout { align-self: center; font-size: 12px; color: var(--sun); max-width: 150px; }
.demo-cap { font-size: 12px; opacity: 0.75; font-style: italic; margin: 4px 0 10px; }

.demo-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(5, 15, 17, 0.3);
  font-size: 12px;
}
.demo-strip .step {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(244, 233, 207, 0.18);
}
.demo-strip .arr { opacity: 0.5; }
.demo-loop { flex-basis: 100%; color: var(--sun); font-size: 12px; margin-top: 4px; }

/* ---------- tutorial ---------- */

.prompt.tut {
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 12px;
  border-radius: 16px;
  padding: 10px 16px;
  max-width: 860px;
  text-align: left;
}
.tut-tag {
  flex: 0 0 auto;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--lapis);
  color: #fff;
}
.tut-hint, .tut-nudge, .tut-takeaway { flex: 1 1 260px; line-height: 1.5; }
.tut-nudge { color: var(--sun); }
.tut-takeaway { color: var(--sun); font-family: Georgia, serif; font-size: 15px; }
.prompt.tut.done { border-color: var(--sun-soft); }

.rules-body { text-align: left; max-height: 55vh; overflow-y: auto; padding-right: 6px; }
.rules-body b { color: var(--sun); }

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  :root {
    --cw: 70px;  --ch: 98px;
    --cw-sm: 58px; --ch-sm: 80px;
    --cw-xs: 34px; --ch-xs: 48px;
    --step: 26px;
    --step-xs: 15px;
    --step-sliver: 7px;
  }
  #app { padding: 0 8px 24px; }
  .board { gap: 7px; }
  .column { padding: 5px; }
  .col-foot { font-size: 10px; }
  .strong-badge { font-size: 13px; padding: 3px 11px 3px 8px; gap: 6px; }
  .sun-icon { font-size: 21px; }
  .strong-badge .suit-chip { font-size: 17px; }
  .opp-toggle { right: 8px; }
  .pip { font-size: 32px; }
  .card.sm .pip { font-size: 24px; }
  .hand .card.in-fan { margin-left: -22px; }
  .pname.mine { display: none; }
  .brand { font-size: 20px; letter-spacing: 4px; }
  .scores { font-size: 12px; }
  .center-area { gap: 8px; flex-wrap: wrap; }
  .panel { padding: 22px 18px; }
  .howto-head h2 { font-size: 19px; }
  .howto-spacer { width: 0; }
  .howto-body { max-height: 66vh; }
  .hub-card { padding: 12px 13px; gap: 10px; flex-wrap: wrap; }
  .hub-badge { font-size: 10px; }
  .hub-text b { font-size: 14px; }
  .demo-figure { gap: 14px; padding: 10px; }
  .ref-table { font-size: 12px; }
  .ref-table th, .ref-table td { padding: 6px 7px; }
  .ref-table td:first-child { white-space: normal; }
  .prompt.tut { padding: 9px 12px; font-size: 13px; }
  .scene .pyramid { border-left-width: 100px; border-right-width: 100px; border-bottom-width: 78px; }
  .scene .pyramid.far { border-left-width: 60px; border-right-width: 60px; border-bottom-width: 46px; }
}
