:root {
  --graphit-10: #eeeff3;
  --graphit-100: #d9dde5;
  --graphit-200: #c1c7d4;
  --graphit-400: #929bae;
  --graphit-700: #555f71;
  --graphit-800: #434c5b;
  --graphit-850: #333945;
  --graphit-900: #24282f;
  --green-0: #27db55;
  --green-400: #00b43f;
  --green-600: #008900;
  --white: #fff;
  --bg: var(--graphit-100);
  --card: var(--white);
  --text: var(--graphit-900);
  --text-low: var(--graphit-700);
  --odd-bg: var(--graphit-100);
  --radius-2: 8px;
  --radius-3: 12px;
  --header-h: 64px;
  --bottom-h: 80px;
  --app-max: 430px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: #c5cad3;
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

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

img {
  display: block;
  max-width: 100%;
}

.app {
  width: 100%;
  max-width: var(--app-max);
  min-height: 100%;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--bottom-h) + 56px);
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  padding: 8px 8px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--graphit-100) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-2);
  background: var(--graphit-10);
  display: grid;
  place-items: center;
  color: var(--text);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.balance {
  height: 48px;
  border-radius: var(--radius-2);
  background: var(--graphit-10);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
}

.balance .rub {
  font-weight: 400;
  font-size: 14px;
}

.balance .plus {
  color: var(--green-600);
  display: grid;
  place-items: center;
}

.chips {
  display: flex;
  gap: 8px;
  padding: 4px 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.chip {
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-3);
  background: #1a3d24 center / cover no-repeat;
  position: relative;
  overflow: hidden;
  color: var(--graphit-10);
  text-align: left;
  padding: 8px;
  display: flex;
  align-items: flex-end;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.chip span {
  font-size: 12px;
  line-height: 14px;
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 1;
}

.chip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.35) 100%);
}

.chip.is-active {
  outline: 2px solid var(--green-0);
  outline-offset: 0;
}

.events {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 8px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-3);
  padding: 8px 0 12px;
  overflow: hidden;
}

