:root {
  --bg: #0b0f1a;
  --bg-2: #111727;
  --card: #151c2f;
  --card-2: #1b2440;
  --line: #26304d;
  --text: #e8ecf6;
  --muted: #8d97b5;
  --gold: #ffc53d;
  --gold-2: #ff9f1c;
  --cyan: #2ee6d6;
  --pink: #ff4d8d;
  --green: #35d07f;
  --red: #ff5a5f;
  --blue: #4c8dff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --header-h: 64px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2350 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #3a1640 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: "JetBrains Mono", Consolas, monospace; }
.hidden { display: none !important; }

/* Layout */
.container { width: min(1200px, 100% - 32px); margin-inline: auto; }
main { padding: 24px 0 96px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.section-title { display: flex; justify-content: space-between; align-items: end; margin: 28px 0 14px; }
.gold { color: var(--gold); }
.cyan { color: var(--cyan); }
.text-right { text-align: right; }
.break { word-break: break-all; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle .track { width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track::after { left: 21px; }
.demo-bar { border: 1px dashed var(--pink); border-radius: 12px; padding: 10px 14px; background: rgba(255, 77, 141, .06); font-size: .85rem; }
.demo-bar b { color: var(--pink); }

/* Header */
.kp-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(11, 15, 26, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.kp-header .container { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; letter-spacing: .3px; }
.brand-wordmark { height: 40px; width: auto; display: block; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 5px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  box-shadow: 0 0 18px rgba(255, 197, 61, .35);
}
.brand-logo span { background: #1a1200; border-radius: 3px; }
.brand-logo span:nth-child(2) { background: #fff7d6; }
.brand b { color: var(--gold); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .92rem; }
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.active { color: var(--text); background: var(--card-2); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.balance-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  padding: 6px 6px 6px 14px; border-radius: 999px;
}
.balance-pill .amount { font-weight: 800; }
.balance-pill .locked { font-size: .75rem; color: var(--muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  display: grid; place-items: center; font-weight: 800; color: #04121a; cursor: pointer;
}
.user-menu { position: relative; }
.user-menu .menu {
  position: absolute; right: 0; top: 46px; min-width: 200px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; display: none;
}
.user-menu.open .menu { display: block; }
.user-menu .menu a, .user-menu .menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px;
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer;
}
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--card-2); }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: none; justify-content: space-around;
  background: rgba(17, 23, 39, .95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); padding: 4px 10px; }
.bottom-nav a .ico { font-size: 1.25rem; line-height: 1; }
.bottom-nav a.active { color: var(--gold); }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; }
.stat .value { font-size: 1.6rem; font-weight: 800; }
.stat .value.gold { color: var(--gold); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); font: inherit; font-weight: 700;
  cursor: pointer; transition: transform .08s ease, filter .15s ease, background .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1200; border-color: transparent; }
.btn-cyan { background: linear-gradient(135deg, var(--cyan), #19b5d8); color: #041619; border-color: transparent; }
.btn-danger { background: rgba(255, 90, 95, .15); color: var(--red); border-color: rgba(255, 90, 95, .4); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 14px; border-radius: 10px; font: inherit; outline: none; width: 100%;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 197, 61, .15); }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .addon { padding: 11px 14px; background: var(--card-2); border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; font-weight: 600; font-size: .85rem; }
.chip.active, .chip:hover { border-color: var(--gold); color: var(--gold); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
.badge-gold { background: rgba(255, 197, 61, .15); color: var(--gold); }
.badge-cyan { background: rgba(46, 230, 214, .13); color: var(--cyan); }
.badge-pink { background: rgba(255, 77, 141, .15); color: var(--pink); }
.badge-green { background: rgba(53, 208, 127, .15); color: var(--green); }
.badge-red { background: rgba(255, 90, 95, .15); color: var(--red); }
.badge-gray { background: rgba(141, 151, 181, .15); color: var(--muted); }
.badge-blue { background: rgba(76, 141, 255, .15); color: var(--blue); }

/* Progress */
.progress { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--gold)); border-radius: 999px; transition: width .6s ease; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid rgba(38, 48, 77, .6); }
.table tr:hover td { background: rgba(27, 36, 64, .5); }
.amount-pos { color: var(--green); font-weight: 700; }
.amount-neg { color: var(--red); font-weight: 700; }

/* Hero */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px; border: 1px solid var(--line);
  background: linear-gradient(135deg, #1b1f4a 0%, #2a1240 55%, #3a1a10 100%);
  padding: 32px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center;
}
.hero h1 { font-size: 2.4rem; }
.hero h1 .gold { color: var(--gold); }
.hero-pixels { position: absolute; inset: 0; opacity: .18; pointer-events: none; background-image:
  linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 18px 18px; }
.jackpot { font-size: 2.6rem; font-weight: 900; color: var(--gold); text-shadow: 0 0 24px rgba(255, 197, 61, .45); }
.countdown { display: flex; gap: 10px; }
.countdown .unit { background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 62px; text-align: center; }
.countdown .unit b { display: block; font-size: 1.4rem; }
.countdown .unit span { font-size: .7rem; color: var(--muted); text-transform: uppercase; }
.hero-preview { position: relative; z-index: 1; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 1; background: #05070d; }
.hero-preview canvas { width: 100%; height: 100%; image-rendering: pixelated; }

/* Game cards */
.game-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
.game-card .cover { height: 130px; border-radius: 10px; position: relative; overflow: hidden; display: grid; place-items: center; font-size: 3rem; }
.cover-instant { background: linear-gradient(135deg, #3b1d6e, #7a2e8e); }
.cover-mini { background: linear-gradient(135deg, #0f4c5c, #1b8a8f); }
.cover-mega { background: linear-gradient(135deg, #5a3a00, #b8860b); }
.cover-warm { background: linear-gradient(135deg, #1d3b2a, #2e8a55); }
.cover .mini-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; padding: 8px; opacity: .35; }
.cover .mini-grid i { background: rgba(255,255,255,.25); border-radius: 2px; }
.cover .mini-grid i.on { background: var(--gold); }
.game-card .meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }

/* Ticker */
.ticker { overflow: hidden; white-space: nowrap; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); padding: 10px 0; }
.ticker-track { display: inline-block; animation: ticker 40s linear infinite; }
.ticker-track span { margin: 0 24px; color: var(--muted); }
.ticker-track b { color: var(--gold); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Instant / mini grid */
.board-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.board {
  display: grid; gap: 4px; padding: 12px; border-radius: 16px;
  background: #070a12; border: 1px solid var(--line); user-select: none;
}
.tile {
  aspect-ratio: 1; border-radius: 6px; cursor: pointer; position: relative;
  perspective: 600px; background: transparent; border: 0; padding: 0;
}
.tile .face {
  position: absolute; inset: 0; border-radius: 6px; display: grid; place-items: center;
  backface-visibility: hidden; transition: transform .5s cubic-bezier(.2,.8,.2,1);
  font-size: .65rem; font-weight: 800;
}
.tile .front { background: linear-gradient(135deg, #24305a, #1a2142); border: 1px solid #2f3d6e; }
.tile:hover .front { background: linear-gradient(135deg, #2f3f78, #222b55); }
.tile .back { transform: rotateY(180deg); background: #0f1424; border: 1px solid var(--line); color: var(--muted); }
.tile.revealed .front { transform: rotateY(180deg); }
.tile.revealed .back { transform: rotateY(360deg); }
.tile.selected .front { background: linear-gradient(135deg, var(--gold), var(--gold-2)); border-color: transparent; box-shadow: 0 0 12px rgba(255, 197, 61, .5); }
.board.no-funds .tile:not(.selected):not(.taken):not(.revealed):not(.mine):not(.warm) { cursor: not-allowed; opacity: .42; }
.board.no-funds .tile:not(.selected):not(.taken):not(.revealed):not(.mine):not(.warm):hover .front { background: linear-gradient(135deg, #24305a, #1a2142); }
.tile.taken { cursor: not-allowed; }
.tile.taken .front { background: #10141f; border-color: #161c2c; }
.tile.mine .front { background: linear-gradient(135deg, var(--cyan), #19b5d8); }
.tile.win .back { background: linear-gradient(135deg, #2c2a05, #5e4a00); color: var(--gold); border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 197, 61, .55); }
.tile.lose .back { color: #5d6788; }
.tile.ticket .back { background: linear-gradient(135deg, #062b2a, #0c4e4b); color: var(--cyan); border-color: var(--cyan); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* Side panel / cart */
.side-panel { position: sticky; top: calc(var(--header-h) + 16px); }
.cart-list { max-height: 220px; overflow: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.cart-list .chip { cursor: default; }
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.summary-line:last-child { border-bottom: 0; }
.summary-line.total { font-size: 1.1rem; font-weight: 800; }
.hold-timer { font-size: 1.6rem; font-weight: 900; color: var(--gold); text-align: center; }

/* Mega canvas */
.mega-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.mega-stage {
  position: relative; height: calc(100vh - var(--header-h) - 150px); min-height: 460px;
  border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #03050a;
  cursor: crosshair; touch-action: none;
}
.mega-stage canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.mega-toolbar { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; z-index: 2; }
.mega-toolbar .btn { background: rgba(21, 28, 47, .9); }
.mega-hud { position: absolute; bottom: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; z-index: 2; pointer-events: none; }
.mega-hud .pill { background: rgba(11, 15, 26, .85); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: .8rem; pointer-events: auto; }
.minimap { position: absolute; top: 12px; right: 12px; width: 130px; height: 130px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; z-index: 2; background: #000; }
.minimap canvas { width: 100%; height: 100%; image-rendering: pixelated; }

/* Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; color: var(--muted); padding: 10px 14px; font: inherit; font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active, .tabs a.active { color: var(--text); border-bottom-color: var(--gold); }

/* Payment method cards */
.method-list { display: grid; gap: 10px; }
.method {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2); cursor: pointer;
}
.method:hover { border-color: #3a4673; }
.method.active { border-color: var(--gold); background: rgba(255, 197, 61, .06); }
.method .logo { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; font-size: .8rem; }
.method .info { flex: 1; }
.method .info .limits { font-size: .78rem; color: var(--muted); }
.iban-box { background: var(--bg-2); border: 1px dashed var(--gold); border-radius: 12px; padding: 14px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 5, 10, .7); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100; padding: 16px;
  animation: fade .15s ease;
}
.modal { width: min(480px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); animation: pop .18s ease; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-close { background: none; border: 0; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Toast */
.toast-wrap { position: fixed; top: calc(var(--header-h) + 12px); right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 360px; padding: 12px 16px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop .2s ease; border-left: 4px solid var(--blue); }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.gold { border-left-color: var(--gold); }

/* Auth */
.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: min(440px, 100%); }

/* Win burst */
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 150; display: grid; place-items: center; }
.burst .msg { font-size: 2.6rem; font-weight: 900; color: var(--gold); text-shadow: 0 0 30px rgba(255, 197, 61, .7); animation: burst 1.6s ease forwards; }
@keyframes burst { 0% { transform: scale(.4); opacity: 0; } 20% { transform: scale(1.15); opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.1) translateY(-40px); opacity: 0; } }
.confetti { position: fixed; top: -10px; width: 8px; height: 14px; z-index: 149; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Empty state */
.empty { text-align: center; padding: 32px; color: var(--muted); }
.empty .ico { font-size: 2.2rem; margin-bottom: 8px; }

/* Footer */
.kp-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: .85rem; }

/* Responsive */
@media (max-width: 1024px) {
  .board-wrap, .mega-layout { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav, .balance-pill .locked, .header-deposit { display: none; }
  .bottom-nav { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 1.7rem; }
  .jackpot { font-size: 2rem; }
  .mega-stage { height: 62vh; min-height: 360px; }
  .minimap { width: 90px; height: 90px; }
  main { padding-bottom: 110px; }
  .board { gap: 3px; padding: 8px; }
}
