@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #fff;
  --muted: rgba(255, 255, 255, 0.68);
  --faint: rgba(255, 255, 255, 0.42);
  --line: rgba(255, 255, 255, 0.14);
  --sung: #8fdcff;
  --pink: #ff5fa2;
  --orange: #ff9a4d;
  --violet: #7b5cff;
  --gold: #ffd25a;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { background: #070b26; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
img { display: block; }
[hidden] { display: none !important; }

/* ---------- auringonlasku-tausta (yhteinen) ---------- */
.sky {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 105%, rgba(255, 154, 77, 0.95) 0%, rgba(255, 95, 162, 0.75) 26%, rgba(123, 92, 255, 0.35) 52%, rgba(7, 11, 38, 0) 75%),
    linear-gradient(180deg, #050a2a 0%, #0c1b5c 38%, #2d2a8a 62%, #7a3a9a 82%, #c8547a 100%);
}
.stars, .stars::after {
  position: absolute; inset: -50% 0 0; content: "";
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 120px 80px, rgba(255,255,255,.8) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 200px 140px, rgba(255,255,255,.9) 50%, transparent 51%),
    radial-gradient(1px 1px at 300px 40px, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 380px 200px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 60px 220px, rgba(255,255,255,.6) 50%, transparent 51%);
  background-size: 420px 260px;
  opacity: 0.8;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 75%);
  mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 75%);
  animation: twinkle 5s ease-in-out infinite alternate;
}
.stars::after { inset: 0; background-position: 210px 130px; animation-delay: 2.5s; opacity: .6; }
@keyframes twinkle { from { opacity: .45; } to { opacity: .95; } }
.lights { position: fixed; left: 0; right: 0; top: 0; width: 100%; height: 110px; z-index: -1; pointer-events: none; }
.palms { position: fixed; left: 0; right: 0; bottom: 0; height: 46vh; z-index: -1; pointer-events: none; }
.palms svg { position: absolute; bottom: 0; height: 100%; width: auto; fill: #0a0718; opacity: .92; }
.palms .l { left: -2vw; }
.palms .r { right: -3vw; transform: scaleX(-1); }

.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; line-height: 1; }
.brand .mic { width: 1.1em; height: 1.1em; }
.brand small { display: block; font-size: .42em; letter-spacing: .3em; color: var(--muted); }

