/* Velín — alternate hub layout (docs/velin-spec.md). A control room built on the
   same data as the standard hub. Everything is scoped under #velin and gated by
   [data-layout] on <html>; the whole thing is tokenised (var(--bg/-panel/-line/
   -ink/-accent/-cat-*…)) so it rides every skin. Neon (glow, scanline) is opt-in
   per skin via --velin-fx (dark skins → 1, light → 0), defaulting to off. */

:root { --velin-fx: 0; }   /* light-safe default; dark skins raise it just below */
:root[data-skin="blueprint"], :root[data-skin="terminal"], :root[data-skin="vykres"],
:root[data-skin="catppuccin"], :root[data-skin="nord"], :root[data-skin="hud"] { --velin-fx: 1; }

/* ---- show/hide: velín replaces the standard hub, never both ----
   NOTE: this must be `grid`, not `block` — the #velin id selector outranks the
   .vn class, so `display: block` here silently overrode `.vn { display: grid }`
   and the sidebar dropped below the main column instead of beside it. */
#velin { display: none; }
html[data-layout="velin"] #velin { display: grid; }
html[data-layout="velin"] .dash,
html[data-layout="velin"] #favourites,
html[data-layout="velin"] #apps-sections,
html[data-layout="velin"] .hub > .section-head,
html[data-layout="velin"] .hub > .grid { display: none; }

/* Give the shell room — the standard hub is a narrow column, velín is wide. */
html[data-layout="velin"] .hub { max-width: 1560px; }

/* ===================== layout ===================== */
.vn {
  --vn-gap: 16px;
  font-family: var(--font-head);
  color: var(--ink);
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--vn-gap);
  align-items: start;
}
.vn * { box-sizing: border-box; }

/* ---- sidebar (the demoted rozcestník) ---- */
.vn-side {
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 12px;
}
.vn-cap {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 6px 4px;
}
.vn-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px solid transparent;
  font-size: 13px;
}
.vn-nav:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.vn-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vn-nav.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.vn-nav .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vn-nav .vn-d { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--dot, var(--ink-faint)); }
.vn-nav .vn-led { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.vn-nav.tone-ok   .vn-led { background: var(--ok); }
.vn-nav.tone-warn .vn-led { background: var(--warn); }
.vn-nav .vn-lock { margin-left: auto; font-size: 10px; opacity: 0.6; }
.vn-nav.tone-ok .vn-lock, .vn-nav.tone-warn .vn-lock { margin-left: 6px; }

/* ---- main ---- */
.vn-main { display: flex; flex-direction: column; gap: var(--vn-gap); min-width: 0; }

.vn-top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border: var(--border-w) solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 9px 16px;
}
.vn-date b { font-size: 15px; }
.vn-date span { display: block; font-size: 11px; letter-spacing: 0.08em; color: var(--ink-dim); }
.vn-sync { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: 0.12em; color: var(--ok); }
.vn-sync i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: var(--glow) var(--ok); }
.vn-weather { margin-left: auto; display: flex; align-items: baseline; gap: 8px; color: var(--ink-dim); font-size: 12px; }
.vn-weather b { font-size: 15px; color: var(--ink); }

.vn-deck {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 288px;
  gap: var(--vn-gap);
  align-items: start;
}
.vn-col { display: flex; flex-direction: column; gap: var(--vn-gap); min-width: 0; }

.vn-panel {
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px 15px;
  position: relative;
}
.vn-pcap {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim); margin: 0 0 11px;
  display: flex; align-items: center; gap: 8px;
}
.vn-pcap::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.vn-lockbadge {
  position: absolute; top: 12px; right: 14px; font-size: 10px; letter-spacing: 0.14em;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding: 1px 6px; border-radius: var(--radius);
}

/* ---- Náplň dne panel ---- */
.vn-score { display: flex; align-items: baseline; gap: 9px; }
.vn-score b { font-size: 34px; font-family: var(--font-head); letter-spacing: -0.02em; }
.vn-score .of { color: var(--ink-faint); }
.vn-score .avg { margin-left: auto; font-size: 11px; color: var(--ink-dim); }
.vn-seg { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); margin: 10px 0 0; position: relative; }
.vn-seg i { height: 100%; }
.vn-seg .s-steps { background: var(--ok); }
.vn-seg .s-games { background: var(--accent); }
.vn-seg .s-time  { background: var(--time); }
.vn-seg .s-goal  { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: 0.85; }
.vn-legend { list-style: none; margin: 11px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-dim); }
.vn-legend li { display: flex; align-items: center; gap: 8px; }
.vn-legend .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.vn-legend b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.sw-steps { background: var(--ok); } .sw-games { background: var(--accent); }
.sw-time { background: var(--time); } .sw-minus { background: var(--danger); }

