/* Bartender Mini App — dark casino theme, mobile-first. No build step. */
:root {
  --bg:            #0e1117;
  --bg-elev:       #161b26;
  --bg-elev-2:     #1e2533;
  --border:        #2a3242;
  --text:          #e7ecf3;
  --text-dim:      #9aa6b8;

  /* Main highlight palette — liquid teal */
  --accent:        #cbeff5;  /* light — glows, active text/borders, values */
  --accent-deep:   #007c8f;  /* dark  — filled CTAs / active pills */
  --accent-ink:    #06333b;  /* ink for text sitting on light-cyan fills */
  --accent-2:      #007c8f;  /* alias kept for legacy references */

  --good:          #16c954;
  --bad:           #ef2b2b;
  --radius:        14px;

  /* Liquid-glass surface tokens (aligned with the pill nav) */
  --glass-bg:      rgba(20, 26, 36, 0.62);
  --glass-bg-2:    rgba(28, 35, 49, 0.50);
  --glass-border:  rgba(255, 255, 255, 0.10);
  --glass-blur:    blur(18px) saturate(160%);
  --glass-shadow:
    0 10px 30px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28);
  --glass-shadow-sm:
    0 4px 14px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  --glass-inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.10);

  --cell-emoji:    clamp(26px, 12vw, 50px);
  --safe-top:      env(safe-area-inset-top, 0px);
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
  background:
    radial-gradient(1200px 860px at 12% -10%, rgba(0, 124, 143, 0.27), transparent 62%),
    radial-gradient(1000px 700px at 108% 8%, rgba(0, 180, 210, 0.15), transparent 58%),
    radial-gradient(700px 500px at 50% 100%, rgba(0, 80, 120, 0.13), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

#app { display: flex; flex-direction: column; min-height: 100%; position: relative; z-index: 1; }

/* Screen area */
.screen-root {
  flex: 1 1 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(104px + var(--safe-bottom));
  max-width: 640px; width: 100%; margin: 0 auto;
  overflow-x: hidden;
}

/* Mobile: reclaim horizontal space so game grids never overflow the viewport */
@media (max-width: 420px) {
  .screen-root { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  .tower-shaft { padding: 10px; }
  .towers, .tower-floor, .grid-cells { gap: 6px; }
}

/* Pill nav — iOS 26 "Liquid Glass" / Dynamic Island floating tab bar */
.pillnav {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-bottom)); z-index: 30;
  transform: translateX(-50%);
  width: min(86vw, 360px);
}
.pillnav-inner {
  position: relative;
  display: flex; align-items: stretch;
  height: 56px;
  padding: 6px;
  border-radius: 999px;
  /* seamless dark glass — lets content refract through */
  background: rgba(18, 22, 30, 0.55);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
}

.pillnav-links {
  position: relative;
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: stretch; justify-content: space-between; gap: 2px;
}

/* the lifted frosted-glass capsule that glides under the active tab */
.pillnav-indicator {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(203, 239, 245, 0.22), rgba(0, 124, 143, 0.16));
  border: 0.5px solid rgba(203, 239, 245, 0.30);
  box-shadow:
    0 4px 14px rgba(0, 124, 143, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -3px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
              width 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, width;
  z-index: 0;
  pointer-events: none;
}

.pillnav-link {
  position: relative; z-index: 1;
  flex: 1 1 auto;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-dim); font: inherit;
  padding: 0 4px; border-radius: 999px; cursor: pointer;
  transition: color 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pillnav-link:active { transform: scale(0.92); }
.pillnav-link.active { color: var(--accent); }
.pillnav-label { font-size: 13px; font-weight: 600; letter-spacing: 0.2px; }
.pillnav-link.active .pillnav-label { font-weight: 700; }

/* Cards & sections */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.card h2, .card h3 { margin: 0 0 10px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); margin: 4px 2px 10px; }
.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 12px; padding: 12px;
  box-shadow: var(--glass-inset-hi);
}
.stat .k { font-size: 11px; color: var(--text-dim); }
.stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--glass-border); background: var(--glass-bg-2);
  color: var(--text); font: inherit; font-weight: 600;
  padding: 11px 14px; border-radius: 12px; cursor: pointer;
  box-shadow: var(--glass-shadow-sm);
  transition: transform .05s ease, opacity .15s ease, filter .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* Filled CTAs — glossy but not glass, with a top light-line to match. */
