/* ===== Základ ===== */
:root {
  --night-1: #07122b;
  --night-2: #0f2552;
  --night-3: #1b3a6b;
  --gold: #f2c14e;
  --gold-soft: #ffe3a1;
  --wine: #8c1c2b;
  --wine-dark: #6b1220;
  --cream: #fdf8ee;
  --paper: #fbf5e6;
  --ink: #2b2118;
  --muted: #5d5145;
  --line: #8a7760;
  --snow: #f6f1e4;
  --radius: 18px;
  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2rem;
  --s5: 3rem;
  --font-ui: "Nunito", system-ui, sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--night-2); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--snow);
  background:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(60, 100, 170, 0.45), transparent 70%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 55%, #1a2f5c 100%);
  background-attachment: fixed;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; margin: 0; }
p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.card :focus-visible,
dialog :focus-visible,
.paper :focus-visible { outline-color: var(--wine); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ===== Sníh (jen transform, žádný JS) ===== */
.snow {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.snow::before,
.snow::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  will-change: transform;
  background-repeat: repeat;
}
.snow::before {
  top: -240px;
  height: calc(100% + 240px);
  background-image:
    radial-gradient(circle at 20px 30px, #fff 1.5px, transparent 2.5px),
    radial-gradient(circle at 130px 80px, #fff 2px, transparent 3px),
    radial-gradient(circle at 200px 170px, #fff 1.5px, transparent 2.5px),
    radial-gradient(circle at 70px 200px, #fff 2.5px, transparent 3.5px),
    radial-gradient(circle at 170px 15px, #fff 1px, transparent 2px);
  background-size: 240px 240px;
  opacity: 0.75;
  animation: snow-fall 14s linear infinite;
}
.snow::after {
  top: -360px;
  height: calc(100% + 360px);
  background-image:
    radial-gradient(circle at 60px 90px, #fff 3px, transparent 4px),
    radial-gradient(circle at 250px 220px, #fff 2.5px, transparent 3.5px),
    radial-gradient(circle at 310px 40px, #fff 2px, transparent 3px);
  background-size: 360px 360px;
  opacity: 0.45;
  animation: snow-fall-far 26s linear infinite;
}
@keyframes snow-fall { to { transform: translateY(240px); } }
@keyframes snow-fall-far { to { transform: translateY(360px); } }

/* ===== Hlavička ===== */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2) clamp(1rem, 4vw, 2rem);
}
.brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--gold-soft);
}
.sound-toggle {
  position: fixed;
  top: var(--s2);
  right: clamp(1rem, 4vw, 2rem);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 48px;
  min-width: 48px;
  padding: 0 var(--s2);
  border: 2px solid rgba(242, 193, 78, 0.6);
  border-radius: 999px;
  background: rgba(7, 18, 43, 0.85);
  color: var(--snow);
  font: 700 0.95rem var(--font-ui);
  cursor: pointer;
}
.sound-toggle:hover { border-color: var(--gold); }

main {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: var(--s2) clamp(1rem, 4vw, 2rem) var(--s5);
}

/* ===== Úvod ===== */
.intro { text-align: center; margin: var(--s3) 0 var(--s4); }
.intro h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  color: var(--gold-soft);
  margin-bottom: var(--s2);
}
.lead { font-size: 1.15rem; max-width: 36rem; margin: 0 auto; color: #e9e3d3; }

/* ===== Karta formuláře ===== */
.card {
  background: var(--cream);
  color: var(--ink);
  border-radius: 24px;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(242, 193, 78, 0.35);
}
.form-section { padding-bottom: var(--s4); margin-bottom: var(--s4); border-bottom: 2px dashed #e4d6b6; }
.section-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: clamp(1.35rem, 3.5vw, 1.65rem);
  color: var(--wine);
  margin-bottom: var(--s2);
}
.step {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font: 800 1.05rem var(--font-ui);
}
.optional { font: 400 0.95rem var(--font-ui); color: var(--muted); }
.hint { color: var(--muted); margin: 0; }

.field-grid { display: grid; grid-template-columns: 1fr; gap: var(--s2); }
@media (min-width: 640px) { .field-grid { grid-template-columns: 2fr 1fr; } }

.field { display: flex; flex-direction: column; gap: var(--s1); margin-bottom: var(--s2); }
.field label, legend { font-weight: 800; font-size: 1.1rem; }
.input-row { display: flex; gap: var(--s1); align-items: center; flex-wrap: wrap; }
.input-row input { flex: 1 1 12rem; min-width: 0; }
.input-row textarea { flex: 1; min-width: 0; }

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 1.15rem var(--font-ui);
}
textarea { resize: vertical; min-height: 7.5rem; line-height: 1.5; }
input:hover, textarea:hover { border-color: var(--ink); }
input[aria-invalid="true"] { border-color: #b3122e; background: #fff6f6; }

.error {
  margin-top: 0.25rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: #fde8ea;
  color: #9a0f26;
  font-weight: 700;
}

/* ===== Tlačítka ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  min-height: 52px;
  min-width: 48px;
  padding: 0 1.35rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font: 800 1.05rem var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-dark); }
.btn-secondary { background: #fff; color: var(--wine); border-color: var(--wine); }
.btn-secondary:hover { background: #fff3e6; }
.btn-gold { background: var(--gold); color: var(--night-1); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ghost { background: rgba(255, 255, 255, 0.06); color: var(--snow); border-color: rgba(242, 193, 78, 0.7); }
.btn-ghost:hover { background: rgba(242, 193, 78, 0.15); }
.btn-send { width: 100%; min-height: 64px; font-size: 1.3rem; }

.mic {
  flex: none;
  width: 52px;
  height: 52px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 1.35rem;
  cursor: pointer;
}
.mic:hover { border-color: var(--wine); }
.mic.is-listening { background: var(--wine); border-color: var(--wine); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(140, 28, 43, 0.2); } }

/* ===== Přidání přání ===== */
.plus-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
  padding: 0;
  border: 0;
  background: none;
  color: var(--wine);
  font: 800 1.15rem var(--font-ui);
  cursor: pointer;
}
.plus-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px dashed var(--wine);
  border-radius: 50%;
  background: #fff;
  font-size: 2.4rem;
  line-height: 1;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.plus-btn[hidden] { display: none; }
.plus-btn:hover .plus-icon { transform: scale(1.06); background: #fff3e6; }
.wish-panel {
  padding: var(--s2);
  margin-bottom: var(--s2);
  border: 2px solid #e6d9bd;
  border-radius: var(--radius);
  background: #fffaf0;
}
.wish-panel .label { font-weight: 800; font-size: 1.1rem; }
.emoji-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 0.35rem;
  max-height: 260px;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid #eadcbc;
  border-radius: 12px;
  background: #fff;
}
.emoji-chosen { font-size: 1.5rem; vertical-align: middle; }
.emoji-btn {
  min-height: 48px;
  border: 2px solid #e6d9bd;
  border-radius: 12px;
  background: #fff;
  font-size: 1.7rem;
  cursor: pointer;
}
.emoji-btn:hover { border-color: var(--gold); }
.emoji-btn[aria-pressed="true"] { border-color: var(--wine); background: #fde8ea; box-shadow: 0 0 0 2px var(--wine); }
.panel-buttons { display: flex; flex-wrap: wrap; gap: var(--s1); }

/* ===== Seznam přání ===== */
.list-title { font-size: 1.2rem; color: var(--ink); margin: var(--s3) 0 var(--s1); }
.count { font-family: var(--font-ui); font-weight: 400; color: var(--muted); }
.wish-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.wish-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.25rem var(--s2);
  border: 1px solid #eadcbc;
  border-radius: 14px;
  background: #fff;
  font-weight: 700;
}
.wish-list .icon { font-size: 1.6rem; }
.wish-list .text { flex: 1; overflow-wrap: anywhere; }
.remove {
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #f6ead2;
  color: var(--wine);
  font: 800 1.2rem var(--font-ui);
  cursor: pointer;
}
.remove:hover { background: #f0d9b0; }
.empty { color: var(--muted); font-style: italic; }

/* ===== Kreslení ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s2); }
.tool-group { display: flex; flex-wrap: wrap; gap: var(--s1); }
.swatch {
  width: 48px;
  height: 48px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--line);
  cursor: pointer;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.08); }
.swatch--red { background: #c62828; }
.swatch--green { background: #2e7d32; }
.swatch--blue { background: #1565c0; }
.swatch--gold { background: #f2a900; }
.swatch--brown { background: #7b4a2a; }
.swatch--black { background: #222; }
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 48px;
  min-height: 48px;
  padding: 0 0.85rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 700 1rem var(--font-ui);
  cursor: pointer;
}
.tool[aria-pressed="true"] { background: #fff3d6; border-color: var(--wine); color: var(--wine); }
.dot { display: block; border-radius: 50%; background: currentColor; }
.dot--thin { width: 6px; height: 6px; }
.dot--thick { width: 18px; height: 18px; }
.pad {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 900 / 560;
  border: 3px solid #d8c7a0;
  border-radius: 14px;
  background: #fffdf7;
  touch-action: none;
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
}

/* ===== Nakreslit / nahrát ===== */
.mode-switch { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s2); }
.mode-btn {
  flex: 1 1 12rem;
  min-height: 52px;
  padding: 0 1rem;
  border: 2px solid #e6d9bd;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: 800 1.05rem var(--font-ui);
  cursor: pointer;
}
.mode-btn:hover { border-color: var(--gold); }
.mode-btn[aria-pressed="true"] { border-color: var(--wine); background: var(--wine); color: #fff; }
.upload-panel { margin-bottom: var(--s2); }
.upload-buttons { display: flex; flex-wrap: wrap; gap: var(--s1); margin-bottom: var(--s1); }
.upload-buttons .btn { position: relative; overflow: hidden; cursor: pointer; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.upload-buttons .btn:focus-within { outline: 3px solid var(--wine); outline-offset: 3px; }
.pad.is-locked { cursor: default; pointer-events: none; }

/* ===== Ozdoba ===== */
.deco-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.deco-fieldset legend.section-title { padding: 0; margin-bottom: var(--s2); font: 700 clamp(1.35rem, 3.5vw, 1.65rem) var(--font-serif); line-height: 1.2; }
.deco-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
@media (min-width: 560px) { .deco-options { grid-template-columns: repeat(4, 1fr); } }
.deco-option { position: relative; cursor: pointer; }
.deco-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.deco-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: var(--s2) var(--s1);
  border: 2px solid #e6d9bd;
  border-radius: var(--radius);
  background: #fff;
  font-weight: 800;
}
.deco-icon { font-size: 2.2rem; }
.deco-option input:checked + .deco-card { border-color: var(--wine); background: #fff3d6; box-shadow: inset 0 0 0 2px var(--wine); }
.deco-option input:focus-visible + .deco-card { outline: 3px solid var(--wine); outline-offset: 3px; }

/* ===== Kouzelný přechod ===== */
.transition {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s2);
  background: radial-gradient(ellipse at 50% 20%, #1d3b70, var(--night-1) 75%);
  cursor: pointer;
}
.anim-stage { position: relative; width: 320px; height: 470px; flex: none; }
@media (max-height: 640px) { .anim-stage { transform: scale(0.72); margin: -66px 0; } }
.anim-window {
  position: absolute;
  top: 0;
  left: 50%;
  width: 170px;
  height: 190px;
  margin-left: -85px;
  border: 10px solid #6b4426;
  border-radius: 85px 85px 8px 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30px 40px, #fff 1.5px, transparent 2.5px),
    radial-gradient(circle at 110px 70px, #fff 2px, transparent 3px),
    radial-gradient(circle at 70px 130px, #fff 1.5px, transparent 2.5px),
    radial-gradient(circle at 125px 150px, #fff 1px, transparent 2px),
    linear-gradient(180deg, #08142f, #1d3b70);
  box-shadow: 0 0 40px rgba(242, 193, 78, 0.25), inset 0 -18px 0 #e8eef8;
}
.anim-window::before,
.anim-window::after { content: ""; position: absolute; background: #6b4426; }
.anim-window::before { left: 50%; top: 0; bottom: 0; width: 8px; margin-left: -4px; }
.anim-window::after { top: 55%; left: 0; right: 0; height: 8px; }
.anim-moon {
  position: absolute;
  top: 26px;
  right: 22px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: -6px 4px 0 0 var(--gold-soft);
}
.anim-paper {
  position: absolute;
  top: 210px;
  left: 50%;
  width: 190px;
  height: 240px;
  margin-left: -95px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(transparent 0 22px, rgba(70, 110, 170, 0.25) 22px 23px),
    var(--paper);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transform-origin: 50% 40%;
}
.anim-fly { position: absolute; top: 270px; left: 50%; width: 220px; height: 140px; margin-left: -110px; }
.anim-envelope {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(160deg, #f1dfb6, #dcc08a);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  perspective: 600px;
}
.anim-envelope::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #e6cf9d;
  clip-path: polygon(0 100%, 50% 45%, 100% 100%);
  border-radius: 6px;
}
.anim-flap {
  position: absolute;
  inset: 0 0 auto 0;
  height: 62%;
  background: #d4b479;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transform: rotateX(180deg);
}
.anim-seal {
  position: absolute;
  top: 52%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b32a3c, var(--wine-dark));
  opacity: 0;
}
.anim-caption { font-family: var(--font-serif); font-size: 1.35rem; color: var(--gold-soft); }

.transition.play { animation: overlay-out 0.45s ease 3.3s forwards; }
.transition.play .anim-paper { animation: paper-fold 1.1s ease-in-out both; }
.transition.play .anim-envelope { animation: env-in 0.35s ease-out 0.95s both; }
.transition.play .anim-flap { animation: flap-close 0.4s ease-in-out 1.3s both; }
.transition.play .anim-seal { animation: seal-in 0.2s ease-out 1.7s both; }
.transition.play .anim-fly { animation: env-fly 1.4s cubic-bezier(0.5, 0, 0.75, 0.2) 1.9s both; }

@keyframes paper-fold {
  0% { transform: none; opacity: 1; }
  45% { transform: translateY(20px) scaleY(0.66); }
  85% { transform: translateY(55px) scaleY(0.42); opacity: 1; }
  100% { transform: translateY(60px) scaleY(0.4); opacity: 0; }
}
@keyframes env-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes flap-close { from { transform: rotateX(180deg); } to { transform: rotateX(0); } }
@keyframes seal-in { from { opacity: 0; transform: scale(1.6); } to { opacity: 1; transform: none; } }
@keyframes env-fly {
  0% { transform: none; opacity: 1; }
  30% { transform: translate(-14px, -40px) rotate(6deg) scale(0.85); }
  85% { opacity: 1; }
  100% { transform: translate(6px, -245px) rotate(-10deg) scale(0.1); opacity: 0; }
}
@keyframes overlay-out { to { opacity: 0; } }

/* ===== Dopis ===== */
.countdown {
  width: fit-content;
  max-width: 100%;
  margin: var(--s3) auto var(--s3);
  padding: 0.6rem 1.4rem;
  border: 1px solid rgba(242, 193, 78, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  text-align: center;
  color: var(--gold-soft);
}
.paper {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  --rule: 2.4rem; /* výška jednoho linkovaného řádku – všechno na papíře je jeho násobek */
  --rule-shift: -0.4rem; /* posun linek, aby písmo sedělo na lince */
  padding: var(--rule) clamp(1.25rem, 6vw, 3.5rem) var(--rule) clamp(2.5rem, 9vw, 5rem);
  border: 1px solid #e3d4b0;
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: clamp(1.45rem, 3.6vw, 1.85rem);
  line-height: var(--rule);
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 255, 255, 0.75), transparent 40%),
    radial-gradient(circle at 85% 95%, rgba(205, 170, 110, 0.22), transparent 50%),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--rule) - 1px), rgba(70, 110, 170, 0.22) calc(var(--rule) - 1px) var(--rule)) 0 var(--rule-shift),
    repeating-radial-gradient(circle at 30% 40%, rgba(120, 90, 40, 0.025) 0 1px, transparent 1px 4px),
    var(--paper);
  box-shadow: inset 0 0 50px rgba(165, 125, 60, 0.18), 0 2px 0 #e9dcc0, 0 24px 60px rgba(0, 0, 0, 0.5);
}
.paper::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: clamp(1.6rem, 6vw, 3.4rem);
  width: 2px;
  background: rgba(140, 28, 43, 0.35);
}
.paper p { margin: 0; }
.letter-deco {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  font-size: clamp(2.6rem, 8vw, 4rem);
  line-height: 1;
  transform: rotate(12deg);
}
.letter-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wine);
  margin: 0;
  line-height: var(--rule);
}
.greeting { font-size: 1.3em; font-weight: 700; }
.letter-wishes { list-style: none; margin: 0; padding: 0; }
.letter-wishes li { display: flex; gap: 0.6rem; align-items: baseline; }
.letter-wishes .icon { font-size: 0.85em; flex: none; width: 1.4em; text-align: center; line-height: 1; }
.letter-drawing {
  margin: 0;
  height: calc(var(--rule) * 6);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 640px) { .letter-drawing { height: calc(var(--rule) * 10); } }
.letter-drawing img {
  display: block;
  max-width: 100%;
  max-height: calc(100% - 1rem);
  width: auto;
  height: auto;
  border: 8px solid #fff;
  box-shadow: 0 6px 18px rgba(80, 50, 20, 0.25);
  transform: rotate(-1deg);
}
.signature { margin-top: var(--rule); }
.sig-name { font-size: 1.3em; font-weight: 700; color: var(--wine); line-height: var(--rule); }
.letter-date { font-family: var(--font-serif); font-size: 1rem; color: var(--muted); text-align: right; line-height: var(--rule); }

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  max-width: 780px;
  margin: var(--s4) auto var(--s2);
}
.new-letter { display: flex; justify-content: center; margin: var(--s4) 0 var(--s2); }
.new-letter .btn { min-width: 240px; }
.status { min-height: 1.6em; text-align: center; color: var(--gold-soft); font-weight: 700; }

/* ===== Dialog ===== */
dialog {
  max-width: min(440px, calc(100vw - 2rem));
  padding: var(--s4);
  border: 0;
  border-radius: 22px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(3, 8, 20, 0.72); }
dialog h2 { color: var(--wine); font-size: 1.5rem; margin-bottom: var(--s2); }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--s3); justify-content: flex-end; }

