: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;
}

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

html, body {
  height: 100%;
  width: 100%;
  background: #0b2140 url("/casino/virt-pinguin/assets/Images/ICE-BG-1920x1080.jpg") center / cover 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 #3fc3ef;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo-img { height: 50px; 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: #0b2140 url("/casino/virt-pinguin/assets/Images/LoadingImage.jpg") center / cover no-repeat;
  overflow: hidden;
}
.stage video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent;
}
#lobby-video { z-index: 1; }
#race-video { z-index: 2; display: none; background: #000; object-fit: contain; }
.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; } }

.fulltime {
  position: absolute; inset: 0; z-index: 8; display: none; flex-direction: column; align-items: center;
  justify-content: space-between; padding: 4% 12px 3%;
  background: #2a8fd0 url("/casino/virt-pinguin/assets/Images/Podium-BG.jpg") center / cover no-repeat;
}
.fulltime.won {
  background:
    url("/casino/virt-pinguin/assets/Images/rays.png") center / cover no-repeat,
    radial-gradient(ellipse at 50% 45%, #ffd84a 0%, #f2b100 55%, #c98a00 100%);
}
.fulltime.show { display: flex; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fulltime h2 {
  font-family: "Lato", "Roboto", sans-serif; font-weight: 900; font-size: clamp(22px, 4.4vw, 52px);
  color: #0f3a40; text-align: center; line-height: 1.05; letter-spacing: 1px; text-transform: uppercase;
}
.fulltime h2 .amt { display: block; color: #ffe100; font-size: 1.5em; text-shadow: 0 3px 0 #b07800, 0 6px 14px rgba(0,0,0,.35); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 6%; width: 100%; }
.podium .pl { position: relative; display: flex; flex-direction: column; align-items: center; }
.podium .trophy { width: clamp(40px, 7vw, 86px); margin-bottom: -18%; position: relative; z-index: 2; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }
.podium .first { transform: translateY(-14%); }
.podium .first .trophy { width: clamp(50px, 8.5vw, 104px); }
.podium .pl { animation: rise .5s ease backwards; }
.podium .second { animation-delay: .1s; }
.podium .third { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } }
.ft-body { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(620px, 100%); }
.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; color: #fff; }
.ft-bets .tag.won { background: var(--win); }
.ft-bets .tag.lost { background: var(--danger); }

/* ---------- penguin avatar ---------- */

.pav {
  --size: 56px;
  position: relative; display: inline-flex; align-items: flex-end; justify-content: center; flex-shrink: 0;
  width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #f4fbff 0%, #c9e3f3 70%);
  box-shadow: 0 0 0 calc(var(--size) * .07) var(--ring), 0 4px 12px rgba(0,0,0,.35);
}
.pav img { width: 86%; height: auto; display: block; pointer-events: none; }
.pav i {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%); font-style: normal;
  font-family: "Roboto Condensed", sans-serif; font-weight: 700; font-size: calc(var(--size) * .2);
  color: #fff; background: var(--ring); border-radius: 8px; padding: 0 5px; line-height: 1.3;
}
.pav.big { --size: clamp(64px, 9vw, 104px); }
.pav.small { --size: 30px; }
.pav.small i { display: none; }
.pav.small.last { box-shadow: 0 0 0 2px var(--ring), 0 0 0 4px #ffd54a; }
.pav.podium { --size: clamp(70px, 12vw, 140px); }

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

.history-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #0a1e36;
  border-top: 1px solid rgba(255,255,255,.08); min-height: 46px;
}
.history-label { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: #9ac3e6; flex-shrink: 0; }
.history { display: flex; gap: 8px; overflow: hidden; flex-wrap: nowrap; padding: 3px; }

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

.board-wrap {
  background: #a3123a url("/casino/virt-pinguin/assets/Images/Xmas/Xmas-BG.jpg") center / cover no-repeat;
  padding: 16px 12px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.board {
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.board.locked { pointer-events: none; }
.pcard {
  position: relative; border: 0; border-radius: 14px; cursor: pointer; color: #fff;
  background: rgba(10, 20, 40, .35); padding: 14px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.15);
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease, background .2s ease;
}
.pcard:hover { background: rgba(10, 20, 40, .5); box-shadow: inset 0 0 0 2px var(--ring); }
.pcard:active { transform: scale(.97); }
.pcard.has-bet { background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 3px var(--ring), 0 0 16px var(--ring); }
.pcard .pname { font-family: "Roboto Condensed", sans-serif; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .6px; }
.pcard .podds { font-size: 12px; font-weight: 800; background: rgba(0,0,0,.4); padding: 1px 10px; border-radius: 10px; }
.pcard .pstake {
  position: absolute; top: 8px; right: 8px; display: none; min-width: 40px; padding: 3px 8px; border-radius: 12px;
  background: #fff; color: #0b2140; font-size: 12px; font-weight: 900; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.pcard .pstake.on { display: block; animation: chipIn .2s ease; }
.pcard.win { background: rgba(255, 213, 74, .35); box-shadow: inset 0 0 0 3px #ffd54a, 0 0 22px rgba(255,213,74,.8); animation: winGlow 1s ease-in-out 3; }
.pcard.dim { opacity: .55; }
@keyframes winGlow { 50% { box-shadow: inset 0 0 0 3px #fff, 0 0 30px rgba(255,255,255,.9); } }
@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 {
  min-width: 58px; height: 38px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 2px solid rgba(255,255,255,.6); background: linear-gradient(180deg, #2fa7c9, #136c8d);
  color: #fff; font-size: 15px; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.5);
  box-shadow: 0 3px 0 #0b4a61, 0 4px 10px rgba(0,0,0,.3); transition: transform .12s ease;
}
.chip:hover { transform: translateY(-2px); }
.chip.active { background: linear-gradient(180deg, #ffe066, #f0a800); color: #3b2500; text-shadow: none; border-color: #fff; transform: translateY(-3px); box-shadow: 0 3px 0 #a86f00, 0 0 0 3px rgba(255,255,255,.35); }

/* ---------- 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: 36px; }
  .board { gap: 8px; }
  .pcard { padding: 10px 4px 8px; }
  .pcard .pname { font-size: 11px; }
  .chip { min-width: 46px; height: 34px; font-size: 13px; padding: 0 8px; }
}