:root {
  --bg: #0b1a24; --panel: #102536; --panel-2: #16314566; --line: #1f3b50;
  --text: #eef4f8; --muted: #93a9b8; --faint: #5d7686;
  --accent: #3d7bff; --accent-2: #2a5fd6; --live: #e5172b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  background-image: radial-gradient(120% 60% at 50% 0%, #17384f 0%, var(--bg) 60%);
  background-attachment: fixed;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.topp { display: flex; align-items: center; gap: 12px; max-width: 980px; margin: 0 auto; padding: 14px 16px 6px; }
.topp-logo { width: 40px; height: 40px; border-radius: 10px; }
.topp-navn { font-weight: 750; font-size: 19px; letter-spacing: .01em; flex: 1; }
.knapp-liten { background: var(--accent); border: 0; border-radius: 99px; padding: 8px 14px; font-size: 14px; font-weight: 600; color: #fff; }

main { max-width: 980px; margin: 0 auto; padding: 8px 16px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

/* Avspiller */
.spiller { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: grid; gap: 18px; }
.omslag { position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: 0 auto; }
.omslag img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; display: block; background: #1d3c4e; box-shadow: 0 12px 40px #0008; }
.direkte {
  position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 8px;
  background: var(--live); color: #fff; font-weight: 750; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 11px; border-radius: 99px; box-shadow: 0 4px 16px #e5172b66;
}
.prikk { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: puls 1.4s ease-in-out infinite; }
@keyframes puls { 50% { opacity: .3; } }

.info { text-align: center; min-width: 0; }
.etikett { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.tittel { font-size: 24px; line-height: 1.15; font-weight: 750; margin: 6px 0 4px; overflow-wrap: anywhere; }
.artist { font-size: 17px; color: #c6d4de; overflow-wrap: anywhere; }
.fremdrift { margin: 16px auto 0; max-width: 420px; }
.linje { height: 5px; background: #ffffff1a; border-radius: 99px; overflow: hidden; }
.stolpe { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 1s linear; }
.tider { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nedtelling { margin-top: 12px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.nedtelling b { color: var(--text); }

.kontroller { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.spill {
  width: 78px; height: 78px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; position: relative; box-shadow: 0 10px 30px #3d7bff55;
  transition: transform .12s ease, background .2s;
}
.spill:active { transform: scale(.95); }
.spill:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.spill svg { width: 34px; height: 34px; fill: currentColor; grid-area: 1 / 1; }
.ikon-stopp, .laster { display: none; }
body.t-spiller .ikon-spill, body.t-laster .ikon-spill { display: none; }
body.t-spiller .ikon-stopp { display: block; }
body.t-laster .laster {
  display: block; grid-area: 1 / 1; width: 34px; height: 34px; border-radius: 50%;
  border: 3.5px solid #ffffff55; border-top-color: #fff; animation: snurr .8s linear infinite;
}
@keyframes snurr { to { transform: rotate(360deg); } }
.status { font-size: 14px; color: var(--muted); min-height: 1.4em; text-align: center; }

.kvalitet { display: grid; gap: 8px; justify-items: center; }
.valg { display: inline-flex; background: #0a1822; border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.valg button { border: 0; background: none; padding: 7px 14px; border-radius: 99px; font-size: 14px; color: var(--muted); font-weight: 550; }
.valg button[aria-checked="true"] { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.kvalitet-info { font-size: 12.5px; color: var(--faint); text-align: center; }

/* Tips om hjemskjerm */
.tips { display: flex; gap: 12px; align-items: flex-start; background: #1a3a8a33; border: 1px solid #2a5fd666; border-radius: 16px; padding: 12px 14px; font-size: 14.5px; }
.tips > div { flex: 1; }
.del-ikon { display: inline-block; padding: 0 3px; }
.lukk { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); padding: 0 4px; }

/* Lister */
.liste-boks { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 16px 16px 8px; min-width: 0; }
.liste-boks h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 2px 4px 8px; font-weight: 650; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-top: 1px solid #ffffff0d; min-width: 0; }
.liste li:first-child { border-top: 0; }
.liste img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex: none; background: #1d3c4e; }
.liste .tekst { flex: 1; min-width: 0; }
.liste .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .a { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .tid { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; flex: none; }
.liste .tom { color: var(--faint); font-size: 14px; justify-content: center; }
.flere { display: block; width: 100%; background: none; border: 0; border-top: 1px solid #ffffff0d; color: var(--accent); font-weight: 600; font-size: 14px; padding: 12px; }

.ingen-data { text-align: center; color: var(--muted); font-size: 14px; margin: 0; }

/* Banner med siste beskjed fra studio */
.banner { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; background: linear-gradient(135deg, #1d3f8f, #16305f); border: 1px solid #2f5bc0; border-radius: 16px; padding: 12px 16px; }
.banner-etikett { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #a9c4ff; }
.banner-tekst { font-size: 15.5px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Faner */
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.faner { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px; background: #0b1a24f2; border-top: 1px solid var(--line); padding: 6px 16px calc(6px + env(safe-area-inset-bottom)); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); z-index: 10; }
.faner button { position: relative; flex: 0 1 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px 8px; border-radius: 12px; }
.faner svg { width: 24px; height: 24px; fill: currentColor; }
.faner button[aria-current="page"] { color: var(--text); background: #ffffff0f; }
.merke { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--live); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

/* Meldinger */
main.smal { max-width: 640px; }
.oppslag { list-style: none; margin: 0; padding: 0; }
.oppslag li { padding: 10px 4px; border-top: 1px solid #ffffff0d; }
.oppslag li:first-child { border-top: 0; }
.oppslag .hvem { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; display: flex; justify-content: space-between; gap: 8px; }
.oppslag .hvem b { color: #a9c4ff; font-weight: 650; }
.oppslag .hilsen .hvem b { color: #8fe0b0; }
.oppslag .tekst, .boble .tekst { white-space: pre-wrap; overflow-wrap: anywhere; }
.oppslag .tom { color: var(--faint); font-size: 14px; text-align: center; }
.skjema { display: grid; gap: 6px; padding-bottom: 16px; }
.skjema label { font-size: 13.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.skjema input, .skjema textarea { width: 100%; background: #0a1822; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; font-size: 16px; color: var(--text); resize: vertical; }
.skjema input:focus, .skjema textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.forklaring { margin: 0 4px 4px; color: #c6d4de; font-size: 14.5px; }
.send-rad { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.tegn { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.knapp { background: var(--accent); border: 0; border-radius: 99px; padding: 10px 26px; font-weight: 650; color: #fff; font-size: 15.5px; }
.knapp:disabled { opacity: .5; }
.send-status { font-size: 14px; min-height: 1.2em; }
.send-status.ok { color: #8fe0b0; }
.send-status.feil { color: #ff8a95; }
.personvern { margin: 4px 4px 0; color: var(--faint); font-size: 12.5px; }
.samtale { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 10px; }
.boble { max-width: 85%; padding: 9px 12px; border-radius: 16px 16px 4px 16px; background: #1d3f8f; align-self: flex-end; }
.boble.studio { align-self: flex-start; background: #17324a; border-radius: 16px 16px 16px 4px; }
.boble .meta { font-size: 12px; color: #ffffffa0; margin-top: 4px; }
.boble.studio .meta { color: var(--muted); }

@media (min-width: 860px) {
  main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  #fane-radio .spiller { grid-row: span 5; position: sticky; top: 16px; }
  .tips, .ingen-data, .banner { grid-column: 2; }
  main.smal { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .prikk, body.t-laster .laster { animation: none; }
  .stolpe { transition: none; }
}

/* Ønskesang */
.onske-topp { display: grid; gap: 10px; padding-bottom: 12px; }
.onske-topp h2 { margin-bottom: 0; }
.onske-status { border-radius: 12px; padding: 10px 12px; font-size: 14.5px; background: #ffffff0d; color: var(--muted); }
.onske-status.apen { background: #0f3a26; color: #a8efc6; border: 1px solid #1e6b45; }
.sok-felt { position: relative; }
.sok-felt svg { position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: var(--muted); }
.sok-felt input { width: 100%; background: #0a1822; border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 12px 40px; font: inherit; font-size: 16px; color: var(--text); }
.sok-felt input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.sok-info { color: var(--faint); font-size: 13.5px; margin: 0 4px; }
.treff li { cursor: pointer; }
.treff li:hover { background: #ffffff08; }
.onsk-knapp { background: var(--accent); border: 0; color: #fff; border-radius: 99px; padding: 7px 14px; font-weight: 650; font-size: 14px; flex: none; }
.onsk-knapp:disabled { background: #ffffff14; color: var(--faint); }
.status-merke { font-size: 12.5px; padding: 3px 9px; border-radius: 99px; flex: none; background: #ffffff10; color: var(--muted); }
.status-merke.spilt { background: #0f3a26; color: #a8efc6; }
.status-merke.lagt_inn { background: #16305f; color: #b9cfff; }
.liste .onske-navn { color: #8fe0b0; font-size: 12.5px; }
.knapp.grå { background: #ffffff14; color: var(--text); }
.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 32px)); }
.dialog::backdrop { background: #000a; }
.dialog .skjema { padding: 20px; }
.dialog h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 0 0 6px; font-weight: 650; }
.valgt-sang { display: flex; flex-direction: column; background: #0a1822; border-radius: 12px; padding: 10px 12px; }
.valgt-sang b { font-size: 17px; }
.valgt-sang span { color: var(--muted); }
.dialog-knapper { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
