/* andrzej.dad — spokojne, osobne widoki. Kształt z podglądu (PR #1), stack bez build stepu.
   𝚅𝚒𝚋𝚎𝚌𝚛𝚊𝚏𝚝𝚎𝚍. with AI Agents by Vetcoders (c)2024-2026 LibraxisAI */

@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("./fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("./fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("./fonts/source-serif-4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("./fonts/source-serif-4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Pixel accent z me-gad-ev: numery, czasy, daty, metadane. */
@font-face {
  font-family: "Departure Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/DepartureMono-1.500.woff2") format("woff2");
}

/* Paleta Sardynii (app/globals.css w m-szymanska/sardynia): krem, róża, słoma, lawenda; noc grafitowo-śliwkowa.
   Z me-gad-ev tylko akcenty: --pixel (Departure Mono) i --mark (jeden czerwony znak: aktywna zakładka, serce, nagrywanie). */
:root {
  --paper: #f7e9d7;
  --sheet: #fdf6ee;
  --ink: #3d3048;
  --muted: #68526f;
  --line: #d9c7b6;
  --rose: #c75f68;
  --rose-ink: #fdf6ee;
  --straw: #c99245;
  --blush: #eadbe4;
  --lavender: #b7a0c8;
  --mark: #b3221a;
  --shade: rgba(61, 48, 72, 0.82);
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Manrope, system-ui, sans-serif;
  --hand: Caveat, "Segoe Script", cursive;
  --pixel: "Departure Mono", "Monaspace Neon", ui-monospace, monospace;
  --nav-h: 3.4rem;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #232329;
  --sheet: #26262e;
  --ink: #efedf3;
  --muted: #b6b3c2;
  --line: #40404a;
  --rose: #eeb4cc;
  --rose-ink: #2a1a22;
  --straw: #ffce6d;
  --blush: #3a3a46;
  --lavender: #cfc2f0;
  --mark: #ff6a60;
  --shade: rgba(35, 35, 41, 0.86);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.6; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--rose); color: var(--rose-ink); }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Nagłówek ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.pixel { font-family: var(--pixel); font-size: 0.72rem; letter-spacing: 0.04em; }
.brand { font-family: var(--serif); font-size: 1.15rem; letter-spacing: -0.01em; flex-shrink: 0; }
.top-right { display: flex; align-items: center; gap: 0.9rem; flex-shrink: 0; }
.nav-player {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  max-width: 28rem;
  padding: 0.1rem 0.35rem;
  color: var(--muted);
}
.nav-player-transport {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}
.nav-player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.4rem;
  padding: 0 0.15rem;
  font-family: var(--pixel);
  font-size: 0.74rem;
  line-height: 1;
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav-player-btn:hover { color: var(--ink); }
.nav-player-toggle { color: var(--ink); }
.nav-player-toggle.is-playing { color: var(--rose); }
.nav-player-viz { color: var(--rose); font-size: 0.72rem; letter-spacing: 0.02em; flex-shrink: 0; min-width: 4ch; text-align: center; opacity: 0.88; }
.nav-player-title {
  font-family: var(--pixel);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 4rem;
  max-width: 12.5rem;
  color: var(--muted);
  text-align: left;
  transition: color 0.15s ease;
}
.nav-player-title:hover { color: var(--ink); }
.nav-player-vol-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}
.unicode-slider {
  position: relative;
  display: inline-flex;
  align-items: center;
  user-select: none;
}
.unicode-slider-bar {
  font-family: var(--pixel);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--rose);
  white-space: pre;
  pointer-events: none;
}
.nav-vol-slider .unicode-slider-bar { color: var(--muted); font-size: 0.66rem; }
.nav-player:hover .nav-vol-slider .unicode-slider-bar { color: var(--rose); }
.unicode-slider input[type="range"] {
  position: absolute;
  inset: -0.3rem 0;
  width: 100%;
  height: calc(100% + 0.6rem);
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
@media (max-width: 44rem) {
  .nav-player-title { max-width: 6.5rem; }
  .nav-vol-slider .unicode-slider-bar { font-size: 0.6rem; }
}
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; font-size: 0.75rem; }
.seg button { padding: 0.25rem 0.65rem; border-radius: 999px; color: var(--muted); }
.seg button.is-active { background: var(--ink); color: var(--paper); }
.who { text-align: right; font-size: 0.9rem; line-height: 1.2; }
.who-meta { display: block; font-family: var(--pixel); font-size: 0.66rem; letter-spacing: 0.04em; color: var(--muted); }

