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

:root {
  --bg: #f4efe2;
  --surface: #090b1d;
  --text: #f5f7fb;
  --muted: rgba(245,247,251,.72);
  --muted-2: rgba(245,247,251,.5);
  --pill: rgba(64, 200, 140, .18);
  --pill-border: rgba(64, 200, 140, .28);
  --pill-text: #76e4b0;
  --btn: #13162b;
  --btn-border: rgba(255,255,255,.08);
  --shadow: 0 20px 60px rgba(0,0,0,.28);
  --shell-bg: #fdfcf7;
  --shell-border: #eae4d0;
  --accent: #b8860b;
  --accent-lt: #fbf3dc;
  --user-bg: #d4af37;
  --user-text: #23301f;
  --bot-bg: #f7f5ee;
  --bot-border: #eae4d0;
  --radius: 14px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  padding: 24px;
}

.hero {
  max-width: 1320px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.hero-brand {
  min-width: 0;
}

.hero-logo {
  font-size: 2.15rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.04em;
  color: #fff;
  animation: fadeUp .7s ease both;
}

.hero-sub {
  margin-top: 8px;
  font-size: .88rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted-2);
  animation: fadeUp .7s ease .08s both;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-link,
.hero-input,
.hero-login {
  height: 48px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--btn-border);
  background: var(--btn);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.hero-input {
  color: var(--muted-2);
  min-width: 260px;
}

.hero-login {
  background: #fff;
  color: #111;
  border-color: #fff;
  cursor: pointer;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 44px;
}

.hero-left {
  flex: 1;
  min-width: 0;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  color: var(--pill-text);
  font-weight: 700;
  font-size: .95rem;
  animation: fadeUp .7s ease .16s both;
}

.hero h1 {
  font-size: clamp(3rem, 5vw, 5.2rem);
  line-height: .93;
  letter-spacing: -.06em;
  font-weight: 800;
  color: #fff;
  max-width: 780px;
  animation: fadeUp .7s ease .24s both;
}

.hero p {
  margin-top: 22px;
  max-width: 650px;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--muted);
  animation: fadeUp .7s ease .32s both;
}

.hero-right {
  flex: 0 0 530px;
  max-width: 530px;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  background: #111;
  animation: fadeInScale .9s ease .18s both;
}

.hero-right img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.content {
  max-width: 1320px;
  margin: 0 auto 24px;
  padding: 0 0 24px;
}

.shell {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  background: var(--shell-bg);
  border-radius: 20px;
  box-shadow: 0 2px 24px rgba(31,43,32,.08);
  border: 1px solid var(--shell-border);
  overflow: hidden;
  min-height: 680px;
}

.history-bar {
  display: none;
  padding: 8px 16px;
  border-bottom: 1px solid var(--shell-border);
  flex-shrink: 0;
  overflow-x: auto;
  white-space: nowrap;
  gap: 6px;
  align-items: center;
  scrollbar-width: none;
  background: #fff;
}

.history-bar.visible {
  display: flex;
}

.history-label {
  font-size: .7rem;
  color: #6b776a;
  flex-shrink: 0;
  margin-right: 4px;
}

.fav-panel {
  display: none;
  flex-direction: column;
  border-bottom: 1px solid var(--shell-border);
  background: #fff;
  flex-shrink: 0;
  max-height: 220px;
}

.fav-panel.open {
  display: flex;
}

.fav-panel-header {
  padding: 10px 16px 6px;
  font-size: .75rem;
  font-weight: 600;
  color: #6b776a;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.fav-list {
  overflow-y: auto;
  flex: 1;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--shell-border);
}

.fav-item-title {
  flex: 1;
  font-size: .83rem;
  color: #23301f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-item-date {
  font-size: .7rem;
  color: #6b776a;
  flex-shrink: 0;
}

.fav-item-del {
  background: none;
  border: none;
  color: #6b776a;
  cursor: pointer;
  font-size: .9rem;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}

.fav-item-del:hover {
  color: #c23b3b;
}

.fav-empty {
  font-size: .82rem;
  color: #6b776a;
  padding: 10px;
  text-align: center;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
  width: 4px;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--shell-border);
  border-radius: 4px;
}

.msg-row {
  display: flex;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-row.bot {
  justify-content: flex-start;
}

.bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.6;
}

.bubble.user {
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
}

.bubble.bot {
  background: var(--bot-bg);
  border: 1px solid var(--bot-border);
  color: #23301f;
  border-bottom-left-radius: 4px;
}

.bubble.error {
  background: #fdeeee;
  border: 1px solid #f3c6c6;
  color: #8a2e2e;
  border-bottom-left-radius: 4px;
}