.btn.primary, .btn.accent2, .btn.good, .btn.danger {
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 6px 16px rgba(0, 0, 0, 0.28);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.btn.primary { background: linear-gradient(180deg, #0a9db3, var(--accent-deep)); color: #f2feff; }
.btn.accent2 { background: linear-gradient(180deg, var(--accent), #a9e2ec); color: var(--accent-ink); }
.btn.good { background: linear-gradient(180deg, var(--good), #24a866); color: #04160c; }
.btn.danger { background: linear-gradient(180deg, var(--bad), #d63b32); color: #fff; }
.btn.block { display: block; width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 13px; border-radius: 10px; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--text-dim); }
input[type="number"], input[type="text"], select {
  width: 100%; background: var(--glass-bg-2); color: var(--text);
  border: 1px solid var(--glass-border); border-radius: 10px; padding: 11px 12px; font: inherit;
  box-shadow: var(--glass-inset-hi);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="number"]:focus, input[type="text"]:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: var(--glass-inset-hi), 0 0 0 3px rgba(0, 124, 143, 0.28);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  box-shadow: var(--glass-inset-hi);
}
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,0.4); }

/* Bet field: $ + amount input with inline 1/2 / 2x / Max value editors. */
.betbox {
  display: flex; align-items: center; gap: 6px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 6px 6px 6px 14px; box-shadow: var(--glass-inset-hi);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.betbox:focus-within {
  border-color: var(--accent);
  box-shadow: var(--glass-inset-hi), 0 0 0 3px rgba(0, 124, 143, 0.28);
}
.betbox-cur { display: flex; align-items: center; color: var(--text-dim); }
.betbox-cur svg { display: block; }
input[type="number"].betbox-input {
  flex: 1 1 auto; min-width: 0; width: auto;
  background: transparent; border: none; box-shadow: none;
  padding: 6px 2px; font-size: 18px; font-weight: 600;
}
input[type="number"].betbox-input:focus {
  outline: none; border: none; box-shadow: none;
}
.betbox-btn {
  flex: 0 0 auto; cursor: pointer;
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text);
  border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 600;
  box-shadow: var(--glass-inset-hi);
  transition: background .15s ease, border-color .15s ease;
}
.betbox-btn:hover { border-color: var(--accent); }
.betbox-btn:active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ===== Ranks page — "Race" redesign ==================================== */
:root {
  --race-gold: #f4c752;
  --race-gold-deep: #b9832b;
  --race-silver: #cdd6e0;
  --race-bronze: #e0955a;
}

/* Category tabs. */
.race-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.race-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 10px; border-radius: 12px; font-size: 15px; font-weight: 700;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text-dim);
  cursor: pointer; box-shadow: var(--glass-inset-hi); transition: color .15s, border-color .15s;
}
.race-tab .icon svg { display: block; }
.race-tab.active {
  color: #f2feff; border-color: transparent;
  background: linear-gradient(180deg, #0a9db3, var(--accent-deep));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 4px 14px rgba(0,124,143,0.3);
}

/* Weekly / all-time segmented switch. */
.race-segtoggle {
  display: inline-flex; gap: 2px; margin: 0 0 14px; padding: 3px;
  border-radius: 999px; background: var(--glass-bg-2);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-inset-hi);
}
.race-seg {
  padding: 6px 16px; border-radius: 999px; border: none; background: transparent;
  color: var(--text-dim); font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  cursor: pointer; transition: color 0.15s, background 0.15s;
}
.race-seg.active { background: rgba(0,124,143,0.18); color: var(--accent); }

/* Ranked table. */
.race-table { display: flex; flex-direction: column; }
.race-thead {
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 10px;
  padding: 4px 12px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-dim);
}
.race-thead .rc-value { text-align: right; }
.race-thead .rc-reward { text-align: center; }
.race-row {
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 12px; margin-bottom: 8px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); box-shadow: var(--glass-inset-hi);
}
.race-row.you { border-color: var(--accent); box-shadow: var(--glass-inset-hi), 0 0 0 1px rgba(203,239,245,0.35), 0 0 18px rgba(0,124,143,0.25); }
.rc-rank { display: flex; justify-content: center; }
.rc-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rc-player .icon { color: var(--accent); flex: 0 0 auto; }
.rc-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-value { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); padding-right: 16px; }
.rc-reward { text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--race-gold); text-shadow: 0 0 10px rgba(244,199,82,0.35); min-width: 56px; }