.site-footer {
  position: relative;
  z-index: 1;
  padding: var(--s3) var(--s2) var(--s4);
  text-align: center;
  color: #cfc8b6;
  font-size: 0.95rem;
}

/* ===== Omezení pohybu: bez sněhu a odletu, zvoneček zůstává ===== */
@media (prefers-reduced-motion: reduce) {
  .snow { display: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Tisk: jen dopis, 1 strana A4 ===== */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body {
    min-height: 0 !important;
    height: auto !important;
    background: #fff !important;
    color: #000;
  }
  .snow, .site-header, .sound-toggle, #form-view, .countdown, .actions, .new-letter, .status,
  .transition, dialog, .site-footer { display: none !important; }
  main { padding: 0; margin: 0; max-width: none; }
  .paper {
    max-width: none;
    max-height: 270mm;
    overflow: hidden;
    padding: 10mm 12mm 8mm 16mm;
    border: 1px solid #bbb;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    --rule: 1.3em;
    font-size: 16pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .paper::before { left: 10mm; }
  .letter-deco { font-size: 34pt; }
  .greeting { font-size: 22pt; }
  .letter-wishes { columns: 2; column-gap: 8mm; }
  .letter-wishes li { break-inside: avoid; }
  .letter-drawing { height: auto; margin: 3mm 0; display: block; }
  .letter-drawing img { max-height: 80mm; width: auto; border: 1px solid #bbb; box-shadow: none; transform: none; }
  .signature { margin-top: 4mm; }
  .greeting { line-height: 1.3; }
  .letter-date { font-size: 10pt; }
}

/* ===== Malé displeje ===== */
@media (max-width: 520px) {
  .sound-toggle { position: absolute; top: var(--s1); padding: 0; justify-content: center; width: 48px; }
  .sound-toggle #sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .swatch { width: 44px; height: 44px; }
  .tool-group { gap: 0.4rem; }
}
