:root {
  --bg: #021018;
  --panel: rgba(10, 24, 38, .86);
  --line: rgba(140, 210, 255, .18);
  --text: #e8f6ff;
  --muted: #8fb3c9;
  --accent: #4fd1ff;
  --accent-2: #8fe3ff;
  --twitch: #9146ff;
  --ok: #5ee6a8;
  --warn: #ffc857;
  --bad: #ff6b7d;
  --danger: #ff5c6c;
  --pink: #ff8fd6;
  --gold: #ffd34d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent-2); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.row.spread { justify-content: space-between; }
.bad { color: var(--bad); }

/* ---------- Pogas ---------- */
button { color: var(--text); background: rgba(79, 209, 255, .12); border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; cursor: pointer; }
button:hover:not(:disabled) { background: rgba(79, 209, 255, .25); }
button:disabled { opacity: .45; cursor: default; }
button.on, button.primary { background: var(--accent); color: #022; border-color: var(--accent); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-2); }
button.wide { width: 100%; margin: 6px 0; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 9px; border: 0; background: #1d4a63; color: #fff; text-decoration: none; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.12); }
.btn.twitch { background: var(--twitch); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.primary { background: var(--accent); color: #022; }
.btn.danger { background: var(--danger); }
.hdr-btn { display: inline-block; padding: 6px 11px; border-radius: 9px; border: 1px solid var(--line); color: var(--text); background: transparent; text-decoration: none; font-size: 13px; white-space: nowrap; }
.hdr-btn:hover { background: rgba(79, 209, 255, .2); }
input { color: var(--text); background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.pearl { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; background: radial-gradient(circle at 35% 30%, #fff, #eef3fa 35%, #aab8cc 100%); box-shadow: 0 0 5px rgba(255,255,255,.45); }

/* ---------- Kanvas ---------- */
#gl, #ui { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { cursor: grab; touch-action: none; }
#ui.drag { cursor: grabbing; }
#ui.steer { cursor: crosshair; }

/* ---------- Paneļi ---------- */
.ui-panel { position: fixed; z-index: 2; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 12px 40px rgba(0,0,0,.35); }
#top { top: 12px; left: 12px; right: 12px; padding: 7px 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#top .brand { font-size: 16px; margin-right: 6px; white-space: nowrap; }
#userBox { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#userBox img { width: 26px; height: 26px; border-radius: 50%; }
.status { font-size: 12px; padding: 4px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid var(--line); }
.status.on { background: rgba(255, 80, 100, .18); border-color: rgba(255, 80, 100, .5); }
.status.off { color: var(--muted); }

.login-card { left: 12px; top: 80px; width: 300px; padding: 14px 16px; text-align: center; }
.login-card p { margin: 6px 0 10px; font-size: 13px; }

#card { right: 12px; top: 74px; width: 320px; padding: 14px 16px; max-height: calc(100% - 86px); overflow-y: auto; }
#card h2 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
#card .sub { color: var(--muted); font-size: 12px; margin: 2px 0 10px; }
.mine-tag { font-size: 11px; background: var(--gold); color: #3a2a00; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.stat { margin: 6px 0; }
.stat span { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .3s; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0 4px; }
.acts button { text-align: left; line-height: 1.25; padding: 7px 9px; }
.acts small { display: block; color: var(--muted); font-size: 11px; min-height: 14px; }
.acts button:disabled small { color: var(--warn); }
.sec { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips button { padding: 4px 8px; font-size: 12px; }
.chips .price { color: var(--muted); font-size: 11px; margin-left: 3px; }
.chips button.on .price { color: #024; }
.sw { width: 24px; height: 24px; border-radius: 50%; padding: 0 !important; border: 2px solid rgba(255,255,255,.25); }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
#card input { flex: 1; min-width: 0; }
.genes { font-size: 12px; color: var(--muted); line-height: 1.6; }
.genes b { color: var(--text); font-weight: 600; }
.note { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.04); border: 1px dashed var(--line); border-radius: 9px; padding: 8px 10px; margin: 10px 0; }
.quest { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.quest.done { color: var(--ok); }
.quest b { white-space: nowrap; }
.tricks span { display: inline-block; font-size: 12px; background: rgba(255,143,214,.15); border: 1px solid rgba(255,143,214,.35); border-radius: 7px; padding: 2px 7px; margin: 2px 3px 2px 0; }
.tricks span.no { opacity: .35; border-style: dashed; }
.ev { font-size: 12px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.ev small { display: block; color: var(--muted); font-size: 10px; }
.x { margin-left: auto; background: transparent !important; border: 0; font-size: 20px; padding: 0 4px; }
.demo { margin-top: 16px; padding-top: 10px; border-top: 1px dashed var(--line); }

#me { left: 12px; bottom: 12px; width: 260px; padding: 10px 12px; cursor: pointer; }
#me .nm { display: flex; justify-content: space-between; font-weight: 600; gap: 8px; }
#me .nm .muted { font-weight: 400; }
#me .mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 7px; }
#me .mini .bar { height: 5px; }
#me .mini label { font-size: 10px; color: var(--muted); }
#me .foot { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12px; color: var(--muted); }

#mg { left: 50%; top: 74px; transform: translateX(-50%); padding: 10px 18px; text-align: center; min-width: 280px; z-index: 3; }
#mg h3 { margin: 0; font-size: 17px; }
#mg .info { color: var(--muted); font-size: 13px; margin-top: 2px; max-width: 420px; }
#mg .big { font-size: 22px; font-weight: 700; margin-top: 4px; }
.pad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 46px); gap: 6px; justify-content: center; margin: 10px auto 2px; }
.pad button { font-size: 22px; padding: 0; transition: background .1s, transform .1s; }
.pad button.lit { background: var(--pink); color: #3a0030; transform: scale(1.08); }
.pad.watch button:not(.lit) { opacity: .4; }
.pad button { touch-action: manipulation; user-select: none; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 6px; min-height: 10px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); }
.dots i.ok { background: var(--ok); border-color: var(--ok); }
.pad .u { grid-column: 2; grid-row: 1; } .pad .l { grid-column: 1; grid-row: 2; } .pad .d { grid-column: 2; grid-row: 2; } .pad .r { grid-column: 3; grid-row: 2; }

.modal { left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 18px 20px; text-align: center; z-index: 5; width: min(720px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto; }
.modal.small { width: min(420px, calc(100% - 24px)); }
.modal h3 { margin: 0 0 6px; font-size: 20px; }
.modal p { margin: 0 0 14px; }
#adoptForm { justify-content: center; }
#evoOpts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
#evoOpts button { padding: 8px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#evoOpts canvas { width: 100%; aspect-ratio: 16 / 10; display: block; border-radius: 8px; background: radial-gradient(circle at 50% 40%, #155f84, #062a40); }
#evoOpts .lbl { font-size: 12px; line-height: 1.4; min-height: 34px; }
#evoOpts .rare { color: var(--gold); font-weight: 700; }
.help { text-align: left; display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 10px 0 16px; }
.help dt { font-weight: 700; }
.help dd { margin: 0; color: var(--muted); }

#toasts { position: fixed; bottom: 58px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; flex-direction: column-reverse; gap: 6px; align-items: center; pointer-events: none; }
#toasts div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 14px; font-size: 13px; animation: tin .25s ease-out; max-width: min(560px, calc(100vw - 24px)); text-align: center; }
#toasts div.bad { border-color: rgba(255,107,125,.6); background: rgba(60,14,24,.92); }
#toasts div.good { border-color: rgba(94,230,168,.55); background: rgba(10,48,36,.92); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
#hint { left: 50%; bottom: 14px; transform: translateX(-50%); padding: 7px 14px; color: var(--muted); font-size: 12px; white-space: nowrap; }
#offline { left: 50%; top: 74px; transform: translateX(-50%); padding: 8px 14px; color: var(--warn); z-index: 6; }

/* ---------- BRB ---------- */
body.brb #top, body.brb #hint, body.brb #me, body.brb #card, body.brb #loginCard, body.brb #toasts { display: none !important; }
body.brb #ui { cursor: none; }
#brbCard { left: 24px; bottom: 24px; padding: 16px 22px; }
.brb-title { font-size: 22px; font-weight: 700; }
.brb-join { font-size: 26px; font-weight: 800; color: var(--accent-2); margin: 4px 0; }
#brbSide { right: 24px; top: 24px; width: 330px; padding: 14px 16px; }
#brbTicker div { font-size: 14px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.06); animation: tin .3s ease-out; }
#brbLists h4 { margin: 12px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
#brbLists ol { margin: 0; padding-left: 20px; }
#brbLists li { font-size: 14px; padding: 2px 0; }
#brbLists li i { float: right; font-style: normal; color: var(--muted); }

/* ---------- Pieslēgšanās lapa ---------- */
.cb-wrap { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 30%, #0e5a80, #021018); }
.cb-card { position: static; max-width: 420px; width: 100%; padding: 22px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }

@media (max-width: 760px) {
  #card { width: calc(100% - 24px); top: auto; bottom: 12px; max-height: 55%; }
  #hint, #fps { display: none; }
  #me { width: calc(100% - 24px); }
  .help { grid-template-columns: 1fr; }
  #evoOpts { grid-template-columns: 1fr; }
}