.card-head {
  padding: 0 12px;
  margin-bottom: 8px;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.league {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.star {
  width: 16px;
  height: 16px;
  color: var(--text);
  flex-shrink: 0;
}

.star.is-on {
  color: #f5b400;
}

.star.is-on svg path {
  fill: currentColor;
}

.time {
  margin-top: 2px;
  font-size: 14px;
  line-height: 20px;
}

.teams {
  display: flex;
  gap: 8px;
  padding: 0 12px;
  margin-bottom: 10px;
  min-width: 0;
}

.logos {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--graphit-10);
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo .ini {
  font-size: 11px;
  font-weight: 700;
  color: var(--graphit-800);
}

.names {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.names div {
  height: 40px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
}

.markets {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 12px;
  scrollbar-width: none;
}

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

.market {
  flex: 1 0 234px;
  min-width: 234px;
}

.market-title {
  font-size: 12px;
  color: var(--text-low);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.odds {
  display: flex;
  gap: 8px;
}

.odd,
.line {
  height: 40px;
  border-radius: var(--radius-2);
  min-width: 69px;
  display: flex;
  align-items: center;
}

.odd {
  flex: 1 0 auto;
  background: var(--odd-bg);
  padding: 0 12px;
  justify-content: space-between;
  gap: 4px;
}

.odd .lbl {
  color: var(--text-low);
  font-size: 16px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.odd .val {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.odd.is-on {
  background: color-mix(in srgb, var(--green-0) 28%, var(--odd-bg));
  box-shadow: inset 0 0 0 1.5px var(--green-600);
}

.line {
  width: 60px;
  min-width: 60px;
  flex: 0 0 60px;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--graphit-200);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-low);
  cursor: default;
}

.switcher {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  width: calc(100% - 16px);
  max-width: calc(var(--app-max) - 16px);
  z-index: 25;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  pointer-events: none;
}

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

.switcher > * {
  pointer-events: auto;
}

.sw {
  height: 48px;
  border-radius: 12px;
  padding: 0 12px;
  background: #24282fe6;
  color: var(--graphit-10);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  backdrop-filter: blur(6px);
}

.sw svg {
  width: 16px;
  height: 16px;
}

.sw.is-on {
  background: #27db55e6;
  color: var(--graphit-900);
  font-weight: 500;
}

.bottom {
  position: fixed;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: calc(100% - 16px);
  max-width: calc(var(--app-max) - 16px);
  height: 56px;
  border-radius: var(--radius-3);
  background: #24282fe6;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  z-index: 30;
}

.nav-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--graphit-10);
  position: relative;
}

.nav-btn svg {
  width: 24px;
  height: 24px;
}

.nav-btn.is-on {
  color: var(--green-0);
}

.slip {
  position: fixed;
  left: 50%;
  bottom: 140px;
  transform: translateX(-50%);
  width: calc(100% - 16px);
  max-width: calc(var(--app-max) - 16px);
  background: var(--graphit-900);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  display: none;
  z-index: 28;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.slip.is-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slip b {
  font-size: 16px;
}

.slip small {
  color: var(--graphit-200);
}

.slip .go {
  background: var(--green-0);
  color: var(--graphit-900);
  font-weight: 700;
  border-radius: 8px;
  height: 40px;
  padding: 0 16px;
}

.search-panel {
  display: none;
  position: sticky;
  top: var(--header-h);
  z-index: 18;
  padding: 0 8px 8px;
  background: var(--bg);
}

.search-panel.is-open {
  display: block;
}

.search-panel input {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--white);
  padding: 0 12px;
  font-size: 16px;
  outline: none;
}

.empty {
  text-align: center;
  color: var(--text-low);
  padding: 40px 16px;
  font-size: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 76px;
  transform: translateX(-50%);
  background: var(--graphit-900);
  color: #fff;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 40;
  display: none;
}

.toast.is-on {
  display: block;
}

body.importing {
  overflow: hidden;
}

.import-progress {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(36, 40, 47, 0.45);
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.import-progress.is-open {
  display: flex;
}

.import-progress-card {
  width: min(100%, 280px);
  background: var(--white);
  border-radius: 16px;
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 12px 32px rgba(36, 40, 47, 0.22);
}

.import-progress-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--graphit-100);
  border-top-color: var(--green-400);
  animation: import-spin 0.75s linear infinite;
}

.import-progress-text {
  margin: 0;
  min-height: 2.6em;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--graphit-800);
  transition: opacity 0.22s ease;
}

.import-progress-text.is-out {
  opacity: 0;
}

@keyframes import-spin {
  to {
    transform: rotate(360deg);
  }
}

.age {
  text-align: center;
  font-size: 12px;
  color: var(--text-low);
  padding: 16px 8px 8px;
}

.settings {
  display: none;
  padding: 8px 8px 24px;
}

.settings h2 {
  font-size: 22px;
  font-weight: 700;
  padding: 8px 8px 16px;
}

.settings-card {
  background: var(--card);
  border-radius: var(--radius-3);
  padding: 16px 14px 14px;
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 700;
}

.settings-card > p {
  margin: 6px 0 14px;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-low);
}

.settings-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 10px;
  background: var(--graphit-10);
  box-shadow: inset 0 0 0 1.5px transparent;
}

.settings-option-kicker {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
}

.settings-option-title {
  font-size: 15px;
  font-weight: 700;
}

.settings-option-desc {
  font-size: 13px;
  line-height: 18px;
  color: var(--text-low);
}

.settings-option.is-on {
  background: color-mix(in srgb, var(--green-0) 22%, var(--graphit-10));
  box-shadow: inset 0 0 0 1.5px var(--green-600);
}

body.settings-open .chips,
body.settings-open .events,
body.settings-open .switcher,
body.settings-open .age,
body.settings-open .search-panel {
  display: none;
}

body.settings-open .settings {
  display: block;
}

