/* DonutClover look: a calmer, cleaner skin over the base styles. Softer and
   rounder surfaces, a faint emerald glow behind the page (the clover), one
   gold accent, tidier header, sidebar, panels and scrollbars. Loaded last. */
:root {
  --bg: #090a0c;
  --surface-0: #0e1013;
  --surface-1: #13161a;
  --surface-2: #191c21;
  --surface-3: #21252b;
  --line: #22262c;
  --line-strong: #30353d;
  --r-sm: 9px;
  --r-md: 14px;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.28);
  --clover: #2fbf71;
}

body {
  background:
    radial-gradient(900px 480px at 0% -10%, rgba(47, 191, 113, 0.07), transparent 70%),
    radial-gradient(900px 480px at 100% -10%, rgba(242, 196, 74, 0.05), transparent 70%),
    var(--bg);
}

/* Header: lighter, with a hairline glow under it. */
.topbar {
  background: rgba(9, 10, 12, 0.72);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 1px 0 rgba(242, 196, 74, 0.06);
}
.brand-mark {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 10px rgba(242, 196, 74, 0.35));
}
.brand-name {
  background: linear-gradient(90deg, #fff6d6, #f2c44a 55%, #d99a1e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.main-nav a,
.main-nav .nav-btn {
  border-radius: 10px;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, rgba(19, 22, 26, 0.9), rgba(12, 14, 17, 0.9));
  border-right-color: rgba(255, 255, 255, 0.05);
}

/* Panels and cards: soft gradient, hairline border, gentle shadow. */
.panel,
.stat-card,
.case-card,
.lvl-case,
.brow,
.battle-seat,
.game-card {
  border-color: rgba(255, 255, 255, 0.06);
}
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--surface-1);
  box-shadow: var(--shadow-1);
}
.stat-card {
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--surface-1);
}
.case-card {
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--trim) 10%, transparent), transparent 70%), var(--surface-1);
}

/* Buttons: rounder, a touch more depth. */
.btn {
  border-radius: 11px;
}
.btn:not(.btn-ghost):not(.btn-secondary):not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 18px -10px rgba(242, 196, 74, 0.7);
}
.input {
  border-radius: 11px;
  background: var(--surface-0);
}

/* Headings */
.display-title {
  letter-spacing: -0.01em;
}
.page-head h1,
.game-title h1 {
  font-weight: 800;
}

/* Footer */
.site-footer {
  opacity: 0.7;
}

/* Thin dark scrollbars everywhere. */
* {
  scrollbar-width: thin;
  scrollbar-color: #2b3037 transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #2b3037;
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- Small win pop-up (under the balance) ---------- */
.win-pop {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  right: 24px;
  z-index: 175;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(60, 207, 142, 0.5);
  background: linear-gradient(180deg, rgba(22, 48, 34, 0.96), rgba(12, 26, 18, 0.96));
  box-shadow: 0 10px 30px -10px rgba(60, 207, 142, 0.6);
  pointer-events: none;
  animation: winpop 1.9s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
.win-pop-plus {
  font-size: 20px;
  font-weight: 800;
  color: #6ef0a8;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(60, 207, 142, 0.6);
}
.win-pop-mult {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(60, 207, 142, 0.2);
  color: #b6f5d2;
  font-size: 12px;
  font-weight: 700;
}
@keyframes winpop {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.6);
  }
  12% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }
  20% {
    transform: scale(1);
  }
  80% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ---------- Level-up pop-up (top centre) ---------- */
