:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --high: #059669;
  --mid: #65a30d;
  --low: #d97706;
  --vlow: #dc2626;
  --high-bg: #ecfdf5;
  --mid-bg: #f7fee7;
  --low-bg: #fffbeb;
  --vlow-bg: #fef2f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f14; --card: #141a21; --ink: #e5e7eb; --muted: #9ca3af; --line: #232b35;
    --accent: #2dd4bf; --accent-soft: #134e4a;
    --high-bg: #052e24; --mid-bg: #1a2e05; --low-bg: #2d1d05; --vlow-bg: #2d0a0a;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f14; --card: #141a21; --ink: #e5e7eb; --muted: #9ca3af; --line: #232b35;
  --accent: #2dd4bf; --accent-soft: #134e4a;
  --high-bg: #052e24; --mid-bg: #1a2e05; --low-bg: #2d1d05; --vlow-bg: #2d0a0a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge.demo { background: var(--low-bg); color: var(--low); }

main { max-width: 640px; margin: 0 auto; padding: 14px 16px; outline: none; }
h2 { font-size: 20px; margin: 6px 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}

.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 10px 14px; cursor: pointer; font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #042f2e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #042f2e; } }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }

input[type=text], input[type=number], input[type=password], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }

/* Glavna brojka šanse */
.hero { text-align: center; padding: 18px 14px; }
.hero .big { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.hero .words { font-size: 16px; margin-top: 6px; font-weight: 600; }
.hero .sub { margin-top: 6px; }
.tone-high { color: var(--high); } .tone-mid { color: var(--mid); }
.tone-low { color: var(--low); } .tone-vlow { color: var(--vlow); }
.bg-high { background: var(--high-bg); } .bg-mid { background: var(--mid-bg); }
.bg-low { background: var(--low-bg); } .bg-vlow { background: var(--vlow-bg); }

.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; border-radius: 99px; }
.meter > i.high { background: var(--high); } .meter > i.mid { background: var(--mid); }
.meter > i.low { background: var(--low); } .meter > i.vlow { background: var(--vlow); }

.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--bg); border-radius: 10px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 16px; }
.stat span { font-size: 12px; color: var(--muted); }

/* Par na listiću */
.leg { padding: 12px 0; border-top: 1px solid var(--line); }
.leg:first-child { border-top: 0; padding-top: 0; }
.leg .name { font-weight: 650; }
.leg .tip { font-size: 13px; color: var(--muted); }
.leg .pct { font-size: 22px; font-weight: 800; }
.leg .odd { font-size: 13px; color: var(--muted); }
.leg.weak { background: var(--vlow-bg); margin: 0 -14px; padding: 12px 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.chip.good { color: var(--high); border-color: var(--high); background: var(--high-bg); }
.chip.bad { color: var(--vlow); border-color: var(--vlow); background: var(--vlow-bg); }
.chip.info { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.note { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--bg); color: var(--muted); }
.note.warn { background: var(--low-bg); color: var(--low); }
.note.bad { background: var(--vlow-bg); color: var(--vlow); }

/* Utakmice */
.fx { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.fx:first-child { border-top: 0; }
.fx .time { width: 44px; font-weight: 700; font-size: 13px; }
.fx .teams { flex: 1; min-width: 0; }
.fx .teams div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx .lg { font-size: 12px; color: var(--muted); }
.trio { display: grid; grid-template-columns: repeat(3, 44px); gap: 4px; text-align: center; font-size: 12px; }
.trio b { display: block; font-size: 14px; }
.league-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 4px; }

.form { display: inline-flex; gap: 3px; }
.form i { width: 18px; height: 18px; border-radius: 4px; font-style: normal; font-size: 11px; font-weight: 700; display: grid; place-items: center; color: #fff; }
.form i.W { background: var(--high); } .form i.D { background: #9ca3af; } .form i.L { background: var(--vlow); }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini td, table.mini th { padding: 6px 4px; border-top: 1px solid var(--line); text-align: left; }
table.mini th { color: var(--muted); font-weight: 600; }

.search { margin-bottom: 10px; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* Donji izbornik */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; background: none; padding: 8px 0 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.tabs button .ic { font-size: 20px; filter: grayscale(1); opacity: .7; }
.tabs button.on { color: var(--accent); font-weight: 700; }
.tabs button.on .ic { filter: none; opacity: 1; }

dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100% - 24px));
  background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .dh { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
dialog .db { padding: 14px 16px; max-height: 70vh; overflow: auto; }
dialog .df { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--card); padding: 10px 14px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); z-index: 20;
}
#toast.show { opacity: 1; }

.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.empty { text-align: center; padding: 28px 10px; color: var(--muted); }
.empty .ic { font-size: 36px; }
.footer-note { font-size: 12px; color: var(--muted); text-align: center; margin: 18px 0 8px; }
.hidden { display: none !important; }