.bubble.error .error-title {
  font-weight: 600;
  font-size: .85rem;
  color: #c23b3b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bubble.error .error-detail {
  font-size: .8rem;
  color: #a24545;
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(194,59,59,.07);
  border-radius: 6px;
  font-family: monospace;
  word-break: break-all;
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--shell-border);
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--shell-border);
  background: #fff;
  color: #23301f;
  flex: 1 1 calc(50% - 4px);
  justify-content: center;
  white-space: nowrap;
}

.btn-action:hover {
  background: var(--accent-lt);
  border-color: var(--accent);
}

.input-area {
  border-top: 1px solid var(--shell-border);
  padding: 14px 16px;
  flex-shrink: 0;
  background: #fdfcf7;
}

.input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--shell-border);
  border-radius: var(--radius);
  padding: 10px 12px 10px 16px;
  transition: border-color .2s;
}

.input-wrap:focus-within {
  border-color: var(--accent);
}

textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: .9rem;
  color: #23301f;
  line-height: 1.5;
  max-height: 120px;
  outline: none;
}

textarea::placeholder {
  color: #6b776a;
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.send-btn svg {
  color: #fff;
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.action-row .menu-btn,
.action-row .fav-toggle {
  flex: 1;
  justify-content: center;
}

.btn-label {
  display: inline;
}

@media (max-width: 420px) {
  .btn-label { display: none; }
  .action-row .menu-btn,
  .action-row .fav-toggle {
    flex: 0 0 auto;
    padding: 0 16px;
  }
}

.input-hint {
  font-size: .72rem;
  color: #6b776a;
  margin-top: 7px;
  text-align: center;
}

/* .menu-btn und .fav-toggle waren zwei identische Regelblöcke — zusammengeführt */
.menu-btn,
.fav-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-lt);
  border: 1px solid var(--shell-border);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.menu-btn.active,
.fav-toggle.active,
.menu-btn:hover,
.fav-toggle:hover {
  background: var(--accent);
  color: var(--user-text);
  border-color: var(--accent);
}

.shop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(35,48,31,.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shop-overlay.open {
  display: flex;
}

.shop-modal {
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  color: #23301f;
}

.shop-modal-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--shell-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shop-modal-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--accent);
}

.shop-close {
  background: none;
  border: none;
  color: #6b776a;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.shop-close:hover {
  color: #23301f;
}

.shop-list {
  overflow-y: auto;
  padding: 12px 18px;
  flex: 1;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--shell-border);
  font-size: .88rem;
  color: #23301f;
}

.shop-item:last-child {
  border-bottom: none;
}

.shop-item input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.shop-item label {
  cursor: pointer;
  flex: 1;
  color: #23301f;
}

.shop-item.checked label {
  text-decoration: line-through;
  color: #6b776a;
}

.shop-modal-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--shell-border);
  display: flex;
  gap: 8px;
}

.shop-modal-footer .btn-action {
  flex: 1;
  justify-content: center;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 34px;
  min-height: 16px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b8860b;
  display: inline-block;
  animation: typingDots 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: .15s;
}

.typing span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes typingDots {
  0%, 80%, 100% {
    opacity: .25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 980px) {
  .hero-top,
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-right {
    width: 100%;
    flex-basis: auto;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 12px;
  }

  .hero {
    padding: 18px;
    border-radius: 18px;
  }

  .hero-logo {
    font-size: 1.7rem;
  }

  .hero-input {
    min-width: 100%;
  }

  .hero-link,
  .hero-input,
  .hero-login {
    width: 100%;
  }

  .hero-right {
    border-radius: 22px;
  }
}

@media print {
  .shop-overlay {
    position: static;
    background: none;
    padding: 0;
  }
  .shop-modal {
    box-shadow: none;
    border: none;
    max-width: 100%;
    max-height: none;
  }
  .shop-modal-footer,
  .shop-close {
    display: none !important;
  }
  .shop-item input[type="checkbox"] {
    display: none;
  }
  body {
    background: white;
    padding: 0;
  }
  .hero,
  .history-bar,
  .fav-panel,
  .recipe-actions,
  .token-info,
  .save-db-btn {
    display: none !important;
  }
  .content {
    margin: 0;
  }
  .shell {
    box-shadow: none;
    border: none;
    height: auto;
    max-height: none;
  }
  .input-area {
    display: none !important;
  }
  .messages {
    overflow: visible;
    padding: 0;
  }
  .bubble.user {
    display: none;
  }
  .bubble.bot {
    border: none;
    max-width: 100%;
  }

  /* Standardmäßig alle Nachrichten beim Drucken ausblenden — nur die
     per JS markierte "printing"-Bubble wird gezeigt, damit nicht die
     komplette Verlaufshistorie mitgedruckt wird. */
  .msg-row {
    display: none !important;
  }
  .msg-row.printing {
    display: flex !important;
  }
}