:root {
  --bg: #0a0d14;
  --bg2: #10141e;
  --card: rgba(255, 255, 255, 0.035);
  --card-h: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8ebf2;
  --muted: #8a94a8;
  --accent: #5eead4;
  --accent2: #818cf8;
  --warn: #fbbf24;
  --bad: #f87171;
  --ok: #4ade80;
  --radius: 18px;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --nav-h: 52px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fb;
    --bg2: #ffffff;
    --card: rgba(255, 255, 255, 0.9);
    --card-h: #ffffff;
    --border: rgba(15, 23, 42, 0.09);
    --text: #0f172a;
    --muted: #64748b;
    --accent: #0d9488;
    --accent2: #4f46e5;
    --warn: #b45309;
    --bad: #dc2626;
    --ok: #15803d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); }

.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; transform: translateZ(0); will-change: transform;
  background:
    radial-gradient(1000px 520px at 5% -10%, color-mix(in srgb, var(--accent2) 22%, transparent), transparent 60%),
    radial-gradient(800px 460px at 100% -5%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 60%);
}

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- Hero ---------- */
.hero { padding: calc(44px + var(--safe-t)) 0 22px; }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 11.5px; margin: 0 0 18px; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); animation: beat 2s infinite; }
@keyframes beat { 50% { opacity: .45; } }
.label { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
h1 { margin: 0; font-size: clamp(32px, 6vw, 64px); line-height: 1.05; font-weight: 780; letter-spacing: -.02em; }
.ip {
  all: unset; cursor: pointer; font-family: var(--mono); word-break: break-all;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ip:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.summary { font-size: clamp(16px, 2.2vw, 20px); margin: 12px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { border: 1px solid var(--border); background: var(--card); padding: 5px 12px; border-radius: 999px; font-size: 13px; }
.chip.hot { border-color: color-mix(in srgb, var(--warn) 55%, transparent); color: var(--warn); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 650; font-size: 14px;
  padding: 10px 16px; border-radius: 12px; min-height: 44px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #0a0d14;
  transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; margin-top: 10px; }

/* Ocjena privatnosti */
.score-card {
  display: flex; align-items: center; gap: 18px; padding: 20px 24px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border); min-width: 300px;
}
.ring { position: relative; width: 112px; height: 112px; flex-shrink: 0; --c: var(--muted); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--border); }
.ring .bar { stroke: var(--c); stroke-linecap: round; stroke-dasharray: var(--p) 100; transition: stroke-dasharray .8s ease, stroke .3s; }
.ring-val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.ring-val strong { font-size: 32px; font-weight: 800; }
.ring-val small { color: var(--muted); font-size: 12px; margin-top: 4px; }
.score-verdict { font-weight: 700; font-size: 17px; margin: 0 0 6px; }
.link { font-size: 13px; }

/* Pločice */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.tile {
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); min-width: 0;
}
.t-ico { font-size: 22px; flex-shrink: 0; }
.tile > div { min-width: 0; }
.tile small { color: var(--muted); font-size: 12px; display: block; }
.tile b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Navigacija ---------- */
.subnav {
  position: sticky; top: 0; z-index: 50; height: calc(var(--nav-h) + var(--safe-t)); padding-top: var(--safe-t);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transform: translateZ(0);
}
.subnav-inner { display: flex; gap: 4px; align-items: center; height: var(--nav-h); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav a {
  color: var(--muted); padding: 7px 13px; border-radius: 10px; font-size: 14px; font-weight: 550; white-space: nowrap;
}
.subnav a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.subnav a.active { color: var(--text); background: var(--card-h); box-shadow: inset 0 0 0 1px var(--border); }

/* ---------- Sekcije ---------- */
.group { padding-top: 34px; }
.group > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 14px; font-weight: 650; display: flex; align-items: center; gap: 12px; }
.group > h2::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; grid-auto-flow: dense; }
.wide { grid-column: span 2; }
.full { grid-column: 1 / -1; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 14px; min-width: 0;
  transition: border-color .2s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.card h3 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 9px; font-weight: 680; }
.ico { font-size: 18px; }

dl { margin: 0; }
.row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--border); align-items: start; }
dl > .row:first-child { border-top: 0; }
dl:not(:empty) + dl:not(:empty) > .row:first-child { border-top: 1px dashed var(--border); }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; min-width: 0; }
dd > span { word-break: break-word; overflow-wrap: anywhere; }
dd.warn > span { color: var(--warn); font-weight: 600; }
dd.bad > span { color: var(--bad); font-weight: 650; }
dd.good > span { color: var(--ok); }
.copy {
  all: unset; cursor: pointer; opacity: 0; color: var(--muted); font-size: 13px; padding: 0 4px; flex-shrink: 0; transition: opacity .15s;
}
.row:hover .copy, .copy:focus-visible { opacity: 1; }
@media (hover: none) { .copy { opacity: .4; padding: 2px 6px; } }

.sk { color: var(--muted); animation: pulse 1.2s ease-in-out infinite; font-weight: 400; }