.lvlup {
  position: fixed;
  top: calc(var(--topbar-h) + 14px);
  left: 50%;
  z-index: 186;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 320px;
  padding: 12px 22px 12px 12px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(242, 196, 74, 0.55);
  background: linear-gradient(135deg, rgba(40, 32, 12, 0.97), rgba(16, 18, 22, 0.97) 60%);
  box-shadow: 0 18px 50px -12px rgba(242, 196, 74, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transform: translate(-50%, 0);
  cursor: pointer;
  animation: lvlup-in 0.6s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.lvlup.out {
  animation: lvlup-out 0.5s ease-in forwards;
}
@keyframes lvlup-in {
  from {
    opacity: 0;
    transform: translate(-50%, -120px) scale(0.8);
  }
}
@keyframes lvlup-out {
  to {
    opacity: 0;
    transform: translate(-50%, -120px);
  }
}
.lvlup-badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  border-radius: 16px;
  background: radial-gradient(circle at 35% 30%, #fff1b8, #f2c44a 50%, #a8700c);
  box-shadow: 0 0 24px rgba(242, 196, 74, 0.6);
  animation: lvlup-badge 1.2s ease-in-out 0.4s 2;
}
.lvlup-badge .icon {
  position: absolute;
  top: 4px;
  width: 16px;
  height: 16px;
  color: #6b4405;
}
.lvlup-badge b {
  margin-top: 12px;
  font-size: 24px;
  font-weight: 900;
  color: #3d2603;
}
@keyframes lvlup-badge {
  50% {
    transform: rotate(-8deg) scale(1.1);
  }
}
.lvlup-text {
  display: flex;
  flex-direction: column;
}
.lvlup-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-2);
}
.lvlup-text b {
  font-size: 17px;
}
.lvlup-title {
  font-size: 12px;
  color: var(--text-muted);
}
.lvlup-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.22) 45%, transparent 60%);
  transform: translateX(-100%);
  animation: lvlup-shine 1.4s ease-out 0.3s;
  pointer-events: none;
}
@keyframes lvlup-shine {
  to {
    transform: translateX(100%);
  }
}

