:root {
  --bg: #f7f8fc;
  --bg2: #ffffff;
  --bg3: #f0f2f8;
  --border: #e2e6f0;
  --text: #1a2035;
  --text-dim: #4f5a76;      /* 6,8:1 na bílé */
  --text-dimmer: #5f6b86;   /* 5,4:1 na bílé, 4,7:1 na --bg3 */
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --green: #16a34a;         /* grafika, velké číslice */
  --green-text: #15803d;    /* malý text (≥ 4,5:1) */
  --green-light: #f0fdf4;
  --green-mid: #dcfce7;
  --yellow: #d97706;
  --yellow-text: #b45309;
  --red: #dc2626;
  --red-text: #b91c1c;
  --violet: #7c3aed;
  --violet-text: #6d28d9;
  --sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1060px; margin: 0 auto; padding: 0 24px; }
.num-tab { font-variant-numeric: tabular-nums; }
.icon { width: 1.1em; height: 1.1em; flex-shrink: 0; }
[hidden] { display: none !important; }

/* NAV */
nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1060px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; height: 60px;
}
.logo { font-size: 1.2rem; font-weight: 800; color: var(--accent); text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--text-dimmer); font-weight: 400; }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a { color: var(--text-dim); text-decoration: none; font-size: 0.9rem; font-weight: 600; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }
.nav-toggle {
  display: none; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: var(--sans); font-size: 0.85rem; font-weight: 700;
  padding: 8px 12px; min-height: 40px; cursor: pointer;
}
@media (max-width: 600px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg2);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 14px 24px; font-size: 1rem; }
}

/* HERO */
.hero { padding: 56px 0 40px; text-align: center; }

.live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-light); color: var(--green-text);
  font-size: 0.82rem; font-weight: 700;
  padding: 6px 14px; border-radius: 100px; margin-bottom: 20px;
  border: 1px solid var(--green-mid);
}
.live-dot {
  width: 7px; height: 7px; background: var(--green);
  border-radius: 50%; flex-shrink: 0;
}
#countdown { font-variant-numeric: tabular-nums; }

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 12px;
}
.hero h1 span { color: var(--accent); }
.hero-sub { color: var(--text-dim); font-size: 1.05rem; font-weight: 400; margin-bottom: 36px; }

