*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:       #2e7d32;
  --green-dark:  #1b5e20;
  --green-light: #e8f5e9;
  --green-mid:   #a5d6a7;
  --red-light:   #ffebee;
  --red:         #c62828;
  --orange:      #e65100;
  --orange-light:#fff3e0;
  --shadow:      0 2px 8px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f4f0;
  color: #1a1a1a;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────── */

header {
  background: var(--green);
  color: #fff;
  padding: 16px 20px 14px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,.28);
}

header h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 2px;
}

/* ── Main (scrollbarer Listenbereich) ───────── */

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 14px 12px 90px; /* Basis-Abstand zum fixierten Panel; wird per JS angepasst */
}

/* ── Fixiertes Eingabe-Panel unten ──────────── */

.bottom-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: 0 -3px 14px rgba(0,0,0,.13);
  z-index: 20;
}

.bottom-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

/* ── Chips-Panel (aufklappbar) ──────────────── */

.chips-panel {
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 10px;
}

.section-label {
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #999;
  margin-bottom: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 190px;
  overflow-y: auto;
}

.chip {
  padding: 8px 14px;
  background: var(--green-light);
  color: var(--green);
  border: 1px solid var(--green-mid);
  border-radius: 20px;
  font-size: .88rem;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.chip:active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* ── Eingabezeile ───────────────────────────── */

.input-row {
  display: flex;
  gap: 8px;
}

#itemInput {
  flex: 1;
  padding: 13px 15px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 10px;
  outline: none;
  background: #fafafa;
  transition: border-color .2s;
  min-width: 0;
}

#itemInput:focus {
  border-color: var(--green);
  background: #fff;
}

#quickBtn {
  width: 50px;
  height: 50px;
  background: var(--orange-light);
  color: var(--orange);
  border: 2px solid #ffcc80;
  border-radius: 10px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

#quickBtn.active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

#addBtn {
  width: 50px;
  height: 50px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.7rem;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

#addBtn:active { background: var(--green-dark); }

/* ── Einkaufsliste ──────────────────────────── */

#list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.list-header {
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #999;
  margin-bottom: 10px;
  padding: 0 4px;
}

.empty-msg {
  grid-column: 1 / -1;
  text-align: center;
  color: #bbb;
  padding: 44px 0;
  font-style: italic;
}

.item {
  display: flex;
  align-items: flex-start;
  background: #fff;
  border-radius: 12px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}

.item.removing {
  opacity: 0;
  transform: translateX(28px);
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: break-word;
}

.item-age {
  font-size: .78rem;
  color: #aaa;
  margin-top: 3px;
  display: block;
}

.del-btn {
  width: 38px;
  height: 38px;
  background: var(--red-light);
  color: var(--red);
  border: none;
  border-radius: 50%;
  font-size: .95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 10px;
  margin-top: 2px;
  flex-shrink: 0;
  transition: background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}

.del-btn:active {
  background: var(--red);
  color: #fff;
}

/* ── Toast ──────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #323232;
  color: #fff;
  padding: 11px 24px;
  border-radius: 24px;
  font-size: .9rem;
  transition: transform .3s;
  z-index: 100;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ── PIN-Overlay ─────────────────────────────── */

#pinOverlay {
  position: fixed;
  inset: 0;
  background: var(--green);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-box {
  text-align: center;
  color: #fff;
  padding: 24px 16px;
  width: 100%;
  max-width: 320px;
}

.pin-logo {
  font-size: 3rem;
  margin-bottom: 6px;
}

.pin-box h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 36px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 40px;
}

.pin-dots span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  background: transparent;
  transition: background .15s, border-color .15s;
}

.pin-dots span.filled {
  background: #fff;
  border-color: #fff;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 14px;
  justify-content: center;
}

.pin-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 400;
  cursor: pointer;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pin-btn:active {
  background: rgba(255,255,255,.35);
}

.pin-reset {
  font-size: 1.4rem;
  color: rgba(255,255,255,.75);
  border-color: rgba(255,255,255,.25);
}
