:root {
  /* Hodnoty z identity (brand/tokens.json → /brand/tokens.css). Tady jen kratší jména pro styly. */
  --cream: var(--sr-linen);
  --paper: var(--sr-paper);
  --ink: var(--sr-ink);
  --muted: var(--sr-ink-soft);
  --dark: var(--sr-night);
  --dark-2: #3a2e28;
  --accent: var(--sr-terra);
  --serif: var(--sr-font-serif);
  --hand: var(--sr-font-script);
  --sans: var(--sr-font-sans);
  --caps: var(--sr-font-caps);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--dark); overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.screen { min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom)); }
.screen-light { background: radial-gradient(120% 80% at 50% 0%, var(--paper), var(--cream)); }
.screen-dark { background: radial-gradient(120% 70% at 50% 30%, var(--dark-2), var(--dark)); color: var(--paper); }

.brand { font-family: var(--hand); font-size: 34px; line-height: 1; margin: 0; }
img.brand-logo { height: 120px; width: auto; display: block; margin: 0 auto; }
.cam-top img.brand-logo { height: 58px; margin: 0; }
.kicker { font-family: var(--caps); text-transform: uppercase; letter-spacing: .22em; font-size: 12px; color: var(--muted); }

/* ---------- Úvod ---------- */
.intro-inner { width: 100%; max-width: 420px; margin: auto; text-align: center; padding: 12px 0; }
.intro-inner h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(38px, 11vw, 52px); line-height: 1.05; margin: 18px 0 4px; }
.intro-inner h2 { font-family: var(--serif); font-weight: 500; font-size: 32px; margin: 18px 0 8px; }
.date { font-family: var(--caps); color: var(--muted); letter-spacing: .22em; text-transform: uppercase; font-size: 12px; margin: 0 0 22px; }
.lead { font-size: 17px; line-height: 1.5; margin: 0 0 8px; }
.lead.small { color: var(--muted); font-size: 15px; }
.fine { color: var(--muted); font-size: 13px; margin-top: 14px; }
.warn { background: #fff3d6; border: 1px solid #ecd39a; border-radius: 12px; padding: 12px; font-size: 14px; line-height: 1.45; text-align: left; }
.help { text-align: left; background: #fff; border-radius: 14px; padding: 4px 16px; margin: 16px 0; font-size: 15px; line-height: 1.45; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

.intro-stack { position: relative; height: 112px; margin: 18px auto 0; width: 160px; }
.mini-pola { position: absolute; left: 50%; top: 0; width: 86px; height: 102px; background: #fff; border-radius: 3px;
  box-shadow: 0 6px 18px rgba(60,40,20,.18); padding: 7px 7px 22px; }
.mini-pola::before { content: ''; display: block; width: 100%; aspect-ratio: 1; background: linear-gradient(140deg, var(--sr-sand), var(--sr-rose) 55%, var(--sr-terra)); }
.mini-pola.p1 { transform: translateX(-95%) rotate(-12deg); }
.mini-pola.p2 { transform: translateX(-5%) rotate(10deg); }
.mini-pola.p3 { transform: translateX(-50%) rotate(-2deg); }
.mini-pola.p3 span { position: absolute; left: 0; right: 0; bottom: 0; font-family: var(--hand); font-size: 21px; line-height: 22px; color: var(--sr-terra); }

.name-field { display: block; text-align: left; margin: 22px 0 16px; }
.name-field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.name-field input { width: 100%; font-size: 17px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--sr-line); background: #fff; color: var(--ink); outline: none; }
.name-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,101,74,.18); }

.btn-primary { width: 100%; border: 0; border-radius: 999px; padding: 17px 20px; font-size: 17px; font-weight: 500; letter-spacing: .02em;
  background: var(--sr-terra); color: var(--paper); box-shadow: 0 8px 22px rgba(181,101,74,.28); }
.btn-primary:active { transform: scale(.98); }

/* ---------- Foťák ---------- */
#camera { justify-content: space-between; gap: 10px; }
.cam-top { width: 100%; max-width: 480px; display: flex; justify-content: space-between; align-items: baseline; }
.cam-couple { font-family: var(--serif); font-size: 17px; opacity: .75; }

