/* ==========================================================================
   Intro – Styles
   Aufbau: Schrift → Farbwelten → Basis → Layout → Karten → Module → Dialoge
           → Mikroanimationen
   ========================================================================== */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url("../fonts/figtree-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   Farbwelten
   Jede Welt definiert nur wenige Grundfarben, alles Weitere wird abgeleitet.
   -------------------------------------------------------------------------- */
:root {
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 22px;
  --radius-sm: 12px;
  --gap: clamp(12px, 2vw, 20px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

[data-theme="morgenrot"] {
  color-scheme: light;
  --bg: #fff4ec; --card: #ffffff; --text: #3b201a; --muted: #8a6458;
  --accent: #f2603f; --accent-2: #ffad42; --glow: #ffc7d1;
}
[data-theme="zitrus"] {
  color-scheme: light;
  --bg: #f9fae6; --card: #ffffff; --text: #26300f; --muted: #6c7448;
  --accent: #6e9e12; --accent-2: #f5c400; --glow: #c9f0a0;
}
[data-theme="ozean"] {
  color-scheme: light;
  --bg: #ebf6fa; --card: #ffffff; --text: #0f2a36; --muted: #557584;
  --accent: #0b84aa; --accent-2: #2fc0aa; --glow: #a9dcff;
}
[data-theme="lavendel"] {
  color-scheme: light;
  --bg: #f4f0fb; --card: #ffffff; --text: #2a1f44; --muted: #74689a;
  --accent: #7656d4; --accent-2: #e283c8; --glow: #c9b8ff;
}
[data-theme="kirschbluete"] {
  color-scheme: light;
  --bg: #fff1f4; --card: #ffffff; --text: #3d1824; --muted: #956272;
  --accent: #d9416f; --accent-2: #6fb38a; --glow: #ffc0d4;
}
[data-theme="papier"] {
  color-scheme: light;
  --bg: #f5f3ee; --card: #fffefb; --text: #1f1d1a; --muted: #77726a;
  --accent: #c1502e; --accent-2: #2f2c28; --glow: #e8dfcf;
}
[data-theme="nordlicht"] {
  color-scheme: dark;
  --bg: #08141e; --card: #102331; --text: #e3f4f2; --muted: #86a5ac;
  --accent: #45e0aa; --accent-2: #9a7bff; --glow: #1d6b74;
}
[data-theme="waldboden"] {
  color-scheme: dark;
  --bg: #111912; --card: #1b261c; --text: #e9eedf; --muted: #9aa98c;
  --accent: #a2d36b; --accent-2: #eba54c; --glow: #355c2a;
}
[data-theme="espresso"] {
  color-scheme: dark;
  --bg: #1a1310; --card: #261c17; --text: #f3e6d6; --muted: #b09884;
  --accent: #e0a463; --accent-2: #c97b5a; --glow: #5a3a26;
}
[data-theme="mitternacht"] {
  color-scheme: dark;
  --bg: #0a0d22; --card: #141a38; --text: #e8eaff; --muted: #8f96c4;
  --accent: #f4c64f; --accent-2: #6d80ff; --glow: #2b2f7a;
}
[data-theme="neon"] {
  color-scheme: dark;
  --bg: #12081f; --card: #1d1033; --text: #f6e9ff; --muted: #a88fc4;
  --accent: #ff3fa4; --accent-2: #24d4ff; --glow: #5b1a7d;
}

/* Abgeleitete Tokens – gelten für jede Welt */
:root, [data-theme] {
  --surface: color-mix(in oklab, var(--card) 80%, transparent);
  --surface-strong: color-mix(in oklab, var(--card) 94%, var(--bg));
  --surface-sunk: color-mix(in oklab, var(--text) 6%, transparent);
  --border: color-mix(in oklab, var(--text) 10%, transparent);
  --border-strong: color-mix(in oklab, var(--text) 20%, transparent);
  --accent-soft: color-mix(in oklab, var(--accent) 16%, transparent);
  --accent-2-soft: color-mix(in oklab, var(--accent-2) 18%, transparent);
  --on-accent: #fff;
  --shadow: 0 1px 2px color-mix(in oklab, var(--text) 8%, transparent),
            0 12px 32px -12px color-mix(in oklab, var(--text) 22%, transparent);
  --good: #2fa866; --warn: #e6a019; --bad: #e0524a;
}
[data-theme="nordlicht"], [data-theme="waldboden"], [data-theme="espresso"],
[data-theme="mitternacht"], [data-theme="neon"] {
  --on-accent: #10131a;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 18px 40px -16px rgb(0 0 0 / .6);
}
[data-theme="zitrus"] { --on-accent: #fff; }

/* --------------------------------------------------------------------------
   Basis
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  transition: background-color .6s var(--ease), color .4s var(--ease);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Bewegter Farbhintergrund */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop i {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(70px); opacity: .55;
  transition: background-color 1s var(--ease);
  animation: drift 38s ease-in-out infinite alternate;
}
.backdrop i:nth-child(1) { background: var(--glow); top: -25vmax; left: -15vmax; }
.backdrop i:nth-child(2) { background: var(--accent-2); opacity: .22; bottom: -30vmax; right: -20vmax; animation-duration: 46s; animation-delay: -12s; }
.backdrop i:nth-child(3) { background: var(--accent); opacity: .14; top: 30%; left: 45%; width: 40vmax; height: 40vmax; animation-duration: 52s; animation-delay: -25s; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(8vmax, 6vmax) scale(1.12); }
  100% { transform: translate(-6vmax, 10vmax) scale(.95); }
}

/* --------------------------------------------------------------------------
   Topbar & Buttons
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; text-decoration: none; }
.actions { margin-left: auto; display: flex; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); cursor: pointer;
  font-weight: 600; font-size: .95rem; white-space: nowrap;
  transition: transform .2s var(--ease-bounce), background-color .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-strong); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: 0 6px 18px -8px var(--accent); }
.btn.primary:hover { background: color-mix(in oklab, var(--accent) 88%, var(--text)); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-sunk); }
.btn.ghost[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.btn.icon-only { width: 40px; padding: 0; }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: .85rem; }
.btn.tiny { min-height: 28px; padding: 2px 10px; font-size: .8rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: .85rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}
.chip:hover { border-color: var(--border-strong); }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: transparent; }

@media (max-width: 720px) {
  .actions .label { display: none; }
  .actions .btn { width: 40px; padding: 0; }
  .brand span { display: none; }
}

/* --------------------------------------------------------------------------
   Layout-Raster
   -------------------------------------------------------------------------- */
main { padding: 8px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); max-width: 1320px; margin: 0 auto; }
.grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row dense;
  align-items: start;
}
.card.size-s { grid-column: span 1; }
.card.size-m { grid-column: span 2; }
.card.size-l { grid-column: 1 / -1; }
@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .card.size-s, .card.size-m { grid-column: 1 / -1; }
}

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); }

