/* Thai-App - ausgelegt auf das iPhone 12 mini (375 x 812), hoch und quer. Keine fremden Schriften:
   iOS bringt gute Thai-Schriften mit (Sukhumvit Set, Thonburi) - so laedt nichts nach. */
:root {
  --grund: #f6f4fb;
  --flaeche: #ffffff;
  --text: #1c1830;
  --leise: #6d6880;
  --linie: #e4e0ee;
  --akzent: #5b2fb8;
  --akzent-hell: #ece6fa;
  --mhai: #8a3fd1;
  --rot: #c62d3c;
  --schatten: 0 1px 2px rgba(28, 24, 48, .06), 0 2px 8px rgba(28, 24, 48, .05);
  --thai: "Sukhumvit Set", Thonburi, "Leelawadee UI", "Noto Sans Thai", sans-serif;
  --oben: env(safe-area-inset-top, 0px);
  --unten: env(safe-area-inset-bottom, 0px);
  --links: env(safe-area-inset-left, 0px);
  --rechts: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #16131f;
    --flaeche: #221e2e;
    --text: #f1eef8;
    --leise: #a39db5;
    --linie: #352f45;
    --akzent: #b597ff;
    --akzent-hell: #2f2747;
    --mhai: #d2a8ff;
    --rot: #ff6b78;
    --schatten: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  touch-action: manipulation;
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* --- Kopf mit Suche --- */
.kopf {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  padding: calc(var(--oben) + 8px) calc(var(--rechts) + 12px) 8px calc(var(--links) + 12px);
  background: color-mix(in srgb, var(--grund) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.suche { position: relative; flex: 1; margin: 0; }
.suche input {
  width: 100%; height: 46px;
  padding: 0 40px 0 40px;
  border: 1.5px solid var(--linie); border-radius: 14px;
  background: var(--flaeche); color: var(--text);
  font-size: 18px; /* >= 16px, sonst zoomt iOS beim Tippen */
  -webkit-appearance: none; appearance: none; outline: none;
}
.suche input:focus { border-color: var(--akzent); }
.suche input::-webkit-search-cancel-button { display: none; }
.lupe { position: absolute; left: 12px; top: 12px; color: var(--leise); pointer-events: none; }
.leeren {
  position: absolute; right: 4px; top: 4px; width: 38px; height: 38px;
  font-size: 26px; line-height: 38px; color: var(--leise);
}
.rund {
  flex: none; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--flaeche); border: 1.5px solid var(--linie); color: var(--akzent);
}
.rund:active { background: var(--akzent-hell); }

.hinweis {
  margin: 0 calc(var(--rechts) + 12px) 8px calc(var(--links) + 12px);
  padding: 10px 12px; border-radius: 12px;
  background: var(--akzent-hell); color: var(--text); font-size: 14px;
}
.hinweis a { color: var(--akzent); font-weight: 600; }

/* --- Liste --- */
main { padding: 0 calc(var(--rechts) + 12px) calc(var(--unten) + 24px) calc(var(--links) + 12px); }
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
@media (orientation: landscape) and (min-width: 600px) {
  .liste { grid-template-columns: 1fr 1fr; }
  .liste .titel, .liste .uebersetzen, .liste .leer { grid-column: 1 / -1; }
}
.titel { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--leise); padding: 10px 4px 0; }

.karte {
  display: flex; align-items: stretch;
  background: var(--flaeche); border-radius: 16px; box-shadow: var(--schatten);
  border: 1px solid var(--linie);
  content-visibility: auto; contain-intrinsic-size: auto 92px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform .12s ease, border-color .2s;
}
.karte:active { transform: scale(.985); }
.karte.spielt { border-color: var(--akzent); }
.k-text { flex: 1; min-width: 0; padding: 10px 4px 10px 14px; }
.k-thai { font-family: var(--thai); font-size: 25px; line-height: 1.45; font-weight: 500; overflow-wrap: anywhere; }
.k-thai.fehlt { font-size: 15px; color: var(--leise); font-family: inherit; line-height: 1.6; }
.k-mhai { color: var(--mhai); font-size: 15px; font-weight: 600; margin-top: 1px; }
.k-de { font-size: 16px; margin-top: 3px; overflow-wrap: anywhere; }
.k-en {
  display: inline-block; color: var(--leise); font-size: 14px;
  padding: 2px 0 2px 2px;
}
.k-en::before { content: "· "; }
.k-gross {
  flex: none; width: 52px; display: grid; place-items: center; color: var(--leise);
  border-left: 1px solid var(--linie);
}
.k-gross:active { color: var(--akzent); }

.uebersetzen {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; border-radius: 16px;
  border: 1.5px dashed var(--akzent); color: var(--akzent);
  font-weight: 600; font-size: 16px;
}
.uebersetzen svg { flex: none; }
.uebersetzen .q { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.leer { text-align: center; color: var(--leise); padding: 24px 8px 4px; }

/* --- Gross zeigen --- */
.zeigen {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  background: var(--flaeche);
  padding: var(--oben) var(--rechts) var(--unten) var(--links);
}
.z-leiste { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.z-knopf { min-width: 44px; height: 44px; font-size: 34px; line-height: 44px; color: var(--leise); }
.z-text { font-size: 17px; color: var(--akzent); font-weight: 600; padding: 0 6px; }
.z-auto { font-size: 12px; color: var(--leise); background: var(--grund); padding: 3px 8px; border-radius: 99px; }
.z-inhalt {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 0 18px; gap: 6px;
}
.z-thai { font-family: var(--thai); font-weight: 500; line-height: 1.5; color: var(--text); max-width: 100%; }
.z-mhai { color: var(--mhai); font-size: 22px; font-weight: 600; }
.z-de { font-size: 20px; }
.z-en { font-size: 17px; color: var(--leise); }
.z-knoepfe { display: flex; gap: 8px; padding: 10px 12px 14px; }
.z-gross {
  flex: 1.4; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--akzent); color: #fff; font-size: 18px; font-weight: 600;
}
@media (prefers-color-scheme: dark) { .z-gross { color: #16131f; } }
.z-gross:active { opacity: .8; }
.z-zweit { flex: 1; background: var(--akzent-hell); color: var(--akzent); font-size: 16px; }
@media (prefers-color-scheme: dark) { .z-zweit { color: var(--akzent); } }
@media (orientation: landscape) and (max-height: 500px) {
  .z-leiste { position: absolute; left: var(--links); right: var(--rechts); top: 0; z-index: 1; }
  .z-inhalt { padding-top: 8px; gap: 2px; }
  .z-mhai { font-size: 18px; }
  .z-de { font-size: 16px; }
  .z-en { font-size: 14px; }
  .z-knoepfe { padding: 6px 12px 8px; }
  .z-gross { height: 44px; }
}

/* --- Blaetter (Formular, Menue) --- */
.blatt {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(10, 8, 20, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.blatt-inhalt {
  width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto;
  background: var(--grund); border-radius: 18px 18px 0 0;
  padding: 6px calc(var(--rechts) + 16px) calc(var(--unten) + 18px) calc(var(--links) + 16px);
  -webkit-overflow-scrolling: touch;
}
.blatt-kopf {
  display: flex; justify-content: space-between; align-items: center;
  height: 50px; position: sticky; top: -6px; background: var(--grund); z-index: 1;
}
.textknopf { color: var(--akzent); font-size: 17px; padding: 8px 0; min-width: 70px; text-align: left; }
.textknopf.fett { font-weight: 700; text-align: right; }
.blatt label { display: block; font-size: 13px; color: var(--leise); font-weight: 600; margin: 10px 0 0; }
.blatt label small { font-weight: 400; }
.blatt input {
  display: block; width: 100%; height: 46px; margin-top: 4px; padding: 0 12px;
  border: 1.5px solid var(--linie); border-radius: 12px;
  background: var(--flaeche); color: var(--text); font-size: 18px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.blatt input:focus { border-color: var(--akzent); }
.blatt input[lang="th"] { font-family: var(--thai); font-size: 20px; }
.mit-knopf { display: flex; gap: 8px; align-items: center; }
.mit-knopf input { flex: 1; }
.klein {
  flex: none; height: 46px; margin-top: 4px; padding: 0 12px; border-radius: 12px;
  background: var(--akzent-hell); color: var(--akzent); font-size: 15px; font-weight: 600;
}
.f-meldung { color: var(--rot); font-size: 14px; margin: 12px 0 0; }
.loeschen { display: block; width: 100%; margin-top: 22px; height: 46px; border-radius: 12px; color: var(--rot); background: var(--flaeche); border: 1.5px solid var(--linie); }
.m-zeile { margin: 8px 0; color: var(--leise); font-size: 15px; }
.m-titel { margin: 4px 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--leise); }
.m-stimmen { background: var(--flaeche); border: 1.5px solid var(--linie); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.m-stimme {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 8px 14px; text-align: left; border-top: 1px solid var(--linie);
}
.m-stimme:first-child { border-top: 0; }
.m-stimme strong { display: block; font-size: 16px; }
.m-stimme small { display: block; font-size: 13px; color: var(--leise); }
.m-stimme .haken { color: var(--akzent); font-weight: 700; font-size: 18px; visibility: hidden; }
.m-stimme.gewaehlt .haken { visibility: visible; }
.m-stimme:active { background: var(--akzent-hell); }
.m-knopf { display: block; width: 100%; height: 48px; margin-top: 10px; border-radius: 12px; background: var(--flaeche); border: 1.5px solid var(--linie); font-size: 16px; color: var(--akzent); font-weight: 600; }
.m-knopf.rot { color: var(--rot); }
.m-klein { font-size: 13px; color: var(--leise); margin-top: 16px; }

/* --- Anmelden --- */
.anmelden { max-width: 380px; margin: 0 auto; padding: calc(var(--oben) + 48px) 20px 24px; text-align: center; }
.anmelden img { border-radius: 18px; }
.anmelden h1 { margin: 8px 0 20px; font-size: 26px; }
.blatt-form { text-align: left; }
.blatt-form label { display: block; font-size: 13px; color: var(--leise); font-weight: 600; margin: 12px 0 0; }
.blatt-form input {
  display: block; width: 100%; height: 48px; margin-top: 4px; padding: 0 12px;
  border: 1.5px solid var(--linie); border-radius: 12px; outline: none;
  background: var(--flaeche); color: var(--text); font-size: 18px; -webkit-appearance: none; appearance: none;
}
.blatt-form input:focus { border-color: var(--akzent); }
.m-knopf.voll { margin-top: 20px; background: var(--akzent); color: #fff; border: 0; }
@media (prefers-color-scheme: dark) { .m-knopf.voll { color: #16131f; } }

/* --- Kurzmeldung unten --- */
.meldung {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--unten) + 16px);
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 24px); padding: 12px 16px; border-radius: 14px;
  background: #1c1830; color: #fff; font-size: 15px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: dark) { .meldung { background: #f1eef8; color: #1c1830; } }
.meldung button { color: #b597ff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .meldung button { color: #5b2fb8; } }
