:root {
  color-scheme: dark;
  --bg: #031719;
  --bg-2: #062525;
  --panel: rgba(8, 31, 32, 0.88);
  --panel-strong: rgba(14, 42, 40, 0.95);
  --line: rgba(198, 255, 58, 0.2);
  --line-soft: rgba(255, 255, 255, 0.11);
  --text: #f5f8ed;
  --muted: #a6b7ae;
  --accent: #d9ff16;
  --accent-2: #88d946;
  --danger: #ff775d;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 46% 0%, rgba(179, 255, 26, 0.1), transparent 34rem),
    linear-gradient(135deg, #021012 0%, #041b1d 44%, #061919 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.18;
  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: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: 100vh;
  padding: 20px;
  gap: 18px;
}

.sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 40px);
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(2, 17, 18, 0.78);
  box-shadow: var(--shadow);
}

.brand {
  display: grid;
  margin: 0 10px 24px;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
  line-height: 0.86;
  font-weight: 950;
  font-size: 20px;
  letter-spacing: 0;
}

.brand-tennis {
  color: var(--text);
  font-size: 18px;
  font-style: italic;
}

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

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 42px;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  color: var(--accent);
  border-color: rgba(217, 255, 22, 0.22);
  background: rgba(217, 255, 22, 0.09);
}

.nav-icon {
  display: grid;
  width: 20px;
  place-items: center;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.profile-card strong,
.profile-card span {
  display: block;
}

.profile-card span {
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 5vw, 56px);
  line-height: 0.94;
  text-transform: uppercase;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 15px;
}

.top-actions,
.panel-title,
.segmented,
.amount-control,
.chip-row,
.settle-actions {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
}

