/* Packpapier, Geschenkanhänger, Siegellack */
:root {
  --kraft: #c9a87f;
  --kraft-deep: #ad8a5f;
  --tag: #fbf6ec;
  --ink: #22302a;
  --ink-soft: #55625a;
  --wax: #a8271f;
  --wax-deep: #861d17;
  --twine: #f1e6cf;
  --fir: #2f5a46;
  --line: rgba(34, 48, 42, .14);
  --focus: #1d5fd1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --kraft: #3b2f23;
    --kraft-deep: #2c231a;
    --tag: #f3ecdf;
    --ink: #1f2a24;
    --ink-soft: #4e5a52;
    --wax: #c8392f;
    --wax-deep: #a52c23;
    --twine: #d9c9aa;
    --fir: #2f5a46;
    --line: rgba(34, 48, 42, .18);
    --focus: #7fb0ff;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 18px/1.55 "Atkinson Hyperlegible", system-ui, sans-serif;
  background-color: var(--kraft);
  /* feine Papierfasern */
  background-image:
    repeating-linear-gradient(17deg, rgba(255,255,255,.05) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-71deg, rgba(0,0,0,.04) 0 1px, transparent 1px 11px);
}

.page { width: 100%; max-width: 540px; margin: 0 auto; padding: 36px 16px 32px; flex: 1; }
.foot { text-align: center; padding: 8px 16px 28px; font-family: "Young Serif", Georgia, serif; color: var(--tag); opacity: .9; }
@media (prefers-color-scheme: light) { .foot { color: var(--ink); opacity: .55; } }

h1, h2 { font-family: "Young Serif", Georgia, serif; font-weight: 400; line-height: 1.15; margin: 0; }
p { margin: 0 0 .8em; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Kopf */
.head { text-align: center; margin-bottom: 30px; color: var(--ink); }
@media (prefers-color-scheme: dark) { .head { color: var(--tag); } }
.year { font-family: "Young Serif", Georgia, serif; font-size: 1.05rem; margin: 0 0 6px; opacity: .8; }
.head h1 { font-size: clamp(2.4rem, 11vw, 3.6rem); letter-spacing: -.01em; }
.facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 1rem; }

/* Papierbogen für Inhalte */
.sheet {
  background: var(--tag);
  color: var(--ink);
  border-radius: 6px;
  padding: 24px 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 10px 24px -14px rgba(40,25,10,.55);
}
.sheet > :last-child { margin-bottom: 0; }
.sheet h2 { font-size: 1.55rem; margin-bottom: 10px; }
.note { white-space: pre-wrap; overflow-wrap: anywhere; }
.quiet { color: var(--ink-soft); }
.center { text-align: center; }
.small { font-size: .92rem; }

/* Namensanhänger */
.tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 16px 0 18px; }
.tag-btn {
  position: relative;
  font: inherit; font-weight: 700; color: var(--ink); text-align: left;
  background: var(--twine);
  border: 0; cursor: pointer;
  padding: 16px 14px 16px 40px;
  min-height: 60px;
  clip-path: polygon(22px 0, 100% 0, 100% 100%, 22px 100%, 0 50%);
  overflow-wrap: anywhere;
  transition: background .15s;
}
.tag-btn::before {
  content: ""; position: absolute; left: 16px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; background: var(--tag); box-shadow: inset 0 0 0 2px var(--kraft-deep);
}
.tag-btn:hover { background: #e9d9ba; }
.tag-btn:focus-visible { outline: none; background: #e3cfa9; box-shadow: inset 0 0 0 3px var(--focus); }

/* Formulare */
label { display: block; font-weight: 700; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: 6px; padding: 12px 14px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--focus); }
textarea { min-height: 130px; resize: vertical; }
.pin {
  font-size: 2rem; letter-spacing: .6em; text-align: center; padding: 10px 0 10px .6em;
  font-variant-numeric: tabular-nums; max-width: 240px; display: block; margin: 0 auto;
}
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 460px) { .row.stack { flex-direction: column; gap: 0; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  min-height: 52px; padding: 12px 20px; border-radius: 6px;
  border: 2px solid transparent; background: var(--wax); color: #fff;
  transition: background .15s;
}
.btn:hover { background: var(--wax-deep); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.plain { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.plain:hover { background: rgba(0,0,0,.04); }
.btn.fir { background: var(--fir); }
.btn.fir:hover { background: #244a39; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .9rem; font-weight: 700; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.linkish { background: none; border: 0; padding: 4px 2px; font: inherit; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }

.error { color: var(--wax); font-weight: 700; margin: 0 0 12px; }
.hello { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hello h2 { margin: 0; }

/* Geschenk & Anhänger-Enthüllung */
.reveal { text-align: center; padding: 8px 0 4px; }
.gift {
  position: relative; width: 150px; height: 130px; margin: 12px auto 16px; display: block;
  border: 0; padding: 0; cursor: pointer; background: transparent;
}
.gift .box { position: absolute; left: 10px; right: 10px; bottom: 0; height: 92px; background: var(--wax); border-radius: 3px; }
.gift .lid { position: absolute; left: 0; right: 0; top: 26px; height: 26px; background: var(--wax-deep); border-radius: 3px; transition: transform .35s ease; }
.gift .ribbon-v { position: absolute; left: 50%; top: 26px; bottom: 0; width: 16px; margin-left: -8px; background: var(--twine); }
.gift .bow { position: absolute; left: 50%; top: 2px; width: 60px; height: 30px; margin-left: -30px; }
.gift .bow::before, .gift .bow::after {
  content: ""; position: absolute; top: 0; width: 28px; height: 24px; border: 6px solid var(--twine); border-radius: 50% 50% 0 50%;
}
.gift .bow::before { left: 0; transform: rotate(-20deg); }
.gift .bow::after { right: 0; transform: scaleX(-1) rotate(-20deg); }
.gift:hover .lid, .gift:focus-visible .lid { transform: translateY(-6px) rotate(-3deg); }

.for-tag {
  position: relative; display: inline-block; min-width: 230px; max-width: 100%;
  background: var(--twine); padding: 22px 30px 22px 58px; margin: 6px 0 18px;
  clip-path: polygon(34px 0, 100% 0, 100% 100%, 34px 100%, 0 50%);
  transform-origin: 8px 50%;
  animation: swing 1.1s cubic-bezier(.3,1.6,.5,1) both;
}
.for-tag::before {
  content: ""; position: absolute; left: 22px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  border-radius: 50%; background: var(--tag); box-shadow: inset 0 0 0 2px var(--kraft-deep);
}
.for-tag .for { display: block; text-align: left; font-family: "Caveat", cursive; font-size: 1.5rem; line-height: 1; color: var(--ink-soft); }
.for-tag .who { display: block; text-align: left; font-family: "Caveat", cursive; font-size: clamp(2.6rem, 12vw, 3.4rem); line-height: 1.05; color: var(--wax); overflow-wrap: anywhere; }
@keyframes swing { 0% { transform: rotate(-24deg); opacity: 0; } 25% { opacity: 1; } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .for-tag { animation: none; } .gift .lid { transition: none; } }

.wish { text-align: left; background: #fff; border-left: 4px solid var(--fir); padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Listen (Admin) */
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list .who { font-weight: 700; overflow-wrap: anywhere; }
.list .state { font-weight: 400; font-size: .88rem; color: var(--ink-soft); display: block; }
.list .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.names { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; }
details summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
details[open] summary { margin-bottom: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: var(--tag); padding: 12px 18px; border-radius: 6px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 10; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
