:root {
  --paper: #f3ecd9;
  --paper-2: #e9dfc6;
  --ink: #1c1614;
  --muted: #7a6b5d;
  --red: #c9302a;
  --pink: #ec8f78;
  --phosphor: #8dffb0;
  --side-w: 360px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Rubik', system-ui, sans-serif;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  overflow: hidden;
}

/* ---------- sidebar ---------- */
.side {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 22px 20px;
  border-right: 3px solid var(--ink);
  background:
    radial-gradient(circle at 1px 1px, rgba(28, 22, 20, .08) 1px, transparent 0) 0 0 / 14px 14px,
    var(--paper);
  z-index: 2;
}
.logo {
  font-weight: 900;
  font-size: 54px;
  line-height: .9;
  letter-spacing: -2px;
  color: var(--ink);
}
.logo span { color: var(--red); }
.logo.small { font-size: 40px; }
.tag {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.channels { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 26px; }
.label {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--muted);
  margin-bottom: 8px;
}
#list {
  list-style: none;
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
  scrollbar-width: thin;
}
#list li + li { margin-top: 10px; }
.item {
  width: 100%;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fffaf0;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 7px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.item:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.item:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.item.on { background: var(--red); color: #fff; }
.item.on .credit { color: #ffd9cf; }
.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px / 10px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--pink), var(--red));
  border: 2px solid var(--ink);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.85) contrast(1.05); }
.thumb::after {               /* scanlines */
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
}
.ch-num {
  position: absolute; left: 5px; top: 2px; z-index: 1;
  font-family: 'VT323', monospace; font-size: 18px;
  color: var(--phosphor); text-shadow: 0 0 4px rgba(0,0,0,.9);
}
.title { display: block; font-weight: 700; font-size: 16px; line-height: 1.15; }
.credit { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.year { display: block; font-family: 'VT323', monospace; font-size: 17px; margin-top: 2px; }

.now {
  margin-top: 14px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
}
.now-meta { display: flex; gap: 10px; align-items: baseline; white-space: nowrap; overflow: hidden; }
.ch { font-family: 'VT323', monospace; font-size: 22px; color: var(--phosphor); }
.now-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; gap: 6px; margin-top: 8px; }
.controls button {
  flex: 1;
  font: 600 14px 'Rubik', sans-serif;
  padding: 7px 0;
  border-radius: 8px;
  border: 1.5px solid var(--paper);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
}
.controls button:hover { background: var(--paper); color: var(--ink); }

.foot {
  display: flex; justify-content: space-between;
  margin-top: 16px; font-size: 13px; color: var(--muted);
}
.foot a { color: var(--ink); font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--red); }

