:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
  font-synthesis: none;
  --page: #07090c;
  --text: #f7fafc;
  --muted: #a7b0ba;
  --soft: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.15);
  --glass: rgba(16, 20, 26, 0.68);
  --glass-strong: rgba(18, 24, 30, 0.88);
  --field: rgba(255, 255, 255, 0.07);
  --accent: #79f2b3;
  --accent-2: #73d3ff;
  --warning: #ffd66b;
  --danger: #ff6f76;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  --nav-height: 78px;
  --card-pad: 20px;
}

:root[data-theme="light"] {
  --page: #e9eef3;
  --text: #10141a;
  --muted: #58636f;
  --soft: rgba(0, 0, 0, 0.06);
  --line: rgba(20, 28, 38, 0.13);
  --glass: rgba(255, 255, 255, 0.64);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --field: rgba(255, 255, 255, 0.86);
  --accent: #10a768;
  --accent-2: #137eb5;
  --warning: #9f6b00;
  --danger: #c73343;
  --shadow: 0 14px 34px rgba(47, 62, 82, 0.14);
}

* {
  box-sizing: border-box;
}

* {
  min-width: 0;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 8%, rgba(121, 242, 179, 0.24), transparent 30%),
    radial-gradient(circle at 88% 16%, rgba(115, 211, 255, 0.22), transparent 32%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.03), transparent 42%),
    var(--page);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 72%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  letter-spacing: 0;
}

.mini-shell {
  position: relative;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 14px calc(env(safe-area-inset-bottom) + 118px);
}

.app-shell {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.loader-shell,
.gate-shell,
.application-shell {
  display: grid;
  align-content: center;
  gap: 18px;
}

.loader-shell {
  overflow: hidden;
  padding-bottom: 18px;
}

#loader-canvas {
  width: 100%;
  height: min(68vh, 560px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  background: #07090c;
}

.loader-copy {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 48px;
  color: #fff;
}

.loader-copy span,
.eyebrow {
  display: block;
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.loader-copy h1,
.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 0.95;
}

.loader-copy p,
.gate-card p,
.hero-glass p,
.event-feature p,
.event-hero p,
.rules-card p,
.version-card p {
  color: var(--muted);
  line-height: 1.45;
}

.glass-card,
.hero-glass,
.balance-card,
.metric,
.admin-panel,
.admin-metric {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03)),
    var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px) saturate(1.08);
}

.glass-card {
  padding: var(--card-pad);
}

.gate-card,
.access-card,
.form-card,
.version-card {
  padding: var(--card-pad);
}

.gate-card {
  display: grid;
  gap: 12px;
}

.brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(3, 12px);
  gap: 7px;
  align-items: end;
  width: max-content;
  height: 32px;
}

.brand-mark span {
  display: block;
  width: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  animation: pulseBar 1.8s ease-in-out infinite;
}

.brand-mark span:nth-child(1) { height: 18px; }
.brand-mark span:nth-child(2) { height: 30px; animation-delay: 0.18s; }
.brand-mark span:nth-child(3) { height: 23px; animation-delay: 0.36s; }

@keyframes pulseBar {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-5px); opacity: 1; }
}

.topbar,
.section-heading,
.inline-action,
.row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  flex-wrap: wrap;
}

.topbar {
  min-height: 78px;
  padding: 4px 2px 16px;
}