/* PRICE CARDS */
.price-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 32px; }
.price-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow); text-align: left;
}
.card-label { font-size: 0.75rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-value { font-size: 2.2rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.card-value.green  { color: var(--green); }
.card-value.yellow { color: var(--yellow-text); }
.card-value.red    { color: var(--red); }
.card-unit { font-size: 0.8rem; color: var(--text-dim); font-weight: 500; }
.card-sub  { font-size: 0.78rem; color: var(--text-dimmer); margin-top: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Karta "Aktuální": barva a štítek podle stavu ceny */
.price-card.current { border-color: var(--accent); background: var(--accent-light); }
.price-card.current .card-value { color: var(--accent); }
.status-badge { text-transform: none; letter-spacing: 0; font-size: 0.75rem; font-weight: 800; padding: 2px 10px; border-radius: 100px; background: var(--bg2); }
.price-card.current.st-cheap { border-color: #86efac; background: var(--green-light); }
.price-card.current.st-cheap .card-value, .st-cheap .status-badge { color: var(--green-text); }
.price-card.current.st-avg { border-color: #fcd34d; background: #fffbeb; }
.price-card.current.st-avg .card-value, .st-avg .status-badge { color: var(--yellow-text); }
.price-card.current.st-exp { border-color: #fca5a5; background: #fef2f2; }
.price-card.current.st-exp .card-value, .st-exp .status-badge { color: var(--red-text); }
.price-card.current.st-neg { border-color: #c4b5fd; background: #f5f3ff; }
.price-card.current.st-neg .card-value, .st-neg .status-badge { color: var(--violet-text); }

/* CHART */
.chart-section {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 28px 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.chart-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.chart-title { font-size: 1rem; font-weight: 700; }
.chart-subtitle { font-size: 0.82rem; color: var(--text-dim); margin-top: 2px; }
.day-toggle, .planner-toggle {
  display: flex; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px; gap: 2px;
}
.day-toggle button, .planner-toggle button {
  background: none; border: none; color: var(--text-dim);
  font-family: var(--sans); font-size: 0.85rem; font-weight: 600;
  padding: 7px 18px; min-height: 36px; cursor: pointer; border-radius: 8px; transition: background 0.18s, color 0.18s;
}
.day-toggle button.active, .planner-toggle button.active { background: var(--bg2); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.day-toggle button:disabled, .planner-toggle button:disabled { opacity: 0.45; cursor: default; }
.chart-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.chart-wrap { position: relative; height: 280px; }
.price-table-wrap { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.price-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.price-table th { position: sticky; top: 0; background: var(--bg3); color: var(--text-dim); font-weight: 700; text-align: right; padding: 8px 12px; font-size: 0.78rem; }
.price-table th:first-child, .price-table td:first-child { text-align: left; }
.price-table td { padding: 6px 12px; border-top: 1px solid var(--border); text-align: right; }
.price-table tr.now td { background: var(--accent-light); font-weight: 700; }
.p-cheap { color: var(--green-text); }
.p-avg { color: var(--yellow-text); }
.p-exp { color: var(--red-text); }
.p-neg { color: var(--violet-text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.chart-legend { display: flex; gap: 20px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-dim); font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.cheap { background: var(--green); }
.legend-dot.avg { background: var(--yellow); }
.legend-dot.exp { background: var(--red); }
.legend-dot.neg { background: var(--violet); }
.chart-more { display: block; text-align: center; margin-top: 12px; font-size: 0.85rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.chart-more:hover { text-decoration: underline; }

/* TOMORROW BLOCK */
.tomorrow-block {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 28px;
  box-shadow: var(--shadow); margin-bottom: 20px; display: none;
}
.tomorrow-block.visible { display: block; }
.tomorrow-title { font-size: 0.9rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 16px; }
.tomorrow-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tomorrow-card { background: var(--bg3); border-radius: 10px; padding: 14px 16px; }
.t-label { font-size: 0.72rem; font-weight: 700; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.t-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.t-value.green { color: var(--green-text); }
.t-value.red { color: var(--red-text); }
.t-value.yellow { color: var(--yellow-text); }
.t-unit  { font-size: 0.78rem; color: var(--text-dim); }
.t-sub   { font-size: 0.75rem; color: var(--text-dimmer); font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* PLÁNOVAČ */
.best-block {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow); margin-bottom: 40px;
}
.best-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 20px;
}
.best-title { font-size: 1rem; font-weight: 700; }
.best-subtitle { font-size: 0.82rem; color: var(--text-dim); margin-top: 2px; }
.best-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.hours-slider-wrap {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 16px;
}
.hours-slider-wrap label { font-size: 0.82rem; font-weight: 700; color: var(--text-dim); white-space: nowrap; }
.hours-slider-wrap input[type=range] { width: 120px; accent-color: var(--accent); cursor: pointer; }
.hours-value { font-size: 0.95rem; font-weight: 800; color: var(--accent); min-width: 36px; text-align: center; }

.best-result {
  background: var(--green-light); border: 1px solid var(--green-mid);
  border-radius: 12px; padding: 20px 24px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.best-result-label { font-size: 0.78rem; font-weight: 700; color: var(--green-text); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.best-result-time { font-size: 1.6rem; font-weight: 800; color: var(--green-text); letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.best-result-desc { font-size: 0.85rem; color: var(--text-dim); margin-top: 4px; }
.best-result-avg { text-align: right; }
.best-result-avg-label { font-size: 0.75rem; color: var(--text-dimmer); font-weight: 600; margin-bottom: 2px; }
.best-result-avg-value { font-size: 1.8rem; font-weight: 800; color: var(--green-text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.best-result-avg-unit { font-size: 0.8rem; color: var(--text-dim); }

.best-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.best-slot {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px;
  font-size: 0.8rem; font-weight: 700; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
}
.best-slot.highlight { background: var(--green-light); border-color: var(--green-mid); color: var(--green-text); }
.slot-price { font-size: 0.75rem; color: var(--text-dimmer); font-weight: 600; }
.best-slot.highlight .slot-price { color: var(--green-text); }

/* SECTIONS */
.section { margin-bottom: 56px; }
.section-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 6px; }
.section-title { font-size: clamp(1.4rem, 2.5vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.section-desc { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 28px; max-width: 560px; }

.doc-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); font-weight: 700; font-size: 0.9rem;
  text-decoration: none; margin-top: 20px;
  padding: 10px 18px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg2);
  box-shadow: var(--shadow); transition: border-color 0.2s, background 0.2s;
}
.doc-link:hover { border-color: var(--accent); background: var(--accent-light); }

/* API CARDS */
.api-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.api-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.api-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.api-card-title .icon { color: var(--accent); }
.api-card p { font-size: 0.875rem; color: var(--text-dim); margin-bottom: 16px; line-height: 1.55; }
.endpoint {
  background: var(--bg3); border-radius: 8px; padding: 9px 14px;
  font-family: var(--mono); font-size: 0.78rem; color: var(--text);
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px; overflow-wrap: anywhere;
}
.method { font-weight: 700; color: var(--accent); flex-shrink: 0; font-size: 0.72rem; }
.method.sub { color: var(--green-text); }

/* CODE */
.code-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.code-tab {
  background: var(--bg3); border: 1px solid var(--border); border-bottom: none;
  color: var(--text-dim); font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  padding: 9px 18px; cursor: pointer; border-radius: 10px 10px 0 0; transition: background 0.15s, color 0.15s;
}
.code-tab.active { background: var(--bg2); color: var(--accent); }
.code-block { background: var(--bg2); border: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.code-block pre { padding: 24px 28px; font-family: var(--mono); font-size: 0.82rem; line-height: 1.75; color: var(--text); overflow-x: auto; }
.kw  { color: #7c3aed; font-weight: 600; }
.fn  { color: #1d4ed8; }
.str { color: #15803d; }
.num { color: #b45309; }
.cmt { color: var(--text-dimmer); font-style: italic; }

/* FOOTER */
footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 32px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
.footer-logo { font-size: 1rem; font-weight: 800; color: var(--accent); }
.footer-logo span { color: var(--text-dimmer); font-weight: 400; }
.footer-text { font-size: 0.8rem; color: var(--text-dimmer); }
.footer-text a { color: var(--text-dim); text-decoration: none; font-weight: 600; }
.footer-text a:hover { color: var(--accent); }

/* RESPONSIVE */
#planovac, #api, #vyvojari { scroll-margin-top: 80px; }

@media (max-width: 640px) {
  .hero { padding: 20px 0 24px; }
  .hero h1 { font-size: 1.5rem; margin-bottom: 16px; }
  .hero h1 br, .hero h1 span, .hero-sub { display: none; }
  .live-badge { margin-bottom: 14px; }
  .chart-section { padding: 18px 16px 16px; }
  .chart-wrap { height: 220px; }
  .chart-controls { width: 100%; justify-content: space-between; }
  .day-toggle button { padding: 7px 12px; }
  .price-table td, .price-table th { padding: 6px 8px; }
  .price-cards { grid-template-columns: 1fr 1fr; }
  .best-block { padding: 20px 16px; }
  .best-result { flex-direction: column; text-align: center; }
  .best-result-avg { text-align: center; }
}
@media (max-width: 400px) { .price-cards { grid-template-columns: 1fr; } }

/* ANIMACE — jen posun, obsah je vidět i když animace neproběhne */
@media (prefers-reduced-motion: no-preference) {
  .fade-up { animation: fadeUp 0.45s ease both; }
  .fade-up:nth-child(2) { animation-delay: 0.06s; }
  .fade-up:nth-child(3) { animation-delay: 0.12s; }
  .fade-up:nth-child(4) { animation-delay: 0.18s; }
  .live-dot { animation: pulse 2s infinite; }
}
@keyframes fadeUp { from { transform: translateY(8px); } to { transform: none; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
