:root {
  --felt: #2d6a34;
  --felt-deep: #1d4a24;
  --grass-1: #3d8a3a;
  --grass-2: #2f6d2c;
  --path: #c9b08a;
  --path-dark: #a88962;
  --ink: #2a1840;
  --purple: #6b2db5;
  --purple-deep: #4a1a86;
  --gold: #e8c547;
  --cream: #fff8e8;
  --panel: #f6e7a8;
  --heart: #e23b4a;
  --diamond: #e23b4a;
  --spade: #1a1a1a;
  --club: #1a1a1a;
  --card-border: #4a2a78;
  --shadow: 0 4px 10px rgba(20, 40, 10, 0.28);
  --font: "Nunito", "Segoe UI", sans-serif;
  --display: "Playfair Display", Georgia, serif;
  --card-font: "Source Sans 3", "Nunito", sans-serif;
  --card-w: 92px;
  --card-h: 125px;
  --card-gap: 6px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: #1a3d1c;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-text { font-weight: 900; }

#app {
  height: 100%;
  width: 100%;
}

/* ========== SCREENS ========== */
.screen {
  display: none;
  height: 100%;
  width: 100%;
}
.screen.active { display: flex; }

/* ---------- Title ---------- */
#screen-title {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 230, 120, 0.18), transparent 50%),
    repeating-linear-gradient(0deg, #2f7a32 0 10px, #348538 10px 20px),
    #2d6a34;
  position: relative;
  overflow: hidden;
}
#screen-title::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(80, 160, 60, 0.4) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(40, 100, 30, 0.35) 0 3px, transparent 4px);
  background-size: 40px 40px, 55px 55px;
  pointer-events: none;
}