/* ---------- Widoki ---------- */
.views { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: var(--nav-h); }
.view { flex: 1; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 2rem 1.25rem; }
.wrap.narrow { max-width: 42rem; }
.section { padding-top: 0.5rem; }
.section-last { padding-bottom: 3rem; }

.kicker { margin: 0; font-family: var(--pixel); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rose); }
.display { margin: 0.4rem 0 0; font-family: var(--serif); font-size: clamp(2.8rem, 7.5vw, 5rem); line-height: 1; letter-spacing: -0.02em; font-weight: 600; }
.out-note { margin: 1.2rem 0 0; padding: 0.8rem 1rem; border-left: 3px solid var(--straw); border-radius: 0 0.6rem 0.6rem 0; background: var(--blush); font-size: 0.95rem; }
.heading { margin: 0 0 0.5rem; font-family: var(--serif); font-size: clamp(1.8rem, 4.5vw, 2.4rem); line-height: 1.1; letter-spacing: -0.015em; font-weight: 600; }
.subheading { margin: 2rem 0 0.4rem; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.tagline { margin: 0.6rem 0 0; font-family: var(--serif); font-size: 1.25rem; color: var(--muted); }
.lead { max-width: 34rem; margin: 1.1rem 0 0; line-height: 1.65; }
.note { margin: 0.9rem 0 0; font-size: 0.92rem; }
.small { font-size: 0.88rem; }
.muted { color: var(--muted); }
.rose { color: var(--rose); }
.prose p { margin: 0 0 0.9rem; max-width: 40rem; }
.signature { font-family: var(--hand); font-size: 1.6rem; color: var(--rose); }
.link { color: var(--rose); font-size: 0.88rem; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- Dom ---------- */
/* Pierwszy ekran to samo zdjęcie i imię — karty rodziny są dopiero po przewinięciu. */
.hero { display: grid; gap: 2rem; align-items: center; min-height: calc(100dvh - 3.4rem - var(--nav-h)); }
@media (min-width: 48rem) { .hero { grid-template-columns: 1.1fr 0.9fr; gap: 3.5rem; } }
.hero-figure { position: relative; margin: 0; height: 20rem; overflow: hidden; border-radius: 1rem; background: var(--blush); }
@media (min-width: 48rem) { .hero-figure { height: min(34rem, 68vh); } }
.hero-slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.8s ease; }
.hero-slide.is-current { opacity: 1; }

.hand-sign {
  display: inline-block;
  min-width: 13ch;
  margin: 0.4rem 0 0;
  font-family: var(--hand);
  font-size: 2.6rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  padding-right: 0.08em;
  border-right: 1.5px solid transparent;
}
.hand-sign.is-writing { border-right-color: currentColor; animation: hand-ink 1.1s step-end infinite; }
@keyframes hand-ink { 50% { border-right-color: transparent; } }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin-top: 1rem; }
.card { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.9rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--sheet); text-align: left; }
.card:hover { border-color: var(--rose); }
.card-plate { width: 100%; aspect-ratio: 8 / 3; border-radius: 0.6rem; background: var(--blush); overflow: hidden; }
.card-plate img { width: 100%; height: 100%; object-fit: cover; }
.card-name { font-family: var(--serif); font-size: 1.3rem; line-height: 1.1; }
.card-relation { font-size: 0.78rem; color: var(--rose); }
.card-text { margin: 0; font-size: 0.92rem; color: var(--muted); }
.cards-music .card-plate { aspect-ratio: 8 / 3; }