.top-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-button,
.tiny-button {
  border: 1px solid var(--line);
  background: var(--glass-strong);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.icon-button.text {
  width: auto;
  min-width: 42px;
  padding: 0 12px;
  font-weight: 900;
}

.icon-button.danger,
.secondary-button.danger {
  color: var(--danger);
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 900;
}

.primary-button {
  color: #07110d;
  background: linear-gradient(135deg, var(--accent), #79e7ff);
  box-shadow: 0 18px 42px rgba(73, 227, 165, 0.22);
}

.secondary-button {
  color: var(--text);
  background: var(--glass-strong);
  border-color: var(--line);
}

.text-button {
  width: max-content;
  min-height: 36px;
  padding: 0;
  color: var(--accent);
  background: transparent;
}

.content-stack {
  display: grid;
  gap: 14px;
}

.hero-glass {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  padding: 22px;
  display: grid;
  align-items: end;
}

.hero-orbit {
  position: absolute;
  inset: auto -20px -90px auto;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle, rgba(121, 242, 179, 0.26), transparent 64%);
  transform: rotateX(62deg) rotateZ(-18deg);
  animation: floatOrbit 7s ease-in-out infinite;
}

@keyframes floatOrbit {
  0%, 100% { transform: translateY(0) rotateX(62deg) rotateZ(-18deg); }
  50% { transform: translateY(-12px) rotateX(62deg) rotateZ(8deg); }
}

.balance-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  padding: 16px;
}

.balance-card div,
.metric {
  display: grid;
  gap: 4px;
}

.balance-card span,
.metric span,
.muted,
.warning-text,
.admin-table-row span,
.event-admin-summary span,
.audit-row span,
.promo-row span,
.ledger-row span,
.bet-row span {
  color: var(--muted);
}

.balance-card strong {
  font-size: 1.45rem;
}

