:root {
  --bg: #0a0806; --card: #15110b; --ink: #f6efe0; --muted: #b3a58a; --line: #3a2f1c;
  --accent: #e8b53a; --accent-ink: #1a1200; --gold: #f2c14e;
  --best: #2fbf7c; --good: #8fcf5a; --fair: #e0a53a; --skip: #f06b5c;
  --pos: #3ed68b; --neg: #ff7a6b; --chip: #231b10; --shadow: 0 0 0 1px rgba(242,193,78,.06), 0 8px 24px rgba(0,0,0,.45);
  --gold-metal: linear-gradient(180deg, #fff6c8 0%, #ffd766 22%, #c8901c 48%, #ffe08a 62%, #a86f10 82%, #ffd766 100%);
  --silver-metal: linear-gradient(180deg, #ffffff 0%, #e6e9ee 25%, #9aa2ad 50%, #f4f6f9 68%, #7c8591 88%, #dfe3e8 100%);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: radial-gradient(120% 60% at 50% 0%, #2a1e08 0%, var(--bg) 60%) fixed, var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: env(safe-area-inset-bottom); }
body.loading #refresh { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.eyebrow { margin: 14px 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fineprint { font-size: .75rem; color: var(--muted); margin: 8px 0 0; }
.pos { color: var(--pos); } .neg { color: var(--neg); }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand-mini { font: 700 1rem Cinzel, Georgia, serif; letter-spacing: .04em; background: var(--gold-metal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 1.2rem; }

.status { display: flex; gap: 14px; align-items: center; margin: 12px 16px 0; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.timer { display: flex; gap: 8px; align-items: center; flex: none; }
.timer small { display: block; font-size: .68rem; color: var(--muted); }
.timer b { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.ring { width: 34px; height: 34px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--accent); stroke-dasharray: 97.4; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.status-lines { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); min-width: 0; }
.status-lines b { color: var(--ink); }

.banner { margin: 10px 16px 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--gold) 18%, var(--card)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); font-size: .9rem; cursor: pointer; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }

.budget label { font-weight: 700; font-size: .9rem; }
.money { display: flex; align-items: center; margin-top: 6px; border: 2px solid var(--line); border-radius: 14px; padding: 4px 12px; background: var(--bg); }
.money:focus-within { border-color: var(--accent); }
.money span { font-size: 1.6rem; font-weight: 700; color: var(--muted); }
.money input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-family: inherit; font-size: 1.8rem; font-weight: 700; line-height: 1.2; padding: 4px 6px; outline: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chips button { border: 1px solid var(--line); background: var(--chip); border-radius: 999px; padding: 6px 12px; font-size: .85rem; font-weight: 600; }
.chips button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.pick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px; border-radius: 14px; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.pick-main { flex: 1; min-width: 0; }
.pick-main h3 { font-size: 1.1rem; }
.pick-main p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--chip); }
.reasons { margin: 10px 0 0; padding-left: 18px; font-size: .9rem; }
.reasons li { margin: 2px 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stats div { background: var(--bg); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.stats small { display: block; font-size: .7rem; color: var(--muted); line-height: 1.2; }
.stats b { font-size: 1.05rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 420px) { .stats.four { grid-template-columns: repeat(2, 1fr); } }
.alts { display: grid; gap: 8px; }
.alt { display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: transparent; border-radius: 12px; padding: 8px; }
.alt .thumb { width: 40px; height: 40px; }
.alt span:not(.score) { flex: 1; min-width: 0; font-weight: 600; font-size: .9rem; }
.alt > span:not(.score) small { display: block; font-weight: 400; color: var(--muted); }

.score { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; padding: 4px 6px; border-radius: 12px; color: #fff; flex: none; }
.score b { font-size: 1.15rem; line-height: 1; }
.score small { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.v-best { background: var(--best); } .v-good { background: var(--good); } .v-fair { background: var(--fair); } .v-skip { background: var(--skip); }
.score { color: #07130c; }

.scroller { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.new-card { position: relative; flex: 0 0 170px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: var(--bg); }
.new-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--chip); }
.new-card small { color: var(--muted); font-size: .72rem; }
.new-card .score { align-self: flex-start; margin-top: 4px; }
.dot-new { position: absolute; top: 12px; left: 12px; background: var(--gold); color: #1a1200; font-size: .62rem; font-weight: 800; padding: 2px 6px; border-radius: 6px; }
.tag-new { font-style: normal; font-size: .62rem; font-weight: 800; background: var(--gold); color: #1a1200; padding: 1px 5px; border-radius: 5px; vertical-align: middle; }

.event { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .88rem; }
.event:first-child { border-top: 0; }
.event p { margin: 0; color: var(--muted); }
.event time { font-size: .72rem; color: var(--muted); white-space: nowrap; }

.filters { margin-bottom: 8px; }
.filters .chips { margin-top: 0; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.filters .chips button { flex: none; }
.filter-row select { width: auto; }
.filter-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
select, .log-form input { min-width: 0; width: 100%; font: inherit; font-size: .9rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.check { font-size: .85rem; display: flex; gap: 6px; align-items: center; }
.game-list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--line); padding: 10px 0; width: 100%; }
.row .rank { width: 20px; text-align: center; color: var(--muted); font-size: .8rem; flex: none; }
.row .thumb { width: 46px; height: 46px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-size: .92rem; }
.row-main small { color: var(--muted); font-size: .76rem; }
.bar { display: block; height: 4px; background: var(--line); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); }

.log-form { display: grid; grid-template-columns: 1fr 80px 80px auto; gap: 6px; }
@media (max-width: 480px) { .log-form { grid-template-columns: 1fr 1fr; } .log-form select { grid-column: 1 / -1; } }
.log-form button, #share-btn { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 8px 14px; font-weight: 700; }
.log-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.ghost.small { padding: 3px 10px; font-size: .8rem; }

.how details { border-top: 1px solid var(--line); padding: 10px 0; }
.how details:first-child { border-top: 0; padding-top: 0; }
.how summary { font-weight: 700; cursor: pointer; }
.how ul { padding-left: 18px; }

dialog { width: min(640px, calc(100vw - 16px)); max-height: 90vh; border: 1px solid var(--line); border-radius: 20px; padding: 18px; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog .close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); }
.detail-head { display: flex; gap: 12px; align-items: center; padding-right: 36px; }
.detail-head img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; }
.detail-head p { margin: 2px 0 6px; color: var(--muted); font-size: .85rem; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-size: .72rem; color: var(--muted); text-transform: uppercase; }
tr.gone { opacity: .45; }

footer { max-width: 760px; margin: 20px auto 0; padding: 16px 16px 32px; font-size: .82rem; color: var(--muted); }
footer b { color: var(--ink); }

/* ---------- Harpstar hero: metallic lettering + dollar burst ----------
   Glow lives on a solid ::before copy behind the text. iOS Safari can drop
   background-clip:text glyphs that also carry a filter, so neither the
   lettering nor the flying $ signs use filter. */
.hero { position: relative; overflow: hidden; text-align: center; padding: 34px 16px 22px; isolation: isolate; }
.title-gold { position: relative; margin: 0; font-family: Cinzel, "Trajan Pro", Georgia, serif; font-weight: 900; text-transform: uppercase;
  font-size: clamp(1.6rem, 8vw, 3rem); line-height: .95; letter-spacing: .03em; display: flex; flex-direction: column; align-items: center; }
.title-gold span, .by-silver span { position: relative; display: inline-block; }
.title-gold span::before, .by-silver span::before { content: attr(data-text); position: absolute; inset: 0; z-index: -1; color: #5a3a05;
  -webkit-text-fill-color: #5a3a05; text-shadow: 0 2px 0 #3d2703, 0 0 18px rgba(255,200,80,.55), 0 0 36px rgba(255,190,60,.25); }
.title-gold span { background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.95) 50%, transparent 62%), var(--gold-metal);
  background-size: 250% 100%, 100% 100%; animation: shine 3.8s ease-in-out infinite;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
@keyframes shine { 0% { background-position: 150% 0, 0 0; } 55%, 100% { background-position: -60% 0, 0 0; } }
.by-silver { margin: 10px 0 0; font: italic 700 clamp(0.9rem, 4vw, 1.3rem) Cinzel, Georgia, serif; letter-spacing: .12em; }
.by-silver span { background: var(--silver-metal); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.by-silver span::before { color: #2b2f35; -webkit-text-fill-color: #2b2f35; text-shadow: 0 1px 0 #16181c, 0 0 14px rgba(220,230,255,.45); }
.tagline { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.burst { position: absolute; left: 50%; top: 46%; width: 0; height: 0; z-index: 0; pointer-events: none; }
.burst i { position: absolute; left: 0; top: 0; font: 900 var(--s, 22px)/1 Georgia, "Times New Roman", serif; font-style: normal; opacity: 0;
  color: var(--c, #ffd766); text-shadow: 0 1px 0 #7a5208, 0 0 8px rgba(255,210,90,.8), 0 0 16px rgba(255,190,60,.45);
  will-change: transform, opacity; animation: shoot var(--d, 2.6s) cubic-bezier(.15,.7,.3,1) var(--delay, 0s) infinite; }
@keyframes shoot {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0deg); }
  12% { opacity: 1; }
  80% { opacity: .95; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.15) rotate(var(--r)); }
}
/* Reduced motion: keep the money flying, but slower and without spin. */
@keyframes drift {
  0% { opacity: 0; transform: translate(calc(-50% + var(--x) * .35), calc(-50% + var(--y) * .35)); }
  30%, 70% { opacity: .9; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x) * .8), calc(-50% + var(--y) * .8)); }
}
@media (prefers-reduced-motion: reduce) {
  .title-gold span { animation: none; }
  .burst i { animation: drift calc(var(--d, 2.6s) * 2.5) ease-in-out var(--delay, 0s) infinite; }
}
.pick { border-color: var(--gold); background: linear-gradient(180deg, rgba(242,193,78,.12), rgba(242,193,78,.03)); }
.card h2 { color: var(--gold); letter-spacing: .02em; }
.title-gold, .by-silver, .tagline { position: relative; z-index: 1; }
.tagline { display: inline-block; padding: 3px 12px; border-radius: 999px; background: rgba(10,8,6,.72); }

/* ---------- plain-English wins ---------- */
.outcomes { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.outcome-head { margin: 0 0 8px; font-size: .92rem; }
.people { display: grid; grid-template-columns: repeat(10, minmax(0, 34px)); gap: 4px; }
.person { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: .85rem; color: #0a0806; }
.o-nothing { background: #6b5f4d; } .o-some { background: #d98a3a; } .o-back { background: #c9ced6; } .o-ahead { background: #3ed68b; }
.outcome-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: .88rem; }
.outcome-list li { display: grid; grid-template-columns: 12px 1fr auto 48px; gap: 8px; align-items: center; }
.outcome-list i { width: 12px; height: 12px; border-radius: 3px; }
.outcome-list small { color: var(--muted); text-align: right; }
.win-truth { margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid var(--gold); background: rgba(242,193,78,.07); border-radius: 0 10px 10px 0; font-size: .88rem; }
.prize-table small { color: var(--muted); }
.prize-table .left { display: block; font-size: .72rem; }
.prize-table td { white-space: nowrap; }
.prize-table th, .prize-table td { padding: 6px 4px; }
.kind { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.k-top { background: var(--gold); color: #1a1200; } .k-big { background: #3ed68b; color: #04130c; } .k-profit { background: rgba(62,214,139,.18); color: var(--pos); }
.k-back { background: rgba(201,206,214,.18); color: #dfe3e8; } .k-less { background: rgba(255,122,107,.15); color: var(--neg); }

/* ---------- Harpstar free slots: side panel on wide screens, bottom sheet on phones ---------- */
.slots-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; border: 0; border-radius: 999px;
  padding: 12px 18px; font-weight: 800; color: #1a1200; background: var(--gold-metal); box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 18px rgba(242,193,78,.35); }
.slots { --sym-h: 64px; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto;
  background: linear-gradient(180deg, #1d160b, #0d0a06); border-top: 2px solid var(--gold); border-radius: 22px 22px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .3s ease; box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
.slots.open { transform: translateY(0); }
.slots-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.slots-head small { display: block; color: var(--muted); font-size: .75rem; }
.slots-title { font: 900 1.25rem Cinzel, Georgia, serif; color: #ffd766; text-shadow: 0 0 10px rgba(255,200,80,.5); }
.small-btn { width: 34px; height: 34px; font-size: .9rem; }
.machine { max-width: 360px; margin: 0 auto; }
.reels { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; border-radius: 16px;
  background: #050403; border: 3px solid #c8901c; box-shadow: inset 0 0 18px rgba(0,0,0,.9), 0 0 0 2px #5a3a05, 0 0 20px rgba(242,193,78,.25); }
.reel { height: var(--sym-h); overflow: hidden; border-radius: 10px; background: linear-gradient(180deg, #d9d2c3, #fffdf6 30%, #fffdf6 70%, #d9d2c3); }
.reel-strip { will-change: transform; }
.sym { height: var(--sym-h); display: grid; place-items: center; font-size: 40px; line-height: 1; }
.payline { position: absolute; left: 6px; right: 6px; top: 50%; height: 2px; background: rgba(255,80,80,.55); pointer-events: none; }
.slot-msg { min-height: 1.4em; margin: 10px 0 6px; text-align: center; font-weight: 700; color: var(--muted); }
.slot-msg.good { color: #ffd766; }
.slot-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bet-chips { margin: 0; align-items: center; }
.bet-chips span { font-size: .8rem; color: var(--muted); }
.spin-btn { flex: 1; min-width: 120px; border: 0; border-radius: 14px; padding: 12px; font: 900 1.2rem Cinzel, Georgia, serif; letter-spacing: .1em;
  color: #1a1200; background: var(--gold-metal); box-shadow: 0 4px 0 #7a5208, 0 0 16px rgba(242,193,78,.35); }
.spin-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #7a5208; }
.spin-btn:disabled { opacity: .5; }
.slot-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; text-align: center; }
.slot-stats div { background: rgba(255,255,255,.04); border-radius: 10px; padding: 6px 2px; }
.slot-stats small { display: block; font-size: .62rem; color: var(--muted); }
.slot-stats b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.paytable { margin-top: 10px; font-size: .85rem; }
.paytable summary { cursor: pointer; font-weight: 700; color: var(--gold); }
.paytable ul { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.paytable li { display: flex; justify-content: space-between; }
.slots.win .reels { animation: winflash .5s ease 3; }
.slots.jackpot .reels { animation: winflash .35s ease 8; }
@keyframes winflash { 50% { box-shadow: inset 0 0 18px rgba(0,0,0,.9), 0 0 0 2px #ffd766, 0 0 40px rgba(255,215,102,.9); } }
@media (min-width: 1180px) {
  body { padding-right: 372px; }
  .slots-fab { display: none; }
  .slots { left: auto; right: 16px; top: 16px; bottom: auto; width: 340px; max-height: calc(100vh - 32px); transform: none;
    border: 2px solid var(--gold); border-radius: 22px; }
  #slots-close { display: none; }
}
@media (prefers-reduced-motion: reduce) { .slots { transition: none; } .slots.win .reels, .slots.jackpot .reels { animation: none; } }
body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ---------- did you win? ---------- */
.win-box { border-color: rgba(242,193,78,.45); background: linear-gradient(180deg, rgba(242,193,78,.08), var(--card) 60%); }
.win-form { display: grid; grid-template-columns: 1fr 110px; gap: 8px; margin-top: 10px; }
.win-form select, .win-form input, .win-form textarea { min-width: 0; width: 100%; font: inherit; font-size: .9rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.win-form #win-name, .win-form textarea, .win-form button { grid-column: 1 / -1; }
.win-form textarea { resize: vertical; }
.win-form button { border: 0; border-radius: 12px; padding: 11px; font-weight: 800; color: #1a1200; background: var(--gold-metal); }
.tip { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.tip p { margin: 0 0 10px; }
.tip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tip-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid #00d64f; color: #00d64f; font-weight: 800; text-decoration: none; }
.cashapp { flex: 1; min-width: 170px; text-align: center; padding: 10px 14px; border-radius: 12px; background: #00d64f; color: #fff; font-weight: 700; text-decoration: none; }
