:root {
  color-scheme: dark;
  --bets-bg: #081b24;
  --bets-surface: #0e2a36;
  --bets-surface-2: #123543;
  --bets-border: rgba(176, 210, 225, 0.15);
  --bets-text: #f5fbfd;
  --bets-muted: #9fb6c1;
  --bets-green: #12df4e;
  --bets-green-dark: #09b83c;
  --bets-blue: #4fb3ff;
  --bets-red: #ff6b72;
  --bets-amber: #ffbd4a;
}

* {
  box-sizing: border-box;
}

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

.bets-body {
  min-height: 100vh;
  margin: 0;
  padding: 0 0 calc(92px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(18, 223, 78, 0.08), transparent 31%),
    linear-gradient(180deg, #0a202a 0%, #071820 100%);
  color: var(--bets-text);
  font-family: "Barlow", "Segoe UI", Arial, sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.bets-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--bets-border);
  background: rgba(8, 27, 36, 0.94);
  backdrop-filter: blur(16px);
}

.bets-topbar__inner {
  width: min(1040px, 100%);
  min-height: 68px;
  margin: 0 auto;
  padding: 9px clamp(14px, 3vw, 28px);
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.bets-back {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--bets-border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--bets-text);
  text-decoration: none;
}

.bets-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--bets-text);
  font-size: 19px;
  font-weight: 800;
  text-decoration: none;
}

.bets-brand__mark {
  width: 31px;
  height: 31px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #12df4e, #08a838);
  color: #04200d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.bets-wallet {
  display: grid;
  justify-items: end;
  gap: 1px;
  white-space: nowrap;
}