.icon-button,
.ghost-button,
.primary-button,
.chip-row button,
.segmented button,
.stepper,
.settle-actions button,
.match-tab {
  min-height: 40px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.icon-button {
  width: 42px;
  font-size: 20px;
}

.ghost-button {
  padding: 0 14px;
}

.ghost-button.full {
  width: 100%;
}

.primary-button {
  width: 100%;
  min-height: 46px;
  color: #061010;
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, var(--accent), #b8f70a);
  box-shadow: 0 14px 38px rgba(217, 255, 22, 0.18);
  font-weight: 900;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:hover {
  transform: translateY(-1px);
}

button:active,
button.is-pressing {
  transform: translateY(1px) scale(0.99);
}

.match-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.match-tab {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-height: 64px;
  padding: 11px 13px;
  text-align: left;
}

.match-tab.active {
  color: var(--accent);
  border-color: rgba(217, 255, 22, 0.62);
  background: rgba(217, 255, 22, 0.1);
  box-shadow: inset 0 0 24px rgba(217, 255, 22, 0.08);
}

.match-tab span {
  color: var(--muted);
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.bet-panel,
.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.bet-panel {
  overflow: hidden;
  min-height: 624px;
}

.match-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px minmax(0, 1fr);
  align-items: center;
  min-height: 184px;
  padding: 26px 26px 18px;
  background:
    linear-gradient(90deg, rgba(217, 255, 22, 0.12), transparent 30%, transparent 70%, rgba(217, 255, 22, 0.09)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent);
}

.match-hero::after {
  position: absolute;
  inset: auto 22px 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(217, 255, 22, 0.55), transparent);
}

.team-display {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.team-display.right {
  justify-content: flex-end;
  text-align: right;
}

.team-name {
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 950;
  line-height: 1.05;
}

.team-sub {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.avatar-pair {
  display: flex;
  flex: 0 0 auto;
}

.avatar-pair .avatar + .avatar {
  margin-left: -10px;
}

.avatar {
  width: 52px;
  height: 52px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 2px solid rgba(244, 252, 237, 0.8);
  border-radius: 50%;
  background: #050505;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar-black {
  position: relative;
  background:
    radial-gradient(circle at 50% 38%, #222 0 17%, transparent 18%),
    radial-gradient(circle at 50% 88%, #202020 0 34%, transparent 35%),
    #020202;
}

.vs-mark {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 42px;
  font-style: italic;
  font-weight: 950;
  text-shadow: 0 0 24px rgba(217, 255, 22, 0.34);
}

.match-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 20px 4px;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  color: var(--accent);
  font-weight: 800;
}

.status-pill.settled {
  color: #cbd6d1;
}

.odds-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px 22px 10px;
}

.odds-card {
  min-height: 106px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  text-align: center;
}

.odds-card.active {
  border-color: rgba(217, 255, 22, 0.88);
  background: linear-gradient(135deg, rgba(217, 255, 22, 0.2), rgba(255, 255, 255, 0.05));
  box-shadow: 0 0 0 1px rgba(217, 255, 22, 0.18), inset 0 0 32px rgba(217, 255, 22, 0.08);
}

.odds-card span,
.odds-card strong {
  display: block;
}

.odds-card span {
  color: var(--text);
  font-weight: 800;
}

.odds-card strong {
  margin-top: 12px;
  color: var(--accent);
  font-size: 28px;
}

.bet-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 14px 22px 22px;
}

.bet-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  height: 44px;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  outline: none;
  background: rgba(0, 0, 0, 0.2);
  padding: 0 12px;
}

input:focus {
  border-color: rgba(217, 255, 22, 0.72);
  box-shadow: 0 0 0 3px rgba(217, 255, 22, 0.1);
}

.amount-control {
  gap: 8px;
}

.stepper {
  width: 44px;
  flex: 0 0 44px;
  font-size: 18px;
}

.chip-row {
  grid-column: 1 / 2;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-row button {
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
}

.chip-row button.active,
.segmented button.active {
  color: #041312;
  border-color: transparent;
  background: var(--accent);
  font-weight: 900;
}

.estimate-box {
  grid-column: 2 / 3;
  grid-row: span 2;
  display: grid;
  align-content: center;
  min-height: 108px;
  padding-left: 20px;
  border-left: 1px solid var(--line-soft);
}

.estimate-box span {
  color: var(--muted);
}

.estimate-box strong {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 34px;
}

.bet-form .primary-button {
  grid-column: 1 / 2;
}

.side-column {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.panel-title {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
}

.coin {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #09200d;
  border-radius: 50%;
  background: var(--accent);
  font-weight: 950;
}

.balance {
  display: block;
  margin-bottom: 14px;
  font-size: 34px;
}

.segmented {
  height: 30px;
  gap: 4px;
  padding: 3px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.segmented button {
  min-height: 24px;
  padding: 0 10px;
  border: 0;
  color: var(--muted);
  font-size: 12px;
}

.record-list,
.rank-list {
  display: grid;
  gap: 10px;
}

.record-card,
.rank-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.record-card {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.record-head,
.record-row,
.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.record-head {
  color: var(--muted);
  font-size: 12px;
}

.record-card strong {
  color: var(--accent);
}

.record-row {
  color: var(--muted);
  font-size: 13px;
}

.record-row b {
  color: var(--text);
}

.record-status {
  color: var(--accent);
  font-weight: 900;
}

.record-status.lost {
  color: var(--danger);
}

.record-status.won {
  color: var(--accent-2);
}

.rank-item {
  min-height: 46px;
  padding: 8px 10px;
}

.rank-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rank-number {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #051716;
  border-radius: 50%;
  background: rgba(217, 255, 22, 0.92);
  font-size: 12px;
  font-weight: 950;
}

.rank-item .avatar {
  width: 28px;
  height: 28px;
  border-width: 1px;
}

.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settle-actions {
  align-items: stretch;
  gap: 8px;
  flex-direction: column;
}

.settle-actions button {
  min-height: 38px;
  padding: 0 12px;
  text-align: left;
}

.settle-actions button:hover,
.ghost-button:hover,
.icon-button:hover,
.stepper:hover,
.chip-row button:hover {
  border-color: rgba(217, 255, 22, 0.58);
  color: var(--accent);
  background: rgba(217, 255, 22, 0.08);
}

.empty {
  padding: 12px;
  color: var(--muted);
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius);
  text-align: center;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid rgba(217, 255, 22, 0.28);
  border-radius: var(--radius);
  background: rgba(5, 25, 24, 0.95);
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease both;
}

.toast.error {
  border-color: rgba(255, 119, 93, 0.5);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.success-modal {
  width: min(390px, calc(100vw - 34px));
  color: var(--text);
  border: 1px solid rgba(217, 255, 22, 0.38);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(8, 35, 33, 0.98), rgba(2, 17, 18, 0.98));
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

.success-modal::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.modal-ball {
  display: grid;
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  place-items: center;
  color: #0a1f0c;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #faff76, #bdea0b 68%);
  font-size: 34px;
  font-weight: 950;
  box-shadow: 0 0 44px rgba(217, 255, 22, 0.28);
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.modal-stats span {
  display: grid;
  gap: 6px;
  padding: 10px 6px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 12px;
}

.modal-stats b {
  color: var(--accent);
  font-size: 16px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
  }

  .brand {
    min-width: 118px;
    margin: 0;
  }

  .nav-list {
    display: flex;
    min-width: max-content;
  }

  .nav-item {
    width: auto;
  }

  .profile-card {
    min-width: 158px;
    margin: 0 0 0 auto;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .match-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 18px;
  }

  .team-display,
  .team-display.right {
    justify-content: center;
    text-align: center;
    flex-direction: column;
  }

  .team-display.right .avatar-pair {
    order: -1;
  }

  .vs-mark {
    font-size: 34px;
  }

  .odds-grid,
  .bet-form {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  .estimate-box,
  .chip-row,
  .bet-form .primary-button {
    grid-column: auto;
  }

  .estimate-box {
    min-height: 80px;
    padding: 12px 0 0;
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }

  .modal-stats {
    grid-template-columns: 1fr;
  }
}