/* ---------- stage ---------- */
.stage { position: relative; height: 100vh; min-width: 0; background: #2a1d17; }
#scene { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#scene.drag { cursor: grabbing; }
.hint {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px;
  background: rgba(28, 22, 20, .72); color: var(--paper);
  font-size: 13px; letter-spacing: .02em; pointer-events: none;
  transition: opacity .6s;
}
.hint.gone { opacity: 0; }

.loader {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--paper); transition: opacity .8s; z-index: 3;
}
.loader.done { opacity: 0; pointer-events: none; }
.loader-inner { text-align: center; }
.bar { width: 220px; height: 12px; margin: 18px auto 10px; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
#loadText { font-family: 'VT323', monospace; font-size: 20px; color: var(--muted); }

/* ---------- phones ---------- */
@media (max-width: 820px) {
  body { grid-template-columns: 1fr; grid-template-rows: 58vh 1fr; overflow: auto; height: auto; }
  .stage { grid-row: 1; height: 58vh; }
  .side { grid-row: 2; height: auto; min-height: 42vh; border-right: 0; border-top: 3px solid var(--ink); padding: 18px 16px; }
  .brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .logo { font-size: 38px; }
  .tag { margin-top: 0; }
  #list { overflow: visible; }
  .channels { margin-top: 14px; }
}

/* YouTube layer sits under the transparent hole in the TV glass */
.css3d { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.css3d * { pointer-events: none; }
#scene { position: relative; z-index: 1; }
.yt { background: #000; position: relative; overflow: hidden; }
.yt-inner { position: absolute; top: 0; }
.yt iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- section tabs ---------- */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 20px; }
.tabs button {
  font: 700 13px 'Rubik', sans-serif;
  padding: 9px 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.tabs button.on { background: var(--ink); color: var(--paper); box-shadow: none; transform: translate(2px, 2px); }
.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 18px; }
.panel[hidden] { display: none; }
.panel .channels { margin-top: 0; }
.blurb { font-size: 14px; color: var(--muted); line-height: 1.4; }

.pager { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 10px; }
.pager button {
  width: 44px; height: 36px; font: 700 22px 'Rubik', sans-serif;
  border: 2px solid var(--ink); border-radius: 10px; background: #fffaf0; cursor: pointer;
}
.pager span { font-family: 'VT323', monospace; font-size: 22px; }
.stills-grid { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; overflow-y: auto; }
.stills-grid button { display: block; width: 100%; padding: 0; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; cursor: pointer; background: #000; aspect-ratio: 3 / 2; }
.stills-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stills-grid button.on { outline: 3px solid var(--red); outline-offset: 1px; }

.about h2 { font: 900 30px 'Rubik', sans-serif; letter-spacing: -1px; }
.about p { margin-top: 10px; line-height: 1.45; }
.about .lead { font-weight: 700; }
.about .sign { font: 700 24px 'Caveat', cursive; color: var(--red); }

.card-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.card-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card-form textarea, .card-form input {
  font: 600 20px 'Caveat', cursive; color: #1d3c78;
  border: 2px solid var(--ink); border-radius: 10px; padding: 8px 10px;
  background: #fffaf0; resize: vertical;
}
.card-form textarea:focus, .card-form input:focus { outline: 3px solid var(--pink); outline-offset: 1px; }
.send {
  font: 700 16px 'Rubik', sans-serif; padding: 12px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--red); color: #fff; box-shadow: 3px 3px 0 var(--ink);
}
.send:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.form-note { font-size: 12px; color: var(--muted); }

.view-hint {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px; background: rgba(28, 22, 20, .72); color: var(--paper);
  font-size: 13px; pointer-events: none; opacity: 0; transition: opacity .5s;
}
.view-hint.show { opacity: 1; }

/* ---------- on-screen TV remote (Videos view) ---------- */
.remote {
  position: absolute; right: 26px; top: 50%; z-index: 2;
  width: 138px; padding: 16px 12px 14px;
  border-radius: 30px 30px 40px 40px;
  background: linear-gradient(160deg, #2e2b29, #161413 70%);
  border: 2px solid #000;
  box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: 10px;
  transform: translate(0, -50%) rotate(3deg);
  transition: transform .6s cubic-bezier(.2,.9,.3,1.2), opacity .4s;
}
.remote.away { transform: translate(190%, -50%) rotate(12deg); opacity: 0; pointer-events: none; }
.r-top { display: flex; align-items: center; justify-content: space-between; }
.r-ir { width: 26px; height: 8px; border-radius: 4px; background: #5a1010; box-shadow: inset 0 0 4px #000; }
.r-ir.flash { background: #ff3b2b; box-shadow: 0 0 10px #ff3b2b; }
.remote button, .r-yt {
  font: 700 12px 'Rubik', sans-serif; color: #f3ecd9; cursor: pointer;
  background: #3d3a37; border: 0; border-radius: 10px; padding: 9px 0;
  box-shadow: 0 3px 0 #0b0a0a; transition: transform .06s, box-shadow .06s;
}
.remote button:active, .r-yt:active { transform: translateY(3px); box-shadow: 0 0 0 #0b0a0a; }
.r-power { width: 38px; height: 38px; border-radius: 50% !important; background: var(--red) !important; font-size: 16px !important; padding: 0 !important; }
.r-lcd {
  background: #1a2a1a; border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px;
  font-family: 'VT323', monospace; font-size: 20px; color: var(--phosphor); box-shadow: inset 0 0 8px #000;
}
.r-volbar { display: block; height: 6px; background: #0e180e; border-radius: 3px; overflow: hidden; }
.r-volbar i { display: block; height: 100%; width: 40%; background: var(--phosphor); }
.r-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.r-grid button:nth-child(-n+4) { background: #4b4844; }
#btnChUp, #btnChDn { color: #e5b52b; }
.r-wide { width: 100%; }
.r-yt { display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; background: #e62117 !important; color: #fff !important; }
.r-yt b { display: inline-grid; place-items: center; width: 18px; height: 13px; background: #fff; color: #e62117; border-radius: 4px; font-size: 9px; }
.r-brand { text-align: center; font: 900 11px 'Rubik', sans-serif; letter-spacing: .2em; color: #8a837a; }
@media (max-width: 820px) {
  .remote { right: 8px; transform: translate(0, -50%) scale(.72); transform-origin: right center; }
  .remote.away { transform: translate(190%, -50%) scale(.72); }
}

/* ---------- stills lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: #0d0a09;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lb-btn {
  position: absolute; border: 0; cursor: pointer;
  width: 56px; height: 56px; border-radius: 50%;
  font: 700 28px 'Rubik', sans-serif; color: var(--paper);
  background: rgba(28, 22, 20, .65);
}
.lb-btn:hover { background: var(--red); }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-close { right: 18px; top: 18px; font-size: 22px; }
.lb-num {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-family: 'VT323', monospace; font-size: 24px; color: var(--phosphor);
}

/* team list in the About panel */
.team { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.team li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.team img { width: 52px; height: 52px; object-fit: cover; border-radius: 50%; border: 2px solid var(--ink); }
.team a, .team li > span { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.team a span { border-bottom: 2px solid transparent; }
.team a:hover span { border-bottom-color: var(--red); }
.team a::after { content: '↗'; color: var(--red); font-weight: 700; }
.brand .logo { cursor: pointer; }

/* ---------- video filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filters button {
  font: 600 12px 'Rubik', sans-serif;
  padding: 6px 11px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.filters button:hover { background: #fffaf0; }
.filters button.on { background: var(--red); border-color: var(--red); color: #fff; }
#list li[hidden] { display: none; }

/* Icelandic labels run longer: size each tab to its words and share out what's left,
   so "Hafa samband" stays inside the sidebar; keep remote labels on one line */
.tabs { display: flex; gap: 4px; }
.tabs button { flex: 1 1 auto; min-width: 0; white-space: nowrap; padding: 9px 5px; font-size: 11.5px; }
.remote { width: 152px; }
.r-grid button { white-space: nowrap; font-size: 11.5px; }

/* ---------- easter egg: old black-and-white film (Konami code) ---------- */
body.film #scene, body.film .css3d { filter: grayscale(1) sepia(.18) contrast(1.25) brightness(1.04); animation: film-flicker .16s steps(2) infinite; }
.film-grain { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .6s; }
body.film .film-grain {
  opacity: 1;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%),
    repeating-linear-gradient(90deg, transparent 0 37%, rgba(255,255,255,.08) 37.1% 37.25%, transparent 37.4% 71%, rgba(0,0,0,.18) 71.1% 71.2%, transparent 71.3%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.35'/></svg>");
  animation: film-grain .25s steps(3) infinite;
}
@keyframes film-flicker { 0% { opacity: 1; } 50% { opacity: .93; } }
@keyframes film-grain { 0% { background-position: 0 0, 0 0, 0 0; } 33% { background-position: 0 0, 7px 0, -40px 30px; } 66% { background-position: 0 0, -4px 0, 30px -50px; } }
