:root {
  color-scheme: dark;
  --ink: #f4f7f2;
  --muted: #a9b8b0;
  --pitch: #071c16;
  --pitch-soft: #0c2a20;
  --panel: #102f25;
  --panel-high: #173d31;
  --line: #2d5648;
  --lime: #b8f26a;
  --lime-ink: #10230c;
  --sky: #77d8f7;
  --warning: #ffd273;
  --danger: #ff8d8d;
  --shadow: 0 16px 40px rgba(0, 0, 0, .24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  min-width: 0;
  background: var(--pitch);
  overflow-x: hidden;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 100% -10%, rgba(119, 216, 247, .14), transparent 35rem),
    linear-gradient(180deg, #071c16 0%, #092219 100%);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .65rem; font-size: clamp(1.8rem, 8vw, 2.8rem); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin-bottom: .85rem; font-size: 1.08rem; line-height: 1.25; }
hr { width: 100%; margin: 1.25rem 0; border: 0; border-top: 1px solid var(--line); }

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-200%);
  padding: .65rem 1rem;
  border-radius: .5rem;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 800;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus { transform: none; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: min(100%, 72rem);
  margin: 0 auto;
  padding: 1rem 1rem .5rem;
}

.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.brand-mark, .lock-mark {
  display: grid;
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: .72rem .72rem .72rem .2rem;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 950;
  box-shadow: 0 6px 20px rgba(184, 242, 106, .16);
}
.brand-name, .brand-subtitle { display: block; white-space: nowrap; }
.brand-name { font-weight: 850; letter-spacing: -.02em; }
.brand-subtitle { color: var(--muted); font-size: .72rem; }

.profile-button {
  max-width: 8.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .48rem .72rem;
  background: transparent;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.app-main {
  width: min(100%, 72rem);
  margin: 0 auto;
  padding: 1rem 1rem 7.2rem;
}

.page { min-width: 0; }
.page-heading { margin: .8rem 0 1.5rem; }
.page-intro { max-width: 38rem; margin-bottom: 0; color: var(--muted); }
.page-utilities {
  display: flex;
  justify-content: flex-end;
  margin: -1rem 0 1rem;
}
.page-utilities--split { justify-content: space-between; }
.context-link {
  color: var(--sky);
  font-size: .78rem;
  font-weight: 800;
  text-underline-offset: .2rem;
}
.eyebrow {
  margin-bottom: .4rem;
  color: var(--lime);
  font-size: .71rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.muted, .field-help { color: var(--muted); }
.block { display: block; }
.freshness { color: var(--muted); font-size: .78rem; text-align: center; }

.card {
  min-width: 0;
  margin-bottom: .85rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(23, 61, 49, .9), rgba(13, 42, 32, .95));
  box-shadow: var(--shadow);
}

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.metric-card { min-height: 8.2rem; }
.metric-value { margin-bottom: .45rem; font-size: clamp(1.25rem, 6vw, 2rem); font-weight: 900; line-height: 1.1; letter-spacing: -.04em; }
.metric-card .muted { margin-bottom: 0; font-size: .79rem; }

.fixture-highlight { border-color: rgba(184, 242, 106, .48); }
.fixture-highlight__teams, .market-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.fixture-highlight__teams h2, .market-card__header h2 { margin-bottom: .25rem; }
.fixture-time { margin-bottom: 1rem; color: var(--muted); font-size: .82rem; }
.status-dot, .market-status, .member-status, .quota {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: .28rem .55rem;
  background: rgba(184, 242, 106, .12);
  color: var(--lime);
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}

.clean-list, .admin-list { margin: 0; padding: 0; list-style: none; }
.bet-summary, .admin-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .75rem 0;
  border-top: 1px solid var(--line);
}
.bet-summary:first-child, .admin-list__row:first-child { border-top: 0; }
.bet-summary > :last-child { flex: 0 0 auto; }

.button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: .72rem;
  padding: .65rem .9rem;
  font-weight: 850;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button--primary { background: var(--lime); color: var(--lime-ink); }
.button--secondary { border-color: var(--line); background: var(--panel-high); color: var(--ink); }
.button--danger { border-color: rgba(255, 141, 141, .55); background: rgba(255, 141, 141, .12); color: #ffd1d1; }
.button--full { width: 100%; }
.button--small { min-height: 2.35rem; padding: .45rem .65rem; font-size: .76rem; }
button:disabled { cursor: not-allowed; opacity: .48; }

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .25rem;
  margin-bottom: 1rem;
  padding: .25rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: rgba(5, 20, 15, .6);
}
.tab { border: 0; border-radius: .65rem; padding: .72rem; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--panel-high); color: var(--ink); box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }

