:root {
  color-scheme: dark;
  --paper: #f3e6d0;
  --gold: #e2b15a;
  --muted: #c5b7b0;
  --ease: cubic-bezier(.22, 1, .36, 1);
  font-family: Manrope, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-width: 280px; min-height: 100%; background: #171323; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--paper);
  background: #171323;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, #11101cc7, #17132391 42%, #171323d9 88%, #171323),
    url('/assets/b96110c63d6bc4fab5ed92f26415efc3ff892f9cb8eb18aecd1c53dcd705e8f7/fairground-night.webp') center center / cover no-repeat;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 500px 600px at 50% 40%, #17132391, transparent 90%);
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #ffedbc; outline-offset: 5px; }
.stage {
  position: relative;
  z-index: 1;
  width: min(100%, 740px);
  margin: 0 auto;
  padding: 32px max(32px, env(safe-area-inset-right)) 24px max(32px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.brand { width: 100%; display: flex; flex-direction: column; align-items: center; }
.brand-lockup { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.logo { width: 112px; height: auto; flex: none; filter: drop-shadow(0 5px 20px #e2b15a29); }
h1 { margin: 0; width: 100%; font-weight: 400; text-align: center; }
.brand-name {
  display: block;
  font-family: "Yeseva One", Georgia, serif;
  font-size: 64px;
  line-height: 1.08;
  letter-spacing: -.045em;
  color: #ffdf9e;
  text-shadow: 0 2px 0 #743e3c, 0 6px 30px #0008;
}
.brand-subtitle {
  display: block;
  margin-top: 9px;
  font: 600 13px/1.4 Manrope, sans-serif;
  letter-spacing: .12em;
  color: #f3e6d0;
}
.lede, .about p { margin: 0; text-wrap: pretty; }
.lede { max-width: 530px; margin-top: 21px; font-size: 14px; font-weight: 600; line-height: 1.75; color: #e1d2c7; }
.follow { width: 100%; margin-top: 22px; }
.follow-note { margin: 13px 0 0; color: #c9b8ae; font-size: 10px; line-height: 1.5; letter-spacing: .025em; }
.about { width: 100%; max-width: 535px; margin-top: 20px; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 13px; margin-bottom: 15px; color: #d2a765; font-size: 12px; }
.ornament span { width: 58px; height: 1px; background: linear-gradient(90deg, transparent, #d2a76566); }
.ornament span:last-child { transform: rotate(180deg); }
.about h2 { margin: 0 0 10px; font: 400 25px/1.25 "Yeseva One", Georgia, serif; color: #f5dfb9; letter-spacing: -.01em; text-wrap: balance; }
.about p { font-size: 14px; line-height: 1.8; color: #d7c9c0; }

/* Original game artwork and compact playable table. */
.tg {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(calc(100% - 8px), 400px);
  max-width: 100%;
  min-height: 64px;
  padding: 16px 37px;
  overflow: visible;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: #fff0c4;
  font: 400 clamp(12px, 3.4vw, 18px)/1.3 "Yeseva One", Georgia, serif;
  text-align: center;
  text-decoration: none;
  transition: transform 150ms cubic-bezier(.39,.575,.565,1), filter 170ms;
}
.tg::after { content: none; }
.tg-label { display: block; white-space: nowrap; }
.tg:active { transform: scale(.985); box-shadow: none; }
.tg.is-celebrating { filter: brightness(1.18) drop-shadow(0 0 15px #ffd38470); }
.follow { min-height: 92px; }
.follow.is-floating .tg {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  width: min(calc(100% - 48px), 400px);
  z-index: 30;
  filter: drop-shadow(0 8px 16px #090712cc);
}
.follow.is-floating { position: relative; z-index: 100; }
.table {
  position: relative;
  width: 100%;
  margin-top: 26px;
  padding: 18px 22px 17px;
  border: 1px solid #bd945c;
  border-radius: 22px;
  background: radial-gradient(ellipse at 50% 15%, #32645a99, transparent 75%),
    repeating-linear-gradient(0deg, #00000008 0 1px, transparent 1px 3px),
    linear-gradient(135deg, #204a43, #173d37 65%, #12332f);
  box-shadow: 0 0 0 5px #392526, 0 0 0 6px #92694088, 0 16px 45px #070711a3, inset 0 0 45px #071d1c88;
}
.table::before { content: ""; position: absolute; inset: 7px; border: 1px solid #e2b15a33; border-radius: 15px; pointer-events: none; }
.table-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 29px; }
.score-summary { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.score-summary > span { font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: #cbb88f; }
.score-total { color: #ffe1a4; font: 400 24px/1.1 "Yeseva One", Georgia, serif; font-variant-numeric: tabular-nums; }
.scoreboard { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; min-height: 34px; }
.combo { margin: 0; font: 400 25px/1.3 "Yeseva One", Georgia, serif; color: #f7e2b3; text-align: left; }
.score-formula { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font: 800 25px/1.1 Manrope, sans-serif; font-variant-numeric: tabular-nums; }
.chip-count { color: #85dee0; }
.times { font-size: 16px; color: #c5b6a7; }
.mult-count { color: #f196ad; }
.hand-hint { margin: 5px 0 0; min-height: 17px; font-size: 11px; line-height: 1.5; text-align: left; color: #bfcec0; }
.card-stage { position: relative; }
.hand { position: relative; width: 100%; height: 194px; margin-top: 10px; --card-w: 94px; --lift: 32px; }
.card {
  position: absolute;
  bottom: 0;
  display: block;
  width: var(--card-w);
  aspect-ratio: 168 / 236;
  padding: 0;
  border: 0;
  border-radius: calc(var(--card-w) * .11);
  background: transparent;
  transform-origin: 50% 100%;
  cursor: pointer;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  transition: transform 280ms cubic-bezier(.175,.885,.32,1.275), opacity 180ms, filter 180ms;
  transition-delay: calc(var(--index, 0) * 28ms);
}
.card-art, .card-back { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.card-art { filter: drop-shadow(3px 5px 3px #07161080); }
.card-back { display: none; position: absolute; inset: 0; }
.card.show-back .card-art { visibility: hidden; }
.card.show-back .card-back { display: block; }
.card.is-on .card-art { filter: drop-shadow(0 0 2px #ffe6a1) drop-shadow(0 4px 8px #e2b15a50); }
.card.is-on::after { content: ""; position: absolute; inset: 1px; border: 1.5px solid #ffe4a8; border-radius: inherit; pointer-events: none; }
.card[aria-disabled="true"] { cursor: default; }
.card:focus-visible { outline: 3px solid #fff0c4; outline-offset: 3px; }
.table[data-phase="playing"] .card:not(.is-on),
.table[data-phase="celebrating"] .card:not(.is-on) { opacity: .3; }
.deck { position: absolute; right: 1px; top: 6px; width: 29px; aspect-ratio: 168 / 236; transform: rotate(8deg); border-radius: 4px; box-shadow: 2px 2px 0 #cbb897, 4px 4px 0 #765f4b, 4px 7px 9px #031c1c88; opacity: .85; }
.deck img { width: 100%; height: 100%; display: block; }
.score-gain { position: absolute; top: 0; right: 0; z-index: 20; font: 400 30px/1.15 "Yeseva One", Georgia, serif; color: #ffe2a4; text-shadow: 0 0 20px #df9c4360; font-variant-numeric: tabular-nums; opacity: 0; pointer-events: none; white-space: nowrap; }
.table[data-phase="celebrating"] .score-gain { opacity: 1; }
.table[data-phase="celebrating"] .score-formula { opacity: 0; }
.table-controls { display: grid; grid-template-columns: 1fr 64px 1.25fr; align-items: center; gap: 12px; margin-top: 19px; }
.selection-count { color: #c8d0bd; font-size: 11px; line-height: 1.5; white-space: nowrap; }
.game-button {
  position: relative;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #c3a4699e;
  border-radius: 11px;
  color: #f3e6d0;
  background: linear-gradient(#ffeecc24, transparent 25%, #0003), #202136;
  box-shadow: 0 4px 0 #06071399, inset 0 0 0 4px #e2b15a0f;
  font-weight: 800;
  font-size: 13px;
  transition: transform 120ms ease-out, filter 120ms;
  cursor: pointer;
}
.game-button::before, .game-button::after { content: ""; position: absolute; top: 6px; width: 2px; height: 2px; border-radius: 50%; background: #e2b15a; box-shadow: 0 29px #e2b15a; opacity: .7; }
.game-button::before { left: 7px; }
.game-button::after { right: 7px; }
.game-button.primary { color: #fff1cf; background: linear-gradient(#ffeecc24, transparent 25%, #0003), #8b2945; border-color: #dccbadb8; }
.game-button:active:not(:disabled):not([aria-disabled="true"]) { transform: scale(.97); }
.game-button:disabled, .game-button[aria-disabled="true"] { cursor: default; opacity: .42; }
.no-script { font-size: 12px; line-height: 1.6; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#fireworks, #card-effects { position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; pointer-events: none; }
#card-effects { z-index: 35; }
#fireworks[hidden] { display: none; }
.ambient { position: fixed; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.ambient i { position: absolute; bottom: -10px; left: 8%; width: 3px; height: 3px; border-radius: 50%; background: #f8dca0; box-shadow: 0 0 10px 2px #e7b26944; opacity: 0; animation: firefly 15s linear infinite; }
.ambient i:nth-child(2) { left: 88%; animation-delay: -4s; animation-duration: 19s; }
.ambient i:nth-child(3) { left: 21%; animation-delay: -10s; animation-duration: 22s; }
.ambient i:nth-child(4) { left: 77%; animation-delay: -6s; animation-duration: 17s; }
.ambient i:nth-child(5) { left: 42%; animation-delay: -13s; animation-duration: 25s; }
.ambient i:nth-child(6) { left: 95%; animation-delay: -9s; animation-duration: 20s; }
@keyframes firefly { 0% { transform: translate(0, 0); opacity: 0; } 15%, 75% { opacity: .6; } 100% { transform: translate(35px, -90vh); opacity: 0; } }
@media (hover: hover) and (pointer: fine) {
  .tg:hover { transform: scale(1.025); filter: brightness(1.11); box-shadow: none; }
  .game-button:not(:disabled):not([aria-disabled="true"]):hover { transform: scale(1.035); filter: brightness(1.1); }
  .card:not([aria-disabled="true"]):hover { filter: brightness(1.08); }
}
@media (min-width: 900px) {
  body::before { background-image: linear-gradient(90deg, #17132326, #171323aa 38%, #171323aa 62%, #17132326), linear-gradient(180deg, #17132344, #17132333 60%, #171323ed), url('/assets/b96110c63d6bc4fab5ed92f26415efc3ff892f9cb8eb18aecd1c53dcd705e8f7/fairground-night.webp'); }
  .stage { padding-top: 36px; }
}
@media (max-width: 600px) {
  .stage { padding: 20px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  body::before { background-position: 42% center; }
  .brand-lockup { gap: 8px; }
  .logo { width: 76px; }
  .brand-name { font-size: clamp(37px, 11.4vw, 55px); }
  .brand-subtitle { margin-top: 6px; font-size: clamp(10px, 2.8vw, 12px); letter-spacing: .06em; }
  .lede { margin-top: 16px; max-width: 410px; font-size: 13px; line-height: 1.65; }
  .follow { margin-top: 18px; min-height: 88px; }
  .tg { min-height: 60px; }
  .follow-note { font-size: 10px; margin-top: 10px; }
  .about { margin-top: 12px; }
  .ornament { margin-bottom: 10px; font-size: 10px; }
  .about h2 { font-size: 21px; margin-bottom: 8px; }
  .about p { max-width: 415px; margin-inline: auto; font-size: 12px; line-height: 1.7; }
  .table { margin-top: 20px; padding: 14px 10px 12px; border-radius: 18px; }
  .table::before { inset: 5px; border-radius: 13px; }
  .table-topline { min-height: 24px; }
  .score-summary { gap: 7px; }
  .score-summary > span { font-size: 8px; }
  .score-total { font-size: 20px; }
  .scoreboard { min-height: 30px; margin-top: 9px; gap: 7px; }
  .combo { font-size: 20px; }
  .score-formula { font-size: 20px; gap: 5px; }
  .times { font-size: 13px; }
  .hand-hint { font-size: 10px; margin-top: 2px; }
  .hand { height: 143px; margin-top: 4px; }
  .deck { top: 7px; width: 22px; }
  .score-gain { top: 2px; font-size: 28px; }
  .table-controls { grid-template-columns: 1fr 50px 1.25fr; gap: 8px; margin-top: 15px; }
  .game-button { font-size: 12px; padding-inline: 10px; }
  .selection-count { font-size: 10px; }
}
@media (max-width: 350px) {
  .stage { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); padding-top: 17px; }
  .logo { width: 70px; }
  .brand-lockup { gap: 7px; }
  .tg { width: calc(100% - 16px); padding-inline: 30px; font-size: 11.5px; }
  .follow-note { font-size: 9px; }
  .about h2 { font-size: 20px; }
  .combo { font-size: 17px; }
  .score-formula { font-size: 18px; }
  .score-total { font-size: 18px; }
  .hand { height: 135px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .ambient { display: none; }
}
