/* Lila als Grund, Papier und Glas als einzige Materialien, Gold nur für das, was man antippen kann. */
@font-face { font-family: Kalam; src: url(/kalam.woff2) format("woff2"); font-display: swap; }
:root {
  --bg: #8e24aa; --bg-low: #6a1784; --deep: #651a7d; --line: #ffffff2e; --fg: #fdf6ff; --soft: #f0d9f7;
  --note: #e4f0bb; --note-2: #f4ebb4; --note-3: #d3ecd2; --ink: #26331a; --ink-soft: #56663c;
  --gold: #ffd872; --on-gold: #33250a; --glass: #f0d5f6;
  --hand: Kalam, cursive; --radius: 18px; --gap: 1rem;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg-low); }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; color: var(--fg); font: 16px/1.45 system-ui, sans-serif;
  background: linear-gradient(var(--bg) 0 35%, var(--bg-low)) fixed; padding-top: env(safe-area-inset-top); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.sr { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.view { width: 100%; max-width: 30rem; margin: 0 auto; padding: var(--gap); flex: 1; }
h1 { font: 400 2rem/1.2 var(--hand); margin: .2rem 0; }
h1:focus { outline: none; }
h2 { font: 400 1.45rem/1.2 var(--hand); margin: 1.6rem 0 .5rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Knöpfe */
.button, .link, .chip { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 1.1rem; border: 0; border-radius: 99px;
  font-weight: 600; text-decoration: none; transition: transform .12s, background-color .15s; }
.button { background: var(--gold); color: var(--on-gold); }
.link, .chip { background: #ffffff1c; color: var(--fg); }
.link:hover, .chip:hover { background: #ffffff2e; }
.button:active, .link:active, .chip:active { transform: scale(.96); }

/* Angebot zur Installation */
#install { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .4rem 1rem; width: calc(100% - 1.5rem); max-width: 29rem;
  margin: .75rem auto 0; padding: .7rem .7rem .7rem 1.1rem; background: var(--deep); border-radius: var(--radius); }
#install .row { margin-left: auto; }

/* Startbildschirm */
body:has(#v-start:not([hidden])) { height: 100dvh; }
.start { min-height: 0; display: flex; flex-direction: column; gap: .5rem; position: relative; overflow: hidden; padding-bottom: .4rem; }
#waiting { align-self: center; padding: .35rem .95rem; border-radius: 99px; background: #ffffff1c; font-size: .9rem; font-weight: 600; }
#text { flex: 1; min-height: 5rem; width: 100%; border: 0; border-radius: 4px 4px 22px 4px; resize: none; color: var(--ink); padding: 1.1rem 1.2rem;
  font: 1.3rem/2rem var(--hand); transform: rotate(-.8deg); margin: .3rem 0;
  background: repeating-linear-gradient(transparent 0 calc(2rem - 1px), #26331a17 calc(2rem - 1px) 2rem) 0 .9rem local, linear-gradient(160deg, #eef6cf, var(--note) 60%);
  background-color: var(--note); box-shadow: 0 1px 2px #2a063a40, 0 14px 30px -8px #2a063a80; }
#text:focus-visible { outline-offset: 2px; }
#text::placeholder { color: var(--ink-soft); opacity: 1; }
.hintline { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: .7rem; flex-wrap: wrap; text-align: center; }
.jars { display: flex; justify-content: center; gap: 1.8rem; padding-top: 1.5rem; }
.jar { width: 130px; max-width: 45%; background: none; border: 0; padding: 0; text-align: center; overflow-wrap: anywhere; transition: transform .15s; border-radius: 24px; }
.jar:active { transform: scale(.97); }
.jar b, .jar .count { display: block; }
.jar .count { font-size: .9rem; color: var(--soft); }
.lid { display: block; position: relative; z-index: 1; height: 17px; margin: 0 14px -2px; border-radius: 7px 7px 4px 4px;
  background: linear-gradient(#ffffff80, transparent 35%), repeating-linear-gradient(90deg, #a8751d38 0 2px, transparent 2px 7px), var(--gold);
  box-shadow: 0 2px 4px #2a063a59; transition: transform .28s cubic-bezier(.3, 1.4, .5, 1); transform-origin: right bottom; }
.jar.open .lid { transform: translate(36px, -3px) rotate(26deg); }
.glass { position: relative; height: 165px; border: 2px solid #ffffff8c; border-radius: 24px 24px 32px 32px; display: flex; flex-wrap: wrap-reverse; align-content: flex-start;
  gap: 4px; padding: 11px; overflow: hidden; margin-bottom: 8px; background: linear-gradient(100deg, #ffffff2b, #ffffff12 45%, #ffffff26);
  box-shadow: inset 0 -14px 22px -12px #2a063a66, inset 0 0 14px #ffffff26, 0 12px 22px -10px #2a063a99; }
.glass::after { content: ""; position: absolute; left: 9px; top: 14px; bottom: 34px; width: 7px; border-radius: 9px; background: linear-gradient(#ffffff8c, #ffffff14); }
.glass i { width: 16px; height: 12px; border-radius: 2px; background: var(--note); transform: rotate(var(--r, 0deg)); box-shadow: 0 1px 2px #2a063a59; }
.glass i:nth-child(3n + 2) { background: var(--note-2); }
.glass i:nth-child(3n) { background: var(--note-3); }
.jar.landed .glass { animation: land .35s; }
@keyframes land { 30% { transform: translateY(3px) scale(1.02, .985); } 65% { transform: translateY(-1px); } }
/* Das große Glas in „Mein Glas“ */
.jar.big { display: block; width: 150px; max-width: none; margin: 1.1rem auto .2rem; padding-top: .6rem; }
.jar.big .glass { height: 175px; }
.glass i.drop { animation: drop .55s calc(var(--i) * 30ms) both cubic-bezier(.3, 1.25, .5, 1); }
@keyframes drop { from { transform: translateY(-210px) rotate(calc(var(--r) * 4)); opacity: 0; } 40% { opacity: 1; } }
#glass-info { text-align: center; color: var(--soft); margin: .2rem 0 .8rem; }
.fly { position: absolute; background: var(--note); border-radius: 4px; box-shadow: 0 14px 30px -8px #2a063a80; z-index: 3; pointer-events: none; transform-origin: 0 0; }
.syncline { display: flex; align-items: center; justify-content: center; gap: .3rem .8rem; flex-wrap: wrap; min-height: 1.4em; font-size: .8rem; color: var(--soft); }
#pending::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45em; background: #8df0a9; }
#pending[data-state="open"]::before { background: var(--gold); }
#pending[data-state="blocked"]::before { background: none; box-shadow: inset 0 0 0 2px var(--soft); }
#relogin { color: var(--gold); font-weight: 600; }

/* Leiste unten */
#tabs { position: sticky; bottom: 0; z-index: 2; background: var(--deep); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs div { display: flex; max-width: 30rem; margin: 0 auto; }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem .2rem .45rem; color: var(--soft); text-decoration: none; font-size: .78rem; font-weight: 600; }
#tabs a:focus-visible { outline-offset: -4px; border-radius: 12px; }
#tabs svg { width: 46px; height: 28px; padding: 3px 12px; border-radius: 99px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: background-color .2s; }
#tabs a[aria-current] { color: var(--fg); }
#tabs a[aria-current] svg { background: var(--gold); color: var(--on-gold); }

/* Meine Zettel */
#list ul, .notes { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .8rem; }
.note { background: #4d0f6352; border: 1px solid var(--line); padding: 1rem 1.1rem; border-radius: var(--radius); min-width: 0; }
.note p { margin: 0; }
.note .text, .slip p { white-space: pre-wrap; overflow-wrap: anywhere; }
.note .meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .85rem; color: var(--soft); margin-top: .5rem; }
.pill { padding: .1rem .65rem; border-radius: 99px; background: #ffffff1c; font-weight: 600; }
.pill[data-status="auf Papier"], .pill[data-status="verschenkt"] { background: var(--note-3); color: var(--ink); }
.pill[data-status="noch nicht hochgeladen"] { background: var(--gold); color: var(--on-gold); }
.pill[data-status="abgelehnt"] { background: #ffd0d0; color: #5a0d14; }
.note > .row { justify-content: space-between; margin-top: .5rem; }
.note label { display: inline-flex; gap: .55rem; align-items: center; min-height: 44px; }
.note > .row .link:only-child { margin-left: auto; }
input[type="checkbox"], input[type="radio"] { appearance: none; width: 1.35rem; height: 1.35rem; margin: 0; flex: none; border: 2px solid var(--soft); border-radius: 6px; display: grid; place-content: center; cursor: pointer; }
input[type="radio"] { border-radius: 50%; }
input:checked { background: var(--gold); border-color: var(--gold); }
input:checked::before { content: ""; width: .75rem; height: .75rem; background: var(--on-gold); clip-path: polygon(8% 52%, 0 62%, 38% 98%, 100% 18%, 90% 8%, 37% 76%); }
input[type="radio"]:checked::before { width: .55rem; height: .55rem; border-radius: 50%; clip-path: none; }
#list-info:not(:empty), #print-info:not(:empty) { background: #ffffff1c; border-radius: 12px; padding: .7rem 1rem; }

/* Mein Glas: hier sind es echte Zettel */
#glass-list { gap: 1.1rem; margin-top: 1.2rem; }
#glass-list .note { background: linear-gradient(160deg, #ffffff73, transparent 60%) var(--note); color: var(--ink); border: 0; border-radius: 3px 3px 18px 3px; padding: 1.1rem 1.2rem .9rem;
  box-shadow: 0 1px 2px #2a063a40, 0 12px 24px -10px #2a063a80; transform: rotate(-.7deg); }
#glass-list .note:nth-child(3n + 2) { background-color: var(--note-2); transform: rotate(.6deg); }
#glass-list .note:nth-child(3n) { background-color: var(--note-3); transform: rotate(-.3deg); }
#glass-list .text { font: 1.25rem/1.5 var(--hand); }
#glass-list .meta { color: #3c4a28; }

.wide { width: 100%; }
.search { display: block; position: relative; margin: .9rem 0 .2rem; }
/* Als Element statt Hintergrundbild: data:-Bilder verbietet die CSP. */
.search svg { position: absolute; left: 1rem; top: 50%; width: 1.15rem; height: 1.15rem; transform: translateY(-50%); fill: none; stroke: var(--soft); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; min-height: 48px; padding: 0 1.1rem 0 2.8rem; border: 1px solid var(--line); border-radius: 99px; color: var(--fg); font: inherit; background: #ffffff1c; }
.search input::placeholder { color: var(--soft); opacity: 1; }
.search input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#draw { background: none; border: 0; box-shadow: none; padding: .8rem; overflow: visible; }
#draw-paper { max-height: 60dvh; overflow-y: auto; background: linear-gradient(160deg, #eef6cf, var(--note) 60%); color: var(--ink); border-radius: 4px 4px 22px 4px; padding: 1.8rem 1.6rem 1.3rem;
  box-shadow: 0 24px 60px #2a063acc; transform: rotate(-1.2deg); }
#draw-text { font: 1.55rem/1.45 var(--hand); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 1rem; }
#draw-by { color: #3c4a28; }
#draw .row { justify-content: center; position: relative; z-index: 1; }
#draw::backdrop { background: #2a063ae0; }
#draw .link { background: var(--deep); }

/* Details */
.details-btn { align-self: flex-start; max-width: 100%; min-height: 36px; padding: 0 .9rem; border: 1px dashed #ffffff66; border-radius: 99px; background: none;
  font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details-btn.filled { border-style: solid; background: #ffffff1c; }
.details { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: .5rem 0 0; font-size: .85rem; }
.tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 .6rem; border: 0; border-radius: 99px; background: #ffffff24; color: inherit; font: inherit; font-weight: 600; }
button.tag { cursor: pointer; }
.place, .event { font-weight: 600; }
.place::before { content: ""; display: inline-block; width: .5em; height: .5em; margin-right: .35em; border: 2px solid currentColor; border-radius: 50% 50% 50% 0; transform: rotate(-45deg) translateY(-1px); }
a.place { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.event { display: inline-flex; align-items: center; min-height: 28px; padding: 0 .6rem; border: 1px dashed currentColor; border-radius: 99px; }
#glass-list .details .tag { background: #26331a14; }
#glass-list .details { color: var(--ink); }
.field { display: block; margin-top: .9rem; font-size: .9rem; font-weight: 600; }
.field input { display: block; width: 100%; min-height: 48px; margin-top: .3rem; padding: 0 1rem; border: 1px solid var(--line); border-radius: 14px; color: var(--fg); font: inherit; font-weight: 400; background: #ffffff1c; }
.field small { display: block; margin-top: .25rem; font-weight: 400; font-size: .75rem; color: var(--soft); }
.field input[type="date"] { color-scheme: dark; }
.field input::placeholder { color: var(--soft); opacity: .8; }
.field input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hints { margin-top: .5rem; gap: .4rem; }
.hints:empty { display: none; }
.geo { flex-wrap: nowrap; margin-top: .5rem; font-size: .85rem; color: var(--soft); }
.geo .chip { min-height: 36px; }
.link.small { min-height: 36px; padding: 0 .8rem; font-size: .85rem; }
.credit { display: block; margin-top: .4rem; font-size: .75rem; color: var(--soft); }
.credit a { color: inherit; }
#d-error:empty { display: none; }
#d-error { margin: .8rem 0 0; color: #ffd0d0; font-size: .9rem; }
#details-title { margin: 0; }

/* Fotos */
.thumb { display: block; width: 100%; max-height: 16rem; object-fit: cover; border-radius: 10px; margin-top: .7rem; cursor: zoom-in; background: #ffffff14; }
#glass-list .thumb { border-radius: 2px; box-shadow: 0 1px 3px #2a063a40; }
dialog .row.photo-row, dialog .row.geo { justify-content: flex-start; }
.photo-row { gap: .6rem; margin-top: .3rem; }
#d-photo-img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
#d-photo-status:empty { display: none; }
#draw-photo { display: block; width: 100%; max-height: 40dvh; object-fit: cover; margin: 0 0 1rem; border-radius: 2px; cursor: zoom-in; box-shadow: 0 1px 3px #2a063a59; }
#photo-view { width: auto; max-width: 100vw; max-height: 100dvh; padding: 0; background: none; border: 0; box-shadow: none; }
#photo-view::backdrop { background: #12021ae6; }
.photo-close { padding: 0; border: 0; background: none; cursor: zoom-out; }
#photo-full { display: block; max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.map-popup img { display: block; width: 100%; max-height: 9rem; object-fit: cover; border-radius: 2px; margin-bottom: .5rem; }
.slip img { display: block; max-width: 100%; max-height: 6cm; margin: 0 auto .5rem; object-fit: contain; }

/* Karte */
body:has(#v-map:not([hidden])) { height: 100dvh; }
.map-view { display: flex; flex-direction: column; min-height: 0; }
#map-info { color: var(--soft); margin: .3rem 0 .7rem; }
#map { flex: 1; min-height: 260px; border-radius: var(--radius); overflow: hidden; background: #dcd3e0; box-shadow: 0 12px 24px -12px #2a063a99; }
#map .leaflet-popup-content-wrapper { background: var(--note); color: var(--ink); border-radius: 4px 4px 16px 4px; }
#map .leaflet-popup-tip { background: var(--note); }
.map-popup p { margin: 0 0 .4rem; font: 1.15rem/1.4 var(--hand); white-space: pre-wrap; overflow-wrap: anywhere; }
.map-popup small { color: #3c4a28; }
#map .leaflet-control-attribution { font-size: .7rem; }

/* Fragen */
dialog { width: min(24rem, calc(100% - 2rem)); background: var(--deep); color: var(--fg); border: 1px solid var(--line); border-radius: 24px; padding: 1.4rem; box-shadow: 0 24px 60px #2a063acc; }
dialog::backdrop { background: #2a063ab3; }
dialog p { margin: 0 0 1rem; font-size: 1.1rem; font-weight: 600; }
dialog .row { justify-content: flex-end; margin-top: 1.2rem; }
#gift label { display: flex; gap: .8rem; align-items: flex-start; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 14px; margin-top: .6rem; cursor: pointer; font-weight: 600; }
#gift label:has(:checked) { border-color: var(--gold); background: #ffffff14; }
#gift input { margin-top: .1rem; }
#gift small { display: block; font-weight: 400; color: var(--soft); margin-top: .1rem; }

/* Anmelden */
#v-login { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6rem; }
#v-login img { border-radius: 28px; box-shadow: 0 16px 34px -10px #2a063a99; }
#v-login h1 { font-size: 2.6rem; }
#v-login p { margin: 0 0 .8rem; max-width: 22rem; }

#sheet { display: grid; grid-template-columns: 1fr 1fr; margin-top: 1rem; background: #fff; color: #111; border-radius: 6px; }
.slip { border: 1px dashed #777; padding: .8rem; break-inside: avoid; min-width: 0; }
.slip p { font: 1.1rem/1.45 var(--hand); margin: 0 0 .4rem; }

@media (max-height: 680px) { .glass { height: 120px; } .jars { padding-top: 1.1rem; } }
@media (max-height: 560px) {
  #install, #tabs, #waiting { display: none; }
  .start { padding-block: .4rem; gap: .2rem; }
  .jars { padding-top: .3rem; }
  .lid { height: 11px; }
  .glass { height: 52px; border-radius: 12px 12px 18px 18px; padding: 6px 10px; margin-bottom: 4px; }
  .glass::after { display: none; }
  .hintline { min-height: 44px; }
  .details-btn { min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@page { size: A4; margin: 12mm; }
@media print {
  :root { color-scheme: light; }
  html, body { background: #fff; }
  .screen, dialog, #install, #tabs { display: none !important; }
  .view { max-width: none; padding: 0; }
  #sheet { border-radius: 0; margin: 0; }
}
