/* Weinkeller – Gestaltung. Keine externen Schriften: Serifen aus dem System (Iowan/Palatino/Georgia/Noto Serif). */
:root {
  --bg: #F6F1EA; --karte: #FFFFFF; --text: #2A1E1A; --leise: #6B5C54; --linie: #E3D8CB;
  --akzent: #7B1E2E; --akzent-text: #FFFFFF; --akzent-hell: #F4E4E4; --gold: #9C7A2E;
  --fehler-bg: #FDE8E4; --fehler: #9B2C1C;
  --rot: #7B1E2E; --weiss: #C2A044; --rose: #D27C8C; --orange: #C8742E; --schaum: #B49A5A; --suess: #A8681C; --likoer: #5A2A1B;
  --r-jung: #5B6F86; --r-reif: #3D7A4A; --r-hoehe: #A0750F; --r-bald: #B5561B; --r-drueber: #9B2C1C;
  --radius: 14px; --leiste: 64px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17110F; --karte: #231A17; --text: #F1E9E2; --leise: #B4A398; --linie: #3A2E29;
    --akzent: #E39AA6; --akzent-text: #2A0E14; --akzent-hell: #3A2026; --gold: #D9B866;
    --fehler-bg: #3A1A15; --fehler: #F4A898;
    --rot: #C2485C; --weiss: #D9BC64; --rose: #E79AA8; --orange: #E0924D; --schaum: #CDB679; --suess: #D18F3E; --likoer: #A0614C;
    --r-jung: #8FA6BF; --r-reif: #7BC48A; --r-hoehe: #E2B84A; --r-bald: #F0985E; --r-drueber: #F08A78;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 17px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 1180px; margin: 0 auto; min-height: 100vh; padding: max(20px, env(safe-area-inset-top)) 16px 24px; }
[hidden] { display: none !important; }
section[data-ansicht] { display: flex; flex-direction: column; gap: 14px; }
.mitte { min-height: 80vh; justify-content: center; align-items: center; text-align: center; max-width: 480px; margin: 0 auto; }
.reiter { display: flex; flex-direction: column; gap: 14px; padding-bottom: calc(var(--leiste) + 96px + env(safe-area-inset-bottom)); }

h1, h2, legend, .serif { font-family: var(--serif); font-weight: 600; }
h1 { margin: 0; font-size: 32px; line-height: 1.15; }
h2 { margin: 0; font-size: 21px; }
.klein-titel { font-size: 22px; }
p { margin: 0; }
code { font-size: .9em; }
.leise { color: var(--leise); }
.klein { font-size: 14px; }
.hinweis { color: var(--leise); font-size: 14px; }
.ueberschrift-klein { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--leise); margin: 6px 2px 0; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.logo { width: 96px; height: 96px; align-self: center; }
.logo.klein { width: 48px; height: 48px; }
.logo.mittel { width: 64px; height: 64px; }

button, .knopf-link { font: inherit; cursor: pointer; border-radius: 12px; min-height: 48px; padding: 0 18px; color: inherit; }
button:disabled { opacity: .6; cursor: progress; }
.haupt { background: var(--akzent); color: var(--akzent-text); border: 0; font-weight: 700; font-size: 18px; min-height: 52px; }
.zweit { background: transparent; color: var(--akzent); border: 1.5px solid var(--akzent); font-weight: 700; }
.zweit.klein { min-height: 40px; font-size: 15px; padding: 0 14px; }
.knopf-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; align-self: flex-start; }
.text { background: transparent; border: 0; color: var(--leise); text-decoration: underline; }
.text.klein { font-size: 15px; min-height: 44px; padding: 0 6px; }
.gefahr { color: var(--fehler) !important; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--akzent); outline-offset: 2px; }

input, select, textarea { font: inherit; color: var(--text); }
.feld { display: flex; flex-direction: column; gap: 5px; text-align: left; font-size: 14px; color: var(--leise); min-width: 0; }
.feld input, .feld select, .feld textarea, textarea, .eingabe-zeile input, .suchzeile input, select {
  min-height: 46px; padding: 8px 12px; background: var(--karte); border: 1px solid var(--linie); border-radius: 10px; width: 100%; font-size: 16px; }
textarea { resize: vertical; line-height: 1.4; }
.feld input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--akzent); }
.schmal-mitte { width: 100%; max-width: 360px; }
fieldset { border: 0; margin: 0; }
legend { font-size: 19px; padding: 0; margin-bottom: 4px; float: left; width: 100%; }
legend + * { clear: both; }

