:root {
  --pine: #12352B;
  --fir: #1E4D3E;
  --fir-line: #2f6553;
  --paper: #F6EBD6;
  --paper-edge: #e6d3ae;
  --cranberry: #B3243A;
  --cranberry-dark: #8e1a2c;
  --straw: #D9A441;
  --ink: #2A1E17;
  --ink-soft: #6b5646;
  --snow: #f4f8f6;
  --serif: "Young Serif", Georgia, serif;
  --sans: "Atkinson Hyperlegible", system-ui, sans-serif;
  --r-tag: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -200px, #22584a 0%, transparent 70%),
    var(--pine);
  color: var(--snow);
  font: 18px/1.55 var(--sans);
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
main { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--straw); outline-offset: 3px; border-radius: 6px; }

/* ---------- tlačítka ---------- */
.btn {
  font: 700 17px/1 var(--sans);
  border: 0; cursor: pointer;
  padding: 14px 20px; border-radius: 999px;
  min-height: 48px;
  transition: transform .1s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cranberry); color: #fff; }
.btn.primary:hover { background: var(--cranberry-dark); }
.btn.straw { background: var(--straw); color: var(--ink); }
.btn.ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.btn.small { padding: 10px 14px; min-height: 40px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 6px; }

/* ---------- hlavička ---------- */
.top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 8px;
}
.countdown { display: flex; align-items: baseline; gap: 14px; }
.countdown .num {
  font-family: var(--serif);
  font-size: clamp(72px, 14vw, 148px);
  line-height: .85;
  color: var(--straw);
  letter-spacing: -0.02em;
}
.countdown .txt { font-family: var(--serif); font-size: clamp(20px, 3vw, 30px); line-height: 1.15; max-width: 11ch; }
.who { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.who .me { opacity: .8; font-size: 16px; }

/* ---------- šňůra s ozdobami (lidé) ---------- */
.garland { position: relative; margin: 28px -20px 8px; padding: 0 20px; overflow-x: auto; scrollbar-width: none; }
.garland::-webkit-scrollbar { display: none; }
.garland-inner { position: relative; display: flex; gap: 6px; min-width: max-content; padding: 14px 4px 18px; }
.garland-inner::before { /* šňůra */
  content: ""; position: absolute; left: 0; right: 0; top: 14px; height: 3px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, #c9a46a 0 6px, #a57f45 6px 12px);
}
.bauble {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  width: 104px; padding-top: 22px;
  background: none; border: 0; color: inherit; cursor: pointer; font: inherit;
  transform-origin: 50% 0;
}
.bauble::before { /* provázek */
  content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 24px; background: var(--straw); opacity: .7;
}
.bauble .ball {
  position: relative;
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center; font-size: 34px;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55) 0 8%, transparent 30%), var(--c, var(--cranberry));
  box-shadow: inset -8px -10px 18px rgba(0,0,0,.25);
}
.bauble .ball::before { /* čepička */
  content: ""; position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 11px; border-radius: 3px 3px 2px 2px; background: var(--straw);
}
.bauble .name { margin-top: 8px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.bauble .count { font-size: 13px; opacity: .75; min-height: 1.2em; }
.bauble[aria-pressed="true"] .ball { outline: 3px solid var(--snow); outline-offset: 4px; }
.bauble[aria-pressed="true"] .name { color: var(--straw); }
@media (prefers-reduced-motion: no-preference) {
  .bauble[aria-pressed="true"] { animation: swing 1.6s ease-in-out 1; }
}
@keyframes swing { 0%,100% { transform: rotate(0) } 25% { transform: rotate(5deg) } 60% { transform: rotate(-3deg) } }

/* ---------- sekce seznamu ---------- */
.listhead { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 26px 0 6px; }
.listhead h2 { font-size: clamp(30px, 5vw, 44px); line-height: 1.05; }
.listhead p { margin: 6px 0 0; opacity: .8; max-width: 60ch; }

.tags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 34px 26px;
  margin-top: 30px;
}