/* Rezervirano mjesto za podatke koji stižu kasnije, da se stranica ne pomiče dok skrolaš */
.reserve { min-height: calc(var(--rows, 5) * 37px); }
#dns-out { min-height: 150px; }

/* Karta na dodirnim uređajima: prst skrola stranicu dok se karta ne aktivira */
.map-lock { position: absolute; inset: auto 12px 12px auto; z-index: 500; }
.map-card { position: relative; }
@keyframes pulse { 50% { opacity: .35; } }
.note { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

/* Tablica (DNS) */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 550; font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 9px 8px; border-bottom: 1px dashed var(--border); vertical-align: top; overflow-wrap: anywhere; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.mono { font-size: 13px; }

/* Karta */
.map-card { padding: 0; overflow: hidden; min-height: 340px; display: flex; }
#map { flex: 1; min-height: 340px; z-index: 0; }
.loc-info .btn { margin-top: 12px; }

/* Oznake */
.feat { display: flex; flex-wrap: wrap; gap: 6px; }
.feat span { font-size: 12.5px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); }
.feat .y { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.feat .n { color: var(--muted); text-decoration: line-through; opacity: .65; }
.feat .p { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

/* Provjere privatnosti */
.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.checks li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.checks li small { display: block; color: var(--muted); font-size: 12.5px; }
.checks .st { font-size: 15px; line-height: 1.3; }
.checks .pts { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.checks li.pass .st { color: var(--ok); }
.checks li.fail .st { color: var(--bad); }
.checks li.wait .st { color: var(--muted); }

/* Brzina */
.speed-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.gauge { padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 40%, transparent); }
.gauge small { color: var(--muted); display: block; font-size: 12.5px; }
.gauge b { font-size: clamp(26px, 4vw, 40px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.gauge span { color: var(--muted); font-size: 13px; margin-left: 4px; }
.progress { height: 6px; border-radius: 99px; background: var(--border); margin: 16px 0; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .25s; }
.speed-foot { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.speed-foot .note { margin: 0; }

pre.mono { white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--border); font-size: 13px; }
.mono-dl dd, .mono-dl dt { font-family: var(--mono); font-size: 12.5px; }
details summary { cursor: pointer; color: var(--accent); min-height: 32px; font-weight: 600; }
details[open] summary { margin-bottom: 8px; }

.foot { color: var(--muted); font-size: 13px; padding-top: 30px; padding-bottom: calc(30px + var(--safe-b)); }
.foot p { margin: 4px 0; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--bg2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px;
  opacity: 0; transition: .2s; pointer-events: none; z-index: 1000; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Tablet ---------- */
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wide { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .score-card { min-width: 0; }
  .checks { grid-template-columns: 1fr; }
  .speed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobitel / WebView ---------- */
@media (max-width: 600px) {
  :root { --nav-h: 48px; --radius: 15px; }
  body { font-size: 14.5px; }
  .wrap { padding: 0 14px; }
  .hero { padding-top: calc(24px + var(--safe-t)); }
  .eyebrow { margin-bottom: 12px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
  .tile { padding: 11px; gap: 9px; }
  .t-ico { font-size: 18px; }
  .tile b { font-size: 13.5px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .wide, .full { grid-column: auto; }
  .row { grid-template-columns: 1fr; gap: 1px; }
  .actions .btn { flex: 1 1 auto; }
  .card { padding: 14px; }
  .ring { width: 92px; height: 92px; }
  .ring-val strong { font-size: 26px; }
  .score-card { padding: 16px; gap: 14px; }
  .map-card, #map { min-height: 240px; }
  .group { padding-top: 26px; }
  .subnav a { padding: 6px 11px; font-size: 13.5px; }
  .gauge { padding: 12px; }
  .reserve { min-height: calc(var(--rows, 5) * 46px); }
}

/* JS dodaje ovu klasu u webviewu / in-app pregledniku */
.is-webview .hero { padding-top: calc(16px + var(--safe-t)); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- Što ne valja ---------- */
.issues-card { border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.issues-sum { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.issues-sum.bad { color: var(--bad); }
.issues-sum.warn { color: var(--warn); }
.issues-sum.ok { color: var(--ok); }
.issues { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
.issues.reserve { min-height: calc(var(--rows, 4) * 52px); }
.issues li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 12px 0; border-top: 1px dashed var(--border); }
.issues .sev {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-content: center; font-size: 12px; font-weight: 800;
  color: var(--muted); background: color-mix(in srgb, var(--muted) 15%, transparent);
}
.issues li.bad .sev { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.issues li.warn .sev { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.issues b { display: block; font-size: 15px; }
.issues li.bad b { color: var(--bad); }
.issues p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.issues p.fix { color: var(--text); }
.issues p.fix span { color: var(--accent); font-weight: 650; }

dl.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; align-content: start; }
dl.cols2 > .row, dl.cols2 > .row:first-child { border-top: 0; border-bottom: 1px dashed var(--border); }

@media (max-width: 860px) {
  .issues, dl.cols2 { grid-template-columns: 1fr; }
}
