/* CANOS — palette chiara, organica, pergamena (piano MVP, settimana 1).
   Minimale per filosofia: l'attenzione va verso l'interno (doc fondativo §12.3). */
:root {
  --bg: #f4efe6;
  --bg-deep: #ece4d4;
  --ink: #2e2a24;
  --ink-soft: #6e6557;
  --accent: #7d6f56;
  --radius: 14px;
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: Georgia, "Iowan Old Style", serif;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
#app { flex: 1; max-width: 540px; width: 100%; margin: 0 auto;
       padding: max(env(safe-area-inset-top), 20px) 22px 90px; }
h1, h2 { font-weight: 400; letter-spacing: 0.01em; }
p { line-height: 1.65; }
button, .btn {
  font: inherit; border: 1px solid var(--accent); background: transparent;
  color: var(--ink); padding: 12px 20px; border-radius: var(--radius);
  cursor: pointer; transition: background .4s ease;
}
button:hover { background: var(--bg-deep); }
.btn-primary { background: var(--accent); color: var(--bg); border: none; }
input, textarea {
  font: inherit; width: 100%; padding: 12px; border-radius: var(--radius);
  border: 1px solid #d8cfbe; background: #fdfaf4; color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; }
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--bg-deep); padding: 8px max(env(safe-area-inset-left), 8px)
  max(env(safe-area-inset-bottom), 8px);
}
#tabbar button { flex: 1; border: none; color: var(--ink-soft); }
#tabbar button.active { color: var(--ink); }
.mood-row { display: flex; gap: 8px; justify-content: space-between; margin: 14px 0; }
.mood-row button { flex: 1; padding: 14px 0; font-size: 1.3rem; }
.mood-row button.sel { background: var(--accent); color: var(--bg); }
.typing { display: inline-flex; gap: 6px; align-items: center; padding: 10px 2px; }
.typing span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft);
  animation: typing-bounce 1.3s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes typing-bounce {
  0%, 70%, 100% { transform: translateY(0); opacity: .3; }
  35% { transform: translateY(-6px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .typing span { animation: typing-fade 1.3s ease-in-out infinite; }
  @keyframes typing-fade { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
}
.fade-in { animation: fade 1.4s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.breath {
  width: 110px; height: 110px; border-radius: 50%; margin: 40px auto;
  background: radial-gradient(circle, var(--bg-deep), var(--accent));
  animation: breathe 9s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { transform: scale(.82); opacity:.7 } 50% { transform: scale(1); opacity:1 } }
.crisis-box { border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 18px; background: #fdfaf4; white-space: pre-line; }
