/* Kasyno CraftCube – widok dla widzów (OBS 1280×1000) i panel admina */

@font-face { font-family: 'Anton'; src: url(fonts/Anton-Regular.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url(fonts/FiraSans-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url(fonts/FiraSans-Medium.ttf) format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url(fonts/FiraSans-SemiBold.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url(fonts/FiraSans-Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0e110f;
  --s1: #151a17;
  --s2: #1b211d;
  --s3: #232a25;
  --line: #262e28;
  --line-2: #343d36;
  --text: #ece7da;
  --muted: #8f978d;
  --dim: #5d665e;
  --green: #3fbf7f;
  --green-ink: #08140d;
  --gold: #f0c24b;
  --red: #e5605a;
  --card: 120px;
  --display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --sans: 'Fira Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }

.page { max-width: 1280px; margin: 0 auto; padding: 16px 18px 10px; display: flex; flex-direction: column; gap: 12px; min-height: 100vh; }

.label, .panel-head h2, th {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}

/* ---------- nagłówek ---------- */
.topbar { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 28px; padding: 2px 2px 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 36px; height: 36px; shape-rendering: crispEdges; }
.brand-name { font-family: var(--display); font-size: 30px; line-height: 1; text-transform: uppercase; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }
.tabs { display: flex; gap: 3px; padding: 3px; background: var(--s1); border: 1px solid var(--line); border-radius: 4px; }
.tabs a { padding: 7px 16px; border-radius: 3px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--s3); color: var(--text); box-shadow: inset 0 -2px 0 var(--green); }
.rules { justify-self: center; max-width: 480px; text-align: center; font-size: 13px; color: var(--muted); }
.clock { text-align: right; }
.clock-time { font-family: var(--display); font-size: 34px; line-height: 1; }
.clock-s { font-size: 16px; color: var(--muted); margin-left: 4px; }
.clock-date { font-size: 11px; color: var(--muted); letter-spacing: .08em; margin-top: 4px; }

/* ---------- jak zagrać ---------- */
.howto { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 20px;
  background: var(--s1); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 4px; padding: 14px 22px 14px 18px; }
.howto-label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--green); line-height: 1.5; }
.howto-label span { color: var(--dim); }
.howto-cmd { font-size: 30px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arg { display: inline-block; background: var(--green); color: var(--green-ink); padding: 0 10px; border-radius: 3px; margin-left: 4px; font-size: .86em; line-height: 1.35; vertical-align: 2px; }
.facts { display: flex; }
.facts li { display: flex; flex-direction: column; align-items: flex-end; padding: 0 0 0 22px; margin-left: 22px; border-left: 1px solid var(--line-2); }
.facts li:first-child { border-left: 0; margin-left: 0; }
.facts b { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.05; }
.facts span { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- panele ---------- */
.panel { background: var(--s1); border: 1px solid var(--line); border-radius: 4px; padding: 16px 18px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.count { min-width: 26px; text-align: center; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 3px; background: var(--s3); color: var(--text); }

.stage { display: grid; grid-template-columns: 1fr 360px; gap: 12px; }

/* ---------- runda ---------- */
.round-head { display: flex; justify-content: space-between; align-items: flex-end; min-height: 86px; }
.round-id { color: var(--dim); margin-left: 4px; }
.pot-value, .timer-value { font-family: var(--display); font-size: 62px; line-height: 1; margin-top: 6px; }
.timer { text-align: right; }
.timer-value { color: var(--green); }
.round[data-state="spin"] .timer-value { color: var(--gold); }
.round[data-state="waiting"] .timer-value,
.round[data-state="paused"] .timer-value { color: var(--dim); }
.timer-value small { font-size: 28px; margin-left: 3px; color: var(--muted); }

.result { display: none; align-items: center; gap: 14px; text-align: right; }
.round[data-state="result"] .timer { display: none; }
.round[data-state="result"] .result { display: flex; animation: rise .35s ease-out; }
.result-text .label { color: var(--gold); }
.result-name { font-family: var(--display); font-size: 40px; line-height: 1.05; color: var(--gold); margin-top: 2px; }
.result-meta { font-size: 14px; color: var(--muted); }
.result-meta b { color: var(--text); font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.progress { height: 4px; background: var(--s3); border-radius: 2px; overflow: hidden; margin: 14px 0 16px; }
#progress-bar { height: 100%; width: 0; background: var(--green); transition: width .25s linear; }
.round[data-state="spin"] #progress-bar, .round[data-state="result"] #progress-bar { background: var(--gold); }

/* pasek ruletki */
.strip-wrap { position: relative; height: 148px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.strip-wrap::before, .strip-wrap::after { content: ""; position: absolute; top: 0; bottom: 0; width: 90px; z-index: 2; pointer-events: none; }
.strip-wrap::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.strip-wrap::after { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }
.strip { position: absolute; left: 0; top: 0; height: 100%; display: flex; will-change: transform; }
.strip.idle { animation: idle-scroll linear infinite; }
@keyframes idle-scroll { from { transform: translateX(0); } to { transform: translateX(var(--loop, -500px)); } }

.card { position: relative; flex: 0 0 var(--card); height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-right: 1px solid var(--line); }
.card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c); opacity: .85; }
.card-name { font-size: 12px; font-weight: 600; max-width: calc(var(--card) - 14px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.card.win { background: var(--s2); box-shadow: inset 0 0 0 2px var(--gold); }
.card.win .card-name { color: var(--gold); }
.strip.landed .card:not(.win) { opacity: .35; transition: opacity .4s; }

.marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--gold); z-index: 3; }
.marker::before, .marker::after { content: ""; position: absolute; left: -6px; border: 7px solid transparent; }
.marker::before { top: 0; border-top-color: var(--gold); }
.marker::after { bottom: 0; border-bottom-color: var(--gold); }
.strip-empty { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 15px; background: var(--bg); }

/* podział puli */
.split-head { display: flex; justify-content: space-between; margin: 14px 0 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.split { display: flex; gap: 2px; height: 10px; border-radius: 2px; overflow: hidden; background: var(--s3); }
.split span { display: block; min-width: 3px; background: var(--c); transition: flex-grow .4s ease; }

/* główki graczy */
.head { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 3px; overflow: hidden;
  background: var(--s3); background: color-mix(in srgb, var(--c) 28%, var(--s3)); }
.head i { font-style: normal; font-weight: 700; color: var(--c); font-size: .42em; }
.head img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }

/* lista graczy */
.players { display: flex; flex-direction: column; }
.player-list { flex: 1; min-height: 0; max-height: 330px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.p { display: grid; grid-template-columns: 16px 36px 1fr auto; grid-template-rows: auto auto; column-gap: 10px; row-gap: 6px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.p:last-child { border-bottom: 0; }
.p-rank { font-size: 12px; color: var(--dim); text-align: right; }
.p-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-amt { font-size: 13px; color: var(--muted); }
.p-main { min-width: 0; }
.p-chance { font-weight: 700; font-size: 16px; color: var(--c); }
.p-bar { grid-column: 2 / -1; height: 3px; background: var(--s3); border-radius: 2px; overflow: hidden; }
.p-bar::before { content: ""; display: block; height: 100%; width: var(--w); background: var(--c); transition: width .4s ease; }
.p.queued { opacity: .5; }
.p.queued .p-chance { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.empty { color: var(--dim); font-size: 14px; padding: 24px 0; text-align: center; line-height: 1.6; }

/* ---------- dolny rząd ---------- */
.lower { display: grid; grid-template-columns: 1.3fr .9fr 1fr; gap: 12px; flex: 1; }

.history { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th { text-align: left; padding: 0 0 8px; font-size: 10px; }
.history td { padding: 7px 0; border-top: 1px solid var(--line); white-space: nowrap; }
.history .r { text-align: right; }
.who { display: flex; align-items: center; gap: 9px; font-weight: 600; max-width: 170px; }
.who span { overflow: hidden; text-overflow: ellipsis; }
.win-amt { color: var(--green); font-weight: 600; }
.chance { color: var(--muted); }
.chance.upset { color: var(--gold); font-weight: 600; }
.ago { color: var(--dim); font-size: 12px; }

.feed li { display: grid; grid-template-columns: 22px 1fr auto; gap: 9px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .a { font-weight: 600; text-align: right; }
.feed .a small { display: block; font-weight: 400; color: var(--dim); font-size: 11px; }

.stats { display: flex; flex-direction: column; }
.stat { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.stat:first-child { border-top: 0; padding-top: 2px; }
.stat .label { font-size: 10px; grid-column: 1 / -1; margin-bottom: -4px; }
.stat-name { font-weight: 600; font-size: 14px; }
.stat-line { font-size: 13px; color: var(--muted); }
.stat-line .pos { color: var(--green); font-weight: 600; }
.stat-line .neg { color: var(--red); font-weight: 600; }
.stat-none { grid-column: 1 / -1; color: var(--dim); font-size: 13px; }

/* ---------- stopka ---------- */
.foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); padding: 0 2px; }
.conn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); margin-right: 7px; vertical-align: 1px; }
.conn.ok::before { background: var(--green); }
.conn.bad::before { background: var(--red); }

/* ---------- ogłoszenie zwycięzcy na cały ekran ---------- */
.celebrate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow: hidden;
  background: rgba(8, 10, 9, .95); opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.celebrate.show { opacity: 1; visibility: visible; }
.cel-box { position: relative; text-align: center; transform: scale(.92); transition: transform .45s cubic-bezier(.2,1.4,.4,1); }
.celebrate.show .cel-box { transform: none; }
.cel-kicker { font-family: var(--display); font-size: 40px; letter-spacing: .04em; text-transform: uppercase; color: var(--green); }
.cel-head { margin: 18px auto 14px; width: 144px; height: 144px; }
.cel-head .head { box-shadow: 0 0 0 4px var(--gold); }
.cel-name { font-family: var(--display); font-size: 84px; line-height: 1; color: var(--gold); }
.cel-sub { margin-top: 10px; font-size: 16px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.cel-amount { font-family: var(--display); font-size: 110px; line-height: 1.05; margin-top: 18px; color: var(--text); }
.cel-chance { font-size: 22px; color: var(--muted); margin-top: 6px; }
.cel-chance b { color: var(--text); font-weight: 700; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 10px; background: var(--c); animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

/* Na dużym ekranie (OBS 1280×1000) strona zawsze mieści się w oknie – dolne panele przycinają nadmiar. */
@media (min-width: 981px) {
  .page { height: 100vh; min-height: 0; }
  .lower { min-height: 0; }
  .lower .panel { overflow: hidden; min-height: 0; -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); }
}

@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .rules { display: none; }
  .howto { grid-template-columns: 1fr; gap: 10px; }
  .howto-cmd { font-size: 22px; white-space: normal; }
  .facts li { align-items: flex-start; }
  .stage, .lower { grid-template-columns: 1fr; }
  .pot-value, .timer-value { font-size: 44px; }
  .cel-name { font-size: 52px; } .cel-amount { font-size: 64px; } .cel-head { width: 104px; height: 104px; }
}