/* ---------- puhelin ---------- */
.phone { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(40px + var(--safe-b)); }
.phone .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.phone .brand { font-size: 34px; text-shadow: 0 0 24px rgba(255, 95, 162, .6); }
.tv-link { font-size: 12.5px; color: var(--muted); text-decoration: none; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.07); white-space: nowrap; }
.card { background: rgba(10, 10, 40, 0.55); border: 1px solid var(--line); border-radius: 20px; padding: 14px; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.card + .card { margin-top: 12px; }
.label { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 2px 8px; }
.input { width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); padding: 0 16px; font-size: 17px; font-weight: 600; outline: none; }
.input:focus { border-color: var(--sung); box-shadow: 0 0 0 4px rgba(143, 220, 255, .18); }
.input::placeholder { color: var(--faint); }
.now { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; }
.now img, .cover { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: #1a1446; }
.t-name { font-weight: 800; font-size: 16.5px; line-height: 1.2; overflow-wrap: anywhere; }
.t-art { color: var(--muted); font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-singer { color: var(--sung); font-size: 13.5px; font-weight: 700; margin-top: 3px; }
.btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn { height: 42px; padding: 0 14px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); font-weight: 750; font-size: 14.5px; display: inline-flex; align-items: center; gap: 7px; }
.btn.primary { background: linear-gradient(120deg, var(--pink), var(--orange)); border: 0; box-shadow: 0 8px 22px rgba(255, 95, 162, .4); }
.btn:active { transform: scale(.97); }
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 8px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.item .cover { width: 48px; height: 48px; border-radius: 10px; }
.item .t-name { font-size: 15px; }
.item .t-art { font-size: 13px; }
.add { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(120deg, var(--pink), var(--orange)); font-size: 22px; font-weight: 800; display: grid; place-items: center; }
.add.done { background: rgba(143, 220, 255, .25); font-size: 17px; }
.rm { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.08); font-size: 15px; display: grid; place-items: center; }
.pos { font-family: var(--display); font-size: 22px; color: var(--muted); width: 48px; text-align: center; }
.empty { color: var(--faint); font-size: 14.5px; padding: 6px 2px; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.hint { color: var(--faint); font-size: 12.5px; margin: 8px 2px 0; }
.toast { position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translate(-50%, 16px); opacity: 0; transition: .25s; z-index: 50; background: #fff; color: #120b33; font-weight: 800; padding: 12px 18px; border-radius: 14px; box-shadow: 0 14px 34px rgba(0,0,0,.4); max-width: 92vw; text-align: center; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #ff4d6d; color: #fff; }

/* ---------- TV ---------- */
.tv { overflow: hidden; height: 100vh; cursor: default; }
.tv.hide-cursor { cursor: none; }
.tv .corner-brand { position: fixed; top: 3.2vh; right: 3vw; z-index: 20; font-size: clamp(26px, 3.4vw, 64px); text-shadow: 0 0 30px rgba(255, 95, 162, .55); }
#yt-wrap { position: fixed; z-index: 5; transition: all .6s cubic-bezier(.2, .8, .2, 1); background: #000; overflow: hidden; }
#yt-wrap.full { inset: 0; border-radius: 0; }
#yt-wrap.mini { left: 2vw; bottom: 3vh; width: 16vw; height: 9vw; border-radius: 14px; opacity: .55; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
#yt-wrap.off { left: 2vw; bottom: 3vh; width: 1px; height: 1px; opacity: 0; }
/* Ääni soi, video on taustan alla piilossa (soittimen pitää olla oikean kokoinen, jotta se toistaa). */
#yt-wrap.hidden { left: 0; top: 0; width: 480px; height: 270px; z-index: -3; }
#yt-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.stage { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; pointer-events: none; }
.stage > * { pointer-events: auto; }

.lyrics { width: 92vw; text-align: center; display: grid; gap: 2.2vh; transform: translateY(-2vh); }
.lyr-row { display: block; white-space: nowrap; }
.lyr { display: inline-block; font-family: var(--body); font-weight: 850; text-transform: uppercase; letter-spacing: .01em; line-height: 1.12; font-size: 5.2vw; color: #fff; filter: drop-shadow(0 3px 0 rgba(10, 6, 40, .6)) drop-shadow(0 0 18px rgba(10, 6, 40, .55)); transition: opacity .35s, transform .35s; }
.lyr.prev { opacity: .38; font-size: 4.2vw; }
.lyr.next2 { opacity: .78; }
.lyr.cur .w { background: linear-gradient(90deg, var(--sung) 0, var(--sung) var(--p, 0%), #fff var(--p, 0%), #fff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lyr.gap { opacity: 0; }
.countdown { display: flex; justify-content: center; gap: 1.4vw; height: 3vw; }
.countdown i { width: 2.2vw; height: 2.2vw; border-radius: 50%; background: var(--sung); box-shadow: 0 0 20px var(--sung); transition: opacity .3s, transform .3s; }
.countdown i.off { opacity: 0; transform: scale(.4); }

.title-card { text-align: center; animation: rise .8s cubic-bezier(.2, .9, .25, 1.1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(40px) scale(.96); } }
.title-card .up { font-size: 1.6vw; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.title-card .singer { font-family: var(--display); font-size: 8vw; line-height: .9; text-transform: uppercase; margin: 1vh 0 3vh; text-shadow: 4px 4px 0 var(--pink), 8px 8px 0 var(--violet); }
.title-card .song { display: inline-grid; grid-template-columns: auto auto; gap: 2vw; align-items: center; text-align: left; padding: 1.6vw 2.2vw; border-radius: 2vw; background: rgba(8, 6, 32, .55); border: 1px solid rgba(255,255,255,.18); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.title-card .song img { width: 9vw; height: 9vw; border-radius: 1vw; object-fit: cover; }
.title-card .s-name { font-weight: 850; font-size: 3vw; line-height: 1.05; max-width: 50vw; }
.title-card .s-art { color: var(--muted); font-size: 2vw; margin-top: .6vh; }
.title-card .status { margin-top: 3vh; font-size: 1.5vw; color: var(--muted); font-weight: 650; }

.idle { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5vw; align-items: center; width: 86vw; }
.idle .qr { background: #fff; border-radius: 2vw; padding: 1.4vw; width: 24vw; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.idle .qr svg { display: block; width: 100%; height: auto; }
.idle h1 { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 9vw; line-height: .85; margin: 0; text-shadow: 4px 4px 0 var(--pink), 8px 8px 0 var(--violet), 0 0 50px rgba(255, 95, 162, .5); }
.idle .lead { font-size: 2.2vw; font-weight: 750; margin: 2.5vh 0 1vh; }
.idle .url { font-size: 1.4vw; color: var(--muted); font-weight: 650; }
.upnext { margin-top: 3.5vh; display: grid; gap: 1.1vh; }
.upnext .row { display: grid; grid-template-columns: 3vw minmax(0, 1fr); align-items: center; gap: 1.2vw; font-size: 1.6vw; }
.upnext .row b { font-family: var(--display); font-size: 2.2vw; color: var(--gold); }
.upnext .row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upnext .row em { font-style: normal; color: var(--sung); font-weight: 750; }

.badge { position: fixed; z-index: 15; left: 2.5vw; top: 3vh; display: flex; gap: 1vw; align-items: center; padding: 1vw 1.6vw; border-radius: 1.4vw; background: rgba(8, 6, 32, .72); border: 1px solid rgba(255,255,255,.18); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: rise .6s both; }
.badge img { width: 4.2vw; height: 4.2vw; border-radius: .6vw; object-fit: cover; }
.badge .b1 { font-weight: 850; font-size: 1.5vw; }
.badge .b2 { color: var(--sung); font-weight: 750; font-size: 1.2vw; }
.next-ticker { position: fixed; z-index: 15; right: 2.5vw; bottom: 3vh; padding: .9vw 1.4vw; border-radius: 1.2vw; background: rgba(8, 6, 32, .72); border: 1px solid rgba(255,255,255,.18); font-size: 1.3vw; font-weight: 700; animation: rise .6s both; }
.next-ticker em { font-style: normal; color: var(--gold); }
.plain { width: 70vw; max-height: 74vh; overflow: hidden; text-align: center; font-weight: 800; font-size: 2.6vw; line-height: 1.5; white-space: pre-line; -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); }
.plain-inner { transition: transform 1s linear; filter: drop-shadow(0 3px 0 rgba(10, 6, 40, .6)); }
.notice { font-size: 2.4vw; font-weight: 800; text-align: center; max-width: 70vw; }

#start { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(5, 4, 22, .86); }
#yield { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8, 6, 32, .92); font-size: 2.2vw; font-weight: 800; padding: 4vw; }
#yield button { margin-top: 2vh; font-family: var(--display); font-size: 3.4vw; text-transform: uppercase; padding: 1.4vw 3.4vw; border-radius: 1.6vw; background: linear-gradient(120deg, var(--pink), var(--orange)); }
@media (max-width: 600px) and (orientation: portrait) { #yield { font-size: 5vw; } #yield button { font-size: 7vw; } }
#start button { font-family: var(--display); font-size: 4vw; text-transform: uppercase; padding: 2vw 4vw; border-radius: 2vw; background: linear-gradient(120deg, var(--pink), var(--orange)); box-shadow: 0 20px 60px rgba(255, 95, 162, .5); }
#start p { text-align: center; color: var(--muted); font-size: 1.4vw; margin-top: 2vh; }
.hud { position: fixed; z-index: 30; left: 50%; bottom: 3vh; transform: translateX(-50%); display: flex; gap: .8vw; padding: .8vw; border-radius: 1.4vw; background: rgba(8, 6, 32, .8); border: 1px solid rgba(255,255,255,.18); transition: opacity .3s; }
.hud.hidden { opacity: 0; pointer-events: none; }
.hud button { font-size: 1.3vw; font-weight: 800; padding: .8vw 1.2vw; border-radius: .9vw; background: rgba(255,255,255,.1); white-space: nowrap; }
.hud .off { white-space: nowrap; }
.hud .off { color: var(--muted); font-size: 1.1vw; align-self: center; padding: 0 .6vw; }

/* ---------- laulun ennakkomerkit ---------- */
.gap-block { display: grid; justify-items: center; gap: 1.6vh; min-height: 6.2vw; align-content: center; }
.gap-text { font-size: 2.4vw; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; color: var(--gold); text-shadow: 0 0 24px rgba(255, 210, 90, .45); }
.countdown i { width: 2.6vw; height: 2.6vw; }
.lyr.next { transition: filter .3s, transform .3s; }
.lyr.next.soon { transform: scale(1.04); filter: drop-shadow(0 3px 0 rgba(10, 6, 40, .6)) drop-shadow(0 0 26px rgba(143, 220, 255, .9)); }

/* ---------- estetty automaattinen toisto ---------- */
#yt-wrap.prompt { left: 50%; top: 56%; width: 52vw; height: 29.25vw; transform: translate(-50%, -50%); z-index: 35; border-radius: 18px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.prompt-msg { position: fixed; z-index: 36; left: 50%; top: 4vh; transform: translateX(-50%); display: grid; gap: 1.2vh; justify-items: center; text-align: center; padding: 1.6vw 2.4vw; border-radius: 1.6vw; background: rgba(8, 6, 32, .9); border: 1px solid rgba(255, 255, 255, .2); font-size: 1.8vw; font-weight: 800; }
.prompt-msg button { font-family: var(--display); font-size: 2.6vw; text-transform: uppercase; padding: .8vw 2.6vw; border-radius: 1.2vw; background: linear-gradient(120deg, var(--pink), var(--orange)); }
.prompt-msg small { font-size: 1.1vw; color: var(--muted); font-weight: 650; }
.warn { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 210, 90, .12); border: 1px solid rgba(255, 210, 90, .4); color: #ffe39a; font-size: 13.5px; font-weight: 650; }
.seg4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 5px; border-radius: 14px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.seg4 button { height: 42px; border-radius: 10px; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg4 button.on { background: linear-gradient(120deg, var(--pink), var(--orange)); color: #fff; box-shadow: 0 6px 16px rgba(255, 95, 162, .35); }
.ready { color: var(--muted); font-weight: 650; }

/* TV-näkymä puhelimella (vaaka- tai pystyasento) */
@media (max-height: 500px) {
  .tv .corner-brand { top: 2vh; font-size: 5.5vh; }
  .lyrics { gap: 1.2vh; }
  .lyr { font-size: 4.6vw; }
  .lyr.prev { font-size: 3.6vw; }
  .badge { top: 2vh; padding: .8vw 1.2vw; }
  .lights { height: 60px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .palms { height: 26vh; opacity: .7; }
  .lyr { font-size: 7vw; white-space: normal; }
  .lyr-row { white-space: normal; }
  .lyrics { width: 94vw; gap: 1.6vh; }
  .gap-text { font-size: 5vw; }
  .countdown i { width: 5vw; height: 5vw; }
      .badge { left: 3vw; right: 3vw; top: 9vh; padding: 2.4vw 3vw; border-radius: 3vw; }
  .badge .b1 { font-size: 3.6vw; }
  .badge .b2 { font-size: 3.2vw; }
  .badge img { width: 10vw; height: 10vw; }
  .tv .corner-brand { font-size: 7vw; right: 4vw; top: 2.5vh; }
  .title-card .singer { font-size: 14vw; }
  .title-card .s-name { font-size: 5.5vw; max-width: 70vw; }
  .title-card .s-art { font-size: 4vw; }
  .title-card .song img { width: 18vw; height: 18vw; }
  .title-card .status, .title-card .up { font-size: 3.6vw; }
  .idle { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 3vh; }
  .idle .qr { width: 52vw; }
  .idle h1 { font-size: 15vw; }
  .idle .lead { font-size: 4.4vw; }
  .idle .url { font-size: 3.6vw; }
  .upnext .row { font-size: 3.8vw; grid-template-columns: 7vw minmax(0, 1fr); }
  .upnext .row b { font-size: 5vw; }
  #start button { font-size: 9vw; padding: 3vw 7vw; border-radius: 4vw; }
  #start p { font-size: 3.6vw; padding: 0 6vw; }
  .prompt-msg { font-size: 4.4vw; width: 90vw; border-radius: 4vw; padding: 4vw; }
  .prompt-msg button { font-size: 7vw; padding: 2vw 6vw; border-radius: 3vw; }
  .prompt-msg small { font-size: 3.2vw; }
  .hud { flex-wrap: wrap; width: 94vw; justify-content: center; }
  .hud button { font-size: 3.4vw; padding: 2vw 3vw; }
}

/* ---------- saapuva viiva (korvaa erillisen palkin) ---------- */
.lyr-row { position: relative; }
.ball { position: absolute; left: 0; top: 0; width: 2.6vh; height: 2.6vh; min-width: 11px; min-height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0, #e9f8ff 30%, var(--sung) 100%); box-shadow: 0 0 12px var(--sung), 0 0 30px rgba(143, 220, 255, .75); pointer-events: none; z-index: 2; will-change: transform; transform: translate(-100vw, 0); }
.lyr.cur.soon { filter: drop-shadow(0 3px 0 rgba(10, 6, 40, .6)) drop-shadow(0 0 26px rgba(143, 220, 255, .9)); }
