:root {
  color-scheme: dark;
  --ink: #fffaf0;
  --muted: #c8d0c6;
  --panel: rgba(5, 31, 22, 0.9);
  --line: rgba(255, 250, 240, 0.13);
  --green: #20d17a;
  --green-dark: #146d55;
  --gold: #f5d36f;
  --danger: #ff9b8f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #061b13; }
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(245, 211, 111, .025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 250, 240, .018) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(32, 209, 122, .12), transparent 34rem),
    linear-gradient(180deg, #061b13 0%, #0b2c20 45%, #06170f 100%);
  background-size: 32px 32px, 32px 32px, auto, auto;
}
button, input { font: inherit; }
button { border: 0; cursor: pointer; transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:not(:disabled):active { transform: translateY(1px) scale(.99); }
[hidden] { display: none !important; }

.shell { width: min(100%, 42rem); min-height: 100dvh; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom)); }
.screen { display: grid; align-content: start; gap: 1.15rem; min-height: calc(100dvh - 3rem); padding: 1rem 0; }
.access-screen { align-content: center; width: min(100%, 31rem); margin: auto; }
.brand-lockup, .topbar { display: flex; align-items: center; gap: .75rem; }
.brand-lockup strong { display: block; font-size: 1rem; }
.brand-mark { display: grid; width: 5.6rem; height: 3.8rem; place-items: center; overflow: hidden; border: 1px solid rgba(245, 211, 111, .35); border-radius: .55rem; background: #020d09; box-shadow: 0 1rem 2rem rgba(0, 0, 0, .28); }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-lockup.compact .brand-mark { width: 3.25rem; height: 2.25rem; }
.topbar { justify-content: space-between; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; }
.eyebrow { color: var(--gold); font-size: .76rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.4rem, 10vw, 4rem); line-height: .95; }
h2 { font-size: 1.35rem; line-height: 1.15; }
p { color: var(--muted); line-height: 1.5; }
.panel { border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); box-shadow: 0 1.4rem 2.8rem rgba(0, 0, 0, .3); backdrop-filter: blur(14px); }
.access-panel { display: grid; gap: 1rem; padding: clamp(1.25rem, 5vw, 2rem); }
.form-stack { display: grid; gap: .7rem; margin-top: .35rem; }
label { font-weight: 850; }
.password-field { display: grid; grid-template-columns: 1fr auto; overflow: hidden; border: 1px solid rgba(255, 250, 240, .24); border-radius: .65rem; background: #fffdf6; }
input { min-width: 0; min-height: 3.2rem; padding: .75rem .9rem; border: 0; outline: 0; color: #14221c; background: transparent; }
input:focus { box-shadow: inset 0 0 0 2px var(--green); }
.field-action { padding: 0 .9rem; color: #0b3c29; background: #e4eee7; font-weight: 900; }
.primary-action, .secondary-action { min-height: 3rem; padding: .72rem 1rem; border-radius: .65rem; font-weight: 950; }
.primary-action { color: #06140d; background: linear-gradient(135deg, #39e38d, #f5d36f); box-shadow: 0 .8rem 1.5rem rgba(32, 209, 122, .18); }
.secondary-action { border: 1px solid rgba(255, 250, 240, .18); color: var(--ink); background: rgba(255, 255, 255, .07); }
.compact-action { min-height: 2.45rem; padding: .5rem .8rem; font-size: .82rem; }
.feedback { font-size: .9rem; font-weight: 850; }
.feedback.error { color: var(--danger); }
.screen-heading { display: flex; gap: 1rem; align-items: end; justify-content: space-between; }
.screen-heading p { margin-top: .55rem; }
.status-badge { flex: 0 0 auto; padding: .45rem .65rem; border: 1px solid rgba(32, 209, 122, .35); border-radius: 999px; color: #8cf0b9; background: rgba(32, 209, 122, .09); font-size: .72rem; font-weight: 900; }
.status-badge.is-offline { color: var(--gold); border-color: rgba(245, 211, 111, .35); background: rgba(245, 211, 111, .08); }
.install-panel { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .85rem; align-items: center; padding: .9rem; border: 1px solid rgba(32, 209, 122, .34); border-radius: .8rem; background: linear-gradient(135deg, rgba(9, 58, 40, .96), rgba(3, 29, 20, .96)); box-shadow: 0 1rem 2rem rgba(0, 0, 0, .25); }
.install-icon { display: grid; width: 2.7rem; aspect-ratio: 1; place-items: center; border: 1px solid rgba(245, 211, 111, .42); border-radius: .65rem; color: #07180f; background: linear-gradient(145deg, var(--green), var(--gold)); font-size: 1.45rem; font-weight: 950; }
.install-copy { display: grid; gap: .15rem; min-width: 0; }
.install-copy strong { color: var(--ink); font-size: .98rem; }
.install-copy p { font-size: .8rem; line-height: 1.35; }
.install-actions { display: grid; gap: .25rem; justify-items: stretch; }
.install-actions button { white-space: nowrap; }
.text-action { padding: .3rem .55rem; color: var(--muted); background: transparent; font-size: .75rem; font-weight: 850; }
.text-action:hover { color: var(--ink); }
.install-dialog { width: min(calc(100% - 2rem), 28rem); padding: 1.25rem; border: 1px solid rgba(245, 211, 111, .28); border-radius: 1rem; color: var(--ink); background: #08271b; box-shadow: 0 2rem 5rem rgba(0, 0, 0, .62); }
.install-dialog::backdrop { background: rgba(0, 8, 5, .76); backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .65rem; }
.dialog-close { display: grid; width: 2.2rem; aspect-ratio: 1; place-items: center; border-radius: 50%; color: var(--ink); background: rgba(255, 255, 255, .08); font-size: 1.4rem; }
.install-dialog > p { margin-top: .65rem; font-size: .9rem; }
.ios-browser-note { padding: .7rem; border: 1px solid rgba(245, 211, 111, .28); border-radius: .55rem; color: var(--gold); background: rgba(245, 211, 111, .07); }
.install-steps { display: grid; gap: .7rem; margin: 1rem 0; padding-left: 1.35rem; color: var(--muted); line-height: 1.4; }
.install-steps strong { color: var(--ink); }
.install-dialog > .primary-action { width: 100%; }
.game-panel { display: grid; justify-items: center; gap: 1.2rem; overflow: hidden; padding: clamp(1.15rem, 5vw, 1.65rem); text-align: center; background: radial-gradient(circle at 50% 0%, rgba(245, 211, 111, .18), transparent 34%), linear-gradient(145deg, rgba(5, 50, 33, .96), rgba(1, 18, 12, .98)); }
.coin { position: relative; display: grid; width: min(68vw, 17rem); aspect-ratio: 1; place-items: center; overflow: hidden; padding: 0; border: .42rem solid rgba(255, 241, 160, .82); border-radius: 999px; color: #07180f; background: #c8921f; box-shadow: 0 1.4rem 2.5rem rgba(0, 0, 0, .42), inset 0 .5rem 1rem rgba(255, 255, 255, .26), inset 0 -.8rem 1.1rem rgba(81, 45, 0, .22); transform: rotateY(0deg) scale(1); transform-style: preserve-3d; transition: transform 1150ms cubic-bezier(.16, .82, .22, 1); }
.coin.flipping { transform: rotateY(1440deg) scale(1.03); }
.coin img { width: 100%; height: 100%; object-fit: cover; }
.coin-shine { position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 28% 18%, rgba(255, 255, 255, .34), transparent 24%), linear-gradient(145deg, rgba(255, 255, 255, .1), transparent 42%, rgba(44, 23, 0, .22)); pointer-events: none; }
.result-copy { display: grid; gap: .3rem; min-height: 3.6rem; }
.result-copy p { font-size: .86rem; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; width: min(100%, 34rem); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: .75rem; background: rgba(2, 18, 12, .72); }
.stats span { display: grid; gap: .2rem; padding: .75rem .4rem; color: var(--muted); text-align: center; font-size: .78rem; font-weight: 800; }
.stats span + span { border-left: 1px solid var(--line); }
.stats strong { color: var(--gold); font-size: 1.25rem; }
.section-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: .65rem; }
.section-title small { color: var(--muted); font-weight: 800; }
.history-list { display: grid; gap: .55rem; }
.history-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: .7rem; align-items: center; padding: .75rem; border: 1px solid var(--line); border-radius: .7rem; background: rgba(5, 31, 22, .78); }
.history-row > strong { color: var(--gold); }
.history-avatar { display: grid; width: 2.35rem; aspect-ratio: 1; place-items: center; border: 1px solid rgba(245, 211, 111, .42); border-radius: 50%; color: #06140d; background: var(--gold); font-weight: 950; }
.history-row div { display: grid; min-width: 0; }
.history-row small { overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.history-result { font-weight: 900; }
.empty-state { padding: 1.3rem; border: 1px dashed rgba(255, 250, 240, .2); border-radius: .75rem; text-align: center; }
.empty-state p { margin-top: .35rem; font-size: .9rem; }
.legal { max-width: 32rem; margin: .5rem auto 0; text-align: center; font-size: .74rem; opacity: .78; }

@media (max-width: 520px) {
  .screen-heading { display: grid; align-items: start; }
  .status-badge { justify-self: start; }
  .actions { grid-template-columns: 1fr; }
  .install-panel { grid-template-columns: auto minmax(0, 1fr); }
  .install-actions { grid-column: 1 / -1; grid-template-columns: 1fr auto; width: 100%; }
  .topbar-actions { gap: .35rem; }
  .topbar-actions .compact-action { padding-inline: .65rem; }
  .history-result { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
