/* ==================================================================
   KOCHSTUDIO — "Midnight Felt" Design System
   ================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg0: #0a0e0b; --felt: #0e1410;
  --card: rgba(255, 252, 240, 0.045);
  --card-hi: rgba(255, 252, 240, 0.09);
  --edge: rgba(232, 193, 90, 0.14);
  --edge-soft: rgba(255, 252, 240, 0.08);
  --ink: #f4efe2; --muted: #93a396;
  --gold: #e8c15a; --gold-glow: rgba(232, 193, 90, 0.35);
  --foil: linear-gradient(115deg, #8a6a1c 0%, #e8c15a 25%, #fff3c4 50%, #e8c15a 75%, #8a6a1c 100%);
  --red: #e2685a;
  --radius: 16px; --radius-sm: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Outfit", system-ui, -apple-system, sans-serif;
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
}
:root[data-theme="light"] {
  --bg0: #f4f1e6; --felt: #ece9db;
  --card: rgba(40, 48, 31, 0.05); --card-hi: rgba(40, 48, 31, 0.08);
  --edge: rgba(120, 95, 20, 0.2); --edge-soft: rgba(40, 48, 31, 0.1);
  --ink: #26301f; --muted: #64705f;
  --gold: #a5851f; --gold-glow: rgba(165, 133, 31, 0.3);
  --foil: linear-gradient(115deg, #6d5416 0%, #a5851f 30%, #c9a13b 50%, #a5851f 70%, #6d5416 100%);
}

html { -webkit-text-size-adjust: 100%; }
* { -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-ui);
  background: radial-gradient(120% 90% at 50% -10%, var(--felt) 0%, var(--bg0) 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.55;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px calc(48px + env(safe-area-inset-bottom));
}

.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.topbar h1 {
  flex: 1;
  font-family: var(--font-display);
  font-style: italic; font-weight: 800;
  font-size: 1.6rem;
}
.foil {
  background: var(--foil); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: foil-sheen 5.5s ease-in-out infinite;
}
@keyframes foil-sheen { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.btn-back, .btn-icon {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink);
  text-decoration: none; font-size: 1.15rem;
  border: 0; cursor: pointer;
  box-shadow: 0 0 0 1px var(--edge) inset;
}

.intro { color: var(--muted); margin-bottom: 20px; }
.intro b { color: var(--ink); }

.lbl { display: block; font-weight: 700; margin: 14px 0 6px; }
.lbl .opt { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

textarea, input[type="text"] {
  width: 100%;
  font-family: inherit; font-size: 1.05rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--edge-soft);
  border-radius: var(--radius);
  padding: 13px 14px;
  resize: vertical;
}
textarea:focus, input:focus { outline: none; border-color: var(--gold); }
::placeholder { color: var(--muted); opacity: 0.7; }

.btn-primary {
  display: block; width: 100%;
  margin-top: 18px;
  font-family: inherit; font-size: 1.15rem; font-weight: 700;
  background: linear-gradient(160deg, #f0cd6e, #e8c15a 45%, #c39a30);
  color: #1a1508;
  border: 0; border-radius: 14px;
  padding: 15px;
  cursor: pointer;
  box-shadow: 0 10px 26px -10px var(--gold-glow);
  transition: transform 0.15s var(--ease-spring);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.card {
  margin-top: 22px;
  background: linear-gradient(175deg, var(--card-hi), var(--card));
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 0 0 1px var(--edge-soft) inset, 0 10px 30px -14px rgba(0,0,0,0.55);
}
.card h2 {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.25rem;
  color: var(--gold);
  margin: 18px 0 8px;
}
.card h2:first-child { margin-top: 0; }
.card p { margin-bottom: 10px; }
.card em { color: var(--muted); font-style: italic; }
.card strong { color: var(--gold); font-weight: 600; }
.card ul, .card ol { margin: 0 0 12px 20px; }
.card li { margin-bottom: 6px; }

.cooking { color: var(--muted); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
.err { color: var(--red); }

#weblinks { list-style: none; margin: 0; }
#weblinks li { margin-bottom: 10px; }
#weblinks a { color: var(--ink); font-weight: 600; text-decoration: none; }
#weblinks a:hover { color: var(--gold); }
#weblinks .host {
  display: block;
  color: var(--muted); font-size: 0.78rem;
}

.disclaimer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

/* ---------- Aktionen (Kopieren/Teilen/Download) ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-secondary {
  flex: 1;
  min-width: 120px;
  font-family: inherit; font-size: 0.98rem; font-weight: 600;
  color: var(--ink);
  background: var(--card-hi);
  border: 0; border-radius: 12px;
  padding: 12px 10px;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--edge-soft) inset;
  transition: transform 0.12s var(--ease-spring);
}
.btn-secondary:active { transform: scale(0.96); }

/* ---------- Verlauf ---------- */
#history-sec { margin-top: 34px; }
.hist-head { display: flex; align-items: center; justify-content: space-between; }
.hist-head h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--gold);
}
.btn-link {
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font-family: inherit; font-size: 0.85rem;
  text-decoration: underline;
}
.btn-link:hover { color: var(--red); }
.hist-note { color: var(--muted); font-size: 0.78rem; margin: 2px 0 12px; }

#history { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hist-item { display: flex; gap: 8px; align-items: stretch; }
.hist-open {
  flex: 1; min-width: 0; text-align: left;
  font-family: inherit; color: var(--ink);
  background: linear-gradient(175deg, var(--card-hi), var(--card));
  border: 0; border-radius: 12px;
  padding: 11px 14px; cursor: pointer;
  box-shadow: 0 0 0 1px var(--edge-soft) inset;
}
.hist-open:active { transform: scale(0.99); }
.hist-title {
  display: block; font-weight: 700; font-size: 0.98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-meta {
  display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-del {
  flex-shrink: 0; width: 46px;
  background: var(--card); border: 0; border-radius: 12px;
  color: var(--muted); font-size: 1rem; cursor: pointer;
  box-shadow: 0 0 0 1px var(--edge-soft) inset;
}
.hist-del:active { transform: scale(0.94); }