.title-card {
  position: relative;
  z-index: 1;
  width: min(720px, 92vw);
  background: linear-gradient(180deg, #fff6d4 0%, #f3d98a 100%);
  border: 4px solid #6b3a12;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35), inset 0 1px 0 #fff;
  padding: 36px 40px 32px;
  text-align: center;
}
.title-suits {
  font-size: 28px;
  letter-spacing: 12px;
  margin-bottom: 6px;
}
.title-card h1 {
  font-family: var(--display);
  font-size: clamp(42px, 7vw, 64px);
  color: #5a1d9a;
  letter-spacing: 1px;
  line-height: 1;
}
.title-card h1 span {
  display: block;
  font-size: 0.42em;
  font-style: italic;
  color: #8a4a16;
  margin-top: 6px;
  letter-spacing: 3px;
}
.title-tag {
  margin: 14px auto 22px;
  max-width: 460px;
  color: #4a3060;
  font-weight: 700;
  font-size: 16px;
}
.title-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-primary, .btn-blue, .btn-ghost, .btn-play, .btn-hint {
  background: linear-gradient(180deg, #e8e2ff, #c9b8f5);
  color: #3a1f6e;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 900;
  border-radius: 12px;
  box-shadow: 0 4px 0 #6b4aa8;
}
.btn-hint.ready { animation: hintPulse 1.4s ease-in-out infinite; }
@keyframes hintPulse {
  0%, 100% { box-shadow: 0 4px 0 #6b4aa8, 0 0 0 0 rgba(255, 230, 106, 0); }
  50% { box-shadow: 0 4px 0 #6b4aa8, 0 0 0 8px rgba(255, 230, 106, 0.55); }
}
.playing-card.hint .card-inner {
  outline: 4px solid #ffe66a;
  outline-offset: -2px;
  border-radius: 10px;
  animation: hintGlow 0.9s ease-in-out infinite alternate;
}
@keyframes hintGlow {
  from { box-shadow: 0 0 0 0 rgba(255, 230, 106, 0.2); }
  to { box-shadow: 0 0 22px 6px rgba(255, 230, 106, 0.9); }
}
.btn-shuffle {
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn-primary {
  background: linear-gradient(180deg, #8b46e0, #5b1fb0);
  color: #fff;
  padding: 14px 34px;
  font-size: 18px;
  box-shadow: 0 4px 0 #3a1178, 0 8px 16px rgba(80,20,140,0.3);
}
.btn-blue {
  background: linear-gradient(180deg, #3d8dff, #1b5ed4);
  color: #fff;
  padding: 12px 26px;
  font-size: 16px;
  box-shadow: 0 4px 0 #0d3d96;
}
.btn-ghost {
  background: #fff;
  color: #5a1d9a;
  border: 2px solid #5a1d9a;
  padding: 11px 22px;
  font-size: 16px;
  font-weight: 800;
}
.btn-freeplay {
  background: linear-gradient(180deg, #3d8dff, #1b5ed4);
  color: #fff;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.4px;
  border-radius: 12px;
  box-shadow: 0 4px 0 #0d3d96, 0 8px 16px rgba(20,60,160,0.28);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn-freeplay:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-freeplay:active { transform: translateY(2px); }
.btn-compete {
  background: linear-gradient(180deg, #e85a8a, #c43b6f);
  color: #fff;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.4px;
  border-radius: 12px;
  box-shadow: 0 4px 0 #8a1f4a, 0 8px 16px rgba(160,20,80,0.28);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn-compete:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-compete:active { transform: translateY(2px); }
.btn-primary:hover, .btn-blue:hover, .btn-play:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-primary:active, .btn-blue:active { transform: translateY(2px); }

.title-best {
  margin-top: 18px;
  font-size: 14px;
  font-weight: 800;
  color: #6b3a12;
}
.title-stats {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #7a5a2a;
}
.btn-daily {
  background: linear-gradient(180deg, #ffd35c, #e0a41a);
  color: #3a2008;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 900;
  border-radius: 14px;
  box-shadow: 0 5px 0 #8a5a08;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-daily:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a5a08; }

#screen-compete {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: auto;
  padding: 28px 16px 36px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 180, 210, 0.18), transparent 50%),
    repeating-linear-gradient(0deg, #2f7a32 0 10px, #348538 10px 20px),
    #2d6a34;
}
.compete-card {
  width: min(820px, 94vw);
  background: linear-gradient(180deg, #fff6d4 0%, #f3d98a 100%);
  border: 4px solid #6b3a12;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  padding: 28px 30px 22px;
}
.compete-card h1 {
  font-family: var(--display);
  font-size: clamp(36px, 6vw, 52px);
  color: #5a1d9a;
  text-align: center;
  line-height: 1;
}
.compete-card h1 span {
  display: block;
  font-size: 0.4em;
  font-style: italic;
  color: #8a4a16;
  margin-top: 6px;
  letter-spacing: 2px;
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #6b3a12;
  margin: 8px 0 6px;
}
.field-input {
  width: 100%;
  border: 2px solid #5a1d9a;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 800;
  color: #2a1840;
  background: #fffdf6;
}
.field-input.code {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 20px;
  text-align: center;
}
.compete-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
.compete-pane {
  background: rgba(255,248,232,0.72);
  border: 2px solid #d4b36a;
  border-radius: 14px;
  padding: 14px 14px 16px;
}
.compete-pane h3 {
  color: #5a1d9a;
  font-size: 18px;
  margin-bottom: 6px;
}
.compete-pane p {
  font-size: 13px;
  font-weight: 700;
  color: #4a3060;
  margin-bottom: 12px;
}
.join-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.join-row .field-input { flex: 1; }
.compete-error {
  margin-top: 12px;
  color: #b02020;
  font-weight: 800;
  text-align: center;
}
.compete-table {
  margin-top: 18px;
  background: #fff8e8;
  border: 2px solid #5a1d9a;
  border-radius: 14px;
  padding: 14px;
}
.share-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.share-kicker {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8a4a16;
}
.share-code {
  font-family: var(--card-font);
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #5a1d9a;
  line-height: 1;
}
.share-mode {
  font-weight: 800;
  color: #4a3060;
  margin-top: 4px;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.stand-title {
  margin: 14px 0 8px;
  color: #5a1d9a;
  font-size: 16px;
}
.standings {
  overflow: auto;
}
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-weight: 700;
}
.standings-table th, .standings-table td {
  padding: 6px 6px;
  text-align: center;
  border-bottom: 1px solid #e0c888;
}
.standings-table th { color: #5a1d9a; font-size: 11px; text-transform: uppercase; }
.standings-table tr.me td { background: #ffe66a; }
.stand-empty {
  text-align: center;
  font-weight: 800;
  color: #6b3a12;
  padding: 10px 0;
}
.compete-foot { margin-top: 18px; }
.table-chip {
  margin-top: 8px;
  display: inline-block;
  background: #c43b6f;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 999px;
}
.results-share {
  margin: 8px 0 14px;
  background: #fff1c8;
  border: 2px solid #d4b36a;
  border-radius: 12px;
  padding: 12px;
}
.submit-status {
  font-size: 13px;
  font-weight: 800;
  color: #4a1a86;
  margin: 8px 0 0;
}
@media (max-width: 760px) {
  .compete-split { grid-template-columns: 1fr; }
}

/* ---------- How to ---------- */
#screen-howto {
  flex-direction: column;
  background:
    repeating-linear-gradient(0deg, #2f7a32 0 12px, #348538 12px 24px);
  padding: 24px 28px 18px;
  overflow: auto;
}
.howto-grid {
  display: grid;
  grid-template-columns: 1fr 280px 1fr;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}
.howto-panel {
  background: #f6e7a8;
  border-radius: 18px;
  padding: 20px 22px 22px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.15);
  color: #4a1a86;
}
.howto-panel h2 {
  font-size: 22px;
  margin-bottom: 10px;
  line-height: 1.25;
}
.howto-panel p, .howto-panel li {
  font-size: 15px;
  font-weight: 700;
  color: #3d2460;
  line-height: 1.45;
}
.howto-panel ol, .howto-panel ul { padding-left: 18px; }
.howto-panel li { margin: 6px 0; }
.howto-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 6px;
}
.mini-tile {
  width: 52px;
  height: 64px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid #4a2a78;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--card-font);
  position: relative;
}
.mini-tile.lit { outline: 3px solid #3d8dff; box-shadow: 0 0 0 3px #ffe66a; }
.mini-word {
  font-family: var(--display);
  font-size: 28px;
  color: #f6e7a8;
  text-shadow: 0 2px 0 #2a1840;
}
.power-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
}
.power-ico {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}
.howto-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1180px;
  margin: 22px auto 0;
  width: 100%;
  color: #fff;
  font-weight: 800;
}

/* ---------- Play layout ---------- */
#screen-play {
  flex-direction: row;
  background: #245528;
}

.side-left, .side-right {
  width: 248px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.side-left {
  background:
    linear-gradient(90deg, rgba(80,50,20,0.15), transparent 30%),
    repeating-linear-gradient(180deg, #d2b48c 0 18px, #c4a574 18px 36px);
  border-right: 8px solid #8a6a3e;
  padding: 16px 14px 12px;
  position: relative;
}
.side-left::after {
  content: "";
  position: absolute;
  top: 0; right: -14px; bottom: 0;
  width: 14px;
  background:
    radial-gradient(circle at 0 12px, #8a6a3e 10px, transparent 11px);
  background-size: 14px 28px;
}

.banner-wrap {
  background: linear-gradient(180deg, #f3d27a, #e0b04a);
  border: 3px solid #8a5a18;
  border-radius: 8px 8px 40px 40px;
  padding: 10px 10px 16px;
  text-align: center;
  box-shadow: 0 4px 0 #8a5a18;
}
.banner-wrap .theme-name {
  font-family: var(--display);
  font-size: 26px;
  color: #5a1d20;
}
.banner-wrap .round-num {
  font-weight: 800;
  color: #4a3060;
  font-size: 15px;
}
.goal-bubble {
  margin-top: 14px;
  background: #3a2410;
  color: #f6e7a8;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.score-block {
  margin-top: 18px;
  text-align: center;
}
.score-block h3 {
  font-family: var(--display);
  font-style: italic;
  color: #5a1d9a;
  font-size: 22px;
}
.score-block .num {
  font-size: 34px;
  font-weight: 900;
  color: #2a1840;
  line-height: 1.1;
}
.score-block .sub {
  font-size: 13px;
  font-weight: 800;
  color: #6b3a12;
}
.progress-pips {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #b89a6a;
  border: 2px solid #6b3a12;
}
.pip.on { background: #6bdc4a; }
.pip.goal { box-shadow: 0 0 0 2px #e8c547; }

.left-actions {
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 12px;
}
.wood-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0b06a, #8a5a28);
  border: 3px solid #5a3410;
  color: #3a2008;
  font-size: 18px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), 0 3px 0 #5a3410;
}
.wood-btn:hover { filter: brightness(1.08); }
.wood-btn.muted { color: #5a3410; }

.play-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,180,0.08), transparent 40%),
    repeating-linear-gradient(90deg, #2f7a32 0 14px, #317e34 14px 28px);
  position: relative;
}
.rope-bar {
  height: 28px;
  background:
    repeating-linear-gradient(90deg, #c9a06a 0 10px, #a87840 10px 14px, #d4b07a 14px 24px);
  box-shadow: 0 4px 0 #6b4a20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 88px;
  position: relative;
}
.barrel-timer {
  position: absolute;
  right: 18px;
  top: 4px;
  width: 72px;
  height: 78px;
  background:
    linear-gradient(90deg, #8a5a28 0 8px, #c4893a 8px 16px, #e0a85a 16px 56px, #c4893a 56px 64px, #8a5a28 64px);
  border-radius: 8px 8px 14px 14px;
  border: 3px solid #4a2a10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff8e0;
  font-weight: 900;
  font-size: 28px;
  text-shadow: 0 2px 0 #3a2008;
  box-shadow: 0 6px 0 #3a2008;
  z-index: 3;
}
.barrel-timer.low {
  animation: pulse 0.8s ease infinite;
  color: #ffd0d0;
}
.barrel-timer.free {
  font-size: 34px;
  color: #ffe66a;
  animation: none;
}
@keyframes pulse {
  50% { filter: brightness(1.25); transform: scale(1.04); }
}

.board-area {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px 6px;
}
.board {
  display: grid;
  grid-template-columns: repeat(8, var(--card-w));
  grid-template-rows: repeat(7, var(--card-h));
  gap: var(--card-gap, 6px);
  user-select: none;
  touch-action: none;
}

.cell {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
}
.cell.empty::after {
  content: "";
  position: absolute;
  inset: 10% 12%;
  border-radius: 10px;
  background: rgba(20, 60, 20, 0.28);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
}

/* Playing cards — Poker Pile Up inspired */
.playing-card {
  width: 100%;
  height: 100%;
  perspective: 600px;
  cursor: pointer;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}
.playing-card.face-down .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
}
.card-front {
  background: #fff;
  border: 2px solid var(--card-border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
}
.card-back {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, #4a1a86 0 6px, #6b2db5 6px 12px),
    #4a1a86;
  border: 2px solid #2a0d50;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.card-back-inner {
  width: 78%;
  height: 82%;
  border: 2px solid #e8c547;
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 50%, #8b46e0, #3a1178);
  display: grid;
  place-items: center;
  color: #e8c547;
  font-family: var(--display);
  font-size: calc(var(--card-w) * 0.28);
  font-weight: 800;
}

.playing-card.selected .card-front {
  outline: 3px solid #3d8dff;
  box-shadow: 0 0 0 3px #ffe66a, var(--shadow);
}
.playing-card.path-head .card-front {
  outline: 3px solid #ff7a18;
}
.playing-card.cleared {
  pointer-events: none;
}
.playing-card.just-flipped .card-inner {
  animation: flipIn 0.45s ease;
}
@keyframes flipIn {
  from { transform: rotateY(180deg); }
  to { transform: rotateY(0); }
}

.card-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 0.9;
  font-family: var(--card-font);
  font-weight: 900;
  color: var(--spade);
  user-select: none;
}
.card-mark .mark-rank {
  font-size: calc(var(--card-w) * 0.48);
  letter-spacing: -0.04em;
}
.card-mark .mark-suit {
  font-size: calc(var(--card-w) * 0.42);
  margin-top: 2px;
}
.suit-hearts .card-mark,
.suit-diamonds .card-mark { color: var(--heart); }
.suit-joker .card-mark { color: #5b1fb0; }

.sel-index {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3d8dff;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: none;
  place-items: center;
  z-index: 2;
  border: 2px solid #fff;
}
.playing-card.selected .sel-index { display: grid; }

.play-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px 12px;
  flex-wrap: wrap;
}
.hand-preview {
  min-width: 220px;
  background: rgba(255,248,232,0.92);
  border: 2px solid #4a2a78;
  border-radius: 12px;
  padding: 6px 14px;
  text-align: center;
  min-height: 52px;
}
.hand-preview .hand-name {
  font-weight: 900;
  font-size: 16px;
  color: #4a1a86;
  letter-spacing: 0.4px;
}
.hand-preview .hand-pts {
  font-size: 13px;
  font-weight: 800;
  color: #6b3a12;
}
.hand-preview.invalid .hand-name { color: #a33; }
.hand-preview.mega .hand-name { color: #c06000; }

.btn-play {
  background: linear-gradient(180deg, #8b46e0, #5b1fb0);
  color: #fff;
  padding: 12px 22px;
  font-size: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 0 #3a1178;
}
.btn-shuffle {
  background: linear-gradient(180deg, #f0c14a, #c4891a);
  color: #3a2008;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 900;
  border-radius: 12px;
  box-shadow: 0 4px 0 #8a5a10;
}
.btn-clear {
  background: #fff;
  color: #4a1a86;
  border: 2px solid #4a1a86;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
}

.side-right {
  background: linear-gradient(180deg, #3a1468, #241040);
  color: #f3e8ff;
  padding: 12px 12px 10px;
  border-left: 4px solid #6b2db5;
}
.side-right h3 {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #e8c547;
  margin: 8px 0 6px;
}
.paytable {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
}
.pay-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
}
.pay-row.hit { background: rgba(232, 197, 71, 0.28); color: #fff6c8; }
.pay-row .pts { color: #9de07a; font-variant-numeric: tabular-nums; }
.pay-row.hit .pts { color: #fff; }

.round-log {
  flex: 1;
  min-height: 80px;
  overflow: auto;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.log-item {
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}
.log-item strong { color: #e8c547; }
.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chip {
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

/* floating score */
.float-score {
  position: fixed;
  pointer-events: none;
  font-weight: 900;
  font-size: 22px;
  color: #fff6c8;
  text-shadow: 0 2px 0 #3a1840, 0 0 12px #5b1fb0;
  animation: rise 900ms ease forwards;
  z-index: 50;
}
@keyframes rise {
  to { transform: translateY(-48px); opacity: 0; }
}

.toast {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: linear-gradient(180deg, #fff6d4, #f3d27a);
  color: #4a1a86;
  border: 3px solid #4a1a86;
  border-radius: 14px;
  padding: 6px 18px;
  font-weight: 900;
  font-size: 16px;
  max-width: 60vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}
.toast.show {
  animation: toastIn 1.8s ease forwards;
}
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.9); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}

/* overlays */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 30, 0.62);
  z-index: 40;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }
.modal {
  width: min(640px, 96vw);
  background: #fff8e8;
  border: 4px solid #5a1d9a;
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  max-height: 90vh;
  overflow: auto;
}
.modal h2 {
  font-family: var(--display);
  color: #5a1d9a;
  font-size: 32px;
  text-align: center;
}
.modal p { text-align: center; font-weight: 700; margin: 8px 0 14px; color: #4a3060; }
.modal .actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 16px;
}
.stat {
  background: #f6e7a8;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}
.stat b { display: block; font-size: 22px; color: #4a1a86; }
.stat span { font-size: 12px; font-weight: 800; color: #6b3a12; }

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-weight: 700;
  margin: 10px 0 16px;
}
.results-table th, .results-table td {
  padding: 6px 6px;
  text-align: center;
  border-bottom: 1px solid #e0c888;
}
.results-table th { color: #5a1d9a; font-size: 11px; text-transform: uppercase; }
.results-table tr.pass td:first-child { color: #1a7a28; }
.results-table tr.fail td:first-child { color: #b02020; }
.grand-total {
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  color: #5a1d9a;
  margin: 6px 0 12px;
}

.path-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.mobile-bar { display: none; }

@media (max-width: 1100px) {
  .side-right { display: none; }
  .side-left { width: 200px; }
}
@media (max-width: 760px) {
  .toast { top: 64px; font-size: 16px; padding: 8px 14px; max-width: 92vw; }
  .side-left { display: none; }
  .howto-grid { grid-template-columns: 1fr; }
  .rope-bar { display: none; }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 6px;
    background: linear-gradient(180deg, #c4a574, #a88952);
    border-bottom: 4px solid #6b4a20;
  }
  .mobile-stats {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    color: #2a1840;
  }
  .mobile-stats strong {
    font-size: 14px;
    font-weight: 900;
  }
  .mobile-stats span {
    font-size: 12px;
    font-weight: 800;
  }
  .barrel-timer.mobile {
    position: static;
    width: 54px;
    height: 46px;
    font-size: 20px;
    box-shadow: 0 3px 0 #3a2008;
  }
  .mobile-bar .wood-btn {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }
  .play-dock {
    gap: 8px;
    padding: 6px 8px 10px;
  }
  .hand-preview { min-width: 0; flex: 1 1 100%; min-height: 40px; padding: 4px 10px; }
}

#btn-cashout {
  background: linear-gradient(180deg, #3d8dff, #1b5ed4);
  color: #fff;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 900;
  border-radius: 12px;
  box-shadow: 0 4px 0 #0d3d96;
}
.suit-joker .card-mark { color: #5b1fb0; }
.playing-card.face-down { cursor: pointer; }
.board { position: relative; }