.zeile { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.zeile > .haupt { flex: 1; }
.zeile.links { justify-content: flex-start; }
.umbruch { flex-wrap: wrap; }
.raster-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.raster-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.raster-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
@media (max-width: 560px) {
  .raster-3 { grid-template-columns: 1fr; }
  .raster-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.kopf-zurueck { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0; margin-top: -6px; }
.kopf-knoepfe { display: flex; align-items: center; gap: 6px; }
.rund { width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%; border: 1px solid var(--linie);
  background: var(--karte); font-size: 24px; line-height: 1; color: var(--akzent); flex: 0 0 auto; }
.karte { background: var(--karte); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--linie); }

/* ---------- Keller: Suche, Filter, Liste ---------- */
.suchzeile { display: flex; gap: 10px; }
.suchzeile input { flex: 1; min-width: 0; }
.suchzeile .zweit { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.zahl { background: var(--akzent); color: var(--akzent-text); border-radius: 10px; font-size: 13px; padding: 0 7px; min-width: 22px; line-height: 20px; }
.sortierung select { min-height: 40px; width: auto; font-size: 15px; padding: 4px 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 38px; padding: 0 12px; border-radius: 19px; border: 1px solid var(--linie); background: var(--karte); font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); font-weight: 700; }
.chip .anzahl { opacity: .65; font-size: 13px; margin-left: 4px; }
.chip.aktiv { background: var(--akzent-hell); border-color: var(--akzent); color: var(--text); }

.weinliste { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.weinkarte { display: flex; gap: 12px; align-items: stretch; padding: 10px; background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; min-height: 112px;
  position: relative; overflow: hidden; }
.weinkarte::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--artfarbe, var(--linie)); }
.weinkarte.archiv { opacity: .6; }
.weinkarte .vorschau { flex: 0 0 72px; height: 92px; border-radius: 8px; object-fit: cover; background: var(--bg); margin-left: 4px; }
.platzhalter { display: flex; align-items: center; justify-content: center; color: var(--artfarbe); font-size: 34px; }
.weinkarte .inhalt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.weinkarte .gut { font-size: 13px; color: var(--leise); text-transform: uppercase; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weinkarte .name { font-family: var(--serif); font-size: 19px; line-height: 1.2; font-weight: 600; overflow-wrap: anywhere; }
.weinkarte .meta { font-size: 14px; color: var(--leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weinkarte .unten { display: flex; gap: 6px; align-items: center; margin-top: auto; flex-wrap: wrap; }
.flaschen { font-weight: 700; font-size: 15px; margin-left: auto; white-space: nowrap; }

.marke { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  background: var(--bg); color: var(--leise); white-space: nowrap; }
.marke::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.marke.ohne-punkt::before { display: none; }
.marke.r-jung { color: var(--r-jung); } .marke.r-reif { color: var(--r-reif); } .marke.r-hoehepunkt { color: var(--r-hoehe); }
.marke.r-bald { color: var(--r-bald); } .marke.r-drueber { color: var(--r-drueber); }

.a-rot { --artfarbe: var(--rot); } .a-weiss { --artfarbe: var(--weiss); } .a-rose { --artfarbe: var(--rose); }
.a-orange { --artfarbe: var(--orange); } .a-schaumwein { --artfarbe: var(--schaum); } .a-suesswein { --artfarbe: var(--suess); }
.a-likoerwein { --artfarbe: var(--likoer); }

.streifen-box { display: flex; flex-direction: column; gap: 6px; }
.streifen { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 6px; scroll-snap-type: x mandatory; }
.streifen .weinkarte { flex: 0 0 290px; scroll-snap-align: start; min-height: 96px; }
.streifen .weinkarte .vorschau { height: 76px; flex-basis: 58px; }

.leer { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 8px; }

/* ---------- Trinkreife ---------- */
.trink-gruppe { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.trink-gruppe h2 { display: flex; align-items: center; gap: 8px; }
.trink-gruppe h2 .punkt { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.trink-gruppe h2.r-drueber .punkt { color: var(--r-drueber); } .trink-gruppe h2.r-bald .punkt { color: var(--r-bald); }
.trink-gruppe h2.r-hoehepunkt .punkt { color: var(--r-hoehe); } .trink-gruppe h2.r-reif .punkt { color: var(--r-reif); }
.trink-gruppe h2.r-jung .punkt { color: var(--r-jung); }

/* ---------- Wein-Ansicht ---------- */
.wein-inhalt { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 860px) {
  .wein-inhalt { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .wein-inhalt .spalte-bild { position: sticky; top: 70px; }
}
.spalte-bild, .spalte-text { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.galerie { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.galerie button { flex: 0 0 auto; padding: 0; border: 0; background: var(--karte); border-radius: 12px; overflow: hidden; scroll-snap-align: start; min-height: 0; }
.galerie img { display: block; height: 340px; max-width: 86vw; object-fit: contain; background: var(--karte); }
.galerie.einzeln button { width: 100%; }
.galerie.einzeln img { width: 100%; max-width: none; height: auto; max-height: 520px; }
.bild-leer { height: 220px; border-radius: 12px; border: 1.5px dashed var(--linie); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; color: var(--artfarbe); font-size: 48px; background: var(--karte); }
.bild-leer span { font-size: 15px; color: var(--leise); }
.wein-titel .gut { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--leise); }
.wein-titel h1 { font-size: 34px; margin: 2px 0 6px; overflow-wrap: anywhere; }
.wein-titel .jahr { color: var(--artfarbe); }
.wein-titel .chips .marke { font-size: 13px; padding: 4px 10px; }
.trennlinie { height: 3px; width: 64px; background: var(--artfarbe); border-radius: 2px; }

.eckdaten { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 16px; margin: 0; }
.eckdaten div { display: flex; flex-direction: column; min-width: 0; }
.eckdaten dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); }
.eckdaten dd { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.rebsorten-gross { display: flex; gap: 18px; flex-wrap: wrap; }
.rebsorten-gross div { display: flex; flex-direction: column; }
.rebsorten-gross strong { font-family: var(--serif); font-size: 28px; color: var(--artfarbe); line-height: 1.1; }

.bestand-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bestand-liste li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.bestand-liste li:last-child { border-bottom: 0; }
.bestand-gesamt { font-family: var(--serif); font-size: 30px; line-height: 1; }

/* Trinkfenster als Zeitleiste */
.zeitleiste { display: flex; flex-direction: column; gap: 6px; }
.zl-balken { position: relative; display: flex; height: 26px; border-radius: 13px; overflow: hidden; background: var(--bg); }
.zl-balken span { height: 100%; }
.zl-jung { background: color-mix(in srgb, var(--r-jung) 35%, transparent); }
.zl-reif { background: color-mix(in srgb, var(--r-reif) 55%, transparent); }
.zl-hoehe { background: var(--r-hoehe); }
.zl-abbau { background: color-mix(in srgb, var(--r-bald) 55%, transparent); }
.zl-heute { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--text); border-radius: 2px; }
.zl-jahre { position: relative; height: 18px; font-size: 12px; color: var(--leise); }
.zl-jahre span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.zl-legende { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--leise); }
.zl-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.verkostung { border-left: 3px solid var(--artfarbe); padding: 2px 0 2px 12px; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  background: none; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; font: inherit; color: inherit; border-radius: 0; min-height: 0; }
.verkostung .kopfzeile { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--leise); }
.verkostung .punkte { font-family: var(--serif); font-size: 22px; color: var(--text); }
.verkostung p { white-space: pre-wrap; overflow-wrap: anywhere; }
.wein-notiz { white-space: pre-wrap; overflow-wrap: anywhere; }
.aktionen-unten { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Formular ---------- */
.weinform { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 820px; width: 100%; margin: 0 auto; }
.weinform .karte { gap: 12px; }
.formular-ende { position: sticky; bottom: calc(var(--leiste) + env(safe-area-inset-bottom)); background: var(--bg); padding: 10px 0; }
.fotoreihe { display: flex; gap: 10px; flex-wrap: wrap; }
.fotoreihe:empty { display: none; }
.foto-vorschau { position: relative; width: 104px; display: flex; flex-direction: column; gap: 4px; }
.foto-vorschau img { width: 104px; height: 130px; object-fit: cover; border-radius: 10px; background: var(--bg); }
.foto-vorschau select { min-height: 34px; font-size: 13px; padding: 2px 6px; }
.foto-vorschau .weg { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; }
.rebsorten, .bestand-zeilen { display: flex; flex-direction: column; gap: 8px; }
.rebsorte-zeile { display: grid; grid-template-columns: minmax(0, 1fr) 92px 44px; gap: 8px; align-items: center; }
.bestand-zeile { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) 128px 44px; gap: 8px; align-items: center; }
@media (max-width: 640px) {
  .bestand-zeile { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
    grid-template-areas: "ort ort weg" "regal fach ." "zahl zahl ."; padding-bottom: 10px; border-bottom: 1px solid var(--linie); }
  .bestand-zeile .b-ort { grid-area: ort; } .bestand-zeile .b-regal { grid-area: regal; } .bestand-zeile .b-fach { grid-area: fach; }
  .bestand-zeile .b-zahl { grid-area: zahl; } .bestand-zeile .weg-klein { grid-area: weg; }
}
.rebsorte-zeile input, .bestand-zeile input, .bestand-zeile select { min-height: 46px; padding: 8px 12px; border: 1px solid var(--linie);
  border-radius: 10px; background: var(--karte); width: 100%; font-size: 16px; }
.weg-klein { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid var(--linie); background: transparent; border-radius: 10px; color: var(--leise); font-size: 18px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--linie); border-radius: 10px; background: var(--karte); overflow: hidden; }
.stepper button { min-height: 44px; width: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--akzent); font-size: 22px; }
.stepper input { border: 0 !important; text-align: center; min-height: 44px; padding: 0 !important; width: 100%; -moz-appearance: textfield; background: transparent !important; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.nur-schaumwein { display: none; }
.weinform.ist-schaumwein .nur-schaumwein { display: grid; }

/* ---------- Mehr ---------- */
.mehr-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 400px) { .mehr-raster { grid-template-columns: minmax(0, 1fr); } }
.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.liste li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--linie); }
.liste li:last-child { border-bottom: 0; }
.liste .info { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.liste .info small { color: var(--leise); font-size: 13px; }
.liste button { min-height: 40px; padding: 0 12px; background: transparent; border: 1px solid var(--linie); font-size: 14px; }
.liste input { flex: 1; min-height: 40px; padding: 4px 10px; border: 1px solid var(--linie); border-radius: 8px; background: var(--karte); }
.eingabe-zeile input { flex: 1; min-width: 0; }
.einladungslink { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; padding-top: 6px; }
.einladungslink img { width: 220px; height: 220px; background: #fff; border-radius: 10px; }
.einladungslink code { font-size: 13px; word-break: break-all; color: var(--leise); }

/* ---------- Leiste, Plus-Knopf, Blätter, Meldung ---------- */
.fab { position: fixed; right: max(16px, calc(50% - 574px)); bottom: calc(var(--leiste) + 18px + env(safe-area-inset-bottom));
  width: 62px; height: 62px; border-radius: 50%; border: 0; padding: 0; background: var(--akzent); color: var(--akzent-text);
  font-size: 34px; line-height: 1; box-shadow: 0 6px 18px rgba(0,0,0,.22); z-index: 5; }
.leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; justify-content: center;
  background: var(--karte); border-top: 1px solid var(--linie); padding-bottom: env(safe-area-inset-bottom); }
.leiste button { flex: 1; max-width: 150px; height: var(--leiste); border: 0; background: transparent; border-radius: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: var(--leise); padding: 0; }
.leiste .symbol { font-size: 20px; line-height: 1; }
.leiste button[aria-current="page"] { color: var(--akzent); font-weight: 700; }

.schleier { position: fixed; inset: 0; background: rgba(20, 10, 8, .5); z-index: 10; }
.blatt { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -6px 24px rgba(0,0,0,.25); }
.breit-blatt { max-width: 760px; }
.blatt-kopf { display: flex; justify-content: space-between; align-items: center; }
.filter-gruppen { display: flex; flex-direction: column; gap: 14px; }
.filter-gruppe { display: flex; flex-direction: column; gap: 6px; }
.auswahl-liste { display: flex; flex-direction: column; gap: 8px; }
.auswahl-liste button { display: flex; justify-content: space-between; align-items: center; text-align: left; background: var(--karte);
  border: 1px solid var(--linie); min-height: 54px; }
.foto-blatt { max-width: 760px; }
.foto-blatt img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 10px; background: var(--karte); }
.foto-blatt select { width: auto; min-height: 40px; font-size: 15px; }
output { font-weight: 700; color: var(--text); }

#meldung {
  position: fixed; left: 16px; right: 16px; z-index: 20; bottom: calc(var(--leiste) + 16px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; padding: 8px 8px 8px 16px; min-height: 52px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: 15px; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex; align-items: center; gap: 12px; }
#meldung-text { flex: 1; }
#meldung.fehler { background: var(--fehler-bg); color: var(--fehler); }
#meldung-rueckgaengig { min-height: 40px; border: 0; background: transparent; color: var(--bg); font-weight: 700; text-decoration: underline; padding: 0 10px; }
body:not(.in-app) #meldung { bottom: max(16px, env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
