:root {
  --ink: #131e1a;
  --ink-2: #1c2a25;
  --ink-3: #24352e;
  --ivory: #f1ebe0;
  --muted: #8b9d92;
  --champagne: #e4c179;
  --rose: #c98b84;
  --alert: #d97066;
  --radius: 14px;
  --pad: clamp(1.1rem, 4vw, 2rem);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--ivory);
  font-family: Figtree, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  padding: 0 var(--pad) calc(2rem + env(safe-area-inset-bottom));
  max-width: 1100px;
  margin-inline: auto;
}

button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--champagne); outline-offset: 3px; border-radius: 4px; }

/* ------------------------------------------------------------- demo-banner */

.demo-banner {
  background: var(--champagne);
  color: var(--ink);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.55rem var(--pad);
  margin: 0 calc(var(--pad) * -1);
}

.demo-banner strong { font-weight: 700; }

.demo-banner a {
  color: var(--ink);
  text-decoration: underline;
  font-weight: 500;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  padding: clamp(2.5rem, 9vw, 4.5rem) 0 clamp(1.5rem, 5vw, 2.5rem);
  text-align: center;
}

.eyebrow {
  margin: 0 0 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--champagne);
}

.names {
  font-family: Fraunces, Georgia, serif;
  font-weight: 300;
  font-size: clamp(2rem, 9vw, 3.6rem);
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.015em;
}

.amp {
  display: inline;
  font-size: 0.75em;
  font-style: italic;
  color: var(--rose);
  margin: 0 0.18em;
}

.hero-photo {
  display: block;
  width: min(75%, 200px);
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  margin: 1.6rem auto 0;
  border-radius: var(--radius);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.55);
}

.schedule-link {
  display: inline-block;
  margin-top: 1.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--ivory);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ivory) 25%, transparent);
  transition: filter 0.15s ease;
}

.schedule-link:hover { filter: brightness(1.2); }

.back-link {
  display: inline-block;
  color: var(--champagne);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.back-link:hover { text-decoration: underline; }

/* ------------------------------------------------------------- harmonogram */

.schedule-head { padding-bottom: clamp(1rem, 4vw, 2rem); }
.schedule-head .names--small { margin-top: 1.1rem; }

.names--small { font-size: clamp(1.8rem, 7vw, 2.6rem); }

.schedule {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  border-top: 1px solid var(--ink-3);
}

.schedule li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--ink-3);
}

.schedule time {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  color: var(--champagne);
  font-size: 1.05rem;
}

.schedule span { color: var(--ivory); }

/* ------------------------------------------------------------------ bingo */

.bingo-name {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0.4rem auto 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--ivory) 25%, transparent);
  background: var(--ink-2);
  color: var(--ivory);
  font: inherit;
  text-align: center;
}

.bingo-name:focus-visible { outline: 2px solid var(--champagne); outline-offset: 2px; }

.bingo-progress {
  text-align: center;
  margin: 1rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 1.4rem 0 2.5rem;
}

.bingo-task {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid color-mix(in oklab, var(--champagne) 30%, transparent);
  border-radius: 10px;
  background: var(--ink-2);
  color: var(--ivory);
  font-size: 0.76rem;
  line-height: 1.25;
  padding: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.bingo-task:active { transform: scale(0.96); }
.bingo-task.pending { opacity: 0.6; }

.bingo-task.done {
  background: color-mix(in oklab, #4caf7d 38%, var(--ink-2));
  border-color: #7fbf9a;
}

.bingo-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.bingo-task-text {
  position: relative;
  z-index: 1;
}

.bingo-thumb:not([hidden]) ~ .bingo-task-text {
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  background: color-mix(in oklab, var(--ink) 60%, transparent);
}

.bingo-secret {
  text-align: center;
  padding-top: 1.4rem;
  border-top: 1px solid var(--ink-3);
  margin-bottom: 2.5rem;
}

.bingo-secret h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 300;
  font-size: 1.6rem;
  margin: 0 0 0.4rem;
}

.lede {
  margin: 1.6rem auto 0;
  max-width: 30ch;
  color: var(--muted);
}

/* --------------------------------------------------------------- dropzone */

.dropzone {
  border: 1px dashed color-mix(in oklab, var(--champagne) 40%, transparent);
  border-radius: var(--radius);
  padding: clamp(1.6rem, 6vw, 2.4rem) 1.2rem;
  text-align: center;
  background: var(--ink-2);
  transition: border-color 0.2s, background 0.2s;
}

.dropzone.is-over {
  border-color: var(--champagne);
  background: var(--ink-3);
}

.cta {
  background: var(--champagne);
  color: #17231d;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 2.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cta:hover { filter: brightness(1.07); }
.cta:active { transform: scale(0.97); }
.cta[disabled] { opacity: 0.5; cursor: default; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
}

.cta-secondary {
  background: transparent;
  color: var(--ivory);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ivory) 35%, transparent);
}

