
/* ══════════════════════════════════════════════════════
   RESET + TOKENS
══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --green:      #f2f4f8;
  --green-dark: #e8ecf3;
  --green-mid:  #64d2ff;
  --yellow:     #0a84ff;
  --orange:     #ff9f0a;
  --pink:       #ff375f;
  --white:      #ffffff;
  --black:      #111319;
  --off-white:  #f6f8fc;
  --line:       #d9dee9;
  --text-muted: #6f7786;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--black);
  overflow: hidden; /* full-app layout — no page scroll */
  overflow-x: hidden; /* prevent horizontal scroll on iOS input focus */
  -webkit-font-smoothing: antialiased;
}

/* Homepage: decorative background */
body {
  background:
    url('../img/sfondo.png') top center / 100% auto no-repeat,
    linear-gradient(180deg, #D7E0F4 0%, #ffffff 30%) #ffffff;
  transition: background 0.3s ease;
}

/* Chat mode: clean white background */
body.is-chatting {
  background: #ffffff;
}

/* ══════════════════════════════════════════════════════
   TOPBAR — fullwidth bg, inner content centered
══════════════════════════════════════════════════════ */
.topbar {
  flex-shrink: 0;
  z-index: 100;
  width: 100%;
  background: rgba(248, 250, 254, 0.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(160%);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-brand {
  height: 32px;
  width: auto;
  display: block;
  object-fit: contain;
}
@media (max-width: 640px) {
  .topbar-brand { height: 26px; }
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(17,19,25,0.14);
  background: rgba(255,255,255,0.78);
  color: #2f3540;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px -20px rgba(17,19,25,0.55);
}
.topbar-btn:hover {
  background: #fff;
  border-color: rgba(17,19,25,0.22);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════
   APP WRAPPER — true fullscreen, no side borders
══════════════════════════════════════════════════════ */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Inner page-width container used by topbar content, messages, inputbar inner */
.page-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

/* ══════════════════════════════════════════════════════
   HERO — EMPTY STATE
══════════════════════════════════════════════════════ */
.main-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.8vh, 20px);
  padding: 16px 24px 24px;
  text-align: center;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Inputbar inside hero: transparent, no border, overlaps mascotte from below */
.main-empty > .inputbar {
  background: transparent;
  border-top: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  width: 100%;
  flex-shrink: 0;
  margin-top: -90px;
  position: relative;
  z-index: 2;
}

/* Inputbar inside #app (chat mode): no background strip */
#app > .inputbar {
  background: transparent;
  border-top: none;
}

/* ALDO avatar — mascotte image used in hero + chat turns */
.aldo-avatar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aldo-avatar img {
  display: block;
  object-fit: contain;
}

/* Hero-sized avatar — GIF is portrait (420×550), let it breathe */
.aldo-avatar--hero {
  width: clamp(220px, 38vh, 420px);
}
.aldo-avatar--hero img {
  width: 100%;
  height: auto;
}

/* Chat-turn avatar */
.aldo-avatar--sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.aldo-avatar--sm img {
  width: 36px;
  height: 36px;
  object-fit: cover;
}

.hero-title {
  flex-shrink: 0;
  text-align: center;
  font-size: clamp(32px, 5vw, 59.63px);
  line-height: calc(58.2 / 59.63);
  letter-spacing: -0.28px;
}

.hero-title-pre {
  display: block;
  font-weight: 400;
  color: #17294F;
}

.hero-title em {
  display: block;
  font-style: normal;
  font-weight: 700;
  color: #3052A0;
}

.hero-sub {
  font-size: clamp(14px, 1.8vw, 19.63px);
  font-weight: 400;
  color: #3052A0;
  line-height: 1;
  letter-spacing: -0.28px;
  text-align: center;
  flex-shrink: 0;
}

/* Prompt pills — lives inside inputbar in hero state */
.prompts {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.prompt-pill {
  background: #fff;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
  white-space: nowrap;
}
.prompt-pill:hover  { transform: translateY(-2px); }
.prompt-pill:active { transform: translateY(0); }

/* Per-category pill colors + tonal hover */
.pill--giochi      { color: #841EE3; background: rgba(132, 30, 227, 0.08); }
.pill--giochi:hover { background: rgba(132, 30, 227, 0.18); }
.pill--ricette     { color: #F96E16; background: rgba(249, 110, 22, 0.08); }
.pill--ricette:hover { background: rgba(249, 110, 22, 0.18); }
.pill--stagionalita { color: #4B8138; background: rgba(75, 129, 56, 0.08); }
.pill--stagionalita:hover { background: rgba(75, 129, 56, 0.18); }
.pill--curiosita   { color: #D52626; background: rgba(213, 38, 38, 0.08); }
.pill--curiosita:hover { background: rgba(213, 38, 38, 0.18); }

/* Per-category response bubble colors */
.turn-aldo--giochi      { --cat: #841EE3; }
.turn-aldo--ricette     { --cat: #F96E16; }
.turn-aldo--stagionalita { --cat: #4B8138; }
.turn-aldo--curiosita   { --cat: #D52626; }


.turn-aldo--giochi .turn-aldo-label,
.turn-aldo--ricette .turn-aldo-label,
.turn-aldo--stagionalita .turn-aldo-label,
.turn-aldo--curiosita .turn-aldo-label {
  color: var(--cat);
}

/* Quiz buttons in categorized turns: tinted default state */
[class*="turn-aldo--"] .chat-quiz-btn {
  background: color-mix(in srgb, var(--cat) 10%, white);
  border-color: color-mix(in srgb, var(--cat) 25%, white);
  color: var(--cat);
}

[class*="turn-aldo--"] .chat-quiz-btn:hover {
  background: var(--cat);
  border-color: var(--cat);
  color: #fff;
}

[class*="turn-aldo--"] .quiz-options.is-answered .chat-quiz-btn {
  border-color: var(--cat);
  color: var(--cat);
  background: transparent;
}

[class*="turn-aldo--"] .quiz-options.is-answered .chat-quiz-btn.is-selected {
  background: var(--cat);
  border-color: var(--cat);
  color: #fff;
}

/* ══════════════════════════════════════════════════════
   MESSAGES — scrollable column, fixed height
══════════════════════════════════════════════════════ */
.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 24px 0 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  align-self: stretch; /* fill full width for bg */
  overflow-y: auto;
  overflow-anchor: none;
  scroll-behavior: smooth;
}

/* Messages needs to be inside a fullwidth wrapper for bg continuity */
.messages-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative; /* anchor for scroll arrow */
}

/* Scroll-to-bottom arrow */
.scroll-arrow {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(17,19,25,0.14);
  background: rgba(255,255,255,0.92);
  color: #29303a;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 32px -22px rgba(17,19,25,0.55);
  transition: opacity 0.2s, transform 0.15s;
  opacity: 0.85;
}
.scroll-arrow:hover {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* ── USER TURN ── */
.turn-user {
  display: flex;
  justify-content: flex-end;
  padding: 10px 32px;
}

.turn-user-bubble {
  background: #EBF0F9;
  color: #223D77;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  padding: 12px 18px;
  border-radius: 18px 18px 6px 18px;
  max-width: min(72%, 600px);
  letter-spacing: -0.01em;
}

/* ── ALDO TURN ── */
.turn-aldo {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 32px;
}
.turn-aldo + .turn-aldo { padding-top: 8px; }

.turn-aldo-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
}

.turn-aldo-label { display: none; }

.turn-aldo-body {
  flex: 1;
  min-width: 0;
  max-width: 780px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}


.turn-aldo-text {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  color: #223D77;
}

.turn-aldo-text p { margin-bottom: 14px; }
.turn-aldo-text p:last-child { margin-bottom: 0; }
.turn-aldo-text strong { font-weight: 700; color: #223D77; }
.turn-aldo-text em { font-style: italic; color: #4f5867; }
.turn-aldo-text ul, .turn-aldo-text ol {
  padding-left: 20px;
  margin-bottom: 10px;
}
.turn-aldo-text li { margin-bottom: 5px; }
.turn-aldo-text h1, .turn-aldo-text h2, .turn-aldo-text h3 {
  font-weight: 700;
  margin-bottom: 8px;
  margin-top: 16px;
  color: #223D77;
}
.turn-aldo-text code {
  background: rgba(10,132,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  color: #1e4f88;
}

/* Clickable links in chat */
.chat-link {
  color: #0a63cf;
  text-decoration: underline;
  text-decoration-color: rgba(10,99,207,0.35);
  text-underline-offset: 2px;
  font-weight: 600;
  transition: text-decoration-color 0.15s;
}
.chat-link:hover {
  text-decoration-color: #0a63cf;
}

/* ── Content blocks ── */
.aldo-block {
  border-radius: 14px;
  padding: 14px 16px;
  margin: 10px 0;
  border: none;
  border-left: 3px solid transparent;
  background: #f7f9fc;
  color: #1b212c;
}
.aldo-block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  color: #334054;
}
.aldo-block-head span.block-icon { font-size: 18px; }
.aldo-block p { margin-bottom: 6px; }
.aldo-block p:last-child { margin-bottom: 0; }
.aldo-block ul, .aldo-block ol { list-style: none !important; padding-left: 0 !important; margin: 0; }
.aldo-block li { margin-bottom: 2px; line-height: 1.5; list-style: none !important; }
.aldo-block li::marker { content: none; }
.aldo-block ul + ul, .aldo-block ol + ol { margin-top: 0; }

/* Ricetta */
.aldo-block--ricetta { --cat: #F96E16; background: rgba(249,110,22,0.08); border-left-color: #F96E16; color: #2a2318; }
.aldo-block--ricetta .aldo-block-head { color: #F96E16; }

/* Ingredienti */
.aldo-block--ingredienti { --cat: #F96E16; background: rgba(249,110,22,0.08); border-left-color: #F96E16; color: #2a2318; }
.aldo-block--ingredienti .aldo-block-head { color: #F96E16; }

/* Preparazione */
.aldo-block--preparazione { --cat: #F96E16; background: rgba(249,110,22,0.08); border-left-color: #F96E16; color: #2a2318; }
.aldo-block--preparazione .aldo-block-head { color: #F96E16; }

/* Info ricetta */
.aldo-block--info { --cat: #F96E16; background: rgba(249,110,22,0.08); border-left-color: #F96E16; color: #2a2318; }
.aldo-block--info .aldo-block-head { color: #F96E16; }
.aldo-block--info .recipe-meta { list-style: none; padding: 0; margin: 0; }
.aldo-block--info .recipe-meta li { padding: 4px 0; font-size: 15px; }
.aldo-block--info .recipe-meta li strong { color: #2a2318; }

/* Curiosità */
.aldo-block--curiosita { --cat: #D52626; background: rgba(213,38,38,0.07); border-left-color: #D52626; color: #1a2230; }
.aldo-block--curiosita .aldo-block-head { color: #D52626; }

/* Stagionalità */
.aldo-block--stagione { --cat: #4B8138; background: rgba(75,129,56,0.08); border-left-color: #4B8138; color: #1a2623; }
.aldo-block--stagione .aldo-block-head { color: #4B8138; }

/* Consiglio — teal per distinguerlo da Curiosità (red) */
.aldo-block--consiglio { --cat: #1A8A7D; background: rgba(26,138,125,0.08); border-left-color: #1A8A7D; color: #1a2623; }
.aldo-block--consiglio .aldo-block-head { color: #1A8A7D; }

/* Lo sapevi */
.aldo-block--losapevi { --cat: #D52626; background: rgba(213,38,38,0.07); border-left-color: #D52626; color: #1c2638; }
.aldo-block--losapevi .aldo-block-head { color: #D52626; }

/* Quiz */
.aldo-block--quiz { --cat: #841EE3; background: rgba(132,30,227,0.07); border-left-color: #841EE3; color: #221e2c; }
.aldo-block--quiz .aldo-block-head { color: #841EE3; }

/* Freddura */
.aldo-block--freddura { --cat: #841EE3; background: rgba(132,30,227,0.07); border-left-color: #841EE3; color: #1c2629; }
.aldo-block--freddura .aldo-block-head { color: #841EE3; }

/* Abbinamento */
.aldo-block--abbinamento { --cat: #F96E16; background: rgba(249,110,22,0.08); border-left-color: #F96E16; color: #2b251a; }
.aldo-block--abbinamento .aldo-block-head { color: #F96E16; }

/* Missione */
.aldo-block--missione { --cat: #841EE3; background: rgba(132,30,227,0.07); border-left-color: #841EE3; color: #2a1f28; }
.aldo-block--missione .aldo-block-head { color: #841EE3; }

/* Indovinello */
.aldo-block--indovina { --cat: #841EE3; background: rgba(132,30,227,0.07); border-left-color: #841EE3; color: #202134; }
.aldo-block--indovina .aldo-block-head { color: #841EE3; }

/* Modi di dire */
.aldo-block--modidire { --cat: #D52626; background: rgba(213,38,38,0.07); border-left-color: #D52626; color: #2b211d; }
.aldo-block--modidire .aldo-block-head { color: #D52626; }

/* Virtual shopper */
.aldo-block--shopper { --cat: #4B8138; background: rgba(75,129,56,0.08); border-left-color: #4B8138; color: #1d2631; }
.aldo-block--shopper .aldo-block-head { color: #4B8138; }

/* Conservazione */
.aldo-block--conservazione { --cat: #4B8138; background: rgba(75,129,56,0.08); border-left-color: #4B8138; color: #1d2631; }
.aldo-block--conservazione .aldo-block-head { color: #4B8138; }

/* Anti-spreco */
.aldo-block--antispreco { --cat: #4B8138; background: rgba(75,129,56,0.08); border-left-color: #4B8138; color: #1d2631; }
.aldo-block--antispreco .aldo-block-head { color: #4B8138; }

/* Scheda prodotto */
.aldo-block--scheda { --cat: #4B8138; background: rgba(75,129,56,0.08); border-left-color: #4B8138; color: #1d2631; }
.aldo-block--scheda .aldo-block-head { color: #4B8138; }

/* Colori benessere */
.aldo-block--colori { --cat: #D52626; background: rgba(213,38,38,0.07); border-left-color: #D52626; color: #1c2721; }
.aldo-block--colori .aldo-block-head { color: #D52626; }

/* Intrattenimento POP */
.aldo-block--pop { --cat: #D52626; background: rgba(213,38,38,0.07); border-left-color: #D52626; color: #1e2633; }
.aldo-block--pop .aldo-block-head { color: #D52626; }

/* Quiz buttons inside any block use --cat from the block */
.aldo-block .quiz-options.is-answered .chat-quiz-btn {
  border-color: var(--cat);
  color: var(--cat);
}
.aldo-block .quiz-options.is-answered .chat-quiz-btn.is-selected {
  background: var(--cat);
  border-color: var(--cat);
  color: #fff;
}

/* Per saperne di più — link box */
.aldo-links-box {
  background: #f6f9ff;
  border: 1px solid #dbe3f0;
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: 18px;
}
.aldo-links-box-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #6c7483;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aldo-links-box-title::before {
  content: '🔗';
  font-size: 14px;
}
.aldo-links-box .links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.aldo-links-box a.chat-link {
  display: inline-block;
  background: #fff;
  color: #1f2732;
  border: 1px solid #d7deec;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, color 0.2s, border-color 0.2s;
}
.aldo-links-box a.chat-link:hover {
  background: #0a84ff;
  border-color: #0a84ff;
  color: #fff;
  transform: translateY(-1px);
  text-decoration: none;
}

/* Approfondimenti cliccabili */
.aldo-suggestions-box {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: 12px;
}
.aldo-suggestions-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aa3b2;
  margin-bottom: 8px;
}
.aldo-suggestions-title::before { content: none; }
.aldo-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chat-suggestion-btn {
  border: none;
  background: #EDEAF6;
  color: #4a3a7a;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, color 0.2s;
}
.chat-suggestion-btn:hover {
  background: #E0DBF0;
  transform: translateY(-1px);
}
.chat-suggestion-btn:active { transform: translateY(0); }

/* Suggestion pills inside a categorized turn use --cat */
[class*="turn-aldo--"] .chat-suggestion-btn {
  background: color-mix(in srgb, var(--cat) 10%, white);
  color: var(--cat);
}
[class*="turn-aldo--"] .chat-suggestion-btn:hover {
  background: color-mix(in srgb, var(--cat) 20%, white);
}

/* Quiz options buttons */
.quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chat-quiz-btn {
  border: 1px solid #cfd8eb;
  background: #fff;
  color: #232d3b;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, opacity 0.2s;
}
.chat-quiz-btn:hover {
  background: #eef5ff;
  border-color: #b8ccef;
  transform: translateY(-1px);
}
.chat-quiz-btn:active { transform: translateY(0); }
.chat-quiz-btn:disabled {
  opacity: 0.62;
  cursor: default;
  transform: none;
}
.chat-quiz-btn.is-selected {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #fff;
  opacity: 1;
}

/* Typing dots */
.typing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 24px;
  padding: 4px 0;
}
.typing-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.typing-status {
  font-size: 12px;
  font-weight: 600;
  color: #6f7786;
  letter-spacing: 0.01em;
}
.typing-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(67,76,94,0.45);
  animation: pulse 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.4; }
  50%       { transform: scale(1);   opacity: 1; }
}

/* Stream cursor */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--yellow);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.9s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Retry error */
.chat-error {
  color: #5f6878;
}
.chat-retry-btn {
  margin-top: 10px;
  border: 1px solid #c8d3e8;
  background: #fff;
  color: #243347;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, color 0.2s;
}
.chat-retry-btn:hover {
  background: #0a84ff;
  border-color: #0a84ff;
  color: #fff;
  transform: translateY(-1px);
}
.chat-retry-btn:active { transform: translateY(0); }



/* ══════════════════════════════════════════════════════
   INPUT BAR — fullwidth bg, inner content centered
══════════════════════════════════════════════════════ */
.inputbar {
  flex-shrink: 0;
  width: 100%;
}
.inputbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 48px calc(14px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Unified input row: field + mic + send as one visual bar */
.input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1.5px solid #88A3DD;
  border-radius: 999px;
  padding: 6px;
  box-shadow: 0 0 32px rgba(136, 163, 221, 0.38), 0 4px 20px rgba(136, 163, 221, 0.16);
}

.input-field-wrap {
  flex: 1;
  position: relative;
}

.input-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #aab3c4;
  pointer-events: none;
}

.input-field {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--black);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  padding: 12px 12px 12px 46px;
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 44px;
  max-height: 160px;
}
.input-field::placeholder { color: #aab3c4; font-weight: 400; }

/* MICROFONO (temporaneamente disabilitato)
.btn-mic-wrap { flex-shrink: 0; }

.btn-mic {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #697284;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.btn-mic:hover { background: rgba(0,0,0,0.05); color: #2f3744; }
.btn-mic.recording { background: rgba(255,55,95,0.12); color: #d12b56; }
*/

.btn-send {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--yellow);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
  box-shadow: 0 8px 20px -8px rgba(10,132,255,0.7);
}
.btn-send:hover:not(:disabled) {
  background: #0a78e6;
  transform: translateY(-1px);
}
.btn-send:active:not(:disabled) { transform: translateY(0); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }

.input-note {
  flex-shrink: 0;
  font-size: 10px;
  color: #8b93a1;
  text-align: center;
  letter-spacing: 0.02em;
  padding: 8px 24px calc(10px + var(--safe-bottom));
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 640px) and (orientation: portrait) {
  body {
    background:
      url('../img/sfondo.png') top center / 150% auto no-repeat,
      linear-gradient(180deg, #D7E0F4 0%, #ffffff 40%) #ffffff;
  }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 0 18px; height: 56px; }
  .main-empty { padding: 16px 20px; gap: clamp(8px, 2vh, 20px); }
  .aldo-avatar--hero { margin-top: -30%; margin-bottom: 3vh; }
  .messages { padding-left: 0; padding-right: 0; }
  .turn-aldo, .turn-user { padding-left: 16px; padding-right: 16px; }
  .turn-user-bubble { max-width: 90%; font-size: 16px; }
  
  .inputbar-inner { 
    padding: 0;
    padding-bottom: calc(6px + var(--safe-bottom));
    gap: 6px;
    max-width: 92%; }
  
  .main-empty > .inputbar .inputbar-inner { padding-left: 4px; padding-right: 4px; }
  .input-row { padding: 3px 3px 3px 6px; }
  .input-field { font-size: 16px; padding: 8px 8px 8px 36px; min-height: 36px; }
  .input-search-icon { left: 10px; }
  .btn-send { width: 36px; height: 36px; }
  .prompt-pill { font-size: 13px; padding: 10px 16px; }
}

/* ── Landscape smartphone: verticale, scorrevole, proporzioni leggibili ── */
@media (max-height: 500px) and (orientation: landscape) {
  /* Rende #app scorrevole in altezza */
  #app {
    overflow-y: auto;
    min-height: 100%;
  }

  .main-empty {
    justify-content: flex-start;
    overflow: visible;
    padding: 20px 24px 16px;
    gap: 12px;
    min-height: auto;
    flex: none;
  }

  /* Avatar proporzionato — no fixed height, rispetta aspect ratio GIF */
  .aldo-avatar--hero {
    width: 130px;
    margin-top: -30%;
    margin-bottom: 3vh;
  }

  /* Titolo leggibile ma non gigante */
  .hero-title { font-size: 28px; line-height: 1.15; }
  .hero-sub   { font-size: 14px; }

  /* Rimuovi l'overlap: l'inputbar scorre dopo l'avatar normalmente */
  .main-empty > .inputbar {
    margin-top: 0;
    position: static;
  }
  .main-empty > .inputbar .inputbar-inner {
    padding: 0 8px 16px;
  }

  /* Pills: a capo libero, stessa logica del portrait */
  .prompts {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (min-width: 900px) {
  .messages { padding-left: 36px; padding-right: 36px; }
  .turn-aldo-body { max-width: 820px; }
}

@media (min-width: 1100px) {
  .turn-user-bubble { max-width: 52%; }
}

/* mode-switcher rimosso — parametri modalità via URL:
   ?mode=personal  → dispositivo personale (memoria, nessun auto-reset)
   ?mode=totem     → totem supermercato (nessuna memoria, auto-reset 3 min)
*/

/* ── HOME FOOTER ── */
.home-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  color: #b0b0b0;
  padding: 8px 16px;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.85);
  z-index: 5;
}
.home-footer a {
  color: #b0b0b0;
  text-decoration: none;
}
.home-footer a:hover {
  text-decoration: underline;
}
