@font-face { font-family: Pixelify; src: url(/fonts/pixelify-sans-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Pixelify; src: url(/fonts/pixelify-sans-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --ink: #1a1c2c; --plum: #5d275d; --red: #b13e53; --orange: #ef7d57; --yellow: #ffcd75; --lime: #a7f070;
  --green: #38b764; --teal: #257179; --navy: #29366f; --blue: #3b5dc9; --sky: #41a6f6; --cyan: #73eff7;
  --white: #f4f4f4; --silver: #94b0c2; --slate: #566c86; --char: #333c57; --pink: #f78fb3; --cream: #fff1d6;
  --bg: #12131f;
  --px: 3px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(#ffffff0d 1px, transparent 1px);
  background-size: 9px 9px;
  color: var(--white);
  font: 17px/1.45 Pixelify, ui-monospace, Menlo, monospace;
  -webkit-font-smoothing: none;
  overscroll-behavior: none;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100%; }
.view { padding: 18px 16px calc(96px + var(--safe-b)); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 700; letter-spacing: .5px; }
h2 { font-size: 20px; color: var(--yellow); }
h3 { font-size: 17px; color: var(--cyan); }
p { margin: 6px 0; }
.muted { color: var(--silver); font-size: 15px; }
.center { text-align: center; }
b { color: var(--yellow); font-weight: 700; }

/* Pixel-Rahmen: Stufen-Schatten statt Rundung */
.card, .btn, .act, input, .stats, .toast, .album-item {
  border: none;
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
    calc(-1 * var(--px)) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
.card {
  background: var(--navy);
  margin: 20px var(--px);
  padding: 16px;
  position: relative;
}
.card::after { content: ''; position: absolute; inset: auto 0 calc(-2 * var(--px) - 3px) 0; height: 6px; background: #0006; }

.btn {
  font: inherit; font-weight: 700; font-size: 16px;
  color: var(--ink); background: var(--yellow);
  padding: 11px 16px; margin: 6px var(--px);
  cursor: pointer;
  transform: translateY(0);
  transition: transform .06s;
}
.btn:active { transform: translateY(3px); }
.btn-cyan { background: var(--cyan); }
.btn-red { background: var(--pink); }
.btn-ghost { background: var(--char); color: var(--white); }
.row { display: flex; gap: 10px; align-items: center; }
.row input { flex: 1; }
input {
  font: inherit; color: var(--white); background: var(--ink);
  padding: 11px 12px; width: 100%; margin: 6px var(--px) 10px; outline: none;
}
input:focus { background: #0d0e17; }
label { display: block; color: var(--silver); font-size: 15px; }

/* ---------------- Onboarding ---------------- */
.hero { text-align: center; padding: 28px 0 6px; }
.hero-pet { width: 104px; image-rendering: pixelated; }
.logo {
  font-size: 46px; color: var(--yellow); letter-spacing: 4px; margin: 6px 0 0;
  text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--plum);
}
.tag { color: var(--cyan); }
.steps { padding-left: 22px; margin: 10px 0; }
.steps li { margin: 8px 0; }
.or { display: flex; align-items: center; gap: 10px; color: var(--slate); margin: 14px 0 6px; }
.or::before, .or::after { content: ''; flex: 1; height: 3px; background: var(--char); }

@keyframes bob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-8px) scale(.97, 1.03); } }
.bob { animation: bob 1.4s steps(6) infinite; }

/* ---------------- Kopfzeile ---------------- */
.top { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; }
.who { display: flex; gap: 12px; align-items: center; }
.pet-name { font-size: 24px; font-weight: 700; color: var(--yellow); letter-spacing: 1px; text-shadow: 2px 2px 0 var(--ink); }
.pet-sub { color: var(--silver); font-size: 14px; }
.dot { width: 12px; height: 12px; background: var(--slate); box-shadow: 0 0 0 3px var(--ink); }
.dot.on { background: var(--lime); animation: pulse 1.6s steps(2) infinite; }
@keyframes pulse { 50% { background: var(--green); } }
.top-right { color: var(--silver); font-size: 14px; text-align: right; }

/* ---------------- Live-Ansicht ---------------- */
.device { display: flex; justify-content: center; padding: 6px 0 4px; }
.bezel {
  width: min(78vw, 320px); aspect-ratio: 1; border-radius: 50%;
  background: #000; position: relative; overflow: hidden;
  box-shadow: 0 0 0 10px #22232f, 0 0 0 13px var(--ink), 0 14px 0 10px #0008;
}
#screen, #screen-fallback {
  width: 100%; height: 100%; display: block; image-rendering: pixelated; border-radius: 50%;
}
#screen-fallback { position: absolute; inset: 0; object-fit: none; background: radial-gradient(var(--navy), var(--ink)); }
.offline-badge {
  position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%);
  background: var(--ink); color: var(--orange); padding: 3px 10px; font-size: 14px;
}