/* ---------- visačka ---------- */
.tag {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--r-tag);
  padding: 34px 20px 18px;
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%, 0 22px);
  box-shadow: 0 2px 0 var(--paper-edge);
  display: flex; flex-direction: column; gap: 10px;
  transform: rotate(var(--tilt, 0deg));
}
.tag-wrap { position: relative; filter: drop-shadow(0 10px 14px rgba(0,0,0,.28)); }
.tag-wrap::before { /* provázek */
  content: ""; position: absolute; z-index: 2; left: 50%; top: -22px; width: 2px; height: 34px;
  background: repeating-linear-gradient(180deg, #c9a46a 0 3px, #a57f45 3px 6px);
  transform: rotate(var(--tilt, 0deg));
}
.tag::before { /* dírka */
  content: ""; position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--pine); box-shadow: 0 0 0 3px var(--straw);
}
.tag .img {
  width: 100%; aspect-ratio: 4 / 3; border-radius: 6px; background: #fff center/contain no-repeat;
  border: 1px solid var(--paper-edge);
}
.tag h3 { font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.tag .note { margin: 0; color: var(--ink-soft); font-size: 16px; overflow-wrap: anywhere; }
.tag .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.tag .price { font-weight: 700; }
.tag .prio { color: var(--cranberry); letter-spacing: 1px; }
.tag .shop { color: var(--fir); font-weight: 700; }
.tag .buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.tag .btn.ghost { color: var(--fir); }
.tag .status { font-size: 15px; color: var(--ink-soft); }
.tag .status strong { color: var(--ink); }
.tag.sealed h3 { padding-right: 52px; }
.tag.dim { opacity: .62; }
.tag.dim:hover, .tag.dim:focus-within { opacity: 1; }

/* pečeť */
.seal {
  position: absolute; z-index: 3; right: -12px; top: -6px;
  width: 80px; height: 80px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  font: 400 13px/1.05 var(--serif); color: #ffe9ec;
  background: radial-gradient(circle at 35% 30%, #d6435a, var(--cranberry) 55%, var(--cranberry-dark));
  box-shadow: 0 4px 10px rgba(0,0,0,.3), inset 0 0 0 6px rgba(0,0,0,.12), inset 0 0 0 8px rgba(255,255,255,.12);
  transform: rotate(-12deg);
  padding: 10px;
}
.seal.gold { background: radial-gradient(circle at 35% 30%, #f0c76a, var(--straw) 55%, #a87a22); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .seal.stamp { animation: stamp .45s cubic-bezier(.2,1.6,.4,1) 1; }
}
@keyframes stamp { 0% { transform: scale(2.2) rotate(-30deg); opacity: 0 } 100% { transform: scale(1) rotate(-12deg); opacity: 1 } }

/* prázdný stav + přidat */
.add-tag {
  border: 3px dashed var(--fir-line); border-radius: var(--r-tag);
  background: transparent; color: var(--snow); cursor: pointer;
  min-height: 220px; font: 400 24px/1.2 var(--serif);
  display: grid; place-items: center; padding: 20px; text-align: center;
}
.add-tag:hover { border-color: var(--straw); color: var(--straw); }
.empty { margin-top: 30px; padding: 26px; border-radius: 14px; background: var(--fir); max-width: 60ch; }
.empty h3 { font-size: 24px; margin-bottom: 6px; }
.empty p { margin: 0; opacity: .85; }

/* nákupní seznam */
.shop-group { margin-top: 34px; }
.shop-group h3 { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.shop-group h3 .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; }
.shop-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--paper); color: var(--ink); border-radius: 10px; padding: 14px 16px; margin-top: 10px;
}
.shop-item .t { font-weight: 700; }
.shop-item .s { font-size: 15px; color: var(--ink-soft); }
.shop-item.done .t { text-decoration: line-through; color: var(--ink-soft); }
.shop-item.removed { box-shadow: inset 4px 0 0 var(--cranberry); }
.shop-item input[type="checkbox"] { width: 26px; height: 26px; accent-color: var(--fir); }

/* ---------- přihlášení ---------- */
.login { min-height: 92vh; display: flex; flex-direction: column; justify-content: center; }
.login h1 { font-size: clamp(44px, 9vw, 96px); line-height: .95; max-width: 12ch; }
.login h1 .small { display: block; font-size: .38em; color: var(--straw); margin-bottom: 10px; }
.login .lead { font-size: 20px; opacity: .85; margin: 18px 0 0; }
.login .garland { margin-top: 30px; }
.login form { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.login input[type="password"] { flex: 1 1 260px; max-width: 360px; }
.login .error { color: #ffb3bf; font-weight: 700; margin-top: 10px; min-height: 1.5em; }

/* ---------- formuláře ---------- */
input[type="text"], input[type="url"], input[type="password"], input:not([type]), textarea {
  width: 100%; font: 18px/1.3 var(--sans); padding: 13px 14px;
  border-radius: 10px; border: 2px solid var(--paper-edge); background: #fffdf8; color: var(--ink);
}
input:focus, textarea:focus { outline: none; border-color: var(--fir); }

dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(620px, calc(100vw - 24px));
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(8, 26, 20, .72); }
dialog form { padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 16px; }
dialog h2 { font-size: 30px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-weight: 700; font-size: 16px; padding: 0; }
.field .row { display: flex; gap: 8px; }
.field .row input { flex: 1; min-width: 0; }
.field .row .btn { color: var(--fir); white-space: nowrap; }
.hint { color: var(--ink-soft); min-height: 1.2em; }
.two { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.prio { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }
.prio legend { width: 100%; margin-bottom: 6px; }
.prio label { cursor: pointer; }
.prio input { position: absolute; opacity: 0; }
.prio span { display: inline-block; padding: 9px 12px; border-radius: 999px; border: 2px solid var(--paper-edge); font-size: 15px; }
.prio input:checked + span { background: var(--cranberry); border-color: var(--cranberry); color: #fff; }
.prio input:focus-visible + span { outline: 3px solid var(--straw); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--cranberry); }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.actions .ghost { color: var(--fir); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; z-index: 50;
  background: var(--snow); color: var(--ink); padding: 14px 20px; border-radius: 12px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: all .25s ease; pointer-events: none; max-width: 90vw;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

.loading { opacity: .7; margin-top: 30px; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  main { padding: 16px 14px 70px; }
  .two { grid-template-columns: 1fr; }
  .field .row { flex-direction: column; }
  .tags { gap: 34px; }
  .bauble { width: 88px; }
  .bauble .ball { width: 62px; height: 62px; font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
