/* Losowanie świąteczne: wigilijna noc, papierowe kartki, złoto świeczki. */
:root {
  --night: #0e2a22;
  --night-deep: #081a14;
  --fir: #1d5040;
  --paper: #fbfcfa;
  --ink: #1b2621;
  --muted: #5b6b63;
  --line: #dbe3de;
  --berry: #b8213a;
  --berry-dark: #921a2e;
  --gold: #e3b04b;
  --gold-soft: #f7d98a;
  --pine: #2f7d5d;
  --like: var(--pine);
  --dislike: var(--berry);
  --want: #c8901f;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; position: relative;
  font: 17px/1.55 var(--sans); color: var(--ink);
  background: var(--night) radial-gradient(ellipse 120% 70% at 50% -10%, #1f5644 0%, var(--night) 55%, var(--night-deep) 100%) fixed;
}
body.no-scroll { overflow: hidden; }
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.7rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
a { color: var(--berry); }
code { background: #f1ede1; padding: 1px 6px; border-radius: 6px; font-size: .92em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* --- girlanda i nagłówek ------------------------------------------------ */
.garland {
  position: absolute; top: 0; left: 0; right: 0; height: 36px; overflow: hidden; z-index: 1;
  display: flex; padding-left: 12px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='36'%3E%3Cpath d='M0 3 Q28 22 56 3' fill='none' stroke='%23ffffff' stroke-opacity='.28' stroke-width='1.5'/%3E%3C/svg%3E") 12px 0 / 56px 36px repeat-x;
}
.garland i { flex: 0 0 56px; position: relative; }
.garland i::before {
  content: ""; position: absolute; left: 50%; top: 12px; width: 9px; height: 13px; margin-left: -4.5px;
  border-radius: 45% 45% 50% 50% / 35% 35% 65% 65%;
  background: var(--c); box-shadow: 0 0 10px 2px var(--c);
  animation: twinkle 2.8s ease-in-out infinite; animation-delay: var(--d, 0s);
}
.garland i::after { content: ""; position: absolute; left: 50%; top: 9px; width: 5px; height: 4px; margin-left: -2.5px; background: #6b7a72; border-radius: 1px; }
.garland i:nth-child(4n+1) { --c: #ff5b6e; --d: 0s; }
.garland i:nth-child(4n+2) { --c: #ffd36b; --d: .7s; }
.garland i:nth-child(4n+3) { --c: #6be3a8; --d: 1.4s; }
.garland i:nth-child(4n+4) { --c: #8fc8ff; --d: 2.1s; }
.garland i:nth-child(3n) { --d: 1s; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; box-shadow: 0 0 2px 0 var(--c); } }

.top {
  position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  max-width: 980px; margin: 0 auto; padding: 44px 16px 0;
}
.logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.05rem; }
.logo .star { width: 24px; height: 24px; color: var(--gold); --hole: var(--night); }
main { position: relative; max-width: 980px; margin: 0 auto; padding: 8px 16px 80px; }

/* --- hero ------------------------------------------------------------- */
.hero { text-align: center; color: #fff; padding: 28px 0 26px; }
.hero.left { text-align: left; }
.hero h1 { margin-bottom: .25em; text-wrap: balance; }
.hero-sub { color: var(--gold-soft); margin: 0; font-size: 1.02rem; }
.hero.left .hero-sub span[data-countdown]:not(:empty) { display: block; opacity: .75; font-size: .9rem; margin-top: 2px; }
.hero-mark { width: 74px; height: 74px; color: var(--gold); --hole: var(--night); display: block; margin: 0 auto 14px; animation: mark-in 1.4s cubic-bezier(.2,1.2,.3,1) both; }
@keyframes mark-in { from { transform: rotate(-120deg) scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.hero-meter { height: 8px; max-width: 420px; margin-top: 14px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.hero-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: inherit; transition: width .6s; }
.mini-mark { width: 40px; height: 40px; color: var(--berry); --hole: var(--paper); display: block; margin: 0 auto 10px; }

/* --- papier --------------------------------------------------------------- */
.paper {
  background: var(--paper); border-radius: var(--r-lg); padding: 24px 22px; margin-bottom: 22px;
  box-shadow: 0 24px 50px -24px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.6) inset;
}
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.paper.status { text-align: center; max-width: 620px; margin-left: auto; margin-right: auto; }
.paper.status p { color: var(--muted); max-width: 46ch; margin: 0 auto; }
.empty { color: var(--muted); background: #f3f6f4; border: 1px dashed var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.warn { background: #fdf3dc; color: #6d4c0d; padding: 10px 14px; border-radius: var(--r-sm); }

/* --- formularze ----------------------------------------------------------- */
label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .95rem; }
input, select {
  width: 100%; padding: 12px 14px; margin-top: 6px; font: inherit; font-weight: 400; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(227,176,75,.28); }
input::placeholder { color: #a3aea8; }
.pw { position: relative; display: block; }
.pw input { padding-right: 76px; }
.eye { position: absolute; right: 6px; top: calc(50% + 3px); transform: translateY(-50%); padding: 6px 10px; font-size: .82rem; background: transparent; color: var(--muted); border-radius: 8px; }
.eye:hover { background: #eef2ef; color: var(--ink); }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; padding: 12px 20px; border: 0; border-radius: 12px;
  background: var(--berry); color: #fff; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s, box-shadow .15s;
}
button:hover, .btn:hover { background: var(--berry-dark); }
button:active, .btn:active { transform: scale(.97); }
button.wide { width: 100%; }
button.big { font-size: 1.15rem; padding: 15px 30px; border-radius: 14px; }
button.gold { background: var(--gold); color: #3b2405; }
button.gold:hover { background: var(--gold-soft); }
button.danger { background: #7a1712; }
.ghost, button.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.ghost:hover, button.ghost:hover { background: #f1f4f2; }
.danger-text { color: var(--berry) !important; }
button.link { background: none; padding: 0; color: var(--berry); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; border-radius: 4px; }
button.link:hover { background: none; color: var(--berry-dark); }
button.link.light { color: rgba(255,255,255,.85); }
button.link.light:hover { color: #fff; }
.small-btn { padding: 7px 12px; font-size: .85rem; border-radius: 9px; }
.small-btn.ok { background: var(--pine); }

/* --- logowanie: kafelki z imionami ---------------------------------------- */
fieldset.who { border: 0; padding: 0; margin: 0 0 6px; }
fieldset.who legend { font-family: var(--serif); font-size: 1.3rem; padding: 0; margin-bottom: 14px; }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.name-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0;
  padding: 14px 8px 12px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff;
  cursor: pointer; text-align: center; font-weight: 600; transition: border-color .15s, background .15s, transform .15s;
}
.name-tile:hover { border-color: #c4cec8; transform: translateY(-2px); }
.name-tile input { position: absolute; opacity: 0; pointer-events: none; }
.name-tile:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.initial {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.35rem; color: #fff; background: var(--berry); transition: transform .3s cubic-bezier(.2,1.6,.4,1);
}
.name-tile:nth-child(4n+2) .initial { background: var(--pine); }
.name-tile:nth-child(4n+3) .initial { background: var(--want); }
.name-tile:nth-child(4n+4) .initial { background: var(--fir); }
.name-tile .nm { font-size: .95rem; line-height: 1.25; word-break: break-word; }
.name-tile:has(input:checked) { border-color: var(--berry); background: #fdf1f2; box-shadow: 0 0 0 3px rgba(184,33,58,.15); }
.name-tile:has(input:checked) .initial { transform: scale(1.12) rotate(-6deg); }
.pw-step { max-height: 0; opacity: 0; overflow: hidden; padding: 0 4px; margin: 0 -4px; transition: max-height .4s ease, opacity .3s, margin-top .3s; }
form:has(.name-tile input:checked) .pw-step, .pw-step.show { max-height: 260px; opacity: 1; margin-top: 18px; }

/* --- dołączanie: kroki ---------------------------------------------------- */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 22px; }
.steps li { counter-increment: s; position: relative; padding: 6px 0 6px 42px; color: var(--muted); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 4px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: .85rem; font-weight: 700; background: #eef2ef; color: var(--muted);
}
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.now::before { background: var(--berry); color: #fff; }

/* --- zawieszka z losem ---------------------------------------------------- */
.tag-wrap { position: relative; padding-top: 40px; margin-bottom: 26px; filter: drop-shadow(0 26px 30px rgba(0,0,0,.45)); }
.tag-wrap::before {
  content: ""; position: absolute; top: -6px; left: 50%; width: 2px; height: 66px; margin-left: -1px; z-index: 2;
  background: linear-gradient(var(--gold-soft), var(--gold)); border-radius: 2px;
}
.tag {
  position: relative; background: var(--paper); padding: 46px 26px 24px; transform-origin: 50% -30px; rotate: -.6deg;
  clip-path: polygon(36px 0, calc(100% - 36px) 0, 100% 36px, 100% 100%, 0 100%, 0 36px);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background-image: radial-gradient(circle at 50% 0, rgba(227,176,75,.10), transparent 60%);
}
.tag.arrive { animation: swing 1.6s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes swing { 0% { rotate: 7deg; } 30% { rotate: -4deg; } 55% { rotate: 2deg; } 80% { rotate: -1.2deg; } 100% { rotate: -.6deg; } }
.tag-hole { position: absolute; top: 16px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--night); box-shadow: 0 0 0 4px var(--gold); }
.tag-for { text-align: center; color: var(--muted); margin-bottom: .2em; }
.receiver {
  text-align: center; font-family: var(--serif); color: var(--berry); line-height: 1.1; margin: 0 0 26px;
  font-size: clamp(2.3rem, 9vw, 3.6rem); text-wrap: balance;
}
.wish-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.wish-col { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--k); border-radius: var(--r-md); padding: 14px 16px 6px; }
.wish-col h3 { color: var(--k); }
.wish-col ul { margin: 0; padding: 0 0 0 1.1em; }
.wish-col li { margin-bottom: 8px; }
.wish-col li::marker { color: var(--k); }
.like { --k: var(--like); } .dislike { --k: var(--dislike); } .want { --k: var(--want); }
.tag-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 18px; }
.tag-foot p { margin: 0; flex: 1 1 260px; }

/* --- moja lista ------------------------------------------------------------ */
.list-head { margin-bottom: 16px; }
.list-head p { margin: 0; }
.wish-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
fieldset.wish-group { border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 12px 14px 6px; margin: 0; min-width: 0; background: #fff; transition: border-color .3s; }
fieldset.wish-group.done { border-color: color-mix(in srgb, var(--k) 55%, white); }
.wish-group legend { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; padding: 0 4px; font-family: var(--serif); font-size: 1.08rem; color: var(--k); }
.wish-group .count { flex-shrink: 0; white-space: nowrap; font-family: var(--sans); font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.wish-group .count b { font-weight: 700; color: var(--ink); display: inline-block; }
.wish-group .count b.bump { animation: bump .35s cubic-bezier(.2,1.8,.4,1); }
@keyframes bump { 50% { transform: scale(1.5); } }
.wish-group.done .count::after { content: " ✓"; color: var(--pine); font-weight: 700; }
.meter { display: block; height: 5px; border-radius: 99px; background: #edf1ee; overflow: hidden; margin: 6px 0 12px; }
.meter span { display: block; height: 100%; background: var(--k, var(--gold)); border-radius: inherit; transition: width .4s cubic-bezier(.3,1.4,.5,1); }
.wish-input { position: relative; margin-bottom: 8px; }
.wish-input .num { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; background: #eef2ef; color: var(--muted); transition: background .2s, color .2s; }
.wish-input input { margin: 0; padding: 10px 12px 10px 38px; font-size: .95rem; }
.wish-input:has(input:not(:placeholder-shown)) .num { background: var(--k); color: #fff; }
.save-bar {
  position: sticky; bottom: 12px; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 10px 10px 10px 16px; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-md);
  transition: border-color .2s, box-shadow .2s;
}
.save-bar.dirty { border-color: var(--gold); box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); }
.save-bar.dirty .save-note { color: #8a5d0a; font-weight: 600; }
.save-note { color: var(--muted); font-size: .92rem; }
#my-list.pulse { animation: pulse 1.6s ease-out 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(227,176,75,.7); } 100% { box-shadow: 0 0 0 22px rgba(227,176,75,0); } }
.spark { position: fixed; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); pointer-events: none; z-index: 50; box-shadow: 0 0 6px var(--gold-soft); }

/* --- historia ------------------------------------------------------------- */
details.history { color: rgba(255,255,255,.82); padding: 4px 4px; margin: 4px 0 0; }
details.history summary { color: #fff; }
details.history .muted { color: rgba(255,255,255,.6); }
.log { list-style: none; padding: 0; margin: 10px 0 0; font-size: .9rem; }
.log li { padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.log time { color: var(--gold-soft); opacity: .75; margin-right: 8px; font-variant-numeric: tabular-nums; }
details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details > form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
details > form input, details > form select { width: auto; flex: 1 1 180px; margin: 0; }

/* --- powiadomienia -------------------------------------------------------- */
.toast {
  position: fixed; top: 16px; left: 50%; z-index: 120; translate: -50% 0; width: max-content; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 18px; border-radius: var(--r-md);
  background: #12372c; color: #fff; box-shadow: 0 18px 40px -12px rgba(0,0,0,.6), inset 0 0 0 1.5px var(--gold);
  animation: toast-in .5s cubic-bezier(.2,1.4,.4,1) both;
}
.toast.err { background: var(--berry-dark); box-shadow: 0 18px 40px -12px rgba(0,0,0,.6); }
.toast.out { animation: toast-out .35s ease-in forwards; }
.toast-x { background: transparent; color: inherit; padding: 2px 8px; font-size: 1.2rem; line-height: 1; opacity: .7; }
.toast-x:hover { background: rgba(255,255,255,.12); opacity: 1; }
@keyframes toast-in { from { transform: translateY(-140%); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-140%); opacity: 0; } }

/* --- przypomnienie o liście ----------------------------------------------- */
dialog.prompt {
  border: 0; border-radius: var(--r-lg); padding: 28px 24px 20px; width: min(430px, calc(100vw - 32px));
  background: var(--paper); color: var(--ink); text-align: center; box-shadow: 0 40px 90px rgba(0,0,0,.5);
}
dialog.prompt::backdrop { background: rgba(5, 18, 13, .6); backdrop-filter: blur(3px); }
dialog.prompt[open] { animation: pop-in .45s cubic-bezier(.2,1.5,.4,1); }
@keyframes pop-in { from { transform: scale(.85) translateY(20px); opacity: 0; } }
dialog.prompt p { color: var(--muted); }
.prompt-progress { list-style: none; padding: 0; margin: 18px 0 22px; text-align: left; }
.prompt-progress li { display: grid; grid-template-columns: 1fr 96px 38px; gap: 12px; align-items: center; padding: 7px 0; font-size: .93rem; }
.prompt-progress .meter { margin: 0; }
.prompt-progress .count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.prompt-progress li.done .count { color: var(--pine); font-weight: 700; }
.prompt-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* --- panel admina ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1.5px solid var(--line); }
td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.person-name { font-weight: 600; }
tr.inactive td { opacity: .5; }
.pairs td:nth-child(2) { color: var(--gold); width: 30px; }
.copy { display: flex; gap: 6px; min-width: 260px; }
.copy input { margin: 0; font-size: .78rem; padding: 7px 9px; color: var(--muted); }
.actions { white-space: nowrap; text-align: right; }
.mini-meter { display: inline-block; vertical-align: middle; width: 56px; height: 6px; border-radius: 99px; background: #edf1ee; overflow: hidden; }
.mini-meter span { display: block; height: 100%; background: var(--pine); }
form.inline { display: inline-flex; gap: 6px; margin: 2px 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row input, .row select { width: auto; flex: 1 1 180px; margin: 0; }
.add-row { margin-bottom: 12px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0 0 12px; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--berry); }
.row label.check { margin: 0; white-space: nowrap; }
.badge { display: inline-block; font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: #eef2ef; color: var(--muted); }
.badge.ok { background: #e2f2ea; color: #1d5b40; }
.badge.wait { background: #fdf3dc; color: #7a560c; }
.badge.bad { background: #fbe3e5; color: var(--berry-dark); }
.badge.tmp { background: var(--want); color: #fff; }
details.menu { display: inline-block; margin: 2px 0 2px 6px; text-align: left; }
details.menu summary { font-size: .85rem; font-weight: 500; color: var(--muted); list-style: none; padding: 6px 10px; border-radius: 8px; box-shadow: inset 0 0 0 1.5px var(--line); }
details.menu summary::-webkit-details-marker { display: none; }
details.menu[open] { display: block; }
details.menu[open] summary { background: #f1f4f2; }
.menu-body { padding: 8px 0 4px; display: grid; gap: 6px; }
form.stack { display: flex; gap: 6px; margin: 0; flex-wrap: wrap; justify-content: flex-end; }
form.stack input { width: 170px; flex: 0 1 auto; margin: 0; padding: 7px 9px; font-size: .85rem; }
.excl { list-style: none; padding: 0; margin: 0 0 14px; }
.excl li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.excl li span:first-child, .excl li span:nth-child(3) { font-weight: 600; }
.excl form { margin-left: auto; }
.tmp-box { border: 2px dashed var(--want); background: #fdf6e4; border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 18px; }
.tmp-box p { margin: 8px 0 10px; }
.draw-btn .die { display: inline-block; transition: transform .5s cubic-bezier(.2,1.4,.4,1); }
.draw-btn:hover .die { transform: rotate(200deg) scale(1.15); }
.draw-btn.rolling .die { animation: roll .5s linear infinite; }
@keyframes roll { to { transform: rotate(360deg); } }

/* --- otwieranie prezentu --------------------------------------------------- */
.reveal {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 58%, #24614c 0%, var(--night) 50%, #050f0b 100%); color: #fff;
  animation: fade-in .5s ease both;
}
.reveal[hidden] { display: none; }
.reveal.leaving { animation: fade-out .35s ease forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.reveal-skip { position: absolute; top: 18px; right: 20px; z-index: 6; }
.reveal-title { font-family: var(--serif); font-size: clamp(1.3rem, 4.5vw, 1.7rem); color: var(--gold-soft); margin: 0 0 4px; min-height: 1.4em; text-align: center; }
.reveal-hint { font-size: .95rem; opacity: .7; margin: 10px 0 0; min-height: 1.5em; animation: breathe 2.2s ease-in-out infinite; }
.reveal-hint[hidden] { visibility: hidden; display: block; }
@keyframes breathe { 50% { opacity: .3; } }
.reveal-done { margin-top: 8px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .4s .7s, transform .4s .7s, background .15s; }
.reveal.finished .reveal-done { opacity: 1; transform: none; pointer-events: auto; }

.stage { position: relative; width: 300px; height: 430px; margin-bottom: 4px; display: grid; place-items: end center; }
.rays {
  position: absolute; left: 50%; top: 42%; width: 760px; height: 760px; margin: -380px 0 0 -380px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(rgba(247,217,138,.16) 0 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 15%, transparent 62%); mask: radial-gradient(circle, #000 15%, transparent 62%);
  opacity: 0; transform: scale(.3); transition: opacity 1s, transform 1.4s cubic-bezier(.2,1,.3,1);
}
.reveal.opening .rays { opacity: 1; transform: scale(1); animation: spin 26s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

.gift { position: relative; width: 260px; height: 360px; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; transform-origin: 50% 100%; }
.gift:not(.open):not(.shake) { animation: wiggle 2.6s ease-in-out infinite; }
.gift.shake { animation: shake .65s ease-in-out; }
.gift:focus-visible .gift-base { outline: 3px solid var(--gold-soft); outline-offset: 6px; }
@keyframes wiggle {
  0%, 58%, 100% { transform: rotate(0); }
  64% { transform: rotate(-4deg); } 70% { transform: rotate(4deg) translateY(-4px); }
  76% { transform: rotate(-3deg); } 82% { transform: rotate(2deg); } 88% { transform: rotate(0); }
}
@keyframes shake {
  0%, 100% { transform: none; }
  15% { transform: rotate(-6deg) scale(1.03); } 30% { transform: rotate(6deg) scale(1.05); }
  45% { transform: rotate(-7deg) scale(1.06); } 60% { transform: rotate(7deg) scale(1.07); }
  80% { transform: scale(.96, 1.06) translateY(-6px); }
}
.gift-base {
  position: absolute; bottom: 0; left: 30px; width: 200px; height: 150px; z-index: 3; border-radius: 8px;
  background:
    radial-gradient(circle at 25% 30%, rgba(255,255,255,.14) 0 3px, transparent 4px) 0 0 / 34px 34px,
    linear-gradient(180deg, #cf2f47, #8f1729);
  box-shadow: 0 28px 50px rgba(0,0,0,.55), inset 0 12px 20px rgba(0,0,0,.25);
}
.gift-base::before, .gift-lid::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 34px; transform: translateX(-50%);
  background: linear-gradient(90deg, #b9862a, var(--gold-soft) 50%, #b9862a);
}
.gift-lid {
  position: absolute; bottom: 146px; left: 20px; width: 220px; height: 48px; z-index: 4; border-radius: 8px;
  background: linear-gradient(180deg, #e2445b, #b0233a); box-shadow: 0 8px 12px rgba(0,0,0,.3);
}
.bow { position: absolute; left: 50%; bottom: 100%; width: 0; height: 0; }
.bow::before, .bow::after {
  content: ""; position: absolute; bottom: -6px; width: 62px; height: 40px;
  border: 11px solid var(--gold); border-radius: 50%; box-sizing: border-box;
}
.bow::before { right: -3px; transform: rotate(-24deg); transform-origin: 100% 100%; }
.bow::after { left: -3px; transform: rotate(24deg); transform-origin: 0 100%; }
.gift.open .gift-lid { animation: lid-off 1s cubic-bezier(.3,.6,.4,1) forwards; }
@keyframes lid-off {
  0% { transform: none; }
  18% { transform: translateY(10px); }
  100% { transform: translate(190px, -380px) rotate(58deg); opacity: 0; }
}
.gift-glow {
  position: absolute; left: 50%; bottom: 130px; width: 40px; height: 40px; margin-left: -20px; z-index: 1;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,226,140,.95), rgba(255,200,90,0) 70%);
  opacity: 0; transform: scale(.4); transition: transform 1.3s ease-out, opacity .6s;
}
.gift.open .gift-glow { opacity: 1; transform: scale(9); }
.name-card {
  position: absolute; left: 40px; right: 40px; bottom: 40px; height: 84px; z-index: 2;
  display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 14px;
  background: var(--paper); color: var(--berry); border-radius: 16px; box-shadow: 0 0 0 3px var(--gold), 0 14px 30px rgba(0,0,0,.4);
  font-family: var(--serif); font-size: 1.85rem; white-space: nowrap;
  transition: transform 1.1s cubic-bezier(.2,1.3,.4,1) .2s, left .6s ease .5s, right .6s ease .5s, scale .4s;
}
.name-card span { overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100%; }
.gift.open .name-card { transform: translateY(-214px); left: -30px; right: -30px; }
.name-card .tick { animation: tick .13s ease-out; }
@keyframes tick { from { transform: translateY(-70%); opacity: .1; filter: blur(1px); } }
.name-card.final { scale: 1.1; box-shadow: 0 0 0 3px var(--gold), 0 0 0 10px rgba(247,217,138,.25), 0 0 70px rgba(247,217,138,.85); animation: final-pop .55s cubic-bezier(.2,1.7,.4,1); }
@keyframes final-pop { 0% { scale: 1; } 60% { scale: 1.24; } 100% { scale: 1.1; } }
.confetti { position: fixed; width: 9px; height: 15px; border-radius: 2px; z-index: 4; pointer-events: none; }
.confetti.round { width: 10px; height: 10px; border-radius: 50%; }
@media (max-width: 420px) { .gift.open .name-card { left: -6px; right: -6px; } }
@media (max-height: 700px) { .stage { scale: .78; margin: -50px 0 -40px; } }

/* --- telefon -------------------------------------------------------------- */
@media (max-width: 760px) {
  .wish-cols, .wish-groups { grid-template-columns: 1fr; }
  .paper { padding: 20px 16px; border-radius: 18px; }
  .tag { padding: 44px 18px 20px; }
  .hero { padding: 18px 0 20px; }
  .top { padding-top: 42px; }
  .logo { font-size: .98rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal-done { transition: none; }
}

/* =========================================================================
   Telefon: dopracowanie
   ========================================================================= */
body { min-height: 100dvh; }
button, .btn, .name-tile, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.mini-label { display: none; }

/* Efekty najechania tylko tam, gdzie jest mysz (na telefonie „przyklejają się”). */
@media (hover: none) {
  .name-tile:hover { transform: none; border-color: var(--line); }
  .name-tile:has(input:checked):hover { border-color: var(--berry); }
  .draw-btn:hover .die { transform: none; }
}

/* Zakładki kategorii (włączane przez JS tylko na telefonie). */
.wish-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 0 0 14px;
  background: #edf1ee; border-radius: 14px; position: sticky; top: 8px; z-index: 4;
  box-shadow: 0 6px 16px -10px rgba(0,0,0,.35);
}
.wish-tabs[hidden] { display: none; }
.wish-tab {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: .86rem; line-height: 1.2;
  transition: background .2s, color .2s, box-shadow .2s;
}
.wish-tab:hover { background: rgba(255,255,255,.6); }
.wish-tab .t-count { font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.wish-tab.done .t-count::after { content: " ✓"; color: var(--pine); font-weight: 700; }
.wish-tab[aria-selected="true"] { background: #fff; color: var(--k); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.wish-groups.tabbed .wish-group:not(.active) { display: none; }
.wish-groups.tabbed .wish-group.active { animation: tab-in .3s ease both; }
@keyframes tab-in { from { opacity: 0; transform: translateX(10px); } }

@media (max-width: 760px) {
  /* iOS nie przybliża strony, gdy pole ma co najmniej 16px. */
  input, select, textarea { font-size: 16px !important; }
  body { font-size: 16px; }
  .hide-sm { display: none; }

  .top { padding: 40px 16px 0; }
  .hero h1 { font-size: 2rem; }
  .hero-mark { width: 60px; height: 60px; margin-bottom: 10px; }

  /* Lista: bez ramki w ramce, więcej miejsca na tekst. */
  fieldset.wish-group, fieldset.wish-group.done { border: 0; padding: 0; background: none; }
  .wish-groups.tabbed .wish-group legend { display: none; }
  .wish-groups.tabbed .meter { margin-top: 0; }
  .wish-input { margin-bottom: 10px; }
  .wish-input input { padding: 13px 12px 13px 42px; }
  .save-bar { bottom: 10px; margin-left: -6px; margin-right: -6px; }
  .save-bar button { padding: 12px 18px; }

  /* Zawieszka */
  .tag-wrap { padding-top: 30px; }
  .tag-wrap::before { height: 54px; }
  .tag { clip-path: polygon(26px 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%, 0 26px); padding-top: 40px; }
  .wish-col { padding: 12px 14px 4px; }
  .tag-foot button { width: 100%; }

  /* Przypomnienie jako arkusz od dołu. */
  dialog.prompt {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 24px 24px 0 0;
    padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  }
  dialog.prompt::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
  dialog.prompt[open] { animation: sheet-up .45s cubic-bezier(.2,1.1,.3,1); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .prompt-progress li { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .prompt-progress .meter { grid-column: 1 / -1; grid-row: 2; }
  .prompt-actions button.wide { padding: 15px; }
  .prompt-actions .link { padding: 8px 16px; }

  /* Powiadomienia na całą szerokość. */
  .toast { left: 12px; right: 12px; translate: none; width: auto; top: 10px; }

  /* Panel admina: uczestnicy jako karty. */
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  table.people, table.people tbody { display: block; }
  table.people tr:first-child { display: none; }
  table.people tr {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name status" "list act" "link link";
    gap: 8px 10px; padding: 14px; margin-bottom: 10px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff;
  }
  table.people td { display: block; padding: 0; border: 0; }
  table.people .person-name { grid-area: name; font-size: 1.05rem; align-self: center; }
  table.people .c-status { grid-area: status; align-self: center; }
  table.people .c-list { grid-area: list; display: flex; align-items: center; gap: 8px; }
  table.people .mini-label { display: inline; font-size: .85rem; color: var(--muted); }
  table.people .mini-meter { flex: 1; width: auto; }
  table.people .c-link { grid-area: link; }
  table.people .link-used { display: none; }
  table.people .copy { min-width: 0; }
  table.people .copy input { font-size: 14px !important; }
  table.people .copy button { padding: 8px 12px; flex-shrink: 0; }
  table.people .actions { grid-area: act; text-align: right; white-space: nowrap; align-self: center; }
  table.people .actions form.inline { margin: 0 6px 0 0; }
  table.people tr:has(details.menu[open]) { grid-template-areas: "name status" "list list" "act act" "link link"; }
  table.people tr:has(details.menu[open]) .actions { text-align: left; white-space: normal; }
  table.people .c-link:has(.link-used) { display: none; }
  table.people .copy .share-btn { background: var(--pine); }
  table.people .actions:empty { display: none; }
  details.menu { display: block; margin: 0; }
  details.menu summary { display: inline-block; }
  form.stack { justify-content: flex-start; }
  form.stack input { width: auto; flex: 1 1 160px; }
  .add-row button { width: 100%; }
  .row select { flex-basis: 100%; }
  .row > span { width: 100%; }
  .row > button { width: 100%; }
  .excl li { font-size: .95rem; }
  .draw-box .big { width: 100%; }
  details > form > button { width: 100%; }
}