/* ---------- Kto przyszedł ---------- */
.who-list { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.who-group { padding: 1rem 0 0.3rem; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.who-list button { display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); text-align: left; }
.who-list .who-item-name { font-family: var(--serif); font-size: 1.45rem; }
.who-list .is-current .who-item-name { color: var(--rose); }
.who-list .who-item-rel { font-size: 0.88rem; color: var(--muted); }

/* ---------- Formularze ---------- */
.stack { display: grid; gap: 0.7rem; margin-top: 1.4rem; }
.row { display: grid; gap: 0.7rem; }
@media (min-width: 40rem) { .row { grid-template-columns: 1fr 1fr; } .row.between { grid-template-columns: 1fr auto; align-items: center; } }
input[type="text"], textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--sheet);
  resize: vertical;
}
.btn { display: inline-block; width: fit-content; padding: 0.55rem 1.05rem; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 0.9rem; text-decoration: none; }
.btn.rose-btn { background: var(--rose); color: var(--rose-ink); }

/* ---------- Zdjęcia ---------- */
.masonry { columns: 2; column-gap: 0.75rem; margin-top: 1.4rem; }
@media (min-width: 48rem) { .masonry { columns: 3; } }
.tile { position: relative; display: block; width: 100%; margin: 0 0 0.75rem; break-inside: avoid; border-radius: 0.8rem; overflow: hidden; background: var(--blush); }
.tile img { width: 100%; height: auto; }
.tile .fav { position: absolute; right: 0.5rem; top: 0.5rem; padding: 0.15rem 0.45rem; border-radius: 999px; background: var(--shade); color: var(--mark); font-size: 0.8rem; }
.tile .tile-num { position: absolute; left: 0.5rem; bottom: 0.5rem; padding: 0.12rem 0.4rem; border-radius: 0.3rem; background: var(--shade); color: var(--paper); font-size: 0.66rem; opacity: 0.85; }
:root[data-theme="dark"] .tile .tile-num { color: var(--ink); }

