:root {
  --night: #0b0618;
  --night-2: #1a0b33;
  --elevated: #161022;
  --card: #1e1633;
  --gold: #e8c36a;
  --gold-soft: #c9a24a;
  --cream: #f5ede0;
  --muted: #c9bba8;
  --lilac: #b39ddb;
  --error: #e89aa8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--night);
  color: var(--cream);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

body {
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(245, 237, 224, 0.45) 0, transparent 2px),
    radial-gradient(1px 1px at 28% 8%, rgba(245, 237, 224, 0.3) 0, transparent 2px),
    radial-gradient(1.5px 1.5px at 63% 14%, rgba(232, 195, 106, 0.4) 0, transparent 3px),
    radial-gradient(1px 1px at 81% 22%, rgba(245, 237, 224, 0.28) 0, transparent 2px),
    radial-gradient(1px 1px at 44% 6%, rgba(245, 237, 224, 0.35) 0, transparent 2px),
    linear-gradient(180deg, #0b0618 0%, #1a0b33 42%, #0b0618 100%);
  background-attachment: fixed;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 18px 96px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.icon-btn, .ghost, .primary, .tab {
  font: inherit;
  cursor: pointer;
}

.icon-btn, .ghost {
  background: transparent;
  border: 0;
  color: var(--gold);
}

.icon-btn {
  font-size: 20px;
  padding: 6px 8px;
}

.hero {
  text-align: center;
  padding: 8px 0 22px;
}

.hero h1, h2, .brand {
  font-family: "Cormorant Garamond", Palatino, serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero h1 {
  margin: 8px 0 4px;
  font-size: 42px;
  color: var(--gold);
}

.hero p, .hint, .muted, .card p, .disclaimer {
  color: var(--muted);
}

.moon {
  font-size: 28px;
}

label.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

textarea, input[type="search"], input[type="email"], input[type="tel"], input[type="date"], input[type="password"] {
  width: 100%;
  border: 1px solid rgba(232, 195, 106, 0.35);
  background: rgba(11, 6, 24, 0.45);
  color: var(--cream);
  border-radius: 18px;
  padding: 16px;
  font: inherit;
}

textarea {
  min-height: 220px;
  resize: vertical;
}

textarea:focus, input:focus {
  outline: 2px solid var(--gold);
  border-color: var(--gold);
}

.primary {
  width: 100%;
  margin-top: 16px;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--gold);
  color: var(--night);
  font-weight: 600;
  font-size: 16px;
}

.primary:hover { filter: brightness(1.05); }

.error { color: var(--error); margin-top: 10px; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 16px;
}

.ghost.outline {
  border: 1px solid rgba(232, 195, 106, 0.55);
  border-radius: 12px;
  height: 46px;
}

.card {
  background: rgba(30, 22, 51, 0.92);
  border: 1px solid rgba(201, 162, 74, 0.35);
  border-radius: 18px;
  padding: 16px;
  margin: 0 0 12px;
}

.card h3 {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: "Cormorant Garamond", Palatino, serif;
  font-size: 22px;
}

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  margin: 18px 0 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid rgba(232, 195, 106, 0.7);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  color: var(--gold);
  background: rgba(11, 6, 24, 0.35);
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(22, 16, 34, 0.96);
  border-top: 1px solid rgba(201, 162, 74, 0.25);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}

.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 4px;
  font-size: 16px;
  font-weight: 600;
}

.tab.active {
  color: var(--gold);
}

.tab span { display: block; font-size: 22px; margin-bottom: 2px; }

.panel { display: none; }
.panel.active { display: block; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-item { cursor: pointer; }
.history-item:hover { border-color: var(--gold); }

dialog {
  border: 1px solid rgba(201, 162, 74, 0.4);
  border-radius: 18px;
  background: var(--card);
  color: var(--cream);
  width: min(520px, 92vw);
  padding: 22px;
}

dialog::backdrop { background: rgba(5, 2, 12, 0.72); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--night);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  display: none;
}

@media (min-width: 800px) {
  .hero h1 { font-size: 48px; }
}

body.guest .app,
body.guest .tabs { display: none; }
body.ready #gate { display: none; }

.gate {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 18px 48px;
}

.gate-screen { display: none; }
.gate-screen.active { display: block; }
.gate h1, .gate h2 {
  font-family: "Cormorant Garamond", Palatino, serif;
  color: var(--gold);
  text-align: center;
}
.gate h1 { font-size: 40px; margin: 8px 0 4px; }
.gate > .gate-screen.active > p,
.gate .moon { text-align: center; }
.gate .moon { font-size: 28px; }
.gate form label {
  display: block;
  margin: 12px 0;
  color: var(--muted);
}
.gate form input {
  margin-top: 6px;
}
.gate .primary,
.gate .ghost.outline {
  font-size: 20px;
  height: 56px;
  font-weight: 600;
}
.rules h3 { font-size: 24px; }
.rules ol {
  margin: 0;
  padding-left: 1.2em;
  color: var(--cream);
  line-height: 1.6;
  font-size: 18px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.quota, .who {
  font-size: 12px;
  color: var(--muted);
}
.quota.ok { color: var(--gold); }
.who { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost.small {
  font-size: 12px;
  padding: 4px 8px;
}
.ghost.outline { width: 100%; margin-top: 10px; }
.price {
  font-family: "Cormorant Garamond", Palatino, serif;
  font-size: 32px;
  color: var(--gold);
  text-align: center;
  margin: 8px 0 18px;
}
.subscribe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: linear-gradient(180deg, #f6e1a4 0%, #e8c36a 52%, #c99a3a 100%);
  color: #1a1006;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(255, 236, 180, 0.35),
    0 6px 18px rgba(232, 195, 106, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.subscribe-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 0 0 1px rgba(255, 236, 180, 0.55),
    0 10px 24px rgba(232, 195, 106, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.subscribe-btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}
.subscribe-btn[hidden] { display: none; }
.subscribe-icon {
  font-size: 15px;
  line-height: 1;
  color: #6b4a12;
}
.subscribe-btn--hero {
  width: 100%;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 0 0 18px;
  gap: 12px;
  font-size: 17px;
}
.subscribe-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  gap: 2px;
}
.subscribe-copy strong { font-weight: 800; }
.subscribe-copy small {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.72;
  color: inherit;
}
