:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1d22;
  --muted: #6b7280;
  --border: #e3e5e9;
  --accent: #e5652b; /* Ruter-ish orange */
  --good: #1f9d55;
  --warn: #d68a00;
  --bad: #d43c3c;
  --input: #f7f8fa;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --card: #1a1d23;
    --text: #e8eaed;
    --muted: #8b929c;
    --border: #2a2e36;
    --input: #22262d;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top { padding: 24px 24px 8px; max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 28px; }
.weather { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.weather-icon { font-size: 38px; line-height: 1; }
.weather-temp { display: block; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.weather-sub { display: block; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.top { flex-wrap: wrap; row-gap: 12px; }
/* News ticker */
.ticker {
  flex: 1 1 260px;
  min-width: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.ticker-track { display: inline-flex; white-space: nowrap; padding-left: 16px; }
.ticker-track.running { animation: ticker var(--ticker-duration, 120s) linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { color: inherit; text-decoration: none; margin-right: 32px; font-size: 14px; }
.ticker-item:hover { text-decoration: underline; }
.ticker-src {
  display: inline-block; font-size: 11px; font-weight: 700; color: #fff; border-radius: 4px;
  padding: 1px 5px; margin-right: 6px; vertical-align: 1px;
}
.src-VG { background: #d6001c; } .src-NRK { background: #00a8e1; } .src-BBC { background: #444; }
.ticker-age { color: var(--muted); font-size: 12px; margin-left: 6px; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker { overflow-x: auto; }
  .ticker-track.running { animation: none; }
}

.btc-icon { color: #f7931a; font-weight: 700; }
.up { color: var(--good); } .down { color: var(--bad); }
.temp-warm { color: var(--bad); } .temp-cold { color: #2f7fd6; }
.clock { font-size: 44px; font-weight: 600; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.date { color: var(--muted); text-transform: capitalize; }

.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 24px 0;
  max-width: 1200px;
  margin: 0 auto;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 0;
}
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 36px; font-weight: 700; line-height: 1.15; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 24px 32px;
  max-width: 1200px;
  margin: 0 auto;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  min-width: 0;
}
.card.wide { grid-column: 1 / -1; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }

input, button {
  font: inherit;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--input);
}
button { cursor: pointer; background: var(--accent); color: #fff; border-color: var(--accent); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.link-btn {
  background: none; border: none; color: var(--accent); padding: 0; margin-top: 10px;
  display: inline-block; cursor: pointer; text-decoration: none; font-size: 14px;
}

ul { list-style: none; padding: 0; margin: 0; }

/* Links */
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.links li { position: relative; }
.links a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  color: inherit; text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.links a:hover { border-color: var(--accent); }
.links img { width: 16px; height: 16px; flex: none; }
.del {
  background: none; border: none; color: var(--muted); padding: 0 4px; font-size: 16px; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.links .del { position: absolute; top: 2px; right: 2px; }
li:hover .del, .del:focus { opacity: 1; }
@media (hover: none) { .del { opacity: .6; } }

/* Tasks */
.tasks { margin-top: 12px; }
.tasks li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.tasks li:last-child { border-bottom: none; }
.tasks label { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.tasks input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.tasks li.done label { color: var(--muted); text-decoration: line-through; }

/* Metro */
.metro { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.departures { list-style: none; padding: 0; margin: 0; }
.departures li {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.departures li:last-child { border-bottom: none; }
.line {
  background: var(--accent); color: #fff; border-radius: 6px; text-align: center; font-weight: 700; padding: 2px 0;
}
.dep-main { min-width: 0; }
.dep-time { font-weight: 600; }
.dep-sub { color: var(--muted); font-size: 13px; }
.dep-in { font-weight: 600; text-align: right; }
.late { color: var(--warn); }
.cancelled { color: var(--bad); text-decoration: line-through; }

/* Traffic */
.traffic-summary { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 12px; }
.big { font-size: 32px; font-weight: 700; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: 13px; }
.legs { font-size: 14px; color: var(--muted); }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.ok { color: var(--good); } .slow { color: var(--warn); } .jam { color: var(--bad); }
.map { height: 320px; border-radius: 8px; border: 1px solid var(--border); }
.error { color: var(--bad); }

@media (max-width: 760px) {
  .ticker { flex-basis: 100%; }
  .kpis { grid-template-columns: 1fr; gap: 10px; padding: 12px 16px 0; }
  .kpi-value { font-size: 28px; }
  .grid { grid-template-columns: 1fr; padding: 12px 16px 24px; }
  .top { padding: 16px 16px 4px; }
  .metro { grid-template-columns: 1fr; gap: 16px; }
  .map { height: 240px; }
}
