/* Konzept: Sonnenuntergangs-Himmel mit Wellen oben, darunter eine Pinnwand voller Postkarten
   mit Klebeband, Briefmarke und Poststempel. Farben aus Thai-Markt: Mango, Hibiskus, Lagune, Nacht-Indigo. */
:root {
  --mango: #ffb627;
  --hibiskus: #ff3d7f;
  --lagune: #00a99d;
  --indigo: #2b2d6e;
  --papaya: #ff7a45;
  --limette: #9bd651;

  --bg: #fff7e8;
  --punkt: #ffd9a8;
  --karte: #ffffff;
  --fg: #2b2d6e;
  --leise: #6b6d9c;
  --schatten: rgba(43, 45, 110, .14);
  --linie: #f4ddbd;

  --display: "Mitr", "Leelawadee UI", "Segoe UI", system-ui, sans-serif;
  --hand: "Mali", "Leelawadee UI", "Comic Sans MS", cursive;
  --r: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17183a; --punkt: #2a2c62; --karte: #23255a; --fg: #fff1dc; --leise: #b9b7e0;
    --schatten: rgba(0, 0, 0, .45); --linie: #34367a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17183a; --punkt: #2a2c62; --karte: #23255a; --fg: #fff1dc; --leise: #b9b7e0;
  --schatten: rgba(0, 0, 0, .45); --linie: #34367a; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--punkt) 1.6px, transparent 1.7px);
  background-size: 22px 22px;
  color: var(--fg);
  font: 16px/1.5 var(--display);
  overflow-x: hidden;
}
:lang(th) { line-height: 1.7; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--mango); outline-offset: 3px; border-radius: 8px; }