/* Hexagon rank badge. */
.hexbadge {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 36px; font-size: 13px; font-weight: 900; color: var(--text-dim);
  background: var(--glass-bg-2); border: 1px solid var(--glass-border);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.hexbadge.r1 { color: #3a2a05; background: linear-gradient(180deg, #ffe9a8, var(--race-gold) 60%, var(--race-gold-deep)); box-shadow: 0 0 14px rgba(244,199,82,0.55); }
.hexbadge.r2 { color: #23282e; background: linear-gradient(180deg, #f2f6fb, var(--race-silver) 60%, #9aa6b3); box-shadow: 0 0 12px rgba(205,214,224,0.4); }
.hexbadge.r3 { color: #3a1f0a; background: linear-gradient(180deg, #f6c79a, var(--race-bronze) 60%, #b06a34); box-shadow: 0 0 12px rgba(224,149,90,0.4); }
.race-you-label { margin: 16px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }

/* Lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 12px; padding: 12px;
  box-shadow: var(--glass-inset-hi);
}
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text-dim); }
.badge.good { color: var(--good); border-color: rgba(53,199,124,0.4); }
.badge.bad  { color: var(--bad);  border-color: rgba(240,85,76,0.4); }

/* Tabs (leaderboard) */
.pilltabs { display: flex; gap: 8px; margin-bottom: 12px; }
.pilltab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 10px; border-radius: 12px; font-size: 16px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text-dim);
  cursor: pointer; font-weight: 700; box-shadow: var(--glass-inset-hi);
}
.pilltab .icon svg { display: block; }
.pilltab.active { background: linear-gradient(180deg, #0a9db3, var(--accent-deep)); color: #f2feff; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,0.28); }

/* Compact segmented control for the weekly / all-time period switch — small,
   inline, and visually secondary to the full-width category pills above. */
.segtoggle {
  display: inline-flex; gap: 2px; margin: -4px 0 17px; padding: 3px;
  border-radius: 999px; background: var(--glass-bg-2);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-inset-hi);
}
.segtoggle-btn {
  padding: 6px 16px; border-radius: 999px; border: none; background: transparent;
  color: var(--text-dim); font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  cursor: pointer; transition: color 0.15s;
}
.segtoggle-btn.active { background: rgba(255,255,255,0.10); color: var(--text); }

.rank-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); box-shadow: var(--glass-inset-hi);
}
.rank-row.you { border-color: var(--accent); box-shadow: var(--glass-inset-hi), 0 0 0 1px rgba(203,239,245,0.35), 0 0 18px rgba(0,124,143,0.25); }
.rank-n { width: 30px; font-weight: 800; color: var(--text-dim); text-align: center; }
.rank-n.r1 { color: #ffd24a; text-shadow: 0 0 10px rgba(255,210,74,0.45); }
.rank-n.r2 { color: #cdd6e0; text-shadow: 0 0 10px rgba(205,214,224,0.4); }
.rank-n.r3 { color: #e0955a; text-shadow: 0 0 10px rgba(224,149,90,0.4); }
.rank-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Game selector */
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.game-tile {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 12px; padding: 12px 8px;
  text-align: center; cursor: pointer; box-shadow: var(--glass-inset-hi);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.game-tile.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 0 18px rgba(0,124,143,0.30); }
.game-tile .g-ico { display: flex; align-items: center; justify-content: center; height: 30px; color: var(--text); }
.game-tile.active .g-ico { color: var(--accent); }
.game-tile .g-name { font-size: 12px; margin-top: 6px; }

/* Inline SVG icon wrapper */
.icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon svg { display: block; }

/* Game screen title with leading icon */
.game-title { display: flex; align-items: center; gap: 8px; }

/* Game panel header: title (left) + ⓘ info button (right) */
.game-title-wrap {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.game-title-wrap .game-title { margin: 0; }
.game-info-btn {
  background: transparent; border: 1px solid var(--glass-border); color: var(--text-dim);
  border-radius: 50%; width: 26px; height: 26px; font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: color .15s, border-color .15s;
}
.game-info-btn:hover { color: var(--text); border-color: var(--accent); }

/* Game description overlay card */
.game-desc-card { max-width: 420px; }
.game-desc-top {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.game-desc-body { font-size: 14px; line-height: 1.65; color: var(--text-dim); margin: 0; }

/* Hidden per-game fairness anchor (state lives in the Provably Fair panel) */
.fair-anchor { display: none; }

/* Play header row with the Provably Fair pill on the right */
.play-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.play-head-title { font-size: 15px; font-weight: 700; color: var(--text); }
.play-head-right { display: inline-flex; align-items: center; gap: 8px; }
.fair-bal {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text);
  padding: 7px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; box-shadow: var(--glass-inset-hi); white-space: nowrap;
}
.fair-bal .icon { color: var(--accent); }
.fair-btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text);
  padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  box-shadow: var(--glass-inset-hi); transition: border-color .2s ease, box-shadow .2s ease;
}
/* Subtle sheen that sweeps across the pill on a slow loop. */
.fair-btn::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: skewX(-20deg); pointer-events: none;
  animation: fair-shimmer 3.6s ease-in-out infinite;
}
.fair-btn:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(0,124,143,0.4); }
.fair-btn .icon { color: var(--accent); position: relative; z-index: 1; }
.fair-btn span { position: relative; z-index: 1; }
@keyframes fair-shimmer {
  0% { left: -60%; }
  55%, 100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) { .fair-btn::after { animation: none; display: none; } }

/* Provably Fair panel */
.fair-card { max-width: 560px; }
.fair-top { display: flex; align-items: center; justify-content: space-between; }
.fair-title { display: flex; align-items: center; gap: 8px; }
.fair-title .icon { color: var(--accent); }
.fair-title h2 { margin: 0; }
.fair-x {
  background: transparent; border: none; color: var(--text-dim); font-size: 16px; cursor: pointer; line-height: 1; padding: 4px;
}
.fair-sub { font-size: 12.5px; color: var(--text-dim); margin: 6px 0 14px; }
.fair-seed {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px;
}
.fair-seed .k { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 3px; }

/* Current Logic collapsible + code block */
.logic-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 10px;
  color: var(--text); font-size: 13px; font-weight: 600; padding: 10px 12px; cursor: pointer;
}
.logic-head > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.logic-head .icon { color: var(--good); }
.logic-head .chev { color: var(--text-dim); transition: transform .2s ease; }
.logic-head.open .chev { transform: rotate(180deg); }
.logic-body { display: none; margin-top: 10px; }
.logic-body.open { display: block; }
.code-block {
  position: relative; background: #0b0e14; border: 1px solid var(--glass-border); border-radius: 12px;
  padding: 14px; overflow: auto; max-height: 320px;
}
.code-block pre {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.55; color: #cfd8e3; white-space: pre;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text);
  padding: 5px 10px; border-radius: 8px; font-size: 11.5px; cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); }

/* Provably Fair: seed-pair sections (Seeds + Rotate) */
.fair-section {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 12px; margin-bottom: 12px;
}
.fair-section-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.fair-note { font-size: 11.5px; color: var(--text-dim); margin: 4px 0 10px; line-height: 1.5; }
.fair-seed-row { margin-bottom: 8px; }
.fair-seed-row .k { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 3px; }
.fair-seed-val { display: flex; align-items: center; gap: 8px; }
.fair-seed-val .mono {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: #cfd8e3;
}
.copy-btn.mini {
  position: static; flex: none; padding: 4px 9px; font-size: 11px;
}
.fair-rotate-row { display: flex; gap: 8px; margin-bottom: 10px; }
.fair-rotate-input {
  flex: 1; min-width: 0; background: #0b0e14; border: 1px solid var(--glass-border);
  color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.fair-rotate-input:focus { outline: none; border-color: var(--accent); }

/* Result banners */
.result { border-radius: 12px; padding: 12px; margin: 12px 0; text-align: center; font-weight: 700; }
.result.win { background: rgba(53,199,124,0.15); color: var(--good); border: 1px solid rgba(53,199,124,0.4); }
.result.lose { background: rgba(240,85,76,0.15); color: var(--bad); border: 1px solid rgba(240,85,76,0.4); }
.result.neutral {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text);
  box-shadow: var(--glass-inset-hi);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}

/* Game visuals */
/* Dice — roll slider. Lose zone (roll <= target) is RED on the left; win zone
   (roll > target) is GREEN on the right. Mirrors the reference "roll" slider
   but truthful to this game's roll-OVER rule. */