.market-card { overflow: visible; }
.betting-toolbar {
  position: sticky;
  top: .5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: -1rem 0 .75rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: rgba(9, 33, 25, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  backdrop-filter: blur(14px);
}
.betting-toolbar strong, .betting-toolbar__label { display: block; }
.betting-toolbar strong { line-height: 1.2; }
.betting-toolbar__label { color: var(--muted); font-size: .66rem; }
.page--betting .page-heading { margin: .25rem 0 .75rem; }
.page--betting .page-heading h1 { margin-bottom: .3rem; font-size: clamp(1.65rem, 7vw, 2.25rem); }
.page--betting .page-intro { font-size: .8rem; line-height: 1.35; }
.page--betting .tabs { margin-bottom: .55rem; }
.page--betting .tab { padding: .55rem; }
.page--betting .market-card {
  margin-bottom: .55rem;
  padding: .72rem;
  border-radius: .82rem;
}
.page--betting .market-card__header h2 { margin-bottom: .12rem; }
.page--betting .fixture-time { margin-bottom: .55rem; font-size: .74rem; }
.market-status--closed, .market-status--settled { background: rgba(255, 210, 115, .12); color: var(--warning); }
.market-status--suspended { background: rgba(255, 141, 141, .12); color: var(--danger); }
.closed-message { margin: .75rem 0 0; color: var(--warning); font-weight: 750; }
.outcome-grid { display: grid; gap: .35rem; }
.outcome-grid--hda { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.outcome-grid--score { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.outcome-button, .stake-preset {
  min-width: 0;
  min-height: 2.65rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: rgba(7, 28, 22, .7);
  color: var(--ink);
  padding: .3rem;
  font-size: .76rem;
  font-weight: 750;
  cursor: pointer;
}
.outcome-button[aria-pressed="true"] { border-color: var(--lime); background: rgba(184, 242, 106, .13); color: var(--lime); }
.bet-slip { display: grid; gap: .5rem; margin-top: .55rem; padding: .62rem; border-radius: .7rem; background: rgba(4, 18, 14, .55); }
.bet-slip__label-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.bet-slip__field { gap: .25rem; }
.bet-slip__field input { min-height: 2.35rem; }
.stake-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; }
.stake-preset { min-height: 2.1rem; padding: .25rem; font-size: .72rem; }
.bet-slip__footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .6rem; }
.bet-slip__footer strong { font-size: .76rem; line-height: 1.25; }
.bet-slip__footer .button { min-height: 2.35rem; padding: .48rem .75rem; white-space: nowrap; }
.warning-copy { margin: 0; color: var(--warning); font-size: .8rem; }

.field { display: grid; min-width: 0; gap: .35rem; }
.field label, legend { font-weight: 750; }
.field input, .field select, select {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: .58rem .68rem;
  background: #092119;
  color: var(--ink);
}
.field-help { font-size: .72rem; }
.month-field { margin-bottom: 1rem; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 1rem; background: rgba(0, 8, 5, .78); }
.dialog-card { width: min(100%, 30rem); padding: 1.25rem; border: 1px solid var(--line); border-radius: 1.1rem; background: var(--panel); box-shadow: var(--shadow); }
.confirmation-grid { display: grid; gap: .6rem; margin: 1.2rem 0; }
.confirmation-grid > div { display: flex; justify-content: space-between; gap: 1rem; }
.confirmation-grid dt { color: var(--muted); }
.confirmation-grid dd { margin: 0; font-weight: 800; text-align: right; }
.button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }

.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 35rem; border-collapse: collapse; font-size: .8rem; }
th, td { padding: .7rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { color: var(--muted); font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
tbody th { font-weight: 800; }
.bet-state { display: inline-block; font-weight: 800; text-transform: capitalize; }
.bet-state--won { color: var(--lime); }
.bet-state--lost { color: var(--danger); }
.bet-state--void, .bet-state--refunded { color: var(--warning); }

.rules-grid { display: grid; gap: .85rem; }
.rule-card { margin-bottom: 0; }
.rule-card p:last-child { margin-bottom: 0; }
.rule-list { margin: 0; padding-left: 1.2rem; }
.rule-list li + li { margin-top: .55rem; }

.locked-panel { padding: 1.35rem; border-color: rgba(119, 216, 247, .38); background: linear-gradient(145deg, rgba(20, 60, 57, .98), rgba(10, 35, 28, .98)); }
.lock-mark { width: 3rem; height: 3rem; margin-bottom: 1.5rem; background: var(--sky); color: #06232b; }

.control-fieldset { margin: 0 0 1rem; padding: 0; border: 0; }
.control-fieldset legend { margin-bottom: .5rem; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row input { width: 1.3rem; height: 1.3rem; accent-color: var(--lime); }
.member-status { margin-left: .45rem; }
.member-status.is-inactive { color: var(--muted); }
.quota { max-width: 9rem; white-space: normal; text-align: right; }
.inline-form, .form-grid { display: grid; gap: .75rem; margin-top: 1rem; }
.member-editor, .member-actions { display: grid; gap: .4rem; margin-top: .55rem; }
.member-editor input { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: .55rem; padding: .48rem; background: #092119; color: var(--ink); }
.member-actions { flex: 0 0 min(9rem, 42%); }

.primary-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: .45rem max(.45rem, env(safe-area-inset-right)) calc(.45rem + env(safe-area-inset-bottom)) max(.45rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgba(6, 25, 19, .96);
  backdrop-filter: blur(18px);
}
.primary-nav__items { display: grid; grid-template-columns: repeat(var(--nav-count), minmax(0, 1fr)); width: min(100%, 46rem); margin: auto; }
.nav-link { display: grid; min-width: 0; min-height: 3.65rem; place-items: center; align-content: center; gap: .12rem; border-radius: .65rem; color: var(--muted); font-size: .61rem; font-weight: 750; text-decoration: none; }
.nav-link.is-active { background: rgba(184, 242, 106, .1); color: var(--lime); }
.nav-icon { font-size: 1rem; line-height: 1; }

.app-status { position: fixed; top: 4.8rem; right: 1rem; left: 1rem; z-index: 40; max-width: 32rem; margin: auto; padding: .75rem 1rem; border: 1px solid rgba(184, 242, 106, .45); border-radius: .75rem; background: #173d31; color: var(--ink); box-shadow: var(--shadow); }
.app-status[data-kind="error"] { border-color: rgba(255, 141, 141, .65); }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 1.2rem; }
.login-card { width: min(100%, 27rem); padding: 1.35rem; border: 1px solid var(--line); border-radius: 1.2rem; background: linear-gradient(145deg, rgba(23, 61, 49, .97), rgba(8, 31, 24, .98)); box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 3.5rem; }
.login-form { display: grid; gap: 1rem; margin-top: 1.6rem; }
.form-status { min-height: 1.5rem; margin: 0; color: var(--muted); font-size: .84rem; }
.form-status[data-kind="error"] { color: #ffc0c0; }
.form-status[data-kind="success"] { color: var(--lime); }

@media (min-width: 720px) {
  .app-header { padding: 1.4rem 2rem .5rem; }
  .app-main { padding: 1.5rem 2rem 7.5rem; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric-card { grid-column: span 2; }
  .outcome-grid--score { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .inline-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dialog-backdrop { place-items: center; }
  .rules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