/* ---------- Sprachumschalter ---------- */
.sprache {
  position: fixed; z-index: 1000;
  top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px));
  display: flex; padding: 4px; gap: 2px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(43, 45, 110, .2);
}
.sprache button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; color: #2b2d6e; cursor: pointer;
}
.sprache button[aria-pressed="true"] { background: var(--hibiskus); color: #fff; }

/* ---------- Himmel ---------- */
.himmel {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(180deg, #5b3fa8 0%, #e2457d 38%, #ff7a45 64%, #ffb627 100%);
  padding-block: calc(64px + env(safe-area-inset-top, 0px)) 120px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.sonne {
  position: absolute; left: 50%; bottom: 40px; width: 240px; height: 240px; margin-left: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c8 0 45%, #ffd36e 46% 60%, rgba(255, 211, 110, 0) 61%);
  box-shadow: 0 0 80px 30px rgba(255, 214, 110, .55);
  animation: aufgang 2.4s cubic-bezier(.2, .8, .2, 1) both;
}
.sonne::after { /* Sonnenstreifen */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-linear-gradient(180deg, transparent 0 16px, rgba(226, 69, 125, .55) 16px 21px);
  -webkit-mask: linear-gradient(180deg, transparent 52%, #000 53%); mask: linear-gradient(180deg, transparent 52%, #000 53%);
}
@keyframes aufgang { from { transform: translateY(60px); opacity: .6; } to { transform: none; opacity: 1; } }

.himmel-innen { position: relative; max-width: 760px; margin: 0 auto; text-align: center; }
.gruss {
  margin: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 18px;
  font-weight: 600; line-height: 1.05; letter-spacing: -.01em;
  text-shadow: 0 4px 0 rgba(91, 30, 90, .35);
}
.gruss-de { font-size: clamp(3.2rem, 14vw, 6.5rem); }
.gruss-th { font-size: clamp(3rem, 13vw, 6rem); line-height: 1.25; }
.gruss-punkt { font-size: clamp(1.4rem, 5vw, 2.4rem); color: #fff6c8; animation: funkeln 3s ease-in-out infinite; }
@keyframes funkeln { 50% { transform: rotate(180deg) scale(1.25); } }
.untertitel {
  margin: 12px auto 0; display: inline-block; padding: 6px 18px; border-radius: 999px;
  font-family: var(--hand); font-size: clamp(1.05rem, 3.6vw, 1.3rem);
  background: rgba(43, 45, 110, .35); backdrop-filter: blur(4px);
}
.wellen { position: absolute; left: 0; bottom: -1px; width: 100%; height: 90px; }
.wellen .w1 { fill: var(--lagune); opacity: .9; animation: wiegen 7s ease-in-out infinite alternate; transform-origin: center; }
.wellen .w2 { fill: var(--bg); }
@keyframes wiegen { to { transform: translateX(-30px) scaleY(1.12); } }

/* ---------- Seite ---------- */
.seite {
  max-width: 760px; margin: -70px auto 0; position: relative; z-index: 2;
  padding-block: 0 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 22px;
}

/* ---------- Anmeldung (Familien-Passwort) ---------- */
.anmeldung {
  position: relative; background: var(--karte); border-radius: 6px; padding: 30px 22px 22px;
  box-shadow: 0 14px 30px var(--schatten); transform: rotate(-.8deg);
  display: grid; gap: 10px; max-width: 460px; width: 100%; justify-self: center;
}
.anmeldung-titel { margin: 0; font-family: var(--hand); font-size: 1.7rem; font-weight: 600; line-height: 1.2; }
.anmeldung-text { margin: 0; color: var(--leise); }
.anmeldung-label { font-weight: 600; margin-top: 6px; }
.anmeldung input[type="password"] {
  font: inherit; font-size: 1.1rem; padding: 12px 14px; border-radius: 12px; min-width: 0;
  border: 2px solid var(--linie); background: var(--bg); color: var(--fg);
}
.anmeldung input[type="password"]:focus { outline: none; border-color: var(--hibiskus); }
.anmeldung button {
  font-weight: 600; font-size: 1.1rem; border: 0; border-radius: 999px; padding: 13px 20px; cursor: pointer;
  background: linear-gradient(90deg, var(--hibiskus), var(--papaya)); color: #fff; box-shadow: 0 6px 0 rgba(43, 45, 110, .18);
}
.anmeldung button:disabled { opacity: .6; cursor: default; }
.anmeldung-meldung { margin: 0; min-height: 1.5em; color: var(--hibiskus); font-weight: 600; }

/* ---------- Gerade hier ---------- */
.jetzt {
  background: var(--karte); border-radius: var(--r); padding: 18px 20px 18px 92px; position: relative;
  box-shadow: 0 10px 30px var(--schatten); min-height: 96px;
  display: grid; gap: 2px; align-content: center;
}
.jetzt-nadel {
  position: absolute; left: 18px; top: 50%; width: 56px; height: 56px; margin-top: -28px;
  border-radius: 50% 50% 50% 6px; transform: rotate(-45deg);
  background: linear-gradient(135deg, var(--hibiskus), var(--papaya));
  box-shadow: 0 6px 14px rgba(255, 61, 127, .4);
}
.jetzt-nadel::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: #fff; }
.jetzt-nadel::before {
  content: ""; position: absolute; inset: -8px; border-radius: 50% 50% 50% 6px; border: 3px solid var(--hibiskus);
  animation: puls 2s ease-out infinite; opacity: 0;
}
@keyframes puls { 0% { transform: scale(.8); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }
.jetzt-label { margin: 0; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--hibiskus); font-weight: 600; }
.jetzt-ort { margin: 0; font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 600; line-height: 1.15; }
.jetzt-info { margin: 0; color: var(--leise); font-size: .95rem; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.jetzt-info b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Karte ---------- */
.karte-block {
  border-radius: var(--r); padding: 8px; background: var(--karte);
  box-shadow: 0 10px 30px var(--schatten);
}
.karte { height: 340px; border-radius: 14px; overflow: hidden; background: #aadaff; }
@media (min-width: 700px) { .karte { height: 420px; } }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.station {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  color: #fff; font-weight: 600; font-size: 14px; border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
}
.station.aktuell { width: 40px; height: 40px; font-size: 18px; position: relative; }
.station.aktuell::before {
  content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--hibiskus);
  animation: puls 1.8s ease-out infinite;
}
.leaflet-tooltip.ort-schild {
  font-family: var(--display); font-weight: 600; border: 0; border-radius: 999px; padding: 3px 10px;
  background: var(--indigo); color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}
.leaflet-tooltip.ort-schild::before { display: none; }

/* ---------- Zahlen ---------- */
.zahlen { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 520px) { .zahlen { grid-template-columns: repeat(2, 1fr); } }
.zahlen li {
  border-radius: 16px; padding: 12px 10px; text-align: center; color: #fff; min-width: 0;
  box-shadow: 0 6px 0 rgba(43, 45, 110, .18);
}
.zahlen li:nth-child(1) { background: var(--hibiskus); transform: rotate(-1.5deg); }
.zahlen li:nth-child(2) { background: var(--lagune); transform: rotate(1deg); }
.zahlen li:nth-child(3) { background: var(--papaya); transform: rotate(-.8deg); }
.zahlen li:nth-child(4) { background: var(--indigo); transform: rotate(1.6deg); }
.zahlen b { display: block; font-size: 1.8rem; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; }
.zahlen span { font-size: .82rem; opacity: .95; }

/* ---------- Länder-Flaggen ---------- */
.laender { display: grid; gap: 10px; }
.laender-titel { margin: 0; font-family: var(--hand); font-size: 1.25rem; font-weight: 600; text-align: center; }
.laender-reihe { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.land {
  display: grid; justify-items: center; gap: 0; min-width: 92px; max-width: 46%;
  padding: 10px 12px 8px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--karte); box-shadow: 0 6px 0 var(--linie), 0 8px 18px var(--schatten);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
}
.land:nth-child(odd) { transform: rotate(-1.6deg); }
.land:nth-child(even) { transform: rotate(1.4deg); }
.land:hover, .land:focus-visible { transform: translateY(-4px) rotate(0deg); box-shadow: 0 10px 0 var(--linie), 0 14px 24px var(--schatten); }
.land:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--linie); }
.land-flagge { font-size: 2.6rem; line-height: 1.1; display: inline-block; transform-origin: 20% 80%; }
.land:hover .land-flagge { animation: wehen .9s ease-in-out; }
@keyframes wehen { 25% { transform: rotate(-10deg) skewX(6deg); } 60% { transform: rotate(6deg) skewX(-4deg); } }
.land-name { font-weight: 600; font-size: .95rem; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.land-zahl { font-size: .78rem; color: var(--leise); }

.postkarte.angesprungen { animation: wackeln .9s ease-in-out; }
@keyframes wackeln {
  0%, 100% { transform: rotate(var(--kipp)); box-shadow: 0 14px 30px var(--schatten); }
  20% { transform: rotate(-3deg) scale(1.02); box-shadow: 0 0 0 5px var(--mango), 0 14px 30px var(--schatten); }
  45% { transform: rotate(2.5deg) scale(1.02); box-shadow: 0 0 0 5px var(--mango), 0 14px 30px var(--schatten); }
  70% { transform: rotate(-1deg); }
}

/* ---------- Hinweise ---------- */
.hinweis {
  margin: 0; padding: 10px 16px; border-radius: 14px; text-align: center;
  font-family: var(--hand); font-size: 1.05rem;
  background: var(--karte); border: 2px dashed var(--lagune); color: var(--fg);
}
.hinweis.neu { border-color: var(--hibiskus); }

/* ---------- Tagebuch / Postkarten ---------- */
.tagebuch { display: grid; gap: 34px; padding-top: 6px; }
.ort-band { display: flex; align-items: center; gap: 12px; margin: 6px 0 -12px; }
.ort-band::before, .ort-band::after { content: ""; flex: 1; height: 3px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--mango) 0 12px, transparent 12px 20px); }
.ort-band span {
  font-weight: 600; font-size: 1.05rem; padding: 4px 16px; border-radius: 999px;
  background: var(--indigo); color: #fff; white-space: nowrap; max-width: 80%; overflow: hidden; text-overflow: ellipsis;
}

.postkarte {
  position: relative; background: var(--karte); border-radius: 6px;
  padding: 16px 16px 18px; box-shadow: 0 14px 30px var(--schatten);
  transform: rotate(var(--kipp, 0deg));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.postkarte:nth-of-type(odd) { --kipp: -1.1deg; }
.postkarte:nth-of-type(even) { --kipp: .9deg; }
.postkarte:hover { --kipp: 0deg; }
.klebeband {
  position: absolute; top: -13px; left: 50%; width: 110px; height: 28px; margin-left: -55px;
  background: var(--band, var(--mango)); opacity: .85; transform: rotate(-3deg);
  -webkit-mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent 0),
    repeating-linear-gradient(0deg, #000 0 3px, transparent 3px 5px);
  clip-path: polygon(0 10%, 4% 0, 8% 12%, 12% 0, 100% 0, 96% 100%, 92% 88%, 88% 100%, 0 100%);
}
.kopfzeile { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.kopfzeile-text { min-width: 0; }
.wann { margin: 0; color: var(--leise); font-size: .9rem; }
.wann .neu-marke {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--hibiskus); color: #fff; vertical-align: 1px; letter-spacing: .04em;
}
.gruss-text { margin: 2px 0 0; font-family: var(--hand); font-size: clamp(1.45rem, 5.4vw, 1.9rem); line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.gruss-text[lang="th"] { line-height: 1.5; }

.marke {
  flex: none; width: 78px; height: 92px; padding: 6px; transform: rotate(4deg);
  background: var(--karte); border-radius: 3px;
  outline: 2px dashed var(--linie); outline-offset: -2px;
  box-shadow: 0 3px 8px var(--schatten);
}
.marke-innen {
  width: 100%; height: 100%; border-radius: 2px; display: grid; place-items: center; text-align: center;
  background: var(--marke, var(--lagune)); color: #fff; padding: 4px; position: relative; overflow: hidden;
}
.marke-innen b { font-size: .7rem; line-height: 1.1; font-weight: 600; overflow-wrap: anywhere; }
.marke-innen i { font-style: normal; font-size: 1.6rem; line-height: 1; }
.stempel {
  position: absolute; right: 64px; top: 34px; width: 74px; height: 74px; border-radius: 50%;
  border: 2.5px solid var(--hibiskus); color: var(--hibiskus); opacity: .55; pointer-events: none;
  display: grid; place-items: center; text-align: center; font-size: .62rem; font-weight: 600; line-height: 1.15;
  transform: rotate(-16deg); text-transform: uppercase; letter-spacing: .05em;
}
.stempel::after { content: ""; position: absolute; right: -46px; top: 22px; width: 50px; height: 26px;
  background: repeating-linear-gradient(180deg, var(--hibiskus) 0 2px, transparent 2px 7px); }
@media (max-width: 420px) { .stempel { display: none; } }

/* Fotos */
.fotos { display: grid; gap: 6px; grid-template-columns: repeat(6, 1fr); }
.foto {
  position: relative; border: 0; padding: 0; margin: 0; cursor: zoom-in; overflow: hidden; border-radius: 8px;
  background: var(--linie); aspect-ratio: 4 / 3; grid-column: span 3; min-width: 0;
}
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.foto:hover img { transform: scale(1.05); }
.fotos[data-n="1"] .foto { grid-column: span 6; aspect-ratio: 16 / 10; }
.fotos[data-n="3"] .foto:first-child { grid-column: span 6; aspect-ratio: 16 / 9; }
.fotos[data-n="4"] .foto, .fotos[data-n="5"] .foto, .fotos[data-n="6"] .foto { grid-column: span 2; aspect-ratio: 1; }
.fotos[data-n="4"] .foto:first-child, .fotos[data-n="5"] .foto:first-child, .fotos[data-n="6"] .foto:first-child { grid-column: span 6; aspect-ratio: 16 / 9; }
.fotos[data-n="5"] .foto:nth-child(2) { grid-column: span 2; }
.abspielen {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, transparent 50%, rgba(23, 24, 58, .55));
}
.abspielen::before {
  content: ""; width: 58px; height: 58px; border-radius: 50%; background: rgba(255, 255, 255, .92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.abspielen::after {
  content: ""; position: absolute; margin-left: 5px; border-style: solid; border-width: 12px 0 12px 19px;
  border-color: transparent transparent transparent var(--hibiskus);
}
.dauer {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(23, 24, 58, .75); color: #fff; font-size: .78rem; font-variant-numeric: tabular-nums;
}

.fuss { text-align: center; color: var(--leise); font-family: var(--hand); font-size: 1.05rem; padding-top: 10px; }
.fuss p { margin: 0; }

/* ---------- Leuchtkasten ---------- */
.leuchtkasten {
  position: fixed; inset: 0; z-index: 2000; background: rgba(15, 14, 40, .94);
  display: grid; grid-template-columns: 56px 1fr 56px; grid-template-rows: 1fr auto; align-items: center;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  touch-action: pan-y;
}
.lk-buehne { grid-column: 2; margin: 0; height: 100%; display: grid; place-items: center; min-width: 0; padding: 56px 0 8px; }
.lk-buehne img, .lk-buehne video { max-width: 100%; max-height: calc(100vh - 150px); border-radius: 10px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.lk-text { grid-column: 1 / -1; margin: 0; padding: 10px 20px 22px; text-align: center; color: #fff; font-family: var(--hand); font-size: 1.3rem; }
.lk-text small { display: block; font-family: var(--display); font-size: .85rem; opacity: .7; }
.lk-pfeil, .lk-zu {
  border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 46px; height: 46px; border-radius: 50%;
  font-size: 1.6rem; line-height: 1; cursor: pointer; justify-self: center;
}
.lk-pfeil:hover, .lk-zu:hover { background: var(--hibiskus); }
.lk-zurueck { grid-column: 1; grid-row: 1; }
.lk-weiter { grid-column: 3; grid-row: 1; }
.lk-zu { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); font-size: 1.2rem; }
@media (max-width: 600px) { .lk-pfeil { display: none; } .leuchtkasten { grid-template-columns: 0 1fr 0; } }
.video-platzhalter {
  width: min(560px, 86vw); aspect-ratio: 16 / 10; border-radius: 10px; display: grid; place-items: center; color: #fff;
  text-align: center; font-family: var(--hand); font-size: 1.1rem; overflow: hidden;
}
.video-platzhalter > * { grid-area: 1 / 1; }
.video-platzhalter img { width: 100%; height: 100%; object-fit: cover; box-shadow: none; border-radius: 0; max-height: none; }
.video-platzhalter span { background: rgba(23, 24, 58, .7); padding: 8px 16px; border-radius: 999px; }

/* Erscheinen beim Laden: startet sichtbar, nur ein kleiner Hüpfer */
.postkarte { animation: landen .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes landen { from { transform: translateY(14px) rotate(var(--kipp)); } to { transform: rotate(var(--kipp)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