.dice-results { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.dice-results::-webkit-scrollbar { display: none; }
.dice-pill { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text-dim); }
.dice-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #6b7688; }
.dice-pill.win { color: #d9ffe9; }
.dice-pill.win .dot { background: var(--good); box-shadow: 0 0 6px rgba(53, 199, 124, 0.8); }

.dice-slider { position: relative; margin: 6px 0 2px; padding-top: 48px; }
.dice-badge {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  min-width: 54px; padding: 9px 6px 12px; text-align: center; line-height: 1;
  font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; color: #10151f;
  background: #e8edf5; clip-path: polygon(50% 0, 100% 27%, 100% 73%, 50% 100%, 0 73%, 0 27%);
  opacity: 0; transition: left .55s cubic-bezier(.22, 1, .36, 1), opacity .2s ease; pointer-events: none;
}
.dice-badge.show { opacity: 1; }
.dice-badge.win { background: linear-gradient(180deg, #bbf7d0, #4ade80); }
.dice-badge.lose { background: linear-gradient(180deg, #fecaca, #f87171); }

.dice-ticks { position: relative; height: 16px; margin-bottom: 8px; }
.dice-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.dice-tick::after { content: ""; position: absolute; left: 50%; top: 15px; transform: translateX(-50%); border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--glass-border); }

.dice-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 999px; margin: 0;
  background: linear-gradient(90deg, #e8252a 0 var(--t, 50%), var(--good) var(--t, 50%) 100%);
  box-shadow: var(--glass-inset-hi); outline: none; cursor: pointer;
}
.dice-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 7px;
  background-color: #fff; background-image: repeating-linear-gradient(90deg, #aab3c2 0 2px, transparent 2px 5px);
  background-size: 11px 12px; background-position: center; background-repeat: no-repeat;
  border: 1px solid rgba(0, 0, 0, 0.15); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); cursor: grab;
}
.dice-range::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 7px; box-sizing: border-box;
  background-color: #fff; background-image: repeating-linear-gradient(90deg, #aab3c2 0 2px, transparent 2px 5px);
  background-size: 11px 12px; background-position: center; background-repeat: no-repeat;
  border: 1px solid rgba(0, 0, 0, 0.15); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); cursor: grab;
}
.dice-range::-moz-range-track { background: transparent; }
.dice-range:disabled { opacity: 0.7; cursor: not-allowed; }