body.coupon-open {
  overflow: hidden;
}

body.coupon-open .switcher,
body.coupon-open .bottom,
body.coupon-open .slip {
  display: none !important;
}

.coupon {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(36, 40, 47, 0.4);
  justify-content: center;
}

.coupon.is-open {
  display: flex;
}

.coupon-sheet {
  width: 100%;
  max-width: var(--app-max);
  margin: 0 auto;
  background: var(--white);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: auto;
}

.coupon-error {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #ff8a00;
  color: #fff;
  padding: 12px 14px;
}

.coupon-error-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.coupon-error-icon svg {
  width: 22px;
  height: 22px;
}

.coupon-error b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 20px;
}

.coupon-error p {
  margin-top: 2px;
  font-size: 13px;
  line-height: 18px;
  opacity: 0.95;
}

.coupon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 8px 16px;
}

.coupon-head h2 {
  font-size: 20px;
  font-weight: 700;
}

.coupon-head-actions {
  display: flex;
  gap: 2px;
}

.coupon-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--graphit-800);
}

.coupon-icon.is-ok {
  color: var(--green-600);
}

.coupon-icon svg {
  width: 22px;
  height: 22px;
}

.coupon-list {
  list-style: none;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coupon-item {
  position: relative;
  border: 1.5px solid var(--graphit-200);
  border-radius: 10px;
  padding: 10px 44px 10px 12px;
  background: #fff;
}

.coupon-item.is-conflict {
  border-color: #e24b4a;
}

.coupon-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-low);
  font-size: 12px;
  margin-bottom: 6px;
}

.coupon-ball {
  width: 16px;
  height: 16px;
  color: var(--graphit-700);
  flex-shrink: 0;
}

.coupon-ball svg {
  width: 16px;
  height: 16px;
}

.coupon-match {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coupon-item-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.coupon-outcome {
  font-size: 16px;
  font-weight: 700;
}

.coupon-odd {
  font-size: 18px;
  font-weight: 700;
}

.coupon-item-ctrl {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.coupon-tick {
  color: var(--green-400);
  width: 18px;
  height: 18px;
}

.coupon-tick svg,
.coupon-remove svg {
  width: 18px;
  height: 18px;
}

.coupon-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e24b4a;
  color: #fff;
  display: grid;
  place-items: center;
}

.coupon-types {
  display: flex;
  gap: 8px;
  padding: 4px 12px 12px;
}

.coupon-type {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  background: var(--graphit-10);
  color: var(--text-low);
  font-size: 14px;
  font-weight: 500;
}

.coupon-type.is-on {
  background: var(--green-0);
  color: var(--graphit-900);
  font-weight: 700;
}

.coupon-pay {
  margin-top: auto;
  background: var(--graphit-900);
  color: #fff;
  padding: 12px 12px 16px;
}

.coupon-stake {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.coupon-sum {
  height: 48px;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 4px;
  font-weight: 700;
  font-size: 18px;
}

.coupon-sum input {
  width: 100%;
  border: 0;
  outline: none;
  font: inherit;
  background: transparent;
}

.coupon-bal {
  height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  background: #333945;
  color: #fff;
  font-weight: 700;
}

.coupon-fill {
  height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--green-0);
  color: var(--graphit-900);
  font-weight: 700;
}

.coupon-totals {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 10px;
}

.coupon-totals div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coupon-totals span {
  font-size: 12px;
  color: var(--graphit-200);
}

.coupon-totals b {
  font-size: 20px;
}

.coupon-signal {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 4px 2px 0;
}

.coupon-signal input {
  width: 18px;
  height: 18px;
  accent-color: var(--green-0);
}

@media (min-width: 768px) {
  body {
    padding: 16px 0;
  }

  .app {
    min-height: calc(100vh - 32px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(36, 40, 47, 0.22);
  }

  .coupon-sheet {
    margin: 16px auto;
    max-height: calc(100% - 32px);
    border-radius: 24px;
    overflow: auto;
  }
}