.bets-wallet span {
  color: var(--bets-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.bets-wallet strong {
  color: var(--bets-green);
  font-size: 15px;
  font-weight: 800;
}

.bets-main {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 42px) clamp(12px, 3vw, 26px) 32px;
}

.bets-title-block {
  margin-bottom: 21px;
}

.bets-eyebrow {
  margin: 0 0 5px;
  color: var(--bets-green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bets-title-block h1 {
  margin: 0;
  color: var(--bets-text);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 900;
  letter-spacing: -0.035em;
}

.bets-title-block > p:last-child {
  margin: 7px 0 0;
  color: var(--bets-muted);
  font-size: 15px;
}

.bets-panel {
  overflow: hidden;
  border: 1px solid var(--bets-border);
  border-radius: 22px;
  background: rgba(12, 39, 50, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.bets-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--bets-border);
  background: rgba(3, 15, 21, 0.32);
}

.bets-tab {
  min-width: 0;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--bets-muted);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}

.bets-tab strong {
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 12px;
}

.bets-tab.is-active {
  border-color: var(--bets-green);
  color: var(--bets-text);
}

.bets-tab.is-active strong {
  background: var(--bets-green);
  color: #041d0d;
}

.bets-toolbar {
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--bets-border);
}

.bets-filters {
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.bets-filters[hidden] {
  display: none;
}

.bets-filters::-webkit-scrollbar {
  display: none;
}

.bets-filters button {
  min-height: 44px;
  padding: 0 14px;
  flex: 0 0 auto;
  border: 1px solid var(--bets-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--bets-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.bets-filters button.is-active {
  border-color: rgba(18, 223, 78, 0.55);
  background: rgba(18, 223, 78, 0.12);
  color: #9ff1b7;
}

.bets-refreshed {
  flex: 0 0 auto;
  color: #78939f;
  font-size: 11px;
  font-weight: 600;
}

.bets-status {
  padding: 22px;
  color: var(--bets-muted);
  text-align: center;
}

.bets-status:empty,
.bets-status[hidden] {
  display: none;
}

.bets-ticket-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.ticket-card {
  overflow: hidden;
  border: 1px solid var(--bets-border);
  border-radius: 17px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 58%),
    #0b2430;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.ticket-card.is-expanded {
  border-color: rgba(18, 223, 78, 0.3);
}

.ticket-summary {
  width: 100%;
  padding: 16px;
  display: block;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.ticket-summary__top,
.ticket-summary__meta,
.ticket-financials,
.ticket-actions,
.selection-top,
.selection-meta,
.ticket-expanded__totals,
.detail-summary-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-summary__top {
  margin-bottom: 8px;
}

.ticket-date {
  color: var(--bets-muted);
  font-size: 12px;
  font-weight: 650;
}

.ticket-status {
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: rgba(79, 179, 255, 0.12);
  color: #8cc9fa;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ticket-status[data-status="live"] {
  background: rgba(255, 71, 81, 0.13);
  color: #ff8c92;
}

.ticket-status[data-status="won"] {
  background: rgba(18, 223, 78, 0.13);
  color: #75ec96;
}

.ticket-status[data-status="lost"] {
  background: rgba(255, 107, 114, 0.12);
  color: #ff959a;
}

.ticket-status[data-status="void"],
.ticket-status[data-status="refunded"],
.ticket-status[data-status="cashed_out"] {
  background: rgba(255, 189, 74, 0.12);
  color: #ffd27d;
}

.ticket-summary__meta {
  justify-content: flex-start;
  margin-bottom: 13px;
  color: var(--bets-text);
  font-size: 13px;
}

.ticket-type {
  font-weight: 800;
}

.ticket-id {
  overflow-wrap: anywhere;
  color: #78939f;
  font-size: 11px;
  font-weight: 700;
}

.ticket-financials {
  align-items: stretch;
  margin: 0 -6px 14px;
}

.ticket-financials > span {
  min-width: 0;
  padding: 0 6px;
  display: grid;
  gap: 3px;
}

.ticket-financials small,
.ticket-expanded__totals small,
.detail-summary-grid small {
  color: var(--bets-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ticket-financials strong,
.ticket-expanded__totals strong,
.detail-summary-grid strong {
  color: var(--bets-text);
  font-size: 15px;
  font-weight: 850;
}

.ticket-match-list {
  display: grid;
  gap: 7px;
}

.ticket-match-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dbe9ee;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ticket-match-line::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #5f8494;
  content: "";
}

.ticket-more {
  margin-top: 1px;
  color: var(--bets-muted);
  font-size: 12px;
  font-weight: 700;
}

.ticket-expand-hint {
  margin-top: 13px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #7f9ba7;
  font-size: 11px;
  font-weight: 750;
}

.ticket-card.is-expanded .ticket-expand-hint i {
  transform: rotate(180deg);
}

.ticket-expanded {
  padding: 0 16px 16px;
  border-top: 1px solid var(--bets-border);
}

.ticket-expanded[hidden] {
  display: none;
}

.ticket-expanded__head {
  padding: 14px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-expanded__head strong {
  font-size: 14px;
}

.ticket-details-link {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: #bcd0d8;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.ticket-selection-list {
  display: grid;
  gap: 9px;
}

.ticket-selection {
  padding: 12px;
  border: 1px solid rgba(176, 210, 225, 0.12);
  border-radius: 13px;
  background: rgba(1, 12, 17, 0.28);
}

.selection-top {
  align-items: flex-start;
}

.selection-match {
  min-width: 0;
  color: var(--bets-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selection-status {
  flex: 0 0 auto;
  color: var(--bets-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.selection-status[data-status="playing"],
.selection-status[data-status="won"] {
  color: #75ec96;
}

.selection-status[data-status="lost"] {
  color: #ff959a;
}

.selection-meta {
  align-items: flex-end;
  margin-top: 8px;
}

.selection-meta > span:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
  color: var(--bets-muted);
  font-size: 11px;
}

.selection-meta strong {
  color: #dcecf1;
  font-size: 12px;
}

.selection-live {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: #ff959a;
  font-size: 11px;
  font-weight: 800;
}

.selection-odds {
  min-width: 52px;
  text-align: right;
  color: var(--bets-green);
  font-size: 15px;
  font-weight: 850;
}

.ticket-expanded__totals {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bets-border);
}

.ticket-expanded__totals > span {
  display: grid;
  gap: 3px;
}

.ticket-expanded__totals > span:last-child {
  text-align: right;
}

.ticket-actions {
  padding: 0 16px 16px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ticket-actions button,
.ticket-actions a {
  min-height: 44px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(18, 223, 78, 0.4);
  border-radius: 11px;
  background: rgba(18, 223, 78, 0.08);
  color: #96efae;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.ticket-actions .ticket-cashout {
  border-color: var(--bets-green);
  background: var(--bets-green);
  color: #04200d;
}

.ticket-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.bets-empty {
  min-height: 330px;
  padding: 52px 22px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.bets-empty[hidden] {
  display: none;
}

.bets-empty__icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(18, 223, 78, 0.3);
  border-radius: 22px;
  background: rgba(18, 223, 78, 0.09);
  color: var(--bets-green);
  font-size: 31px;
}

.bets-empty h2 {
  margin: 18px 0 5px;
  font-size: 21px;
}

.bets-empty p {
  margin: 0;
  color: var(--bets-muted);
  font-size: 14px;
}

.bets-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  min-height: calc(72px + env(safe-area-inset-bottom));
  padding: 7px max(12px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(12px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  border-top: 1px solid var(--bets-border);
  background: rgba(7, 24, 32, 0.97);
  box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(15px);
}

.bets-bottom-nav a {
  min-width: 0;
  min-height: 58px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border-radius: 13px;
  color: #89a3ae;
  text-decoration: none;
}

.bets-bottom-nav i {
  font-size: 19px;
}

.bets-bottom-nav span {
  font-size: 10px;
  font-weight: 800;
}

.bets-bottom-nav a.is-active {
  background: rgba(18, 223, 78, 0.1);
  color: var(--bets-green);
}

.bets-toast {
  position: fixed;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: min(380px, calc(100% - 32px));
  padding: 13px 16px;
  border: 1px solid rgba(18, 223, 78, 0.35);
  border-radius: 13px;
  background: #10323e;
  color: var(--bets-text);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  font-size: 13px;
  font-weight: 750;
}

.bets-toast[data-type="error"] {
  border-color: rgba(255, 107, 114, 0.5);
}

.cashout-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 16px;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(0, 7, 11, 0.82);
  backdrop-filter: blur(8px);
}

.cashout-dialog[hidden] {
  display: none;
}

.cashout-dialog > section {
  position: relative;
  width: min(390px, 100%);
  padding: 30px 22px 22px;
  border: 1px solid var(--bets-border);
  border-radius: 21px;
  background: #0d2935;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.cashout-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--bets-text);
  cursor: pointer;
}

.cashout-dialog__icon {
  width: 65px;
  height: 65px;
  margin: 0 auto 15px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(18, 223, 78, 0.11);
  color: var(--bets-green);
  font-size: 26px;
}

.cashout-dialog h2 {
  margin: 0;
  font-size: 24px;
}

.cashout-dialog p {
  margin: 8px auto 14px;
  color: var(--bets-muted);
  font-size: 14px;
  line-height: 1.45;
}

.cashout-dialog > section > strong {
  color: var(--bets-green);
  font-size: 30px;
  font-weight: 900;
}

.cashout-dialog__actions {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cashout-dialog__actions button {
  min-height: 50px;
  border: 1px solid var(--bets-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--bets-text);
  cursor: pointer;
  font-weight: 850;
}

.cashout-dialog__actions .is-primary {
  border-color: var(--bets-green);
  background: var(--bets-green);
  color: #04200d;
}

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

.ticket-details-main {
  max-width: 780px;
}

.ticket-details-card {
  overflow: hidden;
  border: 1px solid var(--bets-border);
  border-radius: 20px;
  background: #0c2834;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
}

.ticket-details-card__header {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--bets-border);
}

.ticket-details-card__header h2 {
  margin: 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.ticket-details-card__header p {
  margin: 5px 0 0;
  color: var(--bets-muted);
  font-size: 13px;
}

.detail-summary-grid {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  border-bottom: 1px solid var(--bets-border);
}

.detail-summary-grid > span {
  display: grid;
  gap: 4px;
}

.detail-summary-grid > span:nth-child(2) {
  text-align: center;
}

.detail-summary-grid > span:nth-child(3) {
  text-align: right;
}

.ticket-details-selections {
  padding: 18px 20px;
}

.ticket-details-selections > h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.ticket-details-total {
  padding: 18px 20px;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--bets-border);
  background: rgba(1, 12, 17, 0.25);
}

.ticket-details-total > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--bets-muted);
  font-size: 13px;
}

.ticket-details-total strong {
  color: var(--bets-text);
  font-size: 15px;
}

.ticket-verification {
  color: var(--bets-green) !important;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .bets-topbar__inner {
    min-height: 62px;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    padding: 8px 10px;
  }

  .bets-brand {
    font-size: 16px;
  }

  .bets-brand__mark {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .bets-wallet strong {
    font-size: 13px;
  }

  .bets-main {
    padding: 20px 9px 26px;
  }

  .bets-title-block {
    padding: 0 5px;
  }

  .bets-title-block > p:last-child {
    font-size: 13px;
  }

  .bets-panel {
    border-radius: 17px;
  }

  .bets-tab {
    min-height: 58px;
    gap: 7px;
    font-size: 14px;
  }

  .bets-toolbar {
    align-items: flex-start;
    padding: 12px 10px 10px;
    flex-direction: column;
  }

  .bets-filters {
    width: 100%;
  }

  .bets-refreshed {
    padding-left: 4px;
  }

  .bets-ticket-list {
    gap: 10px;
    padding: 9px;
  }

  .ticket-summary {
    padding: 14px 13px;
  }

  .ticket-expanded {
    padding: 0 13px 13px;
  }

  .ticket-actions {
    padding: 0 13px 13px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket-actions button,
  .ticket-actions a {
    width: 100%;
    padding: 0 10px;
  }

  .ticket-actions .ticket-cashout:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .ticket-expanded__head {
    align-items: flex-start;
  }

  .ticket-details-link {
    flex: 0 0 auto;
  }

  .selection-meta {
    align-items: flex-start;
  }

  .detail-summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px 10px;
  }

  .detail-summary-grid > span,
  .detail-summary-grid > span:nth-child(2),
  .detail-summary-grid > span:nth-child(3) {
    text-align: left;
  }
}

@media (max-width: 375px) {
  .bets-brand > span:last-child {
    display: none;
  }

  .bets-topbar__inner {
    grid-template-columns: 44px 34px minmax(0, 1fr);
  }

  .bets-wallet {
    min-width: 0;
  }

  .bets-tab {
    font-size: 13px;
  }

  .bets-tab strong {
    min-width: 23px;
    height: 23px;
  }

  .ticket-financials strong {
    font-size: 14px;
  }

  .ticket-actions {
    grid-template-columns: 1fr;
  }

  .ticket-actions .ticket-cashout:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .cashout-dialog {
    padding: 10px;
  }
}

@media (min-width: 768px) {
  .bets-body {
    padding-bottom: 38px;
  }

  .bets-bottom-nav {
    right: 22px;
    bottom: 20px;
    left: auto;
    width: auto;
    min-height: 66px;
    padding: 6px;
    display: flex;
    grid-template-columns: none;
    justify-content: center;
    gap: 6px;
    gap: 4px;
    border: 1px solid var(--bets-border);
    border-radius: 18px;
  }

  .bets-bottom-nav a {
    min-width: 76px;
    min-height: 52px;
  }

  .bets-toast {
    bottom: 22px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .ticket-card,
  .ticket-summary,
  .ticket-actions button,
  .bets-tab,
  .bets-filters button {
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
  }

  .ticket-actions button:hover,
  .bets-filters button:hover {
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