.dice-value { position: relative; height: 22px; margin-top: 10px; }
.dice-value span { position: absolute; transform: translateX(-50%); font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.dice-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.dice-stat { display: flex; flex-direction: column; gap: 5px; }
.dice-stat > span { font-size: 11px; color: var(--text-dim); }
.dice-stat-box { display: flex; align-items: center; height: 40px; box-sizing: border-box; background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 10px; padding: 0 10px; box-shadow: var(--glass-inset-hi); }
.dice-stat-box input, .dice-stat-box .val { min-width: 0; border: none; background: transparent; color: var(--text); font-weight: 700; font-size: 14px; width: 100%; font-variant-numeric: tabular-nums; outline: none; }
.dice-stat-box .unit { flex: 0 0 auto; color: var(--text-dim); font-size: 13px; margin-left: 4px; }

/* HighLow — playing-card board. Rank is the real game data (A=1..K=13); the
   suit is decorative only (HiLo ignores suit). Tie counts as a LOSS, so the
   sides are "Higher" / "Lower" (never "/Same"). */
.hl-history { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.hl-history::-webkit-scrollbar { display: none; }
.hl-hist-item { flex: 0 0 auto; position: relative; display: flex; flex-direction: column; align-items: center; }
.hl-hist-card { width: 46px; height: 60px; border-radius: 7px; background: #f4f6fb; display: flex; align-items: center; justify-content: center; gap: 2px; font-weight: 800; font-size: 15px; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.hl-hist-card.red { color: #d13b3b; }
.hl-hist-card.black { color: #1a2230; }
.hl-hist-badge { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hl-hist-badge.start { background: var(--good); color: #06240f; }
.hl-hist-badge.win { background: var(--good); color: #06240f; }
.hl-hist-badge.bust { background: var(--bad); color: #2a0605; }
.hl-hist-badge.skip { background: #33415c; color: #cfe0ff; }
.hl-hist-arrow { flex: 0 0 auto; width: 22px; height: 22px; margin: 0 -6px; z-index: 1; border-radius: 50%; background: var(--bg-elev-2); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--accent); }

.hl-board { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 8px 0 4px; }
.hl-side {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px;
  border-radius: 14px; background: var(--glass-bg-2); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset-hi); cursor: pointer; text-align: center;
  transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.hl-side:disabled, .hl-side.locked { opacity: 0.45; cursor: not-allowed; }
.hl-side:not(:disabled):not(.locked):active { transform: scale(0.98); }
.hl-side .hl-arrow { font-size: 18px; line-height: 1; color: var(--text-dim); }
.hl-side .hl-dir { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); }
.hl-side .hl-mult { margin-top: 2px; padding: 4px 10px; border-radius: 8px; background: var(--bg-elev); border: 1px solid var(--glass-border); font-weight: 800; font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; }
/* Active side buttons: no red/green — a silver shimmer ring mixed with dark grey. */
.hl-side.hi:not(:disabled):not(.locked),
.hl-side.lo:not(:disabled):not(.locked) {
  border-color: transparent; border-width: 2px;
  background:
    linear-gradient(160deg, #1a2130, #12161f) padding-box,
    linear-gradient(115deg, #2c3038 0%, #d9dde4 14%, #8b909a 27%, #24282f 43%, #d9dde4 60%, #8b909a 75%, #2c3038 100%) border-box;
  background-size: 260% 100%;
  animation: hlShimmer 3s linear infinite;
}
.hl-side.hi:not(:disabled):not(.locked) .hl-arrow,
.hl-side.lo:not(:disabled):not(.locked) .hl-arrow { color: #d9dde4; }
@keyframes hlShimmer { to { background-position: -260% 0; } }

.hl-card {
  position: relative; width: 116px; height: 164px; border-radius: 14px;
  background: linear-gradient(160deg, #ffffff, #e9edf5); box-shadow: 0 10px 24px rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.hl-card.red .hl-rank-main, .hl-card.red .hl-corner { color: #d13b3b; }
.hl-card.black .hl-rank-main, .hl-card.black .hl-corner { color: #1a2230; }
.hl-rank-main { font-size: 46px; font-weight: 800; line-height: 1; }
.hl-rank-main .hl-suit { display: block; font-size: 30px; text-align: center; margin-top: 4px; }
.hl-corner { position: absolute; font-size: 15px; font-weight: 800; line-height: 1; text-align: center; }
.hl-corner.tl { top: 8px; left: 9px; }
.hl-corner.br { bottom: 8px; right: 9px; transform: rotate(180deg); }
.hl-corner .hl-suit { display: block; font-size: 13px; }
.hl-card.flip { animation: hlFlip .4s ease; }
@keyframes hlFlip { 0% { transform: rotateY(90deg); opacity: 0.2; } 100% { transform: rotateY(0); opacity: 1; } }

.hl-prob { display: flex; gap: 8px; margin: 12px 0 4px; }
.hl-prob-half { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--glass-bg-2); border: 1px solid var(--glass-border); box-shadow: var(--glass-inset-hi); font: inherit; text-align: left; cursor: pointer; -webkit-appearance: none; appearance: none; transition: transform .08s ease, border-color .12s ease; }
.hl-prob-half.lo:not(:disabled), .hl-prob-half.hi:not(:disabled) { border-color: rgba(203,208,216,0.28); }
.hl-prob-half:not(:disabled):active { transform: scale(0.98); }
.hl-prob-half:disabled { cursor: not-allowed; opacity: 0.5; }
.hl-prob-half .hl-prob-label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.hl-prob-half .hl-prob-pct { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hl-prob-half.lo .hl-prob-pct, .hl-prob-half.hi .hl-prob-pct { color: #cfd3da; }

/* Mines — mine-count slider (gems <-> bombs) */
/* Mines count slider — reference style: pill container, badge ends, indigo track. */
.mines-slider-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 6px 8px;
}
.mines-slider-row .msr-end {
  display: flex; align-items: center; gap: 5px;
  font-weight: 800; font-size: 15px; white-space: nowrap;
  padding: 6px 12px; border-radius: 10px; min-width: 56px; justify-content: center;
}
.mines-slider-row .msr-end.gems { background: rgba(79,147,217,0.28); color: #a8d4ff; }
.mines-slider-row .msr-end.bombs { background: rgba(180,50,40,0.38); color: #ffb8aa; }
.mines-range {
  flex: 1; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, #5865d8 0%, #5865d8 var(--fill, 50%), rgba(120,125,160,0.35) var(--fill, 50%), rgba(120,125,160,0.35) 100%);
}
.mines-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border-radius: 8px;
  background:
    linear-gradient(to right,
      transparent 30%, rgba(255,255,255,0.42) 30%, rgba(255,255,255,0.42) 39%,
      transparent 39%, transparent 45%, rgba(255,255,255,0.42) 45%, rgba(255,255,255,0.42) 55%,
      transparent 55%, transparent 61%, rgba(255,255,255,0.42) 61%, rgba(255,255,255,0.42) 70%,
      transparent 70%),
    linear-gradient(160deg, #9fa2bb, #6e7189);
  border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: pointer;
}
.mines-range::-moz-range-thumb {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(160deg, #9fa2bb, #6e7189);
  border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: pointer;
}
.mines-range:disabled { opacity: 0.55; cursor: not-allowed; }

/* Multiplier readout panel (Mines) */
.mult-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 14px; margin: 12px 0; border-radius: 14px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); box-shadow: var(--glass-inset-hi);
  transition: box-shadow .3s ease, border-color .3s ease;
}
.mult-panel .mp-value { font-size: 28px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.mult-panel .mp-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); }
.mult-panel.active { border-color: rgba(203,239,245,0.35); box-shadow: var(--glass-inset-hi), 0 0 22px rgba(0,124,143,0.28); }

.grid-cells { display: grid; gap: 8px; transition: box-shadow .2s ease; border-radius: 12px; }
.grid-cells.flash-bust { animation: gridFlashBust .55s ease; }
.grid-cells.flash-win { animation: gridFlashWin .6s ease; }
@keyframes gridFlashBust { 0% { box-shadow: 0 0 0 rgba(240,85,76,0); } 30% { box-shadow: 0 0 36px rgba(240,85,76,0.45); } 100% { box-shadow: 0 0 0 rgba(240,85,76,0); } }
@keyframes gridFlashWin { 0% { box-shadow: 0 0 0 rgba(0,124,143,0); } 30% { box-shadow: 0 0 40px rgba(203,239,245,0.4); } 100% { box-shadow: 0 0 0 rgba(0,124,143,0); } }

.mines-grid-wrap .cell { font-size: var(--cell-emoji); }
.cell {
  position: relative; aspect-ratio: 1 / 1; min-width: 0; min-height: 0; border-radius: 10px; background: var(--glass-bg-2); border: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; user-select: none;
  transform: translateY(-2px);
  box-shadow: var(--glass-inset-hi), 0 3px 4px rgba(0,0,0,0.35); transition: transform .12s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .3s ease;
}
.cell:not(.disabled):not(.safe):not(.mine):active { transform: translateY(0) scale(0.96); box-shadow: var(--glass-inset-hi), 0 1px 2px rgba(0,0,0,0.3); }
.cell .cell-icon { display: inline-block; transform: scale(0); opacity: 0; }
.cell.safe .cell-icon, .cell.mine .cell-icon { animation: cellPop .38s cubic-bezier(.34,1.56,.64,1) forwards; }
@keyframes cellPop { 0% { transform: scale(0) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.28) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.cell.safe { background: rgba(53,199,124,0.16); border-color: rgba(53,199,124,0.55); box-shadow: var(--glass-inset-hi), 0 3px 4px rgba(0,0,0,0.35), 0 0 14px rgba(53,199,124,0.35); }
.cell.mine { background: rgba(240,85,76,0.16); border-color: rgba(240,85,76,0.6); box-shadow: var(--glass-inset-hi), 0 3px 4px rgba(0,0,0,0.35), 0 0 14px rgba(240,85,76,0.4); }
.cell.mine.hit { animation: cellShake .45s ease; }
@keyframes cellShake { 10%, 90% { transform: translateY(-2px) translateX(-1px); } 20%, 80% { transform: translateY(-2px) translateX(2px); } 30%, 50%, 70% { transform: translateY(-2px) translateX(-4px); } 40%, 60% { transform: translateY(-2px) translateX(4px); } }
.cell.disabled { pointer-events: none; opacity: 0.85; }
.cell.reveal-only { pointer-events: none; opacity: 0.38; box-shadow: none; transform: none; }
.cell.reveal-only .cell-icon { animation: none; transform: scale(1); opacity: 1; filter: grayscale(35%); }

/* Motion over the emoji symbols (pure CSS — no external art).
   Keep the icon/badge above the burst layers. */
.cell .cell-icon { position: relative; z-index: 2; }
.cell .cell-mult { z-index: 3; }

/* Gem reveal: emerald glow burst behind the 💎 + a lingering sparkle glow.
   Only on the tile the player actually clicks (never the passive board reveal). */
.cell.safe:not(.reveal-only) .cell-icon {
  filter: drop-shadow(0 0 5px rgba(120,240,180,0.6));
  animation: cellPop .38s cubic-bezier(.34,1.56,.64,1) forwards, gemTwinkle 2.4s ease-in-out .4s infinite;
}
.cell.safe:not(.reveal-only)::after {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(120,240,180,0.8), rgba(53,199,124,0) 60%);
  opacity: 0; animation: gemBurst .6s ease-out forwards;
}
@keyframes gemBurst { 0% { opacity: 0; transform: scale(0.4); } 40% { opacity: 0.9; transform: scale(1.05); } 100% { opacity: 0; transform: scale(1.3); } }
@keyframes gemTwinkle { 0%, 100% { filter: drop-shadow(0 0 4px rgba(120,240,180,0.45)); } 50% { filter: drop-shadow(0 0 9px rgba(120,240,180,0.85)); } }

/* Bomb hit: fiery explosion flash behind the 💣. */
.cell.mine.hit .cell-icon { filter: drop-shadow(0 0 6px rgba(255,180,90,0.85)); }
.cell.mine.hit::after {
  content: ""; position: absolute; inset: -22%; z-index: 1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,224,120,0.95) 0%, rgba(240,85,76,0.85) 42%, rgba(240,85,76,0) 70%);
  opacity: 0; animation: bombBurst .55s ease-out forwards;
}
@keyframes bombBurst { 0% { opacity: 0; transform: scale(0.2); } 25% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.85); } }

/* Mines (reference): revealed tiles stay neutral/grey — no green or red tint.
   Only the gem symbol itself carries a soft blue glow, matching the artwork. */
.mines-grid-wrap .cell.safe,
.mines-grid-wrap .cell.mine {
  border-color: var(--glass-border);
  background: radial-gradient(circle at 50% 42%, rgba(150,180,230,0.14), rgba(6,10,18,0.5) 72%);
  box-shadow: var(--glass-inset-hi), 0 3px 4px rgba(0,0,0,0.35);
}
.mines-grid-wrap .cell.reveal-only { box-shadow: none; }
.mines-grid-wrap .cell.safe:not(.reveal-only) .cell-icon {
  filter: drop-shadow(0 0 5px rgba(150,195,245,0.65));
  animation: cellPop .38s cubic-bezier(.34,1.56,.64,1) forwards, gemTwinkleBlue 2.4s ease-in-out .4s infinite;
}
.mines-grid-wrap .cell.safe:not(.reveal-only)::after {
  background: radial-gradient(circle at 50% 45%, rgba(150,195,245,0.75), rgba(90,140,220,0) 60%);
}
@keyframes gemTwinkleBlue { 0%, 100% { filter: drop-shadow(0 0 4px rgba(150,195,245,0.5)); } 50% { filter: drop-shadow(0 0 9px rgba(150,195,245,0.9)); } }
/* Mines mine-hit: keep the burst motion but drop the red — neutral grey flash. */
.mines-grid-wrap .cell.mine.hit .cell-icon { filter: drop-shadow(0 0 6px rgba(190,205,225,0.7)); }
.mines-grid-wrap .cell.mine.hit::after {
  background: radial-gradient(circle, rgba(214,222,236,0.85) 0%, rgba(120,140,175,0.55) 42%, rgba(120,140,175,0) 70%);
}

/* Towers: same neutral-grey revealed tiles as Mines — no green/red tile tint.
   Emoji size shares the responsive --cell-emoji token with Mines. */
.tower-shaft .cell { font-size: var(--cell-emoji); }
.tower-shaft .cell.safe,
.tower-shaft .cell.mine {
  border-color: rgba(120,140,180,0.4);
  background:
    radial-gradient(circle at 50% 42%, rgba(150,180,230,0.16), rgba(6,10,18,0.42) 72%),
    url("../img/tower-brick.png") center / cover no-repeat, #1a2036;
  box-shadow: var(--glass-inset-hi), inset 0 1.5px 0 rgba(185,200,230,0.28), 0 3px 4px rgba(0,0,0,0.35);
}
.tower-shaft .cell.tower-cell.safe .cell-icon {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(150,195,245,0.65));
  animation: cellPop .38s cubic-bezier(.34,1.56,.64,1) forwards, gemTwinkleBlue 2.4s ease-in-out .4s infinite;
}
.tower-shaft .cell.mine.hit .cell-icon { filter: drop-shadow(0 0 6px rgba(190,205,225,0.7)); }
.tower-shaft .cell.mine.hit::after {
  background: radial-gradient(circle, rgba(214,222,236,0.85) 0%, rgba(120,140,175,0.55) 42%, rgba(120,140,175,0) 70%);
}
/* Towers wrong-pick: the clicked trap tile turns red and crumbles into falling
   shards instead of showing an emoji. No icon, no burst — just the collapse. */
.tower-shaft .cell.mine.hit.collapse { overflow: visible; background: rgba(18,10,12,0.7); border-color: rgba(120,44,48,0.55); box-shadow: inset 0 0 14px rgba(0,0,0,0.7); }
.tower-shaft .cell.mine.hit.collapse .cell-icon { display: none; }
.tower-shaft .cell.mine.hit.collapse::after { display: none; }
.mine-shard {
  content: ""; position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, #ff6b63 0%, #e0453f 45%, #a8262b 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
  transform-origin: center;
  animation: shatter 1s cubic-bezier(.55,.06,.68,.19) forwards;
}
@keyframes shatter {
  0% { transform: translate(0,0) rotate(0) scale(1); opacity: 1; }
  18% { transform: translate(0,0) rotate(0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx,0), calc(var(--ty,0) + 52px)) rotate(var(--rot,0)) scale(0.72); opacity: 0; }
}

/* Mines — post-round result overlay (matches reference: outer green-bordered
   card + inner bordered box holding the multiplier, big label below). */
.mines-grid-wrap { position: relative; }
.game-result-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.game-result-overlay.hidden { display: none; }
.mro-card {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 18px 20px 20px; border-radius: 22px; text-align: center;
  max-width: 90%;
  background: linear-gradient(180deg, rgba(58,70,96,0.94), rgba(34,43,62,0.94));
  border: 2.5px solid #86e79b;
  box-shadow: 0 0 34px rgba(134,231,155,0.4), 0 10px 26px rgba(0,0,0,0.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: mroIn .22s cubic-bezier(.34,1.56,.64,1) both;
}
.mro-inner {
  width: 100%; padding: 8px 26px; border-radius: 14px;
  border: 1.5px solid rgba(134,231,155,0.55);
  display: flex; align-items: center; justify-content: center;
}
.mro-mult {
  font-size: 44px; font-weight: 800; color: #86e79b;
  font-variant-numeric: tabular-nums; line-height: 1.05; letter-spacing: 0.5px;
}
.mro-label { font-size: 20px; font-weight: 500; color: #86e79b; }
.mro-card.lose { border-color: #f0817a; box-shadow: 0 0 34px rgba(240,129,122,0.4), 0 10px 26px rgba(0,0,0,0.45); }
.mro-card.lose .mro-inner { border-color: rgba(240,129,122,0.55); }
.mro-card.lose .mro-mult, .mro-card.lose .mro-label { color: #f0817a; }
@keyframes mroIn { from { transform: scale(0.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Towers — vertical gem climb inside a dungeon shaft */
.tower-shaft {
  padding: 12px; margin: 12px 0; border-radius: 16px;
  background:
    radial-gradient(120% 55% at 50% -8%, rgba(0,124,143,0.16), transparent 62%),
    linear-gradient(180deg, rgba(12,20,32,0.6), rgba(6,10,18,0.4));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset-hi), inset 0 0 42px rgba(0,0,0,0.4);
}
.towers { display: flex; flex-direction: column-reverse; gap: 8px; }
.tower-floor { display: grid; gap: 8px; transition: opacity .25s ease, filter .25s ease; }
.tower-floor.dim { opacity: 0.42; filter: saturate(0.6); }

/* Per-tile multiplier badge (revealed safe tiles only) */
.cell .cell-mult {
  position: absolute; bottom: 3px; left: 50%;
  font-size: 10px; font-weight: 800; letter-spacing: 0.2px; line-height: 1;
  padding: 2px 6px; border-radius: 999px; color: #d9ffe9; white-space: nowrap;
  background: rgba(53,199,124,0.92); box-shadow: 0 1px 4px rgba(0,0,0,0.45);
  opacity: 0; transform: translate(-50%, 5px); transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
/* Towers: pill shows only on the last-climbed floor's chosen gem. */
.tower-shaft .cell.mult-current .cell-mult { opacity: 1; transform: translate(-50%, 0); }
.tower-shaft .cell-mult { background: rgba(79,147,217,0.96); color: #eaf4ff; font-size: 11px; padding: 2px 8px; }
/* Mines: the running multiplier pill shows only under the last-clicked gem. */
.mines-grid-wrap .cell.mult-current .cell-mult { opacity: 1; transform: translate(-50%, 0); }
.mines-grid-wrap .cell-mult { background: rgba(79,147,217,0.96); color: #eaf4ff; font-size: 11px; padding: 2px 8px; }

/* Tower gems: a 💎 whose hue/brightness shifts per state (green = safe) */
.cell.tower-cell {
  aspect-ratio: 1 / 0.6;
  border-radius: 14px;
  background: url("../img/tower-brick.png") center / cover no-repeat, #1a2036;
  border: 1.5px solid rgba(120,140,180,0.4);
  box-shadow: var(--glass-inset-hi), inset 0 1.5px 0 rgba(185,200,230,0.28), 0 3px 4px rgba(0,0,0,0.35);
}
.cell.tower-cell .cell-icon {
  transform: none; opacity: 0; animation: none;
  filter: grayscale(0.85) brightness(0.6);
  transition: filter .25s ease, transform .2s ease, opacity .25s ease;
}
.tower-floor.active .cell.tower-cell:not(.disabled):active { transform: translateY(0) scale(0.96); box-shadow: var(--glass-inset-hi), 0 1px 2px rgba(0,0,0,0.3); }
.cell.tower-cell.safe .cell-icon {
  opacity: 1; animation: cellPop .38s cubic-bezier(.34,1.56,.64,1);
  filter: hue-rotate(85deg) saturate(1.5) brightness(1.15) drop-shadow(0 0 6px rgba(53,199,124,0.7));
}
.cell.tower-cell.mine .cell-icon {
  opacity: 1; filter: none; animation: cellPop .38s cubic-bezier(.34,1.56,.64,1);
}
.coin-flip-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 10px 0 16px; perspective: 700px; }
.coin-shadow { width: 62px; height: 12px; margin-top: 10px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,0.35), rgba(0,0,0,0) 70%); animation: coinShadowPulse 2.4s ease-in-out infinite; }
@keyframes coinShadowPulse { 0%, 100% { transform: scaleX(1); opacity: 0.8; } 50% { transform: scaleX(0.82); opacity: 0.5; } }
.coin-bob { animation: coinIdleBob 2.4s ease-in-out infinite; }
@keyframes coinIdleBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.coin-3d {
  position: relative; width: 92px; height: 92px; transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.22, 1.12, .36, 1);
}
.coin-face {
  position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; color: #7a5410;
  background: radial-gradient(circle at 35% 28%, #fff7dd 0%, #f6d571 35%, #e0ab3d 68%, #ad7a1c 100%);
  border: 3px solid #f2d878; box-shadow: inset 0 0 12px rgba(255,255,255,0.65), inset 0 -8px 14px rgba(115,75,10,0.4), 0 5px 14px rgba(0,0,0,0.4);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.coin-face.tails { transform: rotateY(180deg); }
.coin-face::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1px dashed rgba(122,84,16,0.45);
}

.pk-board {
  position: relative; width: 100%; height: 310px; margin-bottom: 4px;
  border-radius: 16px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% -10%, #1a2236 0%, transparent 60%),
              linear-gradient(180deg, #10141e 0%, #0b0e16 100%);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-inset-hi), 0 10px 30px rgba(0,0,0,0.35);
}
.pk-pegs { position: absolute; left: 12px; right: 12px; top: 10px; bottom: 8px; }
.pk-peg {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #ffffff, #b9c1cf);
  box-shadow: 0 0 4px rgba(255,255,255,0.35);
}
.pk-ball {
  position: absolute; width: 13px; height: 13px; border-radius: 50%; z-index: 3;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 34% 28%, #fff3c4, #f7b733 55%, #e8890c);
  box-shadow: 0 0 12px rgba(247,183,51,0.75), 0 2px 4px rgba(0,0,0,0.45);
  transition: left .09s linear, top .09s linear;
}
.pk-ball.hidden { opacity: 0; }
.pk-buckets { display: flex; gap: 2px; padding: 0 12px; margin-bottom: 14px; }
.pk-bucket {
  flex: 1 1 0; min-width: 0; text-align: center; font-size: 10px; font-weight: 800;
  padding: 5px 0; border-radius: 6px; color: #3a1400; letter-spacing: -0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: clip;
  box-shadow: 0 2px 0 rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform .12s ease, filter .12s ease;
}
.pk-buckets.dense { gap: 1px; }
.pk-buckets.dense .pk-bucket { font-size: 8.5px; padding: 4px 0; border-radius: 5px; }
.pk-bucket.hit { animation: pkPop .4s ease; filter: brightness(1.25); transform: translateY(2px); }
@keyframes pkPop {
  0% { transform: translateY(-6px) scale(1.12); filter: brightness(1.6); }
  60% { transform: translateY(3px) scale(0.96); }
  100% { transform: translateY(2px) scale(1); }
}
.plinko-opts .chips.seg { flex-wrap: nowrap; }
.plinko-opts .chips.seg .chip { flex: 1 1 0; }
.chips.seg.locked { opacity: 0.5; pointer-events: none; }

.mult-track { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.mult-step { min-width: 46px; text-align: center; padding: 6px; border-radius: 8px; background: var(--glass-bg-2); border: 1px solid var(--glass-border); font-size: 12px; font-weight: 700; box-shadow: var(--glass-inset-hi); }
.mult-step.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,0.4); }

/* Overlay / age gate */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(6,8,12,0.72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
}
.overlay.hidden { display: none; }
.overlay-card {
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 20px; max-width: 460px; width: 100%; box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.overlay-card h2 { margin-top: 0; }
.legal { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.legal strong { color: var(--text); }

/* Legal footer block */
.legal-footer { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; text-align: center; margin-top: 16px; }

/* Toast */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(84px + var(--safe-bottom)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), var(--glass-inset-hi);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  animation: toastin .2s ease; max-width: 90%;
}
.toast.error { border-color: rgba(240,85,76,0.5); }
.toast.success { border-color: rgba(53,199,124,0.5); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Utility */
.hidden { display: none !important; }
.center { text-align: center; }
.spacer { height: 8px; }
.notice {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 12px; padding: 12px;
  color: var(--text-dim); font-size: 13px; box-shadow: var(--glass-inset-hi);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.loading { color: var(--text-dim); text-align: center; padding: 24px; }

@media (max-width: 360px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); }
}
