:root {
  --bg: #111;
  --header: #050505;
  --text: #01043a;
  --muted: #424b6b;
  --accent: #e3262f;
  --accent-2: #ff5b5b;
  --board: #8d1020;
  --board-2: #b8162a;
  --win: #00c166;
  --danger: #ea442e;
  --cyan: #29f2ba;
  --gold: #f6c343;
}
body.theme-ita { --accent: #13a24a; --accent-2: #4fd07f; --board: #0b6b33; --board-2: #12894a; }
body.theme-esp { --accent: #c8102e; --accent-2: #f6c343; --board: #6e0b22; --board-2: #8f1330; }
body.theme-euro { --accent: #1f5fd1; --accent-2: #f6c343; --board: #0c2f6e; --board-2: #164a9c; }

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

html, body {
  height: 100%;
  width: 100%;
  background: #1b1b1b;
  font-family: "Roboto", "Segoe UI", sans-serif;
  color: #fff;
  overflow: hidden;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

/* ---------- top bar ---------- */
.topbar {
  height: 60px;
  background: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .league-icon { height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text .title { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.brand-text .sub { font-size: 10px; font-weight: 700; color: #bbb; }

.top-right { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.clock { font-size: 12px; opacity: .9; }
.balance { font-size: 14px; }
.exit-btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 2px;
  cursor: pointer;
}
.lang-btn {
  border: 0;
  background: #222;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.help-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.help-btn img { width: 24px; height: 24px; filter: brightness(0) invert(1); opacity: .85; }

/* ---------- layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 10px;
  min-height: 0;
  padding: 10px 12px;
}
.main-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  border-radius: 4px;
}

.day-bar {
  height: 40px;
  background: linear-gradient(90deg, var(--board), var(--board-2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .4px;
  flex-shrink: 0;
  border-radius: 4px 4px 0 0;
}
.day-bar .phase-hint { font-size: 11px; font-weight: 700; opacity: .9; text-transform: uppercase; }
.day-bar .closes { font-size: 12px; font-weight: 700; }
.day-bar .closes b {
  font-family: "Roboto Condensed", monospace;
  color: #ffe600;
  font-size: 16px;
  margin-left: 4px;
}
.day-bar .closes.urgent b { color: #fff; animation: flicker 1s steps(1) infinite; }
@keyframes flicker { 50% { color: #ff3b3b; } }

/* ---------- stage ---------- */
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 58vh;
  width: 100%;
  background: #05080c url("/casino/football-eng/modules/FFSP/bin_prod/data/images/preload/backgrounds/desktop-bg.png") center/cover;
  overflow: hidden;
  flex-shrink: 0;
}
.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: none;
  z-index: 1;
}
.stage.live video { display: block; }

.stage-loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
}
.stage-loader.show { display: flex; }
.stage-loader span {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: var(--accent-2);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* board (pre-match fixtures / single intro / results) */
.board {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3% 4%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.15), rgba(0,0,0,.6));
}
.stage.live .board { display: none; }
.board-card {
  width: 100%;
  max-width: 760px;
  background: rgba(0,0,0,.25);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.board-head {
  background: linear-gradient(100deg, #fff 0 18%, var(--board-2) 18% 100%);
  color: #fff;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 6px 10px;
  position: relative;
}
.board-head .tag {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--board);
  font-size: 13px;
  font-weight: 900;
}
.fixtures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: rgba(0,0,0,.25);
}
.fixture {
  display: grid;
  grid-template-columns: 28px 34px 1fr 34px;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, var(--board), var(--board-2));
  padding: 6px 8px;
  cursor: pointer;
  transition: filter .15s;
}
.fixture:hover { filter: brightness(1.15); }
.fixture.has-bet { box-shadow: inset 4px 0 0 var(--gold); }
.fixture .no { font-size: 18px; font-weight: 900; text-align: center; }
.fixture img { width: 30px; height: 30px; object-fit: contain; }
.fixture .mid { text-align: center; line-height: 1.1; }
.fixture .teams { font-family: "Roboto Condensed", sans-serif; font-size: 17px; font-weight: 700; }
.fixture .teams .vs { font-size: 11px; opacity: .7; margin: 0 6px; }
.fixture .form { font-size: 10px; opacity: .8; letter-spacing: .5px; }
.fixture .score { font-size: 20px; font-weight: 900; color: #ffe600; }

.single-intro {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 26px 20px 18px;
  background: linear-gradient(90deg, transparent, var(--board-2) 20% 80%, transparent);
}
.single-intro .team { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.single-intro .team img { width: 110px; height: 110px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0,0,0,.5)); }
.single-intro .team .code { font-size: 34px; font-weight: 900; letter-spacing: 1px; }
.single-intro .team .name { font-size: 12px; opacity: .85; text-transform: uppercase; }
.single-intro .team .pos { font-size: 11px; color: var(--gold); font-weight: 700; }
.single-intro .vs { font-size: 26px; font-weight: 900; color: var(--gold); }
.single-odds {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px 14px;
  background: rgba(0,0,0,.35);
}
.single-odds div { background: rgba(255,255,255,.1); padding: 6px 14px; border-radius: 3px; font-weight: 700; font-size: 13px; }
.single-odds b { color: var(--gold); margin-left: 6px; }

.results-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.results-table td { padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.results-table tr:nth-child(odd) td { background: rgba(255,255,255,.04); }
.results-table td:last-child { text-align: right; font-weight: 800; color: var(--gold); }
.results-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px;
  background: linear-gradient(90deg, transparent, var(--board-2) 20% 80%, transparent);
  font-size: 34px;
  font-weight: 900;
}
.results-banner img { width: 56px; height: 56px; object-fit: contain; }
.results-banner .sc { background: var(--board); padding: 2px 16px; border-radius: 4px; color: #fff; }

/* live overlays (cover Kiron's own burned-in score graphics) */
.live-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  height: 17%;
  min-height: 44px;
  display: none;
  align-items: flex-start;
  gap: 14px;
  padding: 1.2% 14px 0;
  background: linear-gradient(180deg, #000 0 72%, rgba(0,0,0,0) 100%);
  font-family: "Roboto Condensed", sans-serif;
  font-weight: 700;
  pointer-events: none;
}
.stage.live .live-top { display: flex; }
.lt-team { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.lt-team img { width: 28px; height: 28px; object-fit: contain; }
.lt-score {
  background: var(--accent);
  padding: 2px 12px;
  border-radius: 2px;
  font-size: 22px;
  letter-spacing: 2px;
}
.lt-meta { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; line-height: 1.1; }
.lt-meta b { color: #ffe600; font-size: 22px; }

.live-list {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 5;
  width: 33%;
  height: 50%;
  min-width: 200px;
  display: none;
  flex-direction: column;
  justify-content: space-evenly;
  background: rgba(0,0,0,.94);
  font-family: "Roboto Condensed", sans-serif;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
.stage.live.mode-league .live-list { display: flex; }
.stage.live.mask-bottom::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  z-index: 4;
  background: linear-gradient(0deg, #000 0 75%, rgba(0,0,0,0));
}
.live-row {
  display: grid;
  grid-template-columns: 18px 18px 1fr auto 1fr 18px;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.live-row img { width: 16px; height: 16px; object-fit: contain; }
.live-row .h { text-align: right; }
.live-row .s { color: #ffe600; min-width: 34px; text-align: center; }
.live-row.flash { animation: rowflash 1.2s ease 2; }
@keyframes rowflash { 50% { background: var(--accent); } }
.live-row.mine .no { color: var(--gold); }

.goal-flash {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(.6);
  z-index: 6;
  font-size: 64px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 var(--accent), 0 10px 26px rgba(0,0,0,.6);
  opacity: 0;
  pointer-events: none;
}
.goal-flash.show { animation: goal 1.6s ease; }
@keyframes goal {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- league bar (flags) ---------- */
.league-bar {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #0d0d0d;
  overflow-x: auto;
  flex-shrink: 0;
}
.league-btn {
  flex: 0 0 auto;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 2px;
  cursor: pointer;
  position: relative;
  transition: transform .15s;
}
.league-btn img { height: 30px; display: block; }
.league-btn:hover { transform: translateY(-2px); }
.league-btn.active { border-color: var(--accent); transform: scale(1.12); }
.league-btn:disabled { opacity: .45; cursor: default; transform: none; }
.league-btn .tip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
  white-space: nowrap;
  display: none;
}
.league-btn:hover .tip { display: block; }

/* ---------- markets ---------- */
.markets { background: #cbd5e6; padding: 6px 8px 10px; }
.markets-head {
  display: grid;
  gap: 6px;
  color: #fff;
  background: #1a2430;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  text-align: center;
}
.market-row {
  display: grid;
  gap: 6px;
  align-items: center;
  background: #fff;
  margin-top: 4px;
  padding: 5px 6px;
  border-radius: 2px;
}
.markets.mode-league .markets-head,
.markets.mode-league .market-row { grid-template-columns: minmax(130px, 170px) 1.4fr 1fr 1fr; }
.market-row .pair {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-weight: 800;
  font-size: 12px;
}
.market-row .pair .no { color: #888; width: 16px; }
.market-row .pair img { width: 20px; height: 20px; object-fit: contain; }
.market-row .pair .res { margin-left: auto; color: var(--accent); }
.odds { display: flex; gap: 4px; min-width: 0; }
.odd-btn {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid #d4d8df;
  background: #f8faff;
  height: 40px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  padding: 2px;
  white-space: nowrap;
}
.odd-btn b { color: var(--text); font-size: 14px; }
.odd-btn.selected { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.odd-btn.selected b { color: #fff; }
.odd-btn.won { outline: 2px solid var(--win); }
.odd-btn:disabled { opacity: .5; cursor: default; }

.single-markets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin-top: 4px; }
.single-group { background: #fff; border-radius: 2px; padding: 6px; color: var(--text); }
.single-group h4 { font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; }

/* ---------- matchday bets ---------- */
.panel-head {
  min-height: 40px;
  background: #121212;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
}
.panel-head .count {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.matchday-bets { background: #fff; flex-shrink: 0; }
.md-list { max-height: 150px; overflow: auto; color: var(--text); }
.md-item {
  padding: 8px 12px;
  border-top: 1px solid #dfe0e1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.md-item .right { text-align: right; color: var(--muted); font-weight: 700; }
.md-item.won .right { color: var(--win); }
.md-item.lost .right { color: var(--danger); }

/* ---------- ticket ---------- */
.ticket {
  background: #121212;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  align-self: stretch;
}
.ticket.has-bets { border-color: var(--accent); }
.ticket-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
}
.ticket-toggle h2 { font-size: 14px; flex: 1; text-align: left; letter-spacing: .04em; }
.ticket-count {
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.ticket-count.hide { display: none; }
.ticket-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid #9aa;
  border-bottom: 2px solid #9aa;
  transform: rotate(225deg);
  margin-top: 4px;
}
.ticket.is-collapsed .ticket-chevron { transform: rotate(45deg); margin-top: -4px; }
.ticket.is-collapsed .ticket-panel { display: none; }
.ticket-panel-inner { padding: 0 10px 10px; }
.ticket-tools { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.linkish { background: none; border: 0; color: var(--cyan); font-size: 12px; cursor: pointer; }
.stake-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; font-weight: 700; color: #9aa3b5; }
.stake-row input {
  width: 72px;
  text-align: center;
  background: #0a1018;
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  border-radius: 4px;
  padding: 6px;
}
.stake-row button { width: 28px; height: 28px; background: #243545; border: 0; border-radius: 4px; color: #fff; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips button {
  min-width: 44px;
  height: 30px;
  padding: 0 8px;
  background: #1a2836;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.chips button.active { border-color: var(--accent-2); background: #2a1a1a; }
.slip-body { max-height: 240px; overflow: auto; min-height: 44px; }
.slip-empty { color: var(--cyan); font-size: 13px; padding: 10px 4px; }
.slip-item {
  background: #1a222c;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  animation: slipIn .25s ease;
}
@keyframes slipIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.slip-item .meta { font-size: 11px; color: #9aa3b5; margin-bottom: 4px; }
.slip-item .sel { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.slip-item .row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.slip-item input {
  width: 74px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 2px;
  text-align: right;
  padding: 0 6px;
  font-weight: 700;
  background: #0a1018;
  color: #fff;
}
.slip-item .est { color: var(--accent-2); font-size: 11px; }
.slip-item .remove { float: right; border: 0; background: transparent; color: #9aa3b5; cursor: pointer; font-size: 15px; }
.ticket-totals {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 8px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.ticket-totals strong { float: right; color: var(--accent-2); font-size: 15px; font-weight: 800; }
.submit-btn {
  width: 100%;
  margin-top: 10px;
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #ff5b14, #ff8139);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}
.submit-btn:disabled { opacity: .5; cursor: default; }

/* ---------- standings ---------- */
.standings { border-top: 1px solid rgba(255,255,255,.1); padding: 8px 10px 12px; }
.standings h3 { font-size: 12px; letter-spacing: .5px; margin-bottom: 6px; color: #bbb; }
.standings table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: "Roboto Condensed", sans-serif; }
.standings th { color: #888; font-weight: 700; text-align: right; padding: 2px 3px; }
.standings th:nth-child(2) { text-align: left; }
.standings td { padding: 2px 3px; text-align: right; border-bottom: 1px solid rgba(255,255,255,.05); }
.standings td:nth-child(1) { color: #888; }
.standings td:nth-child(2) { text-align: left; display: flex; align-items: center; gap: 4px; font-weight: 700; }
.standings td:nth-child(2) img { width: 14px; height: 14px; object-fit: contain; }
.standings td:last-child { color: var(--gold); font-weight: 700; }

/* ---------- modals / toast ---------- */
.help-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.7);
  padding: 16px;
}
.help-modal.hide { display: none; }
.help-modal-card {
  width: min(720px, 100%);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  background: #2f343b;
  border-radius: 10px;
  overflow: hidden;
}
.help-modal-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 14px; border-bottom: 1px solid #444; }
.help-modal-head h2 { font-size: 16px; }
.help-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.help-modal-body { padding: 14px 16px; overflow: auto; flex: 1; font-size: 14px; line-height: 1.45; color: #e8eef5; }
.help-modal-body p { margin: 0 0 12px; }
.stats-footer { padding: 10px 16px; border-top: 1px solid #444; }
.stats-clear { background: #243545; border: 0; color: #fff; padding: 8px 12px; border-radius: 6px; font-weight: 700; cursor: pointer; }
.stats-row { padding: 8px 0; border-bottom: 1px solid #3a4048; font-size: 13px; }
.stats-row .sub { opacity: .75; font-size: 12px; margin-top: 2px; }

.toast {
  position: fixed;
  top: 76px;
  right: 20px;
  background: rgba(255,255,255,.96);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 70;
  display: none;
  font-weight: 600;
  max-width: 360px;
}
.toast.show { display: block; animation: slipIn .3s ease; }

@media (max-width: 980px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100%; }
  .layout { grid-template-columns: 1fr; }
  .main-col { overflow: visible; }
  .stage { max-height: none; }
  .fixtures { grid-template-columns: 1fr; }
  .fixture .teams { font-size: 14px; }
  .markets.mode-league .markets-head,
  .markets.mode-league .market-row { grid-template-columns: 1fr; }
  .single-intro .team img { width: 70px; height: 70px; }
  .single-intro .team .code { font-size: 22px; }
  .lt-team { font-size: 14px; }
}