.lightbox { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: var(--shade); padding: 1rem; }
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 0.8rem; }
.lightbox-close { position: absolute; top: 0.6rem; right: 1rem; font-size: 2rem; color: var(--paper); }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 3rem; line-height: 1; padding: 0.5rem 0.9rem; color: var(--paper); }
.lightbox-nav.prev { left: 0.2rem; }
.lightbox-nav.next { right: 0.2rem; }
.lightbox-bar { position: absolute; bottom: 1rem; left: 0; right: 0; display: flex; justify-content: center; align-items: baseline; gap: 1.5rem; color: #fdf6ee; font-family: var(--pixel); font-size: 0.8rem; letter-spacing: 0.04em; }
.lightbox-bar .link { color: #fdf6ee; font-family: var(--sans); }

/* ---------- Filmy i muzyka ---------- */
.player-frame { position: relative; margin-top: 1.2rem; border-radius: 1rem; overflow: hidden; background: var(--blush); aspect-ratio: 16 / 9; }
.player { width: 100%; height: 100%; background: #000; }
.gate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 1.5rem; text-align: center; background: var(--blush) center / cover no-repeat; color: #fffaf6; }
.gate::before { content: ""; position: absolute; inset: 0; background: rgba(27, 22, 20, 0.62); }
.gate > * { position: relative; }
.gate .muted { color: rgba(255, 250, 246, 0.78); }
.gate .btn { background: var(--rose); color: var(--rose-ink); margin-top: 0.4rem; }
.gate-title { margin: 0; font-family: var(--serif); font-size: 1.5rem; }

/* ---------- Budka: siatka wszystkich kadrów → scena z pytaniem (układ z oryginału Groka), tylko rodzina ---------- */
.budka-gate { position: relative; inset: auto; min-height: 14rem; margin-top: 1.4rem; border-radius: 1rem; overflow: hidden; }
.budka-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.9rem; margin-top: 1.6rem; padding-bottom: 1rem; }
@media (min-width: 64rem) { .budka-grid { grid-template-columns: repeat(6, 1fr); } }
.budka-cell { position: relative; aspect-ratio: 1; border-radius: 1rem; overflow: hidden; background: var(--blush); }
.budka-cell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.budka-cell:hover img { transform: scale(1.03); }
.budka-cell .tile-num { position: absolute; left: 0.5rem; bottom: 0.5rem; padding: 0.12rem 0.4rem; border-radius: 0.3rem; background: var(--shade); color: #fdf6ee; font-size: 0.66rem; opacity: 0.85; }
/* Scena: wybrany kadr w całości (nigdy nie kadrujemy za rodzinę), tło to ten sam kadr rozmyty. */
.budka-stage { position: relative; width: 100%; height: clamp(22rem, calc(100dvh - 3.4rem - var(--nav-h) - 9rem), 44rem); margin-top: 1.4rem; border-radius: 1.2rem; overflow: hidden; background: var(--blush); }
.budka-stage-bg { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; filter: blur(28px) saturate(0.8) brightness(0.55); }
.budka-stage-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.budka-stage-num { position: absolute; top: 0.8rem; right: 0.9rem; padding: 0.15rem 0.45rem; border-radius: 0.3rem; background: var(--shade); color: #fdf6ee; font-size: 0.72rem; }
/* Kafelek w rogu = powrót do siatki */
.budka-pick { position: absolute; left: 0.8rem; bottom: 5.4rem; width: 4rem; height: 4rem; border-radius: 0.7rem; overflow: hidden; border: 2px solid rgba(255, 250, 246, 0.85); background: var(--blush); box-shadow: 0 6px 18px rgba(27, 22, 20, 0.35); }
.budka-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.budka-pick::after { content: "‹"; position: absolute; top: -0.1rem; right: 0.3rem; color: #fdf6ee; font-size: 1.1rem; line-height: 1; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.budka-pick .tile-num { position: absolute; left: 0.2rem; bottom: 0.2rem; padding: 0.05rem 0.25rem; border-radius: 0.25rem; background: var(--shade); color: #fdf6ee; font-size: 0.55rem; }
.budka-prompt { position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.8rem; display: flex; gap: 0.6rem; align-items: center; }
.budka-prompt input { flex: 1; min-width: 0; padding: 0.95rem 1.2rem; border-radius: 999px; border: 1px solid rgba(255, 250, 246, 0.35); background: rgba(27, 22, 20, 0.55); color: #fdf6ee; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 1.05rem; }
.budka-prompt input::placeholder { color: rgba(255, 250, 246, 0.7); }
.budka-prompt input:focus { outline: none; border-color: var(--rose); }
.budka-go { flex: 0 0 auto; width: 4.6rem; height: 4.6rem; border-radius: 50%; background: var(--rose); color: var(--rose-ink); font-size: 1rem; box-shadow: 0 8px 24px rgba(27, 22, 20, 0.35); }
.budka-go:disabled { opacity: 0.6; }
@media (max-width: 40rem) { .budka-stage { height: auto; aspect-ratio: 4 / 5; } .budka-go { width: 3.8rem; height: 3.8rem; font-size: 0.9rem; } }
.budka-results { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); margin-top: 1.8rem; padding-bottom: 2rem; }
.budka-card { display: grid; gap: 0.5rem; border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; background: var(--sheet); }
.budka-card img { width: 100%; height: auto; display: block; background: var(--blush); }
.budka-card .budka-where { margin: 0; padding: 0 0.9rem; font-family: var(--serif); font-size: 1.05rem; }
.budka-card .budka-meta { margin: 0; padding: 0 0.9rem; color: var(--muted); font-size: 0.78rem; }
.budka-card .budka-download { display: inline-block; margin: 0 0.9rem 0.9rem; justify-self: start; color: var(--rose); text-decoration: none; border-bottom: 1px solid currentColor; font-size: 0.85rem; }
.budka-card .budka-download:hover { color: var(--ink); }
.budka-card.is-pending img { min-height: 12rem; opacity: 0.4; animation: budka-breathe 1.6s ease-in-out infinite; }
@keyframes budka-breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.7; } }

/* Muzyka: wykonawca | tytuły — spis, nie odtwarzacz dla gości. */
.music-table { list-style: none; margin: 1.6rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.music-table li { display: grid; gap: 0.2rem 1.5rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 40rem) { .music-table li { grid-template-columns: minmax(10rem, 1fr) 2.2fr; } }
.music-artist { color: var(--rose); }
.music-titles { font-size: 1.05rem; }
.list { list-style: none; margin: 1.2rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); }
.list button, .list .list-row { display: grid; width: 100%; gap: 0.15rem 1rem; padding: 0.75rem 0; text-align: left; }
@media (min-width: 40rem) { .list button, .list .list-row { grid-template-columns: 1fr auto; align-items: baseline; } }
.list .is-current .list-title { color: var(--rose); }
.list-title { font-size: 1rem; }
.list-sub { grid-column: 1; font-size: 0.85rem; color: var(--muted); }
.list-dur { font-size: 0.85rem; color: var(--muted); }
.list .locked .list-title { color: var(--muted); }
.list .is-playing .list-title::before { content: "▶ "; color: var(--mark); font-size: 0.72em; }
#view-muzyka .list { padding-bottom: 6rem; }

/* Pełny odtwarzacz w #view-muzyka + scena Unicode Shapes z Art API (/api/art/plate). */
.player-bar {
  margin: 1.4rem 0 1.8rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--sheet);
  overflow: hidden;
}
.music-stage {
  padding: 1rem 1.2rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--blush) 45%, var(--sheet));
}
.music-stage-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.viz-heading { color: var(--rose); font-size: 0.78rem; letter-spacing: 0.14em; }
.viz-motifs { flex-wrap: wrap; }
.music-stage-grid {
  display: grid;
  gap: 1rem;
  align-items: stretch;
}
@media (min-width: 52rem) {
  .music-stage-grid { grid-template-columns: minmax(17rem, 0.95fr) minmax(0, 1.25fr); }
}
.viz-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8.5rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--paper) 65%, transparent);
}
.viz-plate svg { width: 100%; height: auto; max-height: 11rem; display: block; }
.viz-live-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  overflow-x: auto;
}
.viz-frame-box {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--ink);
  white-space: pre;
}
.music-visualizer {
  margin: 0;
  font-family: ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", var(--pixel), monospace;
  font-size: clamp(0.64rem, 1.35vw, 0.84rem);
  line-height: 1.18;
  letter-spacing: 0.04em;
  color: var(--rose);
  white-space: pre;
  user-select: none;
}
.player-bar-row {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  gap: 0.45rem 0.55rem;
  align-items: center;
  padding: 0.75rem 1.2rem 0.85rem;
}
.unicode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.05rem;
  height: 2.05rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 0.82rem;
  line-height: 1;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.unicode-btn:hover { border-color: var(--rose); color: var(--rose); }