.filmstrip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; width: min(92vw, 420px); }
.filmstrip i { aspect-ratio: 1; border-radius: 3px; background: var(--paper); box-shadow: inset 0 0 0 2px var(--paper); transition: background .35s, transform .35s; }
.filmstrip i.used { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(251,248,242,.28); }
.filmstrip i.just { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(1.5); background: var(--sr-terra); } 100% { transform: scale(1); } }

/* Hledáček jako polaroid: širší spodní okraj s ručně psaným počítadlem */
.polaroid { --w: min(88vw, 52dvh, 440px); width: var(--w); background: var(--sr-paper); border-radius: 4px;
  padding: calc(var(--w) * .055) calc(var(--w) * .055) 0; box-shadow: 0 18px 40px rgba(0,0,0,.45); color: var(--ink); }
.viewfinder { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; background: #0d0c0b; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  /* náhled filtru – finální úprava se počítá přesně až při focení */
  filter: contrast(.9) saturate(.82) brightness(1.05) sepia(.12); }
.viewfinder.mirror video { transform: scaleX(-1); }
.tint { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(180deg, rgba(255,214,150,.35), rgba(255,190,140,.15) 55%, rgba(80,140,150,.25)); }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(20,12,6,.38) 100%); }
.shutter-blink { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.shutter-blink.on { animation: blink .28s ease-out; }
@keyframes blink { 0% { opacity: 1; } 100% { opacity: 0; } }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 120px; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.5); }
.countdown.tick { animation: tick .9s ease-out; }
@keyframes tick { 0% { transform: scale(1.4); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(.9); opacity: .9; } }
.caption { font-family: var(--hand); font-size: calc(var(--w, 300px) * .1); line-height: 1.1; text-align: center; margin: 0; padding: .35em 0 .45em; color: var(--sr-ink); }
.caption b { font-weight: 400; color: var(--sr-terra); }

.controls { width: min(92vw, 420px); display: flex; justify-content: space-between; align-items: center; }
.icon-btn { width: 72px; background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; opacity: .85; }
.icon-btn svg { width: 46px; height: 46px; padding: 11px; border-radius: 50%; background: rgba(255,255,255,.1); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
#btn-flash svg { fill: none; }
.icon-btn[aria-pressed="true"] svg { background: var(--sr-sand); color: var(--dark); fill: var(--dark); stroke: var(--dark); }
.icon-btn:disabled { opacity: .25; }
.shutter { width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--paper); background: none; padding: 5px; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--paper); transition: transform .12s; }
.shutter:active span { transform: scale(.88); }
.shutter:disabled { opacity: .35; }
.timer-toggle { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 999px; padding: 7px 16px; font-size: 13px; color: var(--paper); }
.timer-toggle[aria-pressed="true"] { background: var(--paper); color: var(--dark); }

.upload-status { min-height: 1.3em; font-size: 13px; opacity: .7; margin: 0; text-align: center; }

.screen-flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 50; transition: opacity .08s; }
.screen-flash.on { opacity: 1; }

/* ---------- Dofoceno ---------- */
.done-inner { margin: auto; text-align: center; max-width: 400px; }
.done-inner h2 { font-family: var(--serif); font-weight: 500; font-size: 40px; margin: 28px 0 8px; }
.done-card { --w: min(70vw, 300px); margin: 0 auto; transform: rotate(-3deg); animation: eject 1.1s cubic-bezier(.2,.8,.2,1); }
@keyframes eject { 0% { transform: translateY(-40px) rotate(0); opacity: 0; } 100% { transform: translateY(0) rotate(-3deg); opacity: 1; } }
.undeveloped { display: grid; place-items: center; background: linear-gradient(135deg, #3a3631, #26231f 60%, #3b352e); }
.undeveloped span { font-family: var(--hand); font-size: 30px; color: rgba(255,255,255,.45); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .4; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--paper); color: var(--ink);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 60; }

/* ---------- Galerie ---------- */
.gallery-page { background: var(--cream); color: var(--ink); min-height: 100dvh; padding: 24px 16px 60px; }
.gallery-head { max-width: 1100px; margin: 0 auto 22px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: end; }
.gallery-head h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; margin: 4px 0 0; }
.gallery-head p { margin: 4px 0 0; color: var(--muted); }
.gallery-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-ghost { border: 1px solid #d9cdbb; background: #fff; border-radius: 999px; padding: 9px 16px; font-size: 14px; text-decoration: none; color: var(--ink); }
.grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 18px; }
.card { background: var(--sr-paper); padding: 8px 8px 0; border-radius: 3px; box-shadow: 0 6px 16px rgba(60,40,20,.15); cursor: zoom-in; transition: transform .2s; }
.card:nth-child(3n) { transform: rotate(-1.2deg); } .card:nth-child(3n+1) { transform: rotate(.9deg); }
.card:hover { transform: rotate(0) scale(1.02); }
.card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #ddd; }
.card .cap { font-family: var(--hand); font-size: 26px; text-align: center; padding: 6px 0 8px; line-height: 1.1; }
.card .cap small { display: block; font-family: var(--sans); font-size: 11px; color: var(--muted); margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; grid-column: 1 / -1; }