.cta-toggle {
  background: transparent;
  color: var(--rose);
  font-size: 0.85rem;
  padding: 0.95rem 1.6rem;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rose) 45%, transparent);
}

.hint {
  margin: 1rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

/* ------------------------------------------------------------------ queue */

.queue {
  margin-top: 1.4rem;
  display: grid;
  gap: 0.6rem;
}

.job {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.85rem;
  align-items: center;
  background: var(--ink-2);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
}

.job img, .job video {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 7px;
}

.job-name {
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  height: 4px;
  background: var(--ink-3);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--champagne);
  transition: width 0.25s ease;
}

.job.done .bar > i { background: #7fbf9a; }
.job.failed .bar > i { background: var(--alert); width: 100% !important; }
.job.failed .job-name { color: var(--alert); }
.job.private .job-name::after { content: ' 🔒'; }

/* ------------------------------------------------------------------ album */

.album { margin-top: clamp(2.4rem, 8vw, 3.6rem); }

.album-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink-3);
  padding-bottom: 0.7rem;
  margin-bottom: 1.1rem;
}

.album-head h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 300;
  font-size: 1.6rem;
  margin: 0;
}

.count {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.tile {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  background: var(--ink-2);
  border-radius: 8px;
  overflow: hidden;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Sygnaturowy moment: kadr „wywołuje się" po wczytaniu miniatury. */
  filter: blur(12px) saturate(0.4);
  transform: scale(1.06);
  opacity: 0.5;
  transition: filter 0.7s ease, transform 0.7s ease, opacity 0.4s ease;
}

.tile img.ready {
  filter: none;
  transform: none;
  opacity: 1;
}

/* <video> pojawia się tylko w tymczasowym kaflu lokalnego podglądu
   (addPendingTile) — zawsze od razu "gotowy", bez efektu wywoływania. */
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile.private::before {
  content: "🔒";
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 1;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.3rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--ink) 70%, transparent);
}

.tile.pending::after {
  content: "wywołuje się…";
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: color-mix(in oklab, var(--ink) 78%, transparent);
  color: var(--champagne);
}

/* Tylko na potwierdzonych kaflach z serwera — nigdy razem z .pending. */
.tile.video::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: color-mix(in oklab, white 92%, transparent);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.empty, .loading {
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
}

.sentinel { height: 1px; }

/* --------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  background: #0b120f;
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}

.lightbox[hidden] { display: none; }

.lightbox img, .lightbox video {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 6px;
}

.lb-close, .lb-nav, .lb-delete {
  position: absolute;
  background: color-mix(in oklab, var(--ink-2) 88%, transparent);
  color: var(--ivory);
  border: 0;
  border-radius: 999px;
}

.lb-close {
  top: calc(0.9rem + env(safe-area-inset-top));
  right: 0.9rem;
  width: 42px;
  height: 42px;
  font-size: 1.05rem;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 1.7rem;
  line-height: 1;
}

.lb-prev { left: 0.6rem; }
.lb-next { right: 0.6rem; }

.lb-delete {
  bottom: calc(1.3rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 0.7rem 1.4rem;
  color: var(--alert);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(1.2rem + env(safe-area-inset-bottom));
  background: var(--ink-3);
  color: var(--ivory);
  padding: 0.75rem 1.3rem;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 60;
  max-width: calc(100vw - 2rem);
  text-align: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.toast[hidden] { display: none; }
.toast.bad { color: var(--alert); }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding-top: 3rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .tile img { filter: none; transform: none; opacity: 1; }
}