.player-toggle.is-playing {
  border-color: var(--rose);
  color: var(--rose);
  background: color-mix(in srgb, var(--blush) 65%, var(--sheet));
}
.player-meta { display: flex; flex-direction: column; min-width: 0; padding-left: 0.2rem; }
.player-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.84rem; color: var(--ink); }
.player-volume-wrap { display: flex; align-items: center; gap: 0.35rem; }
.player-mute { width: 1.9rem; height: 1.9rem; font-size: 0.8rem; color: var(--muted); }
.vol-slider .unicode-slider-bar { font-size: 0.8rem; letter-spacing: 0.03em; }
.seek-slider, .player-seek { grid-column: 1 / -1; width: 100%; margin: 0.2rem 0 0; overflow: hidden; }
.seek-bar-glyphs {
  display: block;
  width: 100%;
  font-size: clamp(0.58rem, 1.35vw, 0.76rem);
  letter-spacing: 0.03em;
  color: var(--rose);
  overflow: hidden;
}

/* ---------- Księga ---------- */

/* ---------- Rozmowa ---------- */
.view-chat { display: flex; flex-direction: column; min-height: 0; height: calc(100dvh - 3.4rem - var(--nav-h)); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.chat-log { display: flex; flex-direction: column; gap: 0.7rem; padding-bottom: 1rem; }
.bubble { max-width: 40rem; padding: 0.75rem 1rem; border-radius: 1.1rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 0.6rem; white-space: normal; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: 0.2rem 0 0.6rem 1.1rem; padding: 0; white-space: normal; }
.bubble.user { align-self: flex-end; background: var(--sheet); border: 1px solid var(--line); }
.bubble.assistant { align-self: flex-start; background: var(--blush); }
.bubble.assistant.is-streaming::after { content: "…"; color: var(--muted); }
.bubble-tools { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--muted); }
.composer { flex-shrink: 0; border-top: 1px solid var(--line); background: var(--paper); }
.composer-row { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.7rem 1.25rem 0.35rem; }
.composer textarea { flex: 1; min-width: 0; max-height: 10rem; border-radius: 1.2rem; resize: none; }
.composer .btn { padding: 0.7rem 1.05rem; }
.icon { display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: 999px; border: 1px solid var(--line); background: var(--sheet); color: var(--muted); }
.icon.is-recording { color: var(--mark); border-color: var(--mark); }
.list-dur { font-family: var(--pixel); letter-spacing: 0.04em; }
.composer p { margin: 0; padding: 0 1.25rem 0.5rem; min-height: 1.2rem; }

