:root {
  --bg: #fff3e0;
  --ink: #2b211c;
  --muted: #6d5c52;
  --accent: #8b5a7c;
  --green: #2f7d4c;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ---------- Gespräch ---------- */

#stage {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  text-align: center;
}

#avatar-btn {
  border: 0;
  background: none;
  padding: 0;
  width: min(68vw, 42vh, 340px);
  flex: none;
  cursor: pointer;
}
#avatar { display: block; }
.avatar-svg { display: block; width: 100%; height: auto; }

#status {
  min-height: 1.6em;
  font-size: clamp(1.15rem, 5vw, 1.6rem);
  font-weight: 700;
  color: var(--green);
}
body[data-phase="speaking"] #status,
body[data-phase="thinking"] #status { color: var(--accent); }
body[data-phase="rest"] #status { color: var(--muted); }

#caption {
  font-size: clamp(1.7rem, 7.4vw, 2.6rem);
  line-height: 1.3;
  font-weight: 600;
  max-width: 22em;
  overflow-wrap: break-word;
}

/* Bilder zum Aussuchen (Bestell-Liste): Avatar wird kleiner, damit die Bilder Platz haben */
body.choosing #avatar-btn { width: min(34vw, 20vh, 170px); }
body.choosing #caption { font-size: clamp(1.4rem, 6vw, 2rem); }

#products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  width: min(100%, 640px);
}
.product {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 4px solid #d9c7b3;
  border-radius: 20px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.product:active { border-color: var(--green); background: #eef7f0; }
.product img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: #fff; }
.product span { font-size: clamp(1.2rem, 5.2vw, 1.6rem); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }

#heard {
  font-size: clamp(1.05rem, 4.6vw, 1.4rem);
  color: var(--muted);
  font-style: italic;
  min-height: 1.4em;
  max-width: 30em;
}

.big {
  margin-top: auto;
  font: inherit;
  font-size: clamp(1.3rem, 6vw, 1.8rem);
  font-weight: 700;
  padding: 18px 26px;
  border-radius: 20px;
  border: 3px solid var(--accent);
  background: #fff;
  color: var(--accent);
  width: min(100%, 420px);
}
.big:active { background: #f3e3ee; }

#type-form { display: flex; gap: 8px; width: min(100%, 520px); }
#type-form input { flex: 1; font: inherit; font-size: 1.1rem; padding: 10px; border: 2px solid #c9b8a6; border-radius: 10px; }
#type-form button { font: inherit; font-size: 1.1rem; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; }

/* ---------- große Tipp-Fläche ---------- */

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 243, 224, 0.94);
  display: flex;
  padding: 24px;
}
#overlay-btn {
  flex: 1;
  border: 6px solid var(--green);
  border-radius: 36px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
}
#overlay-icon { font-size: clamp(5rem, 28vw, 9rem); line-height: 1; }
#overlay-text { font-size: clamp(2rem, 9vw, 3.2rem); font-weight: 800; line-height: 1.2; }

/* ---------- Einrichtung und Verwaltung ---------- */

.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.page h1 { font-size: 1.7rem; margin: 0 0 6px; }
.page h2 { font-size: 1.25rem; margin: 0 0 10px; }
.page p { line-height: 1.5; }

.card { background: #fff; border-radius: 16px; padding: 16px; margin: 16px 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }
.card.done { opacity: 0.6; }
.card .step { display: inline-block; background: var(--accent); color: #fff; border-radius: 999px; width: 1.9em; height: 1.9em; line-height: 1.9em; text-align: center; font-weight: 700; margin-right: 8px; }

.btn { font: inherit; font-size: 1.05rem; font-weight: 700; padding: 12px 18px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
.btn.secondary { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.btn.small { font-size: 0.9rem; padding: 6px 10px; }
.btn:disabled { opacity: 0.5; }

.msg { font-weight: 700; margin: 10px 0 0; }
.msg.ok { color: var(--green); }
.msg.error { color: #b3261e; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font: inherit; width: 100%; padding: 10px; border: 2px solid #c9b8a6; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 170px; line-height: 1.45; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 14px; }
.check input { width: 22px; height: 22px; }

.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #eee2d3; }
.list-item:first-child { border-top: 0; }
.list-item.clickable { cursor: pointer; }
.linkbox { word-break: break-all; background: #f7efe3; padding: 10px; border-radius: 10px; margin-top: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 0.9rem; }
.stats { display: flex; flex-wrap: wrap; gap: 18px; }
.stats div strong { display: block; font-size: 1.4rem; }
#preview { width: 150px; margin: 6px auto 0; }

.transcript p { margin: 6px 0; line-height: 1.45; }
.transcript .user { font-weight: 600; }
.transcript .hidden-msg { color: var(--muted); font-style: italic; }

.thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
input[type="file"] { font: inherit; }