.deposit-card,
.rules-card,
.bet-slip,
.referral-panel {
  padding: var(--card-pad);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  color: var(--text);
  background: var(--field);
  outline: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.inline-action {
  align-items: end;
}

.inline-action input {
  flex: 1;
}

.pill,
.status {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  color: var(--text);
  background: var(--soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.status.open,
.status.approved,
.positive {
  color: var(--accent);
}

.status.locked,
.status.rejected,
.negative,
.error-text {
  color: var(--danger);
}

.event-feature,
.event-card,
.event-hero,
.event-admin-summary {
  overflow: hidden;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 14px;
  padding: 12px;
  text-align: left;
}

.event-feature img,
.event-card img,
.event-hero img,
.event-admin-summary img {
  width: 100%;
  height: 100%;
  min-height: 112px;
  object-fit: cover;
  border-radius: 16px;
}

.event-card {
  width: 100%;
  color: var(--text);
}

.event-card > .icon {
  align-self: center;
}

.event-card h2,
.event-feature h2,
.event-hero h2 {
  margin-bottom: 8px;
  line-height: 1.05;
}

.event-card p,
.event-feature p {
  margin-bottom: 8px;
}

.event-card-wrap {
  position: relative;
}

.event-card-wrap .tiny-button {
  position: absolute;
  right: 10px;
  top: 10px;
}

.team-rail {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.team-rail span,
.team-row > span {
  min-width: 34px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #07110d;
  background: var(--team);
  font-size: 0.72rem;
  font-weight: 950;
}

.segmented {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 24px 4px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 13px;
  color: var(--muted);
  background: var(--soft);
  font-weight: 900;
}

.segmented button.active {
  color: #07110d;
  background: var(--accent);
}

.event-grid,
.team-list,
.ledger-list,
.bet-list,
.product-grid,
.promo-list,
.audit-list,
.timeline,
.step-list {
  display: grid;
  gap: 10px;
}

.event-hero {
  grid-template-columns: 1fr;
}

.event-hero img {
  aspect-ratio: 16 / 9;
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 14px;
}

.metric strong {
  font-size: 1.25rem;
}

.team-row,
.ledger-row,
.bet-row,
.promo-row,
.audit-row,
.admin-table-row {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ledger-row > div,
.bet-row > div,
.promo-row > div,
.admin-table-row > div {
  min-width: 0;
}

.history-row {
  align-items: start;
}

.history-row > div:first-child {
  display: grid;
  gap: 4px;
}

.history-row strong,
.product-card strong,
.event-card h2,
.event-feature h2 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.row-side {
  display: grid;
  justify-items: end;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 42%;
  text-align: right;
}

.row-side .secondary-button {
  min-height: 34px;
  border-radius: 12px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.team-row {
  justify-content: start;
}

.team-row em {
  margin-left: auto;
  font-style: normal;
  font-weight: 950;
}

.bet-slip {
  display: grid;
  gap: 13px;
}

.top3-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.preview-box,
.invoice-box,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(115, 211, 255, 0.1);
  display: grid;
  gap: 4px;
}

.warning-text {
  margin: 0;
  color: var(--warning);
}

.store-card {
  position: relative;
  overflow: hidden;
  padding: var(--card-pad);
}

.store-card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 160px;
  background: linear-gradient(100deg, transparent, rgba(45, 214, 177, 0.22), rgba(99, 209, 255, 0.18), transparent);
  transform: translateX(-40%);
  animation: neonSweep 6s ease-in-out infinite;
  pointer-events: none;
}

.product-card {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: var(--soft);
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  align-items: center;
}

.product-card img {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  object-fit: cover;
}

.product-card div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.product-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.product-card em {
  color: var(--accent);
  font-style: normal;
  font-weight: 950;
}

.product-card .secondary-button {
  grid-column: 1 / -1;
}

@keyframes neonSweep {
  0%, 100% { transform: translateX(-45%) rotate(-4deg); opacity: .15; }
  45%, 60% { transform: translateX(45%) rotate(-4deg); opacity: .7; }
}

.referral-panel h2 {
  font-size: clamp(2.4rem, 10vw, 4rem);
  margin-bottom: 18px;
}

.step-list span {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: var(--soft);
}

.step-list span.done {
  color: var(--accent);
}

.timeline article {
  border-left: 2px solid var(--accent);
  padding: 0 0 4px 14px;
}

.timeline p {
  margin-bottom: 0;
  color: var(--muted);
}

.clean-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  z-index: 20;
  width: min(calc(100% - 28px), 500px);
  min-height: var(--nav-height);
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  background: var(--glass-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px) saturate(1.05);
}

.bottom-nav button {
  min-width: 0;
  min-height: 62px;
  border: 0;
  border-radius: 17px;
  color: var(--muted);
  background: transparent;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.1;
}

.bottom-nav button.active {
  color: #07110d;
  background: linear-gradient(135deg, var(--accent), #80e7ff);
}

.bottom-nav .icon {
  width: 20px;
  height: 20px;
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.admin-login .form-card {
  width: min(100%, 420px);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: var(--glass-strong);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-sidebar nav {
  display: grid;
  gap: 8px;
}

.admin-sidebar a {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.admin-sidebar a:hover {
  background: var(--soft);
  color: var(--text);
}

.admin-content {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.admin-header,
.admin-panel {
  padding: 18px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-metric {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-grid.wide {
  align-items: start;
}

.admin-panel {
  display: grid;
  gap: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr auto;
  gap: 8px;
}

.row-actions.stretch > * {
  flex: 1;
}

.tiny-button {
  min-height: 30px;
  min-width: 34px;
  border-radius: 999px;
  padding: 0 10px;
  font-weight: 900;
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: relative;
    height: auto;
  }

  .admin-metrics,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .mini-shell {
    padding-inline: 12px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 124px);
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 2.1rem;
  }

  .event-feature,
  .event-card {
    grid-template-columns: 96px 1fr;
    gap: 10px;
  }

  .top3-grid,
  .facts-grid {
    grid-template-columns: 1fr;
  }

  .ledger-row,
  .bet-row,
  .promo-row {
    align-items: start;
  }

  .row-side {
    max-width: 46%;
  }

  .bottom-nav {
    bottom: calc(env(safe-area-inset-bottom) + 10px);
    width: min(calc(100% - 18px), 500px);
  }

  .bottom-nav button span {
    font-size: 0.66rem;
  }
}