.empty { text-align: center; padding: 12vh 16px; display: grid; justify-items: center; gap: 10px; }
.empty-emoji { font-size: 4rem; animation: float 4s ease-in-out infinite; }

.edit-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: var(--gap); padding: 10px 10px 10px 18px;
  border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: .92rem;
}

/* --------------------------------------------------------------------------
   Karten
   -------------------------------------------------------------------------- */
.card {
  position: relative; display: flex; flex-direction: column;
  min-width: 0; padding: 18px 20px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  animation: card-in .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 36px; }
.card-icon {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--accent-soft);
  font-size: 1.25rem; line-height: 1; cursor: pointer; user-select: none;
  transform-origin: 50% 70%;
}
.card-title { font-size: .95rem; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.card-body { flex: 1; min-width: 0; }
.card-foot { margin-top: 14px; display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: .75rem; color: var(--muted); }
.card-foot a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted currentColor; }
.card-foot a:hover { color: var(--text); }

.card-tools { display: none; gap: 2px; margin-left: auto; }
.card-tools button {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 10px; background: var(--surface-sunk); cursor: pointer; font-size: .85rem; font-weight: 700;
}
.card-tools button:hover { background: var(--border-strong); }
.card-tools .drag { cursor: grab; touch-action: none; font-size: 1.1rem; }
.card-tools .remove:hover { background: var(--bad); color: #fff; }

body.editing .card-tools { display: flex; }
body.editing .card-meta { display: none; }
body.editing .card.size-s .card-head { flex-wrap: wrap; }
body.editing .card.size-s .card-tools { order: 3; width: 100%; justify-content: flex-end; }
body.editing .card { outline: 2px dashed var(--border-strong); outline-offset: -6px; }
body.editing .card-body { pointer-events: none; opacity: .75; }
.card.dragging { z-index: 5; outline-color: var(--accent) !important; box-shadow: 0 24px 50px -18px var(--accent); transform: scale(1.02); }
body.dragging-active, body.dragging-active * { cursor: grabbing !important; user-select: none; }

/* Lade- und Fehlerzustände */
.skeleton { display: grid; gap: 10px; }
.skeleton span {
  height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-sunk) 0%, var(--border-strong) 50%, var(--surface-sunk) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton span:nth-child(1) { width: 70%; height: 28px; }
.skeleton span:nth-child(2) { width: 90%; }
.skeleton span:nth-child(3) { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.notice { display: grid; gap: 10px; justify-items: start; color: var(--muted); font-size: .92rem; }
.notice .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Gemeinsame Modul-Bausteine
   -------------------------------------------------------------------------- */
.big { font-size: clamp(2.4rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.lead { font-size: 1.05rem; font-weight: 600; }
.small { font-size: .85rem; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .88rem; }
.stats b { color: var(--text); font-weight: 700; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.list li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: baseline; }
.year {
  font-weight: 800; font-variant-numeric: tabular-nums; font-size: .82rem;
  padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); min-width: 3.4em; text-align: center;
}
.list a { text-decoration: none; }
.list a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-5 { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-sunk); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s var(--ease); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; font-size: .8rem; }
.link-btn:hover { text-decoration: underline; }

/* Begrüßung */
.greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.greet h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
.greet .clock { font-size: clamp(2.6rem, 7vw, 4.4rem); font-weight: 800; letter-spacing: -.05em; line-height: .95; font-variant-numeric: tabular-nums; }
.greet .clock small { font-size: .4em; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.greet .date { color: var(--muted); font-weight: 600; margin-top: 6px; }

/* Wetter */
.weather-now { display: flex; align-items: center; gap: 14px; }
.weather-now .wx-emoji { font-size: 3.4rem; line-height: 1; }
.hours { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(52px, 1fr); gap: 4px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.hours::-webkit-scrollbar { display: none; }
.hour { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: var(--surface-sunk); font-size: .8rem; }
.hour .e { font-size: 1.3rem; }
.hour b { font-size: .92rem; }
.hour .rain { color: var(--accent-2); font-weight: 700; font-size: .72rem; min-height: 1em; }

/* Sonne */
.sun-arc { width: 100%; height: auto; max-height: 150px; display: block; margin: 4px 0 10px; overflow: visible; }
.sun-times { display: flex; justify-content: space-between; gap: 8px; }
.sun-times div { display: grid; }
.sun-times b { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.sun-times span { color: var(--muted); font-size: .8rem; font-weight: 600; }

/* Mond */
.moon { display: flex; align-items: center; gap: 16px; }
.moon-disc { flex: none; width: 76px; height: 76px; }

/* Bilder */
.media { position: relative; border-radius: 16px; overflow: hidden; background: var(--surface-sunk); aspect-ratio: 16 / 10; }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.media:hover img { transform: scale(1.04); }
.article { display: grid; gap: 10px; }
.article.with-thumb { grid-template-columns: 96px 1fr; align-items: start; }
.article .thumb { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; background: var(--surface-sunk); }
.article h3 { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }
.article h3 a { text-decoration: none; }
.article h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }

/* Luft & Pollen */
.aqi { display: flex; align-items: center; gap: 14px; }
.aqi-badge { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; font-size: 1.5rem; font-weight: 800; color: #fff; flex: none; }
.meters { display: grid; gap: 8px; margin-top: 14px; }
.meter { display: grid; grid-template-columns: 7.5em 1fr auto; align-items: center; gap: 10px; font-size: .85rem; }
.meter .bar { height: 8px; }
.meter .bar > i.lvl0 { background: var(--good); }
.meter .bar > i.lvl1 { background: var(--warn); }
.meter .bar > i.lvl2 { background: var(--bad); }

/* Feiertage */
.holidays li { grid-template-columns: 3.4em 1fr; align-items: center; }
.date-tile { display: grid; justify-items: center; line-height: 1.05; padding: 6px 0; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.date-tile b { font-size: 1.15rem; }
.date-tile span { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* Wechselkurse */
.fx { display: grid; gap: 10px; }
.fx-row { display: grid; grid-template-columns: 2.6em 1fr 88px 4.2em; align-items: center; gap: 10px; }
.fx-row .flag { font-size: 1.5rem; }
.fx-row .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.fx-row .chg { font-size: .78rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.fx-row .chg.up { color: var(--good); }
.fx-row .chg.down { color: var(--bad); }
.spark { width: 88px; height: 28px; overflow: visible; }

/* Fortschritt */
.progress { display: grid; gap: 12px; }
.progress .p-row { display: grid; gap: 4px; }
.progress .p-label { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 600; }
.progress .p-label span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Fokus */
.focus { display: grid; gap: 8px; }
.focus-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 14px; background: var(--surface-sunk); }
.focus-item input[type=checkbox] { appearance: none; flex: none; width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--border-strong); background: var(--card); cursor: pointer; display: grid; place-items: center; transition: background .2s, border-color .2s, transform .2s var(--ease-bounce); }
.focus-item input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.focus-item input[type=checkbox]:checked::after { content: "✓"; color: var(--on-accent); font-weight: 900; font-size: .9rem; }
.focus-item input[type=text] { flex: 1; min-width: 0; border: 0; background: transparent; padding: 6px 0; outline: none; font-weight: 600; }
.focus-item.done input[type=text] { text-decoration: line-through; color: var(--muted); }
.focus-done { text-align: center; font-weight: 700; color: var(--accent); }

/* Atmen */
.breath { display: grid; justify-items: center; gap: 12px; padding: 6px 0; }
.breath-orb {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 10px var(--accent-soft), 0 0 50px -6px var(--accent);
  display: grid; place-items: center; color: var(--on-accent); font-weight: 800; font-size: 1.4rem;
  transform: scale(.62); transition: transform 4s ease-in-out;
}
.breath-orb.in { transform: scale(1); }
.breath-orb.hold-in { transform: scale(1); }
.breath-orb.out { transform: scale(.62); }
.breath-phase { font-weight: 700; min-height: 1.5em; }

/* Zitat */
blockquote.quote { margin: 0; font-size: clamp(1.05rem, 2vw, 1.25rem); font-weight: 600; line-height: 1.45; letter-spacing: -.01em; }
blockquote.quote::before { content: "„"; display: block; height: .55em; margin-top: -.5em; color: var(--accent); font-size: 3em; line-height: 1; font-weight: 800; }
.quote-by { margin-top: 10px; color: var(--muted); font-weight: 600; font-size: .9rem; }

/* --------------------------------------------------------------------------
   Dialoge (Katalog, Einstellungen)
   -------------------------------------------------------------------------- */
dialog.sheet {
  width: min(880px, calc(100vw - 24px)); max-height: min(88dvh, 900px);
  padding: 0; border: 1px solid var(--border); border-radius: 28px;
  background: var(--surface-strong); color: var(--text);
  box-shadow: 0 40px 80px -20px rgb(0 0 0 / .45);
}
dialog.sheet::backdrop { background: color-mix(in oklab, var(--bg) 40%, rgb(0 0 0 / .45)); backdrop-filter: blur(6px); }
dialog.sheet[open] { animation: sheet-in .35s var(--ease); }
dialog.sheet[open]::backdrop { animation: fade-in .3s ease; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@media (max-width: 640px) {
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 28px 28px 0 0; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
}
.sheet-inner { padding: 22px; display: grid; gap: 18px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }

input[type=search], input[type=text] {
  width: 100%; min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--border-strong); border-radius: 14px;
  background: var(--card); outline: none;
}
input[type=search]:focus, input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.catalog-tools { display: grid; gap: 12px; position: sticky; top: -22px; padding: 10px 0; margin: -10px 0; background: var(--surface-strong); z-index: 1; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.tile {
  display: grid; grid-template-rows: auto auto 1fr auto; gap: 6px;
  padding: 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--card);
  transition: transform .25s var(--ease), border-color .2s, box-shadow .25s;
  animation: card-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms);
}
.tile:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.tile .tile-emoji { font-size: 2rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; background: var(--accent-soft); transform-origin: 50% 70%; }
.tile:hover .tile-emoji { animation: wiggle .7s var(--ease); }
.tile h3 { font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em; }
.tile p { font-size: .87rem; color: var(--muted); }
.tile .tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.tile .src { font-size: .72rem; color: var(--muted); font-weight: 600; }
.tile.active { border-color: var(--accent); background: color-mix(in oklab, var(--card) 90%, var(--accent)); }

.setting { display: grid; gap: 10px; }
.setting h3 { font-size: 1rem; font-weight: 800; }
.setting .row { display: flex; gap: 8px; flex-wrap: wrap; }
/* Farbwelt-Panel (von unten, nicht modal) */
.dock {
  position: fixed; left: 50%; bottom: 0; z-index: 40;
  width: min(920px, 100vw);
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  border: 1px solid var(--border); border-bottom: 0; border-radius: 26px 26px 0 0;
  background: color-mix(in oklab, var(--surface-strong) 88%, transparent);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 -18px 50px -20px rgb(0 0 0 / .35);
  transform: translate(-50%, 110%); visibility: hidden;
  transition: transform .4s var(--ease), visibility 0s .4s, background-color .6s;
}
.dock.open { transform: translate(-50%, 0); visibility: visible; transition: transform .45s var(--ease-bounce), visibility 0s, background-color .6s; }
.dock-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dock-head h2 { font-size: 1rem; font-weight: 800; }
.theme-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 6px; scrollbar-width: thin; }
.theme-row .theme-opt { flex: none; width: 112px; scroll-snap-align: center; font-size: .82rem; }
.theme-row .theme-opt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-row .theme-opt small { display: none; }
.theme-opt {
  display: grid; gap: 8px; padding: 10px; border-radius: 18px; cursor: pointer;
  border: 2px solid var(--border); background: var(--card); text-align: left; font-weight: 700; font-size: .88rem;
  transition: transform .2s var(--ease-bounce), border-color .2s;
}
.theme-opt:hover { transform: translateY(-2px); }
.theme-opt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-opt .sw { height: 46px; border-radius: 12px; position: relative; overflow: hidden; }
.theme-opt .sw i { position: absolute; border-radius: 50%; }

.place-search { position: relative; }
.place-results { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.place-results button { width: 100%; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); cursor: pointer; }
.place-results button:hover { border-color: var(--accent); }
.place-results small { color: var(--muted); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .25s var(--ease-bounce); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; font-size: .92rem;
  transition: opacity .25s, transform .3s var(--ease-bounce); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------------------
   Mikroanimationen – werden per JS zufällig auf Icons angewendet
   -------------------------------------------------------------------------- */
.anim-wiggle { animation: wiggle .8s var(--ease); }
.anim-bounce { animation: bounce .9s var(--ease); }
.anim-spin   { animation: spin 1.1s var(--ease); }
.anim-float  { animation: float 2.2s ease-in-out; }
.anim-pulse  { animation: pulse 1s var(--ease); }
.anim-swing  { animation: swing 1.2s var(--ease); transform-origin: 50% 0; }
.anim-pop    { animation: pop .6s var(--ease-bounce); }
.anim-tada   { animation: tada 1s var(--ease); }
.anim-flip   { animation: flip 1s var(--ease); }
.anim-drift  { animation: drift-x 2.4s ease-in-out; }

@keyframes wiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(11deg); } 60% { transform: rotate(-7deg); } 80% { transform: rotate(3deg); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-9px) scale(1.05, .95); } 50% { transform: translateY(0) scale(.95, 1.05); } 70% { transform: translateY(-3px); } }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 40% { transform: scale(1.22); } 70% { transform: scale(.95); } }
@keyframes swing { 0%,100% { transform: rotate(0); } 25% { transform: rotate(16deg); } 50% { transform: rotate(-12deg); } 75% { transform: rotate(6deg); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(.7); } 100% { transform: scale(1); } }
@keyframes tada { 0%,100% { transform: scale(1) rotate(0); } 10%,20% { transform: scale(.9) rotate(-4deg); } 30%,50%,70%,90% { transform: scale(1.15) rotate(4deg); } 40%,60%,80% { transform: scale(1.15) rotate(-4deg); } }
@keyframes flip { from { transform: perspective(200px) rotateY(0); } to { transform: perspective(200px) rotateY(360deg); } }
@keyframes drift-x { 0%,100% { transform: translateX(0); } 30% { transform: translateX(5px) rotate(4deg); } 70% { transform: translateX(-5px) rotate(-4deg); } }

/* Konfetti (Fokus erledigt) */
.confetti { position: fixed; pointer-events: none; z-index: 60; font-size: 1.2rem; animation: confetti 1.1s var(--ease) forwards; }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .backdrop i { animation: none; }
}
body.no-motion .backdrop i { animation: none; }
