:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #16150f;
  --muted: #6b6559;
  --line: #e0dbd1;
  --accent: #1f6f4a;
  --cheap: #1f6f4a;
  --normal: #8a6d1f;
  --expensive: #a8321f;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --surface: #1d1c17;
    --ink: #f2efe7;
    --muted: #a49c8c;
    --line: #33312a;
    --accent: #6ecf9a;
    --cheap: #6ecf9a;
    --normal: #dbb551;
    --expensive: #f08a72;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}
.bar h1 { font-size: 18px; margin: 0; letter-spacing: -0.2px; }
.bar-meta { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }

h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 32px 0 10px; }
section:first-child h2 { margin-top: 0; }

.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--expensive); font-weight: 600; }

/* --- Hero ---------------------------------------------------------------- */

.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

/* The verdict is the hero element. "Cheapest 10% of the week" means something
   to a person in their kitchen; "1.87 kr/kWh" does not. */
.verdict {
  font-size: clamp(40px, 12vw, 64px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}
.verdict[data-verdict="cheap"] { color: var(--cheap); }
.verdict[data-verdict="normal"] { color: var(--normal); }
.verdict[data-verdict="expensive"] { color: var(--expensive); }

.hero-price { margin-top: 10px; font-size: 26px; font-weight: 600; }
.hero-price .unit { font-size: 15px; font-weight: 400; color: var(--muted); }

/* --- Callouts ------------------------------------------------------------ */

.callout {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 17px;
}
.callout strong { font-size: 19px; }

.banner {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--expensive);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  margin-bottom: 16px;
}

.note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* --- Chart --------------------------------------------------------------- */

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
#chart { width: 100%; height: 220px; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend span::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  background: currentColor;
}
.legend .k-cheap { color: var(--cheap); }
.legend .k-normal { color: var(--normal); }
.legend .k-expensive { color: var(--expensive); }
.legend .k-now { color: var(--ink); }

/* --- Forms --------------------------------------------------------------- */

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row label { font-size: 14px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 6px; }

input, select, button {
  font: inherit;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
input[type="number"] { width: 110px; }
#address-input { width: 100%; }

button {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}
button:hover { opacity: 0.88; }
button.ghost { background: transparent; color: var(--muted); border-color: var(--line); font-weight: 500; }
button.danger { color: var(--expensive); }

.field { position: relative; }
.results {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 260px;
  overflow-y: auto;
}
.results li { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.results li:last-child { border-bottom: none; }
.results li:hover, .results li[aria-selected="true"] { background: var(--bg); }

/* --- Recommendation ------------------------------------------------------ */

.recommendation {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.recommendation .headline { font-size: 20px; font-weight: 700; }
.recommendation .savings { color: var(--cheap); font-weight: 700; }
.recommendation ul { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.recommendation.infeasible .headline { color: var(--expensive); }

.footer-note { margin-top: 32px; }
a { color: inherit; }