/* ---------- Daily case menu ---------- */
.dmenu {
  position: fixed;
  inset: 0;
  z-index: 158;
  display: grid;
  place-items: center;
  padding: var(--s4);
  background: rgba(4, 5, 7, 0.72);
  backdrop-filter: blur(6px);
  animation: dopen-in 0.2s ease-out;
}
.dmenu.out {
  opacity: 0;
  transition: opacity 0.2s;
}
.dmenu-box {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: var(--s5);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--glow) 18%, transparent), transparent 70%), #12151a;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 60px -30px var(--glow);
  animation: pop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.dmenu-x {
  position: absolute;
  top: 14px;
  right: 14px;
}
.dmenu-head {
  display: flex;
  align-items: center;
  gap: var(--s4);
}
.dmenu-head .lvl-art {
  width: 96px;
  height: 90px;
}
.dmenu-head h3 {
  margin-top: 6px;
  font-size: var(--fs-xl);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lvl-badge.static {
  position: static;
}
.dmenu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dmenu-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rarity) 35%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--rarity) 14%, transparent), transparent 70%), var(--surface-0);
}
.dmenu-art {
  width: 40px;
  height: 40px;
  flex: none;
}
.dmenu-art svg {
  width: 100%;
  height: 100%;
}
.dmenu-name {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.dmenu-name b {
  font-size: var(--fs-sm);
}
.dmenu-name .coin-amount {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.dmenu-chance {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--rarity);
  font-variant-numeric: tabular-nums;
}
.dmenu-open {
  margin-top: var(--s1);
}
.dmenu-note {
  text-align: center;
}

/* ---------- Home: welcome banner ---------- */
.hero-banner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--s5);
  min-height: 300px;
  margin-bottom: var(--s4);
  padding: 36px 40px;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(242, 196, 74, 0.22);
  background:
    radial-gradient(70% 120% at 85% 50%, rgba(47, 191, 113, 0.22), transparent 60%),
    radial-gradient(60% 90% at 10% 0%, rgba(242, 196, 74, 0.16), transparent 60%),
    linear-gradient(135deg, #15201a, #0f1215 55%, #16130b);
  box-shadow: 0 30px 70px -40px rgba(242, 196, 74, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.hb-glow {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 22px);
  mask-image: linear-gradient(90deg, transparent, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%, transparent);
  pointer-events: none;
}
.hb-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hb-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #8cf0a4;
}
.hb-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 56px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}
.hb-title > span:last-child {
  background: linear-gradient(180deg, #fff8dc, #f2c44a 60%, #c8891a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(242, 196, 74, 0.35));
}
.hb-logo {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  filter: drop-shadow(0 0 16px rgba(242, 196, 74, 0.55));
}
.hb-logo svg,
.hb-mark svg,
.hb-chest svg,
.hb-coin svg {
  display: block;
  width: 100%;
  height: 100%;
}
.hb-tag {
  max-width: 470px;
  font-size: var(--fs-lg);
  color: var(--text-muted);
}
.hb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}
.hb-actions .btn {
  min-height: 44px;
  padding: 10px 20px;
}
.hb-violet {
  background: linear-gradient(180deg, #b46cf7, #9333ea);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.btn.hb-violet:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 8px 22px -10px #a855f7;
}
.hb-facts {
  display: flex;
  gap: var(--s4);
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.hb-facts b {
  color: var(--text);
}
.hb-art {
  position: relative;
  height: 250px;
}
.hb-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 230px;
  height: 230px;
  margin: -115px 0 0 -115px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 196, 74, 0.28), transparent 65%);
  animation: hb-pulse 3.2s ease-in-out infinite;
}
.hb-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 150px;
  margin: -75px 0 0 -75px;
  filter: drop-shadow(0 0 30px rgba(242, 196, 74, 0.6));
  animation: hb-spin 22s linear infinite;
}
.hb-chest {
  position: absolute;
  width: 92px;
  height: 92px;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.55));
  animation: hb-float 4s ease-in-out infinite;
}
.hb-chest.c1 {
  left: 4%;
  top: 4%;
}
.hb-chest.c2 {
  right: 2%;
  top: 12%;
  animation-delay: -1.3s;
}
.hb-chest.c3 {
  left: 30%;
  bottom: -6%;
  width: 80px;
  height: 80px;
  animation-delay: -2.6s;
}
.hb-coin {
  position: absolute;
  width: 26px;
  height: 26px;
  animation: hb-float 3s ease-in-out infinite;
}
.hb-coin.k1 {
  right: 20%;
  bottom: 12%;
}
.hb-coin.k2 {
  left: 18%;
  top: 46%;
  width: 18px;
  height: 18px;
  animation-delay: -1s;
}
.hb-coin.k3 {
  right: 6%;
  bottom: 40%;
  width: 22px;
  height: 22px;
  animation-delay: -2s;
}
@keyframes hb-float {
  50% {
    transform: translateY(-12px) rotate(4deg);
  }
}
@keyframes hb-pulse {
  50% {
    transform: scale(1.12);
    opacity: 0.7;
  }
}
@keyframes hb-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Home: category chips ---------- */
.section-head {
  flex-wrap: wrap;
  gap: var(--s3);
}
.game-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.game-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s;
}
.game-chip:hover {
  color: var(--text);
}
.game-chip.active {
  border-color: rgba(242, 196, 74, 0.6);
  background: rgba(242, 196, 74, 0.12);
  color: var(--gold-2);
}