.stats { background: var(--char); margin: 26px var(--px) 18px; padding: 12px 14px; }
.stat { display: grid; grid-template-columns: 88px 1fr 36px; gap: 10px; align-items: center; margin: 5px 0; font-size: 15px; }
.stat span { color: var(--silver); }
.bar { height: 14px; background: var(--ink); position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; display: block; box-shadow: inset 0 3px 0 #ffffff40; transition: width .4s steps(8); }
.stat em { font-style: normal; text-align: right; color: var(--white); }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 var(--px); }
.act {
  font: inherit; font-size: 15px; font-weight: 700; color: var(--white);
  background: var(--navy); padding: 12px 4px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.act:active { background: var(--blue); transform: translateY(2px); }
.act:disabled { opacity: .45; }
.ic { width: 33px; height: 33px; display: inline-block; background-size: contain; image-rendering: pixelated; background-repeat: no-repeat; }
.ic-food { background-image: url(/img/ic-food.png); }
.ic-snack { background-image: url(/img/ic-snack.png); }
.ic-love { background-image: url(/img/ic-love.png); }
.ic-bath { background-image: url(/img/ic-bath.png); }
.ic-meds { background-image: url(/img/ic-meds.png); }
.ic-light { background-image: url(/img/ic-light.png); }
.ic-live { background-image: url(/img/ic-live.png); }
.ic-diary { background-image: url(/img/ic-diary.png); }
.ic-album { background-image: url(/img/ic-album.png); }
.ic-more { background-image: url(/img/ic-more.png); }

/* ---------------- Tagebuch ---------------- */
.tab-title { text-align: center; font-size: 26px; margin: 4px 0 14px; text-shadow: 2px 2px 0 var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 3px; background: var(--char); }
.timeline li { position: relative; margin: 0 0 16px; padding: 10px 12px; background: var(--navy); box-shadow: 3px 3px 0 var(--ink); }
.timeline li::before { content: ''; position: absolute; left: -19px; top: 14px; width: 9px; height: 9px; background: var(--cyan); box-shadow: 0 0 0 3px var(--ink); }
.timeline li.k-evolved::before, .timeline li.k-hatched::before { background: var(--yellow); }
.timeline li.k-farewell::before { background: var(--pink); }
.timeline li.k-sick::before { background: var(--lime); }
.timeline time { display: block; color: var(--silver); font-size: 13px; }
.timeline .empty { background: none; box-shadow: none; color: var(--silver); }

/* ---------------- Album ---------------- */
.album { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 6px var(--px); }
.album-item { background: var(--navy); padding: 12px 8px 10px; text-align: center; }
.album-item img { height: 92px; image-rendering: pixelated; display: block; margin: 0 auto 6px; }
.album-item b { display: block; font-size: 17px; }
.album-item small { color: var(--silver); font-size: 13px; }
.album-item.locked b { color: var(--slate); }
.album-item.current { background: var(--plum); }

/* ---------------- Navigation ---------------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 480px; margin: 0 auto;
  background: var(--ink); padding: 8px 6px calc(8px + var(--safe-b));
  box-shadow: 0 -3px 0 var(--char);
}
.nav button { font: inherit; font-size: 13px; color: var(--slate); background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.nav button .ic { width: 28px; height: 28px; filter: grayscale(1) brightness(.7); }
.nav button.on { color: var(--yellow); }
.nav button.on .ic { filter: none; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: var(--white); padding: 10px 16px; font-size: 15px; z-index: 9; max-width: 90vw;
}
.toast.bad { color: var(--orange); }

@media (prefers-reduced-motion: reduce) { .bob, .dot.on { animation: none; } }

/* Sprachauswahl oben rechts */
.langbar { display: flex; justify-content: flex-end; padding: 10px 16px 0; }
.lang-pick { display: inline-flex; align-items: center; gap: 6px; background: var(--navy); padding: 4px 8px;
  box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink); }
.lang-pick .globe { color: var(--cyan); font-size: 16px; }
.lang-pick select { font: inherit; font-size: 15px; color: var(--white); background: transparent; border: 0; padding: 2px 0; outline: none; }
.lang-pick select option { background: var(--navy); color: var(--white); }
.view { padding-top: 6px; }
/* Installieren-Karte hervorheben */
.card-install { background: var(--plum); }
.card-install h2 { color: var(--cream); }
.btn-big { display: block; width: calc(100% - 6px); font-size: 19px; padding: 14px; margin-top: 12px; background: var(--lime); }
.card-install .muted { color: var(--cream); }
