@font-face {
  font-family: "AntonLocal";
  src: url("/casino/virt-tarakan/media/Anton-Regular-LWLRL4VM.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #0b1020;
  --text: #071a33;
  --muted: #4a5878;
  --accent: #ff7a1a;
  --accent-2: #ffb15c;
  --red: #e3262f;
  --red-2: #ff5a3c;
  --win: #00c166;
  --danger: #ea442e;
  --header: #03070d;
  --cyan: #7fe3ff;
  --felt: #0d5a2f;
  --num-red: #c8102e;
  --num-black: #15171c;
  --num-green: #128a3e;
  --line: rgba(255,255,255,.55);
}

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

html, body {
  height: 100%;
  width: 100%;
  background: radial-gradient(ellipse at 50% 0%, #1d3a6e 0%, #101a36 45%, var(--bg) 100%) fixed;
  font-family: "Roboto", "Segoe UI", sans-serif;
  color: #fff;
  overflow: hidden;
  user-select: none;
}

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

/* ---------- top bar ---------- */

.topbar {
  height: 64px;
  background: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  border-bottom: 2px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo-img { height: 46px; width: auto; display: block; filter: drop-shadow(0 0 6px rgba(255,122,26,.35)); }
.top-right { display: flex; align-items: center; gap: 14px; font-weight: 700; position: relative; z-index: 110; }
.clock { font-size: 12px; opacity: .9; }
.balance { font-size: 14px; letter-spacing: .2px; color: var(--accent-2); }
.exit-btn {
  border: 0; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .4px;
  padding: 8px 14px; border-radius: 2px; cursor: pointer; text-transform: uppercase;
}
.exit-btn:hover { background: var(--red-2); }
.help-btn {
  width: 34px; height: 34px; padding: 0; border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
}
.help-btn img {
  width: 26px; height: 26px; display: block;
  filter: brightness(0) saturate(100%) invert(58%) sepia(86%) saturate(2200%) hue-rotate(347deg) brightness(102%) contrast(101%);
}
.help-btn:hover { opacity: .85; }

.lang-switch { position: relative; z-index: 120; }
.lang-btn {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; border: 0; border-radius: 6px;
  background: #102233; color: #fff; cursor: pointer;
}
.lang-btn img { width: 22px; height: 16px; object-fit: cover; border-radius: 2px; }
.lang-btn #lang-code { font-size: 12px; font-weight: 700; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); max-height: 280px; overflow: auto; min-width: 180px;
  background: #0f1d2b; border: 1px solid #23384d; border-radius: 8px; box-shadow: 0 12px 28px rgba(0,0,0,.45); z-index: 130;
}
.lang-menu.hide { display: none; }
.lang-item {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; text-align: left;
  border: 0; background: transparent; color: #fff; cursor: pointer; font-size: 12px;
}
.lang-item:hover, .lang-item.on { background: #1a3046; }
.lang-item img { width: 22px; height: 16px; object-fit: cover; }

/* ---------- modals ---------- */

.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: #14263a; border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.55); overflow: hidden; color: #fff;
}
.help-modal-head {
  display: flex; align-items: center; justify-content: center; position: relative; padding: 14px;
  border-bottom: 1px solid #2a4058;
}
.help-modal-head h2 { margin: 0; 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 #2a4058; }
.stats-clear { background: #1f3a55; border: 0; color: #fff; padding: 8px 12px; border-radius: 6px; font-weight: 700; cursor: pointer; }
.stats-row { padding: 8px 0; border-bottom: 1px solid #2a4058; font-size: 13px; }
.stats-row .sub { opacity: .75; font-size: 12px; margin-top: 2px; }

/* ---------- layout ---------- */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  grid-template-areas: "main slip";
  align-items: start;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  overflow: auto;
}
.main-col {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(0,0,0,.25);
  border-radius: 4px;
  overflow: hidden;
}

.day-bar {
  height: 50px; background: #eef3f8; color: var(--text); display: flex; align-items: center;
  justify-content: center; gap: 16px; font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.day-bar .phase-hint { font-size: 12px; font-weight: 700; color: #e0620a; text-transform: uppercase; letter-spacing: .3px; }

/* ---------- stage ---------- */

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 56vh;
  background: #000 url("/casino/virt-tarakan/assets/Images/VideoPlaceHolder.jpg") center / cover no-repeat;
  overflow: hidden;
}
.stage video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent;
}
#lobby-video { z-index: 1; }
#race-video { z-index: 2; display: none; background: #000; }
.stage.playing #race-video { display: block; }
.stage.playing #lobby-video { visibility: hidden; }

.live-badge {
  position: absolute; bottom: 12px; left: 12px; z-index: 5; display: none;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 1px;
  padding: 4px 10px; border-radius: 2px; animation: pulse 1.4s ease-in-out infinite;
}
.stage.playing .live-badge { display: block; }
@keyframes pulse { 50% { opacity: .55; } }

.podium {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%); z-index: 9; display: none;
  align-items: flex-end; gap: 14px;
}
.podium.show { display: flex; animation: dropIn .45s ease; }
.podium .mk { position: relative; width: 64px; display: flex; flex-direction: column; align-items: center; }
.podium .mk:nth-child(2) { width: 82px; }
.podium .mk img { width: 100%; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.6)); }
.podium .mk .box {
  margin-top: -6px; min-width: 44px; padding: 2px 8px; border-radius: 4px; text-align: center;
  font-family: "AntonLocal", "Anton", sans-serif; font-size: 22px; border: 2px solid #fff;
}
.podium .mk:nth-child(2) .box { font-size: 28px; }
@keyframes dropIn { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }

.box.red, .hball.red, .ft-number.red { background: var(--num-red); }
.box.black, .hball.black, .ft-number.black { background: var(--num-black); }
.box.green, .hball.green, .ft-number.green { background: var(--num-green); }

.fulltime {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; display: none; flex-direction: column; align-items: center;
  justify-content: flex-end; background: linear-gradient(180deg, transparent, rgba(3,10,18,.88) 40%); gap: 8px; padding: 70px 12px 14px;
}
.fulltime.show { display: flex; }
.fulltime h2 {
  color: #fff; font-size: 24px; font-weight: 900; letter-spacing: 2px; font-style: italic;
  text-shadow: 0 2px 0 var(--red), 0 6px 14px rgba(227,38,47,.45);
}
.ft-body { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(620px, 100%); }
.ft-caption { font-size: 12px; font-weight: 800; letter-spacing: 1.5px; opacity: .85; }
.ft-number {
  width: 70px; height: 70px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: "AntonLocal", "Anton", sans-serif; font-size: 38px; border: 3px solid #ffd54a;
  box-shadow: 0 0 22px rgba(255,213,74,.55);
}
.ft-bets { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ft-bets .tag { font-size: 12px; padding: 3px 10px; border-radius: 10px; white-space: nowrap; font-weight: 700; }
.ft-bets .tag.won { background: var(--win); }
.ft-bets .tag.lost { background: var(--danger); }
.ft-total { font-size: 18px; font-weight: 900; padding: 4px 16px; border-radius: 4px; }
.ft-total.won { background: var(--win); }
.ft-total.lost { background: rgba(234,68,46,.85); }

/* ---------- history ---------- */

.history-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #0a1626;
  border-top: 1px solid rgba(255,255,255,.08); min-height: 44px;
}
.history-label { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: #9aaabf; flex-shrink: 0; }
.history { display: flex; gap: 6px; overflow: hidden; flex-wrap: nowrap; }
.hball {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-family: "AntonLocal", "Anton", sans-serif; font-size: 14px; border: 1px solid rgba(255,255,255,.35);
}
.hball.last { border: 2px solid #ffd54a; box-shadow: 0 0 8px rgba(255,213,74,.6); }

/* ---------- board ---------- */

.board-wrap {
  background: var(--felt) url("/casino/virt-tarakan/assets/Images/Texture/black-felt.png") center / 300px repeat;
  background-blend-mode: multiply;
  padding: 14px 12px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.board {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: 1fr repeat(4, 1.25fr) 1.25fr;
  grid-template-rows: repeat(3, 54px) 40px 44px 36px;
  gap: 3px;
}
.board.locked { pointer-events: none; }
.board.locked .cell { opacity: .8; }
.cell {
  position: relative; border: 2px solid var(--line); border-radius: 4px; background: rgba(0,0,0,.15); color: #fff;
  font-family: "Roboto Condensed", sans-serif; font-weight: 700; font-size: 14px; letter-spacing: .5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; text-transform: uppercase;
  transition: transform .1s ease, box-shadow .2s ease, background .2s ease;
}
.cell:hover { box-shadow: inset 0 0 0 100px rgba(255,255,255,.12); }
.cell:active { transform: scale(.97); }
.cell img { height: 30px; pointer-events: none; }
.cell.num .n {
  font-family: "AntonLocal", "Anton", sans-serif; font-size: 26px; font-weight: 400;
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
}
.cell.red { background: var(--num-red); }
.cell.black { background: var(--num-black); }
.cell.green { background: var(--num-green); }
.cell.zero .n { font-size: 34px; }
.cell.group { font-size: 13px; }
.cell.win {
  box-shadow: 0 0 0 3px #ffd54a, 0 0 18px rgba(255,213,74,.8);
  border-color: #ffd54a; z-index: 2; animation: winGlow 1s ease-in-out 3;
}
@keyframes winGlow { 50% { box-shadow: 0 0 0 3px #fff, 0 0 26px rgba(255,255,255,.9); } }

.stack {
  position: absolute; right: 2px; top: 2px; width: 30px; height: 30px; display: none; pointer-events: none; z-index: 3;
}
.stack.on { display: block; animation: chipIn .2s ease; }
.stack img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.stack b {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: "Roboto", sans-serif; font-size: 10px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000;
}
@keyframes chipIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.chips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.chip {
  position: relative; width: 52px; height: 52px; border: 0; background: transparent; cursor: pointer; border-radius: 50%;
  transition: transform .15s ease;
}
.chip img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.chip b {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000;
}
.chip:hover { transform: translateY(-2px); }
.chip.active { transform: translateY(-5px) scale(1.08); box-shadow: 0 0 0 3px #ffd54a, 0 6px 14px rgba(0,0,0,.5); }

/* ---------- my bets ---------- */

.panel-head {
  min-height: 46px; background: linear-gradient(90deg, #10204a, #1d3a6e); display: flex; align-items: center;
  padding: 0 14px; gap: 8px; font-size: 17px; font-weight: 500;
}
.panel-head .count {
  min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; background: var(--accent); color: #021526; font-size: 13px;
  font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.matchday-bets { margin-top: 8px; background: #fff; border-radius: 2px; overflow: hidden; }
.md-list { max-height: 140px; overflow: auto; color: var(--text); }
.md-item {
  padding: 10px 12px; border-top: 1px solid #dfe3ea; display: flex; justify-content: space-between; gap: 8px; font-size: 13px;
}
.md-item .right { text-align: right; color: #e0620a; font-weight: 700; }
.md-item.won .right { color: var(--win); }
.md-item.lost .right { color: var(--danger); }

/* ---------- order ticket ---------- */

.ticket {
  grid-area: slip; background: #0c1824; border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  display: flex; flex-direction: column; align-self: start; overflow: hidden; color: #fff;
  transition: box-shadow .35s ease, border-color .35s ease;
}
.ticket.has-bets { border-color: rgba(255,122,26,.45); box-shadow: 0 0 0 1px rgba(255,122,26,.15); }
.ticket-toggle {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px; text-align: left;
  background: transparent; border: 0; cursor: pointer; color: inherit;
}
.ticket-toggle:hover { background: rgba(255,255,255,.03); }
.ticket-toggle h2 { margin: 0; font-size: 14px; letter-spacing: .04em; flex: 1; font-weight: 700; }
.ticket-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #021526;
  font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.ticket-count.hide { display: none; }
.ticket-chevron {
  width: 10px; height: 10px; border-right: 2px solid #9ab; border-bottom: 2px solid #9ab;
  transform: rotate(45deg); transition: transform .35s ease; margin-top: -4px; flex-shrink: 0;
}
.ticket:not(.is-collapsed) .ticket-chevron { transform: rotate(225deg); margin-top: 4px; }
.ticket-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.22,.61,.36,1); }
.ticket:not(.is-collapsed) .ticket-panel { grid-template-rows: 1fr; }
.ticket-panel-inner {
  overflow: hidden; min-height: 0; padding: 0 10px; opacity: 0; transform: translateY(-6px);
  transition: opacity .3s ease, transform .35s ease, padding .35s ease;
}
.ticket:not(.is-collapsed) .ticket-panel-inner { padding: 0 10px 10px; opacity: 1; transform: translateY(0); }
.ticket-tools { display: flex; gap: 6px; margin-bottom: 8px; }
.tool-btn {
  flex: 1; height: 30px; background: #1c344c; border: 0; border-radius: 4px; color: #fff; font-size: 12px;
  font-weight: 700; cursor: pointer;
}
.tool-btn:not(:disabled):hover { background: #25486a; }
.tool-btn:disabled { opacity: .4; cursor: default; }
.slip-body { overflow: auto; min-height: 0; max-height: 0; transition: max-height .35s ease; position: relative; }
.ticket:not(.is-collapsed) .slip-body { max-height: 180px; min-height: 48px; }
.ticket.ticket--grow:not(.is-collapsed) .slip-body { max-height: 300px; }
.slip-empty { color: var(--cyan); font-size: 13px; padding: 12px 4px; }
.slip-item {
  background: #132536; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; padding: 8px;
  margin-bottom: 6px; font-size: 12px; position: relative; animation: slipIn .28s ease;
}
@keyframes slipIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.slip-item .meta { font-size: 11px; color: #9aaabf; margin-top: 4px; }
.slip-item .sel { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; padding-right: 20px; }
.slip-item .remove {
  position: absolute; right: 6px; top: 6px; border: 0; background: transparent; color: #9aaabf; cursor: pointer; font-size: 14px;
}
.slip-item .remove:disabled { visibility: hidden; }
.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: 48px; border: 0; border-radius: 6px;
  background: linear-gradient(180deg, var(--red-2), var(--red)); color: #fff; font-size: 15px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; cursor: pointer;
}
.submit-btn:disabled { opacity: .5; cursor: default; }

.toast {
  position: fixed; top: 80px; 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,.2); z-index: 50;
  display: none; font-weight: 600; border-left: 4px solid var(--accent);
}
.toast.show { display: block; animation: slideIn .35s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100%; }
  .layout { grid-template-columns: 1fr; grid-template-areas: "main" "slip"; overflow: visible; }
  .stage { max-height: none; }
}
@media (max-width: 600px) {
  .clock, .help-btn { display: none; }
  .brand .logo-img { height: 34px; }
  .board { grid-template-rows: repeat(3, 44px) 34px 38px 32px; }
  .cell { font-size: 11px; }
  .cell.num .n { font-size: 20px; }
  .cell.group { font-size: 10px; }
  .stack { width: 22px; height: 22px; }
  .podium .mk { width: 46px; }
  .podium .mk:nth-child(2) { width: 58px; }
  .podium .mk .box { font-size: 16px; min-width: 32px; }
  .ft-number { width: 52px; height: 52px; font-size: 28px; }
  .chip { width: 44px; height: 44px; }
}
