/* Forecast-based climate control: the control film (forecast page, id="kontrol").
   Dark app-window, a 3D stage with a quiet HUD; panels flow below the picture on narrow screens.
   Palette from the art direction: ink #edf0ea / #a7b1ab, rule #26302c, emerald #3ecf98, LED magenta #ff5a8e. */

.cf-sec { --cf-ink: #edf0ea; --cf-ink2: #a7b1ab; --cf-ink3: #7f8d86; --cf-rule: rgba(255, 255, 255, 0.09); --cf-glass: rgba(6, 13, 11, 0.74); --cf-em: #3ecf98; --cf-led: #ff5a8e; --cf-heat: #f2a65a; --cf-tmin: #8cc4f2; --cf-tmax: #f5914f; --cf-in: #d8f36a; }
.cf-question { margin: 14px 0 0; font-size: clamp(1.05rem, 1.4vw, 1.25rem); line-height: 1.45; color: var(--cf-ink); font-weight: 520; max-width: 40ch; }
.cf-win { font-variant-numeric: tabular-nums; }
.cf-win .aw-title { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.cf-win .aw-title > span { white-space: nowrap; }
.cf-win .aw-title b { font-weight: 600; color: var(--cf-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cf-status { margin: 0; padding: 9px 20px; font-size: 0.78rem; color: #8fa49b; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.cf-status.is-fallback { color: #f6efcf; background: linear-gradient(90deg, rgba(240, 214, 96, 0.12), rgba(240, 214, 96, 0.03)); box-shadow: inset 3px 0 0 #f0d660; font-weight: 650; }
.cf-status:empty { display: none; }

/* ---------- stage ---------- */
.cf-stage { position: relative; background: #040807; overflow: hidden; }
.cf-win[data-state='loading'] .cf-stage, .cf-win[data-state='film'] .cf-stage { aspect-ratio: 16 / 9; }
.cf-canvas { position: absolute; inset: 0; display: none; }
.cf-win[data-state='loading'] .cf-canvas, .cf-win[data-state='film'] .cf-canvas { display: block; }
.cf-canvas canvas { display: block; width: 100%; height: 100%; }
.cf-canvas .cf-fade { position: absolute; inset: 0; background: #040807; opacity: 0; pointer-events: none; transition: opacity calc(var(--dur-4, 1100ms) / 2) var(--ease-in-out, ease); }
.cf-canvas.is-cut .cf-fade { opacity: 1; }
.cf-win[data-state='loading'] .cf-canvas::after { content: ''; position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.12); border-top-color: var(--cf-em); animation: cf-spin 1s linear infinite; }
@keyframes cf-spin { to { transform: rotate(360deg); } }

/* stills: the static version (no JavaScript or no WebGL) */
.cf-stills { list-style: none; margin: 0; padding: 0; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 14px; }
.cf-win[data-state='loading'] .cf-stills, .cf-win[data-state='film'] .cf-stills { display: none; }
.cf-still { flex: 0 0 min(88%, 860px); scroll-snap-align: start; }
.cf-still figure { margin: 0; }
.cf-still img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: #0b1411; }
.cf-still figcaption { margin-top: 8px; font-size: 0.84rem; line-height: 1.45; color: var(--cf-ink2); }
.cf-still figcaption b { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: rgba(62, 207, 152, 0.16); color: var(--cf-em); font-size: 0.72rem; }
.cf-stills:empty { display: none; }

/* ---------- HUD ---------- */
.cf-hud { position: absolute; inset: 0; pointer-events: none; color: var(--cf-ink); font-size: 0.8rem; line-height: 1.35; }
.cf-hud[hidden] { display: none; }
.cf-panel { background: var(--cf-glass); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; -webkit-backdrop-filter: blur(10px) saturate(1.1); backdrop-filter: blur(10px) saturate(1.1); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.cf-tl { position: absolute; top: 14px; left: 14px; padding: 10px 14px 11px; min-width: 190px; max-width: 46%; color: var(--cf-ink); font-size: 0.8rem; line-height: 1.35; pointer-events: none; z-index: 1; }
.cf-place { margin: 0; font-weight: 700; font-size: 0.86rem; color: var(--cf-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-clock { margin: 2px 0 0; font-size: 1.9rem; font-weight: 340; letter-spacing: -0.02em; line-height: 1.05; }
.cf-clock small { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; color: var(--cf-ink2); margin-left: 8px; }
.cf-date { margin: 3px 0 0; color: var(--cf-ink2); }
.cf-run { margin: 6px 0 0; font-size: 0.72rem; color: var(--cf-ink3); }
.cf-sys { position: absolute; left: 14px; bottom: 14px; width: 248px; padding: 10px 12px; }
.cf-sys h4, .cf-side h4 { margin: 0 0 6px; font-size: 0.68rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cf-ink3); }
.cf-sys ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cf-sys li { display: grid; grid-template-columns: 9px 1fr auto; gap: 8px; align-items: center; }
.cf-sys li i { width: 9px; height: 9px; border-radius: 50%; background: #34443d; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); transition: background var(--dur-2, 320ms) var(--ease, ease); }
.cf-sys li.on i { background: var(--cf-em); }
.cf-sys li.on[data-k='led'] i { background: var(--cf-led); }
.cf-sys li.on[data-k='heater'] i { background: var(--cf-heat); }
.cf-sys li.ready[data-k='heater'] i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--cf-heat); }
.cf-sys li span { color: var(--cf-ink2); white-space: nowrap; }
.cf-sys li b { font-weight: 650; text-align: right; white-space: nowrap; }
.cf-sys .cf-bar { grid-column: 2 / 4; height: 2px; margin-top: -2px; border-radius: 2px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.cf-sys .cf-bar u { display: block; height: 100%; width: 0; background: var(--cf-em); transition: width 0.25s linear; }
.cf-sys li[data-k='led'] .cf-bar u { background: var(--cf-led); }
.cf-side { position: absolute; top: 14px; right: 14px; bottom: 14px; width: 318px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.cf-shead { display: grid; gap: 2px; }
.cf-sn { font-size: 0.68rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cf-em); }
.cf-st { margin: 0; font-size: 1.08rem; font-weight: 650; color: var(--cf-ink); }
.cf-sd { margin: 0; color: var(--cf-ink2); }
.cf-rule { margin: 0; font-size: 0.72rem; color: var(--cf-ink3); }
.cf-kv { margin: 0; display: grid; gap: 1px; }
.cf-kv > div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; padding: 2px 0; border-bottom: 1px solid var(--cf-rule); }
.cf-kv dt { color: var(--cf-ink2); font-size: 0.74rem; }
.cf-kv dt small { color: var(--cf-ink3); font-size: 0.9em; }
.cf-kv dd { margin: 0; text-align: right; font-weight: 650; font-size: 0.9rem; white-space: nowrap; }
.cf-kv dd small { font-weight: 500; font-size: 0.78em; color: var(--cf-ink2); margin-left: 3px; }
.cf-kv .cf-group { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 7px; }
.cf-gname { font-size: 0.68rem; color: var(--cf-ink3); }
.cf-house { margin: 5px 0 0; padding-left: 7px; font-size: 0.7rem; line-height: 1.4; color: var(--cf-ink2); box-shadow: inset 2px 0 0 rgba(62, 207, 152, 0.55); max-width: 40ch; }
.cf-house:empty { display: none; }
.cf-side .cf-house-side { display: none; }
.cf-sys li.na { opacity: 0.45; }
.cf-sys li.na b { font-weight: 500; }
.cf-leg i.cf-box { height: 8px; width: 10px; opacity: 0.5; }
.cf-tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.02em; color: #cfe0d8; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); white-space: nowrap; }
.cf-tag[data-k='calibrated'], .cf-tag[data-k='point'] { color: #bfe6d4; box-shadow: inset 0 0 0 1px rgba(62, 207, 152, 0.35); }
.cf-tag[data-k='normal'] { color: #f6efcf; box-shadow: inset 0 0 0 1px rgba(240, 214, 96, 0.4); }
.cf-tag[data-k='simNv'], .cf-tag[data-k='sim'] { color: #e6ecbf; box-shadow: inset 0 0 0 1px rgba(216, 243, 106, 0.32); }
.cf-tag[data-k='calc'] { color: #cfdcff; box-shadow: inset 0 0 0 1px rgba(143, 165, 255, 0.36); }
.cf-chart { margin-top: auto; }
.cf-chart h5 { margin: 0 0 2px; font-size: 0.72rem; font-weight: 700; color: var(--cf-ink); }
.cf-chart p { margin: 0 0 4px; font-size: 0.68rem; color: var(--cf-ink3); }
.cf-svg { display: block; width: 100%; height: auto; overflow: visible; }
.cf-svg .ax { font-size: 9px; fill: #84938c; }
.cf-svg .g { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.cf-svg .th { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; stroke-dasharray: 3 3; }
.cf-svg .thl { font-size: 8.5px; fill: #a7b1ab; }
.cf-svg .cur { stroke: #fff; stroke-width: 1; opacity: 0.65; }
.cf-svg .mark { fill: none; stroke: #fff; stroke-width: 1.2; opacity: 0.8; }
.cf-leg { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 3px 0 0; padding: 0; list-style: none; font-size: 0.64rem; color: var(--cf-ink2); }
.cf-leg i { display: inline-block; width: 12px; height: 2px; margin-right: 5px; vertical-align: middle; border-radius: 2px; }
.cf-note2 { margin: 0; font-size: 0.7rem; color: #f6efcf; }
.cf-mnote { margin: 0; padding: 5px 8px; border-radius: 6px; font-size: 0.7rem; line-height: 1.4; color: #e9e3c4; background: rgba(240, 214, 96, 0.07); box-shadow: inset 2px 0 0 rgba(240, 214, 96, 0.55); }

@media (min-width: 1280px) {
  .cf-side { width: 340px; }
  .cf-strip { right: 368px; }
}

/* 15-day strip (forecast and plan scenes) */
.cf-strip { position: absolute; left: 276px; right: 346px; bottom: 14px; padding: 10px 12px; opacity: 0; transform: translateY(8px); transition: opacity var(--dur-3, 600ms) var(--ease, ease), transform var(--dur-3, 600ms) var(--ease, ease); }
.cf-strip.is-on { opacity: 1; transform: none; }
.cf-strip h4 { margin: 0 0 6px; font-size: 0.68rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cf-ink3); }
.cf-days { display: grid; grid-template-columns: repeat(var(--n, 15), minmax(0, 1fr)); gap: 3px; }
.cf-d { display: grid; gap: 2px; justify-items: center; padding: 4px 0 5px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); font-size: 0.66rem; color: var(--cf-ink2); opacity: 0; transform: translateY(6px); transition: opacity 0.4s var(--ease, ease), transform 0.4s var(--ease, ease), background 0.4s var(--ease, ease); transition-delay: calc(var(--i) * 70ms); }
.cf-strip.is-on .cf-d { opacity: 1; transform: none; }
.cf-d b { color: var(--cf-ink); font-weight: 650; font-size: 0.7rem; }
.cf-d .cf-dli { width: 60%; height: 34px; display: flex; align-items: flex-end; }
.cf-d .cf-dli i { display: block; width: 100%; border-radius: 2px 2px 0 0; background: #f0d660; opacity: 0.85; }
.cf-d .cf-fz { color: var(--cf-tmin); }
.cf-d.m-frost { background: rgba(140, 196, 242, 0.14); box-shadow: inset 0 0 0 1px rgba(140, 196, 242, 0.45); }
.cf-d.m-dark { background: rgba(255, 90, 142, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 90, 142, 0.45); }
.cf-d.m-warm { background: rgba(245, 145, 79, 0.12); box-shadow: inset 0 0 0 1px rgba(245, 145, 79, 0.45); }
.cf-d.is-dim { opacity: 0.55; }
.cf-lanes { display: grid; grid-template-columns: 118px repeat(var(--n, 15), minmax(0, 1fr)); gap: 3px 3px; align-items: center; font-size: 0.66rem; }
.cf-lanes > span { color: var(--cf-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-lanes > em { font-style: normal; text-align: center; color: var(--cf-ink3); }
.cf-cell { height: 18px; border-radius: 4px; background: rgba(255, 255, 255, 0.04); display: grid; place-items: center; font-weight: 650; color: #fff; opacity: 0; transition: opacity 0.4s var(--ease, ease); transition-delay: calc(var(--i) * 50ms); }
.cf-strip.is-on .cf-cell { opacity: 1; }
.cf-cell.led { background: rgba(255, 90, 142, calc(0.15 + var(--a, 0) * 0.6)); }
.cf-cell.frost { background: rgba(140, 196, 242, 0.55); }
.cf-cell.frost.past { background: rgba(140, 196, 242, 0.16); }
.cf-cell.vent { background: rgba(62, 207, 152, 0.55); }
.cf-cell.shade { background: rgba(150, 160, 150, 0.6); }
.cf-cell.na { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 3px, transparent 3px 6px); }

/* below the stage: caption, controls, foot */
.cf-below:empty { display: none; }
.cf-caption { margin: 0; padding: 14px 20px 4px; min-height: 3.2em; font-size: 0.98rem; line-height: 1.5; color: var(--cf-ink); }
.cf-caption:empty { display: none; }
.cf-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 20px 12px; }
.cf-controls[hidden] { display: none; }
.cf-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); color: var(--cf-ink); cursor: pointer; transition: background var(--dur-1, 160ms) var(--ease, ease), border-color var(--dur-1, 160ms) var(--ease, ease); }
.cf-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.24); }
.cf-btn:focus-visible, .cf-dots button:focus-visible { outline: 2px solid var(--accent, #d8f36a); outline-offset: 2px; }
.cf-btn svg { width: 16px; height: 16px; }
.cf-play { width: 44px; height: 44px; background: var(--cf-em); border-color: transparent; color: #06140f; }
.cf-play:hover { background: #5fe0ad; }
.cf-play .i-pause { display: none; }
.cf-play[aria-pressed='true'] .i-play { display: none; }
.cf-play[aria-pressed='true'] .i-pause { display: block; }
.cf-dots { list-style: none; margin: 0 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; min-width: 0; }
.cf-dots button { position: relative; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 17px; border: 1px solid rgba(255, 255, 255, 0.1); background: transparent; color: var(--cf-ink2); font: inherit; font-size: 0.76rem; cursor: pointer; overflow: hidden; }
.cf-dots button[aria-current='step'] { color: var(--cf-ink); border-color: rgba(62, 207, 152, 0.6); background: rgba(62, 207, 152, 0.08); }
.cf-dn { font-weight: 750; color: var(--cf-em); }
.cf-dp { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--p, 0) * 100%); background: var(--cf-em); }
.cf-keys { flex-basis: 100%; margin: 2px 0 0; font-size: 0.7rem; color: var(--cf-ink3); }
.cf-foot { padding: 6px 20px 16px; display: grid; gap: 4px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.cf-foot p { margin: 0; font-size: 0.74rem; line-height: 1.5; color: var(--cf-ink3); }
.cf-foot .cf-note { margin-top: 8px; color: var(--cf-ink2); }
.cf-foot .cf-note b { font-weight: 650; }
.cf-foot [hidden] { display: none; }
.cf-table { margin: 18px 0 0; }
.cf-table table { min-width: 720px; }
.cf-live h4 { margin: 10px 14px 6px; font-size: 0.8rem; color: #cfe3d9; }
.cf-method { margin-top: 28px; max-width: 900px; }
.cf-method .h3 { color: var(--cf-ink); }
.cf-method li { color: var(--cf-ink2); }

/* ---------- narrow screens: the picture on top, the panels below it ---------- */
@media (max-width: 899px) {
  .cf-win[data-state='film'] { display: flex; flex-direction: column; }
  .cf-win[data-state='film'] > .aw-bar { order: 0; }
  .cf-win[data-state='film'] > .cf-status { order: 0; }
  .cf-win[data-state='film'] .cf-stage { display: contents; }
  .cf-win[data-state='film'] .cf-canvas { order: 1; }
  .cf-win[data-state='film'] .cf-caption { order: 2; }
  .cf-win[data-state='film'] .cf-controls { order: 3; }
  .cf-win[data-state='film'] .cf-hud { order: 4; }
  .cf-win[data-state='film'] .cf-foot { order: 5; }
  .cf-win[data-state='loading'] .cf-stage { aspect-ratio: auto; display: flex; flex-direction: column; }
  .cf-win[data-state='film'] .cf-stage { aspect-ratio: auto; }
  .cf-win[data-state='film'] .cf-canvas, .cf-win[data-state='loading'] .cf-canvas { position: relative; inset: auto; aspect-ratio: 4 / 3; flex: none; }
  .cf-hud { position: static; display: grid; gap: 8px; padding: 8px; background: #08100d; }
  .cf-tl { top: 10px; left: 10px; padding: 7px 10px 8px; min-width: 0; max-width: 70%; }
  .cf-clock { font-size: 1.35rem; }
  .cf-run { display: none; }
  .cf-tl .cf-house { display: none; }
  .cf-side .cf-house-side { display: block; margin: 0; max-width: none; }
  .cf-side, .cf-sys, .cf-strip { position: static; width: auto; inset: auto; }
  .cf-side { order: 1; max-height: none; }
  .cf-sys { order: 2; }
  .cf-sys ul { grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .cf-strip { order: 0; display: none; }
  .cf-strip.is-on { display: block; }
  .cf-lanes { grid-template-columns: 64px repeat(var(--n, 15), minmax(0, 1fr)); font-size: 0.6rem; }
  .cf-d { font-size: 0.58rem; }
  .cf-d b { font-size: 0.6rem; }
  .cf-dl { display: none; }
  .cf-dots button { padding: 0 11px; }
  .cf-caption { padding: 12px 14px 2px; font-size: 0.92rem; }
  .cf-controls { padding: 6px 14px 10px; }
  .cf-foot { padding: 6px 14px 14px; }
  .cf-keys { display: none; }
}
@media (max-width: 640px) {
  .cf-win .aw-bar { height: auto; min-height: 44px; padding: 8px 14px; gap: 10px; }
  .cf-win .aw-title { flex: 1 1 auto; min-width: 0; }
  .cf-win .aw-title > span { overflow: hidden; text-overflow: ellipsis; }
  .cf-win .aw-title b { display: none; }
  .cf-win .aw-badge { flex: none; max-width: 42%; text-align: right; line-height: 1.25; font-size: 0.6rem; }
}
@media (max-width: 520px) {
  .cf-sys ul { grid-template-columns: 1fr; }
  .cf-days { gap: 2px; }
  .cf-d .cf-dli { height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-strip, .cf-d, .cf-cell, .cf-canvas .cf-fade, .cf-sys .cf-bar u { transition: none !important; }
}
