/* tottelz – Retro-/Pixel-Look, mobil zuerst. */

:root {
  --bg: #f3e9d2;
  --bg-2: #e7d7b8;
  --device: #f7c6d9;
  --device-edge: #e79cc0;
  --screen: #cdeccd;
  --screen-edge: #8fc79a;
  --ink: #3a2e2a;
  --accent: #6b4ea9;
  --accent-2: #8a6fd6;
  --good: #6ec46e;
  --mid: #f2c14e;
  --bad: #e8736a;
  --shadow: rgba(58, 46, 42, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: ui-monospace, "Courier New", monospace;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, #fff6e6 0, transparent 45%),
    radial-gradient(circle at 80% 0, #ffe3ef 0, transparent 40%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  padding: 16px;
}

#app { width: 100%; max-width: 420px; }

.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
}

/* --- Kopf --- */
.title { text-align: center; }
.title h1 {
  margin: 8px 0 0;
  font-size: 34px;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 var(--shadow);
}
.subtitle { margin: 6px 0 0; opacity: 0.8; }
.badges { display: flex; gap: 8px; justify-content: center; margin: 8px 0 0; flex-wrap: wrap; }
.badge {
  background: #fff;
  border: 2px solid var(--screen-edge);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13px;
}

/* --- "Gerät" mit Bildschirm --- */
.device {
  background: linear-gradient(160deg, var(--device), var(--device-edge));
  border-radius: 28px;
  padding: 22px;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.08), 0 10px 24px var(--shadow);
  display: flex;
  justify-content: center;
}
.device-screen {
  background: var(--screen);
  border: 4px solid var(--screen-edge);
  border-radius: 14px;
  padding: 10px;
  box-shadow: inset 0 0 0 3px #fff, inset 0 4px 14px rgba(0,0,0,0.12);
}
canvas {
  display: block;
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* --- Vorlagen-Auswahl --- */
.picker-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.tpl-name { font-size: 20px; min-width: 120px; text-align: center; }
.nav-btn {
  width: 44px; height: 44px;
  font-size: 24px; line-height: 1;
  border: 3px solid var(--accent);
  background: #fff; color: var(--accent);
  border-radius: 12px; cursor: pointer;
}
.nav-btn:active { transform: translateY(2px); }

/* --- Farb-Slots --- */
.slots { display: flex; flex-direction: column; gap: 10px; }
.slot { display: flex; align-items: center; gap: 10px; }
.slot-label { width: 72px; font-size: 13px; opacity: 0.85; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--shadow);
  cursor: pointer; padding: 0;
}
.swatch.active { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- Name --- */
.name-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.name-field input,
.share-row input {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 3px solid var(--screen-edge);
  border-radius: 12px;
  background: #fff;
  width: 100%;
}

/* --- Buttons --- */
.primary-btn {
  font-family: inherit;
  font-size: 18px;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 #4f3a86;
}
.primary-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #4f3a86; }
.primary-btn:disabled { opacity: 0.7; cursor: default; }

/* --- Statusbalken --- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 34px; align-items: center; gap: 10px; }
.bar-label { font-size: 13px; }
.bar-track {
  height: 18px;
  background: #fff;
  border: 3px solid var(--screen-edge);
  border-radius: 10px;
  overflow: hidden;
}
.bar-fill {
  display: block; height: 100%;
  width: 0;
  background: var(--good);
  transition: width 0.4s ease, background 0.4s ease;
}
.bar-fill.high { background: var(--good); }
.bar-fill.mid { background: var(--mid); }
.bar-fill.low { background: var(--bad); }
.bar-val { font-size: 13px; text-align: right; }

/* --- Aktionen --- */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.action-btn {
  font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px;
  font-size: 12px;
  border: 3px solid var(--accent);
  background: #fff; color: var(--ink);
  border-radius: 14px;
  cursor: pointer;
}
.action-btn:active { transform: translateY(2px); }
.action-btn:disabled { opacity: 0.5; }
.action-icon { font-size: 24px; }

/* --- Teilen --- */
.share { display: flex; flex-direction: column; gap: 8px; }
.share-label { font-size: 13px; opacity: 0.85; }
.share-row { display: flex; gap: 8px; }
.share-row input { font-size: 14px; }
.ghost-btn {
  font-family: inherit;
  white-space: nowrap;
  padding: 0 14px;
  border: 3px solid var(--accent);
  background: #fff; color: var(--accent);
  border-radius: 12px; cursor: pointer;
}
.ghost-btn:active { transform: translateY(2px); }

/* --- Hinweise --- */
.error { color: var(--bad); margin: 0; min-height: 18px; font-size: 14px; text-align: center; }
.error.big { font-size: 16px; margin: 24px 0; }
.loading { text-align: center; opacity: 0.7; padding: 40px 0; }