/* ---- Blíží se ---- */
.vn-soon { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.vn-soon a { display: flex; gap: 10px; align-items: baseline; text-decoration: none; color: inherit; }
.vn-soon .when { flex: none; width: 58px; font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }
.vn-soon .what { color: var(--ink); }
.vn-soon .what small { display: block; color: var(--ink-faint); font-size: 11px; }

/* ---- PIN summary rows (Peníze) ---- */
.vn-pinrow { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.vn-pinrow:last-child { border-bottom: 0; }
.vn-pinrow span { color: var(--ink-dim); }
.vn-note { color: var(--ink-faint); font-size: 11px; margin: 10px 0 0; }

/* ===================== dvojče ===================== */
.vn-twin {
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(420px 420px at 50% 46%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--panel);
  padding: 13px 15px 10px;
  overflow: hidden;
}
.vn-twin-head { display: flex; align-items: center; gap: 12px; }
.vn-twin-head .vn-pcap { margin: 0; flex: 1; }
.vn-chip {
  font-size: 11px; color: var(--ink-dim); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: var(--radius); background: var(--panel-2);
}
.vn-chip b { color: var(--ink); }
/* Body in the centre, metrics flanking it in two columns — a grid, not absolute
   positioning, so nothing overlaps whatever the column width turns out to be. The
   side columns keep a floor width so the callouts never collapse to a clipped sliver. */
.vn-stage { display: grid; grid-template-columns: minmax(126px, 1fr) auto minmax(126px, 1fr); gap: 10px; align-items: center; margin-top: 4px; }
.vn-co-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vn-art { position: relative; width: clamp(220px, 100%, 340px); margin: 0 auto; }
.vn-art svg.vn-scene { display: block; width: 100%; height: auto; }
.vn-scanline { opacity: var(--velin-fx); }

.vn-co {
  border: 1px solid var(--line); background: var(--panel-2);
  border-radius: var(--radius); padding: 7px 10px; font-size: 11px; color: var(--ink-dim);
  cursor: default;
}
.vn-co:hover, .vn-co:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.vn-co > span { display: block; }
.vn-co b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.vn-co small { color: var(--ink-faint); font-size: 10px; }
.vn-co.good b { color: var(--ok); } .vn-co.bad b { color: var(--danger); }
.vn-co-col.r { text-align: right; }

/* Hover cue — a connector from the metric to the body part it belongs to, with an
   impulse running along it. Lives inside the body SVG (no cross-element pixel math),
   toggled by .on from JS on hover/focus of the matching callout. */
.vn-wire { opacity: 0; transition: opacity 0.18s ease; }
.vn-wire.on { opacity: 1; }
.vn-wire line { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 7; }
.vn-wire circle { fill: var(--accent); }
.vn-wire.on line { animation: vn-flow 0.7s linear infinite; }
.vn-wire.on circle { animation: vn-throb 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes vn-flow { to { stroke-dashoffset: -12; } }
@keyframes vn-throb { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .vn-wire.on line, .vn-wire.on circle { animation: none; }
}

/* command bar (rychlý zápis) */
.vn-cmd { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; }
.vn-cmd .cap { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faint); }
.vn-cmd button, .vn-cmd a {
  font: inherit; font-size: 12px; cursor: pointer; text-decoration: none;
  color: var(--ink); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 12px; display: inline-flex; align-items: center; gap: 7px;
}
.vn-cmd button:hover, .vn-cmd a:hover { border-color: var(--accent); color: var(--accent); }
.vn-cmd button:focus-visible, .vn-cmd a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vn-cmd .st { font-size: 11px; color: var(--ink-faint); }
.vn-cmd .st.warn { color: var(--warn); }

/* ===================== gauges ===================== */
.vn-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vn-g { border: var(--border-w) solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 12px 8px 10px; text-align: center; }
.vn-g svg { display: block; margin: 0 auto; }
.vn-g .lbl { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); margin-top: 6px; }
.vn-g .sub { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ---- Dnes vs. obvykle (reuses vitals deviation idea) ---- */
.vn-dev { display: flex; flex-direction: column; gap: 11px; }
.vn-dev-row { display: grid; grid-template-columns: 60px 1fr 54px; gap: 10px; align-items: center; font-size: 11px; }
.vn-dev-row > span { color: var(--ink-dim); }
.vn-track { position: relative; height: 6px; background: var(--line); border-radius: 3px; }
.vn-track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-faint); }
.vn-fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--ink-dim); }
.vn-fill.good { background: var(--ok); } .vn-fill.bad { background: var(--danger); }
.vn-dev-row b { text-align: right; font-variant-numeric: tabular-nums; }
.vn-dev-row b.good { color: var(--ok); } .vn-dev-row b.bad { color: var(--danger); }

/* ===================== trend ===================== */
.vn-trend svg { display: block; width: 100%; height: 116px; }

.vn-muted { color: var(--ink-faint); font-size: 12px; }

@keyframes vn-scan { 0% { transform: translateY(-8%); } 100% { transform: translateY(1200%); } }
.vn-scanline { animation: vn-scan 7s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .vn-scanline { animation: none; }
  .vn-sync i { box-shadow: none; }
}

/* ===================== responsive ===================== */
@media (max-width: 1200px) {
  .vn-deck { grid-template-columns: minmax(0, 1fr) 288px; }
  .vn-col-l { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--vn-gap); }
}
@media (max-width: 900px) {
  .vn { grid-template-columns: 1fr; }
  .vn-side { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
  .vn-cap { padding: 2px 6px; width: 100%; }
  .vn-deck { grid-template-columns: 1fr; }
}
/* Narrow / phone: the twin can't hold three columns — put the body full-width on
   top and drop the callouts into two columns beneath it. */
@media (max-width: 620px) {
  .vn-stage { grid-template-columns: 1fr 1fr; align-items: start; }
  .vn-art { order: -1; grid-column: 1 / -1; width: clamp(200px, 70%, 300px); margin-bottom: 6px; }
  .vn-co-col.r { text-align: left; }
  .vn-gauges { grid-template-columns: 1fr 1fr; }
}
