/* Én kolonne, telefon først. Farverne følger billedernes salviegrøn og creme. */
:root {
  --bg: #f3f0e8; --surface: #fffdf8; --fg: #1f2a24; --muted: #6b766f; --line: #e1ddd2;
  --accent: #2f6f55; --accent-fg: #ffffff; --soft: #dfe9e2; --warn: #9a5420; --danger: #b3382c;
  --head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a16; --surface: #1a241f; --fg: #e6eee9; --muted: #9caea4; --line: #2a3832;
    --accent: #74c49d; --accent-fg: #0f1a14; --soft: #233a2f; --warn: #e3a06b; --danger: #ef7d70;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 17px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.side { max-width: 600px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 140px max(16px, env(safe-area-inset-left)); }

/* Topbjælke */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); display: grid; grid-template-columns: minmax(48px, auto) 1fr minmax(48px, auto); gap: 4px; align-items: center; min-height: 60px; border-bottom: 1px solid var(--line); margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))); padding: 0 8px; }
.top h1 { margin: 0; text-align: center; font-family: var(--head); font-size: 1.45rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ikon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 1.35rem; color: var(--muted); }
.ikon:active { background: var(--soft); }
.tekstknap { color: var(--accent); font-weight: 600; font-size: .95rem; padding: 8px; }

/* Forside */
.hero { padding: 28px 0 8px; }
.hero h1 { font-family: var(--head); font-size: 2.2rem; margin: 0; line-height: 1.1; }
.hero p { margin: 6px 0 0; color: var(--muted); }
.kort-liste { display: grid; gap: 14px; margin-top: 20px; }
.kort { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 12px; text-align: left; width: 100%; }
.kort:active { transform: scale(.99); }
.kort h2 { margin: 0; font-family: var(--head); font-size: 1.35rem; }
.kort .meta { color: var(--muted); font-size: .8rem; letter-spacing: .06em; font-weight: 600; }
.kort .beskr { color: var(--muted); font-size: .92rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stak { display: flex; }
.stak img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); margin-left: -10px; background: var(--soft); }
.stak img:first-child { margin-left: 0; }
.stak span { margin-left: 6px; align-self: center; color: var(--muted); font-size: .85rem; }
.ny { border: 2px dashed var(--line); border-radius: 18px; padding: 18px; color: var(--accent); font-weight: 600; width: 100%; }
.stilvalg { display: flex; align-items: center; gap: 6px; }
.stilvalg button { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; background: var(--surface); font-weight: 600; font-size: .85rem; color: var(--muted); }
.stilvalg button.valgt { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.fod { margin-top: 28px; color: var(--muted); font-size: .85rem; display: grid; gap: 8px; justify-items: start; }

/* Rutine */
.intro { text-align: center; padding: 22px 0 18px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.intro .meta { color: var(--muted); font-weight: 700; letter-spacing: .06em; }
.intro p { margin: 0; }
.felt { display: grid; gap: 4px; text-align: left; }
.felt label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.felt input, .felt textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.felt textarea { min-height: 70px; resize: vertical; }
.raekker { list-style: none; margin: 0; padding: 8px 0 0; display: grid; }
.raekke { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 10px 0; }
.raekke.red { grid-template-columns: 64px 1fr auto; }
.rund { position: relative; width: 64px; height: 64px; }
.rund img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--soft); }
.rund .skift { position: absolute; top: -2px; right: -4px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: .75rem; }
.navn { min-width: 0; }
.navn b { display: block; font-weight: 500; font-size: 1.05rem; }
.navn small { color: var(--muted); }
.tid { display: flex; align-items: center; gap: 4px; }
.tid output { min-width: 3.2em; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.rundknap { width: 38px; height: 38px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 6px rgb(0 0 0 / .1); display: grid; place-items: center; font-size: 1.2rem; color: var(--muted); }
.rundknap:active { background: var(--soft); }
.rundknap:disabled { opacity: .35; }
.red-knapper { display: flex; gap: 4px; }
.slet { color: var(--danger); }
.tilfoej { margin-top: 12px; width: 100%; padding: 14px; border-radius: 14px; border: 2px dashed var(--line); color: var(--accent); font-weight: 600; }
.handlinger { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.knap { border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 10px 18px; font-weight: 600; }
.knap.fare { color: var(--danger); border-color: var(--danger); }
.tom { text-align: center; color: var(--muted); padding: 28px 0; }

.bund { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 24px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: linear-gradient(to bottom, transparent, var(--bg) 35%); }
.bund > div { max-width: 600px; margin: 0 auto; }
.start { width: 100%; background: var(--accent); color: var(--accent-fg); border-radius: 999px; padding: 18px; font-weight: 700; font-size: 1.1rem; letter-spacing: .06em; }
.start:disabled { opacity: .4; }

/* Vælg øvelse */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .4); display: grid; align-items: end; }
.sheet .panel { background: var(--bg); border-radius: 20px 20px 0 0; max-height: 85dvh; overflow: auto; padding: 8px max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); max-width: 640px; width: 100%; margin: 0 auto; }
.sheet .panel header { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -8px; background: var(--bg); padding: 10px 0; }
.sheet h2 { margin: 0; font-family: var(--head); }
.valg { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.valg button { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.valg img { aspect-ratio: 16/9; object-fit: cover; width: 100%; background: #f8f2e6; }
.valg span { display: block; padding: 8px 10px; font-weight: 500; font-size: .92rem; line-height: 1.25; }
.valg small { display: block; color: var(--muted); font-weight: 400; }

/* Afspiller */
.spil { max-width: 600px; margin: 0 auto; min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr auto; padding: 0 max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.spil .top { position: static; }
.billede { background: #f8f2e6; border-radius: 18px; overflow: hidden; aspect-ratio: 16/9; margin-top: 12px; }
.billede img { width: 100%; height: 100%; object-fit: cover; animation: ind .35s ease; }
@keyframes ind { from { opacity: .2; } }
.info { padding: 16px 0 0; display: grid; gap: 8px; align-content: start; }
.trin { color: var(--muted); font-size: .8rem; letter-spacing: .08em; font-weight: 700; text-transform: uppercase; }
.info h2 { margin: 0; font-family: var(--head); font-size: 1.8rem; line-height: 1.1; }
.sidelabel { color: var(--accent); font-weight: 700; }
.cues { margin: 4px 0 0; padding-left: 1.1em; display: grid; gap: 3px; color: var(--fg); }
.note { color: var(--warn); font-size: .9rem; margin: 0; }
.ur { display: grid; gap: 10px; padding-top: 12px; }
.ur .tal { font-family: var(--head); font-size: 4.2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; text-align: center; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.bar.lille { height: 4px; }
.naeste { color: var(--muted); font-size: .9rem; text-align: center; }
.styr { display: grid; grid-template-columns: 64px 1fr 64px; gap: 12px; align-items: center; margin-top: 6px; }
.styr .rundknap { width: 64px; height: 64px; font-size: 1.4rem; }
.styr .start { padding: 20px; }
.faerdig { text-align: center; display: grid; gap: 14px; place-content: center; padding: 40px 0; }
.faerdig h2 { font-family: var(--head); font-size: 2.2rem; margin: 0; }

.opdatering { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 30; background: var(--fg); color: var(--bg); border-radius: 999px; padding: 12px 18px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .billede img { animation: none; } }