/* Game cards: coloured glow line on top, softer label. */
.game-card {
  border-radius: 20px;
}
.game-card::before {
  content: '';
  position: absolute;
  left: 14%;
  right: 14%;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--glow, #f2c44a);
  box-shadow: 0 0 18px var(--glow, #f2c44a);
  opacity: 0.55;
  z-index: 2;
  transition: opacity 0.2s;
}
.game-card:hover::before {
  opacity: 1;
}

@media (max-width: 860px) {
  .hero-banner {
    grid-template-columns: 1fr;
    padding: 26px 22px;
  }
  .hb-art {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hb-mark,
  .hb-chest,
  .hb-coin,
  .hb-ring {
    animation: none;
  }
}

/* ---------- Races ---------- */
.race-head {
  margin-bottom: var(--s4);
}
.race-head h1 {
  font-size: var(--fs-3xl);
}
.race-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.race-col {
  --race: #f2c44a;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: 0 var(--s5);
  border-top: 2px solid color-mix(in srgb, var(--race) 70%, transparent);
  padding-top: var(--s4);
}
.race-col.weekly {
  --race: #a855f7;
  border-left: 1px solid rgba(242, 196, 74, 0.25);
}
.rc-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.rc-head h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
}
.rc-head .muted {
  font-size: var(--fs-xs);
}
.rc-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--race) 45%, transparent);
  background: color-mix(in srgb, var(--race) 14%, transparent);
  color: var(--race);
}
.rc-icon svg {
  width: 20px;
  height: 20px;
}
.rc-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-dim);
}
.rc-label .icon {
  width: 13px;
  height: 13px;
}
.rc-timer-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.rc-clock {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.rc-clock b {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}
.rc-clock small {
  margin-right: 10px;
  font-size: 18px;
  color: var(--text-dim);
}
.rc-clock .colon {
  font-size: 32px;
  color: var(--text-dim);
}
.rc-ends {
  font-size: var(--fs-xs);
  color: var(--text-dim);
}
.rc-bar {
  height: 6px;
  border-radius: 6px;
  background: var(--surface-3);
  overflow: hidden;
}
.rc-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--race) 70%, #000), var(--race));
  box-shadow: 0 0 12px var(--race);
}
.rc-podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: var(--s2);
  margin-top: var(--s4);
}
.rc-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  --pc: #cfd6df;
}
.rc-place.p1 {
  --pc: #f2c44a;
}
.rc-place.p3 {
  --pc: #f08a3c;
}
.rc-medal {
  width: 22px;
  height: 22px;
  color: var(--pc);
}
.rc-medal svg {
  width: 100%;
  height: 100%;
}
.rc-place.p1 .rc-medal {
  width: 28px;
  height: 28px;
}
.rc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: var(--s3) var(--s2);
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--pc) 40%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 10%, transparent), transparent), var(--surface-1);
  text-align: center;
}
.rc-place.p1 .rc-card {
  box-shadow: 0 0 34px -12px var(--pc);
}
.rc-wager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #4ade80;
}
.rc-wager .coin {
  width: 12px;
  height: 12px;
}
.rc-prize {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: var(--pc);
}
.rc-prize .icon {
  width: 14px;
  height: 14px;
}
.rc-step {
  display: grid;
  place-items: center;
  width: 100%;
  height: 52px;
  border-radius: 10px 10px 4px 4px;
  font-size: 22px;
  font-weight: 900;
  color: rgba(0, 0, 0, 0.35);
  background: linear-gradient(180deg, var(--pc), color-mix(in srgb, var(--pc) 55%, #000));
}
.rc-place.p1 .rc-step {
  height: 92px;
}
.rc-place.p2 .rc-step {
  height: 64px;
}
.rc-place.p3 .rc-step {
  height: 40px;
}
.rc-place.empty .rc-card {
  opacity: 0.6;
}
.rc-table {
  padding: 0;
  overflow: hidden;
}
.rc-table table {
  width: 100%;
  border-collapse: collapse;
}
.rc-table th,
.rc-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
  text-align: left;
}
.rc-table th {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}
.rc-table .num {
  text-align: right;
}
.rc-table .num .coin-amount {
  justify-content: flex-end;
}
.rc-table .green {
  color: #4ade80;
}
.rc-table .rank {
  width: 52px;
  color: var(--text-dim);
}
.rc-table .empty {
  text-align: center;
  color: var(--text-dim);
}
.rc-me {
  font-size: var(--fs-sm);
}
@media (max-width: 1100px) {
  .race-cols {
    grid-template-columns: 1fr;
    gap: var(--s5);
  }
  .race-col.weekly {
    border-left: 0;
  }
}
.lvlup-go {
  margin-left: var(--s2);
  white-space: nowrap;
}

/* Legal: sign-up consent and footer links */
.field.consent { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 0.85rem; line-height: 1.4; }
.field.consent input { margin-top: 3px; flex: none; }
.field.consent a, .site-footer a { color: inherit; text-decoration: underline; }
#view .fair-card h3 { margin: 14px 0 6px; font-size: 1rem; }
#view .fair-card ul { padding-left: 20px; display: grid; gap: 6px; }
