:root {
  --bg: #0d0b09;
  --bg-2: #17130f;
  --panel: #1e1813;
  --line: #33291f;
  --ink: #f3ead9;
  --muted: #a1907a;
  --accent: #ff8a1f;
  --accent-2: #ffd166;
  --win: #58d68d;
  --lose: #e74c3c;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  background-image:
    radial-gradient(1200px 500px at 50% -10%, rgba(255, 138, 31, 0.12), transparent 70%),
    radial-gradient(800px 400px at 100% 100%, rgba(255, 209, 102, 0.06), transparent 70%);
}

a { color: var(--accent-2); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

header.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 11, 9, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo b { color: var(--accent); }
.logo .tusk { font-size: 22px; }

.top nav {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.pill {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
  text-decoration: none;
}
.pill.live { color: var(--accent-2); border-color: rgba(255, 209, 102, 0.35); }

button, .btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #23180c;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:hover:not(:disabled), .btn:hover { filter: brightness(1.08); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.danger { background: linear-gradient(180deg, #ff7a6b, #e74c3c); color: #fff; }
button.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}
@media (min-width: 900px) {
  .grid.two { grid-template-columns: 1fr 340px; align-items: start; }
}

h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -0.6px; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.2px; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
p.lead { color: var(--muted); margin: 0 0 18px; line-height: 1.55; }

/* --- widok kamery --- */

.stage {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
}
.stage video, .stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stage video { transform: scaleX(-1); }
.stage canvas { pointer-events: none; }
.stage.dual { aspect-ratio: auto; }

.readout {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(13, 11, 9, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-variant-numeric: tabular-nums;
}
.readout .big {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  color: var(--accent-2);
}
.readout .big small { font-size: 15px; color: var(--muted); font-weight: 700; }
.readout .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.hint {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  background: rgba(231, 76, 60, 0.92);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.hint.ok { background: rgba(88, 214, 141, 0.9); color: #06210f; }
.hint:empty { display: none; }

.qbar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 8px;
  height: 96px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.qbar i {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, var(--lose), var(--accent), var(--win));
  transition: height 0.2s ease;
}

/* --- formularze --- */

label.field {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
label.field span { display: block; margin-bottom: 5px; }
input[type='text'], input[type='number'], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 138, 31, 0.5); outline-offset: 1px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }

.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.stat-row span:first-child { color: var(--muted); }
.stat-row span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
td.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.tiny { font-size: 12px; line-height: 1.5; }
.center { text-align: center; }
.spacer { height: 14px; }