.lightbox { position: fixed; inset: 0; background: rgba(20,16,12,.92); display: grid; place-items: center; z-index: 40; padding: 16px; }
.lightbox .polaroid { --w: min(92vw, 78dvh, 760px); }
.lightbox img { display: block; width: 100%; aspect-ratio: 1; }
.lightbox .lb-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.lightbox .meta { color: rgba(255,255,255,.55); font-size: 12px; text-align: center; margin-top: 8px; }
.btn-danger { border: 1px solid #e3b4a8; background: #fff; color: #a3361f; border-radius: 999px; padding: 9px 16px; font-size: 14px; }
.btn-light { background: var(--paper); color: var(--ink); margin-top: 18px; }
.link-light { color: rgba(251,248,242,.6); }

/* Úkol pro hosta nad hledáčkem */
.task-card { width: min(88vw, 52dvh, 440px); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  background: rgba(255,250,243,.08); border: 1px solid rgba(255,250,243,.16); border-radius: 14px; padding: 9px 10px 9px 12px; }
.task-card.task-in { animation: taskIn .45s ease; }
@keyframes taskIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.task-label { font-family: var(--caps); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; background: var(--sr-terra); color: var(--sr-paper); border-radius: 999px; padding: 4px 9px; }
.task-text { margin: 0; font-family: var(--hand); font-size: 25px; line-height: 1.1; color: var(--sr-paper); }
.task-skip { background: none; border: 0; color: rgba(255,250,243,.6); font-size: 13px; padding: 6px; white-space: nowrap; }
#camera:has(.task-card:not([hidden])) .polaroid { --w: min(88vw, 46dvh, 440px); }
#camera:has(.task-card:not([hidden])) .task-card { width: min(88vw, 46dvh, 440px); }

.task-card.shared { background: rgba(181,101,74,.28); border-color: rgba(212,165,154,.55); }
.task-card.shared .task-label { background: var(--sr-paper); color: var(--sr-terra); }
.task-sub { display: block; font-size: 12px; color: rgba(255,250,243,.7); margin-top: 2px; }
.task-news { margin: -2px 0 0; font-size: 13px; color: rgba(255,250,243,.75); text-align: center; width: min(88vw, 46dvh, 440px); }

/* Vzkaz k fotce */
.comment-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--sr-paper); color: var(--sr-ink);
  border-radius: 22px 22px 0 0; padding: 18px 20px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.35);
  animation: sheetUp .3s ease; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.comment-q { font-family: var(--hand); font-size: 30px; margin: 0 0 10px; color: var(--sr-terra); line-height: 1.1; }
.comment-sheet input { width: 100%; font: inherit; font-size: 17px; padding: 13px 15px; border-radius: 14px; border: 1px solid var(--sr-line); background: #fff; color: var(--ink); outline: none; }
.comment-sheet input:focus { border-color: var(--sr-terra); }
.comment-actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.comment-actions button[type=button] { background: none; border: 0; padding: 14px 10px; color: var(--muted); font-size: 16px; }
.comment-actions .btn-primary { flex: 1; padding: 14px; }
body:has(#comment:not([hidden])) .toast { bottom: calc(230px + env(safe-area-inset-bottom)); }