/* ---------- Dolna nawigacja ---------- */
.nav-bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  height: var(--nav-h);
  border-top: 1px solid var(--line);
  background: var(--sheet);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-bottom button { position: relative; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; color: var(--muted); }
.nav-bottom button.is-active { color: var(--ink); }
/* Znak me-gad-ev: jedna czerwona kropka pod aktywną zakładką, nie kolorowanie całego słowa. */
.nav-bottom button.is-active::after { content: ""; position: absolute; left: 50%; bottom: 0.45rem; width: 4px; height: 4px; border-radius: 50%; background: var(--mark); transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) {
  .hero-slide { transition: none; }
  .hand-sign.is-writing { animation: none; }
}

/* ═══ Unicode / ekran domowy ═══════════════════════════════════════════
   Donors: quantum-replit/static/css/styles.css (scanlines, grain, vignette),
   me-gad-ev/docs/assets/frontier.css (mono grid, hairlines, one signal).
   Texture is an independent, non-interactive layer. No flicker or flashes. */
@font-face {
  font-family: "Monaspace Neon";
  src: url("./fonts/MonaspaceNeon-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root { --top-h: 3.5rem; --glyph-font: "Monaspace Neon", "Apple Symbols", "Segoe UI Symbol", monospace; }
.pixel, .nav-glyph, .heading-glyph { font-variant-numeric: tabular-nums; font-feature-settings: "calt" 1, "liga" 0; }
.crt-texture { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s ease; }
/* Zdjęcia nad fakturą, poniżej nawigacji i lightboksu — także podczas przewijania. */
.hero-figure, .tile, .budka-cell, .budka-stage, .budka-card, .player-frame { position: relative; z-index: 1; }
:root[data-crt="on"] .crt-texture { opacity: 1; }
.crt-texture::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(53, 34, 21, 0.035) 2px 3px); box-shadow: inset 0 0 12vw rgba(53, 34, 21, 0.10); }
.crt-texture::after { content: ""; position: absolute; inset: 0; opacity: 0.025; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath d='M0 0h180v180H0z' filter='url(%23n)'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .crt-texture::before { background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.12) 2px 3px); box-shadow: inset 0 0 15vw rgba(0, 0, 0, 0.2); }
.crt-toggle { white-space: nowrap; padding: 0.4rem 0; min-height: 2.4rem; color: var(--muted); }
.crt-toggle[aria-pressed="true"] { color: var(--rose); }
.crt-toggle:hover { color: var(--ink); }
.heading { display: flex; align-items: baseline; gap: 0.7rem; }
.heading-glyph { font: 400 0.48em / 1 var(--glyph-font); color: var(--rose); align-self: center; }
.nav-bottom { height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.nav-bottom button { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: var(--pixel); font-size: 0.68rem; transition: color 0.2s; }
.nav-glyph { font-family: var(--glyph-font); font-size: 1rem; color: var(--muted); }
.nav-bottom .is-active .nav-glyph { color: var(--rose); }
.nav-bottom button:hover .nav-glyph { color: var(--ink); }
.view-chat { height: calc(100dvh - var(--top-h) - var(--nav-h) - env(safe-area-inset-bottom)); }
.views { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.unicode-slider:focus-within { outline: 2px solid var(--rose); outline-offset: 5px; border-radius: 2px; }
.nav-player-btn { min-height: 2.2rem; min-width: 1.8rem; }
.nav-player { max-width: 33rem; flex: 1 1 auto; justify-content: center; }
.nav-player-title { max-width: 17rem; }

/* Pełny odtwarzacz: ciepły luminofor, plansza Art API i żywe pole znaków. */
.player-bar {
  --deck-paper: #201d1d;
  --deck-ink: #f5e6d1;
  --deck-dim: #c4ad98;
  --deck-line: #635147;
  --deck-signal: #efc78c;
  position: relative;
  border-color: var(--deck-line);
  border-radius: 0.65rem;
  color: var(--deck-ink);
  background: var(--deck-paper);
  box-shadow: 0 14px 44px -24px rgba(44, 24, 18, 0.5);
}
.music-stage { padding: 1rem clamp(0.85rem, 2.5vw, 1.7rem) 1.4rem; background: transparent; border-color: var(--deck-line); }
.player-options { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.7rem; margin-bottom: 1rem; border-bottom: 1px solid var(--deck-line); color: var(--deck-dim); }
#player-source { flex: 1; }
#player-position { letter-spacing: 0.12em; }
.player-option { min-width: 2.25rem; min-height: 2.25rem; color: var(--deck-dim); border: 1px solid transparent; border-radius: 0.25rem; font: 1.1rem var(--glyph-font); }
.player-option:hover, .player-option[aria-pressed="true"] { color: var(--deck-signal); border-color: var(--deck-line); }
.player-option:focus-visible { outline-color: var(--deck-signal); }
.viz-heading { color: var(--deck-dim); font-size: 0.66rem; }
.viz-motifs { border: 0; padding: 0; gap: 0.15rem; border-radius: 0; }
.viz-motifs button { font-family: var(--pixel); font-size: 0.6rem; color: var(--deck-dim); padding: 0.5rem; border-radius: 0; border-bottom: 1px solid transparent; }
.viz-motifs button:hover { color: var(--deck-ink); }
.viz-motifs button.is-active { background: transparent; color: var(--deck-signal); border-color: var(--deck-signal); }
.music-stage-grid { gap: 1.25rem; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.6fr); align-items: center; }
.viz-plate { min-width: 0; padding: 0; min-height: 10rem; border: 0; border-radius: 0; background: none; }
.viz-plate svg { max-height: 14rem; overflow: visible; }
.viz-plate svg [fill="#8a8073"] { fill: var(--deck-dim); }
.viz-plate svg [stroke="#8a8073"] { stroke: var(--deck-dim); }
.viz-plate svg [fill="#c4673f"] { fill: var(--deck-signal); }
.viz-plate svg [stroke="#c4673f"] { stroke: var(--deck-signal); }
.viz-live-box { position: relative; min-width: 0; padding: 1rem 0 1rem 1.25rem; border: 0; border-left: 1px solid var(--deck-line); border-radius: 0; background: none; overflow: hidden; }
.viz-frame-box { display: none; }
.music-visualizer { width: 100%; overflow: hidden; color: var(--deck-signal); font-family: var(--glyph-font); font-size: 12px; line-height: 1.3; letter-spacing: 0; min-height: 16em; text-shadow: 0 0 12px rgba(239, 199, 140, 0.15); }
.player-bar-row { gap: 1rem 0.6rem; padding: 1.2rem clamp(0.85rem, 2.5vw, 1.7rem); }
.player-bar .unicode-btn { background: none; color: var(--deck-ink); border-color: var(--deck-line); border-radius: 0.25rem; min-width: 2.5rem; min-height: 2.5rem; }
.player-bar .player-toggle { min-width: 3.1rem; min-height: 3.1rem; color: var(--deck-signal); }
.player-bar .player-toggle.is-playing { color: var(--deck-paper); background: var(--deck-signal); border-color: var(--deck-signal); }
.player-bar .player-title { color: var(--deck-ink); white-space: normal; overflow-wrap: anywhere; font-size: 0.78rem; }
.player-bar .muted, .player-bar #player-time { color: var(--deck-dim); }
.player-bar .unicode-slider-bar { color: var(--deck-signal); }
.player-bar .seek-slider { min-height: 1.7rem; display: flex; align-items: center; margin: 0; }
.player-bar .seek-bar-glyphs { font-family: var(--glyph-font); font-size: 0.9rem; letter-spacing: 0; }
.player-status { margin: 0; padding: 0 1.7rem; color: var(--deck-dim); }
.player-status:not(:empty) { padding-bottom: 1rem; }
.player-bar:fullscreen { margin: 0; padding: clamp(0.5rem, 3vw, 4rem); border-radius: 0; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; }
.player-bar:fullscreen .music-visualizer { min-height: 24em; }
:root[data-crt="on"] .player-bar:fullscreen::after { content: ""; position: fixed; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.12) 2px 3px); box-shadow: inset 0 0 15vw rgba(0, 0, 0, 0.2); }
.queue-tools { display: flex; align-items: center; gap: 1rem; margin: 1.4rem 0 0; padding: 0.7rem 0; border-block: 1px solid var(--line); }
.queue-tools input { flex: 1; min-width: 0; border: 0; border-radius: 0; padding: 0.6rem 0.25rem; background: transparent; color: var(--ink); font-family: var(--pixel); font-size: 0.78rem; }
.queue-tools input::placeholder { color: var(--muted); }
#music-match-count { flex-shrink: 0; color: var(--muted); }
#music-list { margin-top: 0; border-top: 0; padding-bottom: 1rem; }
#music-list button { grid-template-columns: 2.5rem minmax(0, 1fr) auto; padding: 0.85rem 0.25rem; align-items: baseline; }
#music-list .track-index { grid-column: 1; grid-row: 1 / 3; color: var(--muted); }
#music-list .list-title { grid-column: 2; grid-row: 1; font-size: 0.76rem; line-height: 1.65; overflow-wrap: anywhere; }
#music-list .list-dur { grid-column: 3; grid-row: 1; font-size: 0.66rem; }
#music-list .list-sub { grid-column: 2 / -1; font-size: 0.76rem; }
#music-list .is-current { background: color-mix(in srgb, var(--blush) 35%, transparent); }
#music-list .is-current .track-index { color: var(--rose); }
#music-list .is-playing .list-title::before { content: ""; }
#music-list .is-playing .track-index { color: var(--mark); }
.queue-empty { padding: 1.5rem 0; color: var(--muted); }
@media (max-width: 64rem) {
  .top { flex-wrap: wrap; gap: 0.25rem 0.75rem; padding: 0.6rem 1rem; }
  .top-right { margin-left: auto; gap: 0.65rem; }
  .nav-player { order: 3; flex-basis: 100%; max-width: none; justify-content: flex-start; padding: 0.25rem 0 0; border-top: 1px solid var(--line); }
  .nav-player-title { flex: 1; max-width: none; }
  .nav-player-vol-wrap { margin-left: auto; }
}
@media (max-width: 44rem) {
  .brand { font-size: 1rem; }
  .top-right { gap: 0.5rem; }
  .music-stage-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .viz-plate { min-height: 0; padding: 0.5rem 0; }
  .viz-plate svg { max-height: 8rem; }
  .viz-live-box { border-left: 0; border-top: 1px solid var(--deck-line); padding: 0.85rem 0 0; }
  .player-options { gap: 0.25rem; }
  #player-source { font-size: 0.6rem; }
  #player-position { font-size: 0.6rem; }
  .player-bar-row { grid-template-columns: auto auto auto minmax(0, 1fr); gap: 0.5rem; }
  .player-meta { grid-column: 1 / -1; grid-row: 1; padding: 0 0 0.5rem; gap: 0.3rem; }
  .player-volume-wrap { justify-self: end; }
  .nav-bottom button { flex-direction: column; gap: 0.1rem; font-size: 0.55rem; padding-bottom: 0.4rem; }
  .nav-glyph { font-size: 0.95rem; }
  .nav-bottom button.is-active::after { bottom: 0.18rem; }
  .who { font-size: 0.8rem; }
  .who-meta { max-width: 5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.55rem; }
  .crt-toggle { font-size: 0.6rem; }
  .seg button { padding-inline: 0.4rem; font-size: 0.65rem; }
  #music-list button { grid-template-columns: 1.9rem minmax(0, 1fr) auto; gap: 0.2rem 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .crt-texture, .nav-bottom button, .budka-cell img { transition: none; }
  .budka-card.is-pending img { animation: none; }
}
@media (forced-colors: active) {
  .crt-texture { display: none; }
  .unicode-slider input[type="range"] { opacity: 1; }
  .unicode-slider-bar { visibility: hidden; }
}
