/* ═══════════════════════════════════════════════════════════
   Racconta — app. Editoriale caldo, pensato per mani e occhi 70+.
   Regole: 1 azione per schermata, testo gigante, contrasto AAA,
   niente gesti, solo tocchi. Carta crema + inchiostro + rosso geranio.
   ═══════════════════════════════════════════════════════════ */

:root {
  --paper: #F8F1E3;
  --paper-deep: #F1E6CF;
  --ink: #2A2118;
  --ink-soft: #5C5044;
  --red: #A63A2B;
  --red-deep: #7E2A1E;
  --line: rgba(42, 33, 24, 0.22);
  --shadow: 0 3px 0 rgba(42, 33, 24, 0.28);
  --radius: 18px;
}

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

html { font-size: 20px; }

body {
  font-family: 'Literata', Georgia, serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  /* grana di carta */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

#main {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.2rem 1.2rem 3rem;
}

/* ── Schermate ── */
.screen { display: none; animation: appear .35s ease; }
.screen.is-active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

/* ── Brand / Home ── */
.brand { text-align: center; padding: 2.2rem 0 1rem; }
.brand-mark {
  font-family: 'Fraunces', serif;
  font-size: 5.4rem;
  line-height: .55;
  color: var(--red);
  font-weight: 700;
}
.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 3rem;
  letter-spacing: -0.02em;
}
.brand-tagline {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.1rem;
  margin-top: .4rem;
}
.home-count {
  text-align: center;
  margin: 1.4rem 0 1.6rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: .8rem 0;
}
.home-foot {
  margin-top: 2.4rem;
  text-align: center;
  font-size: .95rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ── Bottoni ── */
.stack { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.4rem; }

.btn {
  display: block;
  width: 100%;
  min-height: 4.4rem;
  padding: 1rem 1.2rem;
  font-family: 'Literata', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  line-height: 1.25;
}
.btn:active { transform: translateY(3px); box-shadow: none; }

.btn-primary { background: var(--red); border-color: var(--red-deep); color: #FFF7EA; }
.btn-secondary { background: var(--paper-deep); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 400;
  min-height: 3.2rem;
}
.btn-tall { padding: 1.3rem 1.2rem; }
.btn-big { display: block; font-size: 1.45rem; font-weight: 700; }
.btn-sub { display: block; font-size: .95rem; font-weight: 400; margin-top: .3rem; opacity: .85; }

.pill {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  border-radius: 99px;
  padding: .1rem .7rem;
  font-size: 1.05rem;
  margin-left: .3rem;
}

.btn-back {
  background: none;
  border: none;
  white-space: nowrap;
  font-family: 'Literata', Georgia, serif;
  font-size: 1.05rem;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: .6rem .6rem .6rem 0;
}

/* ── Domanda ── */
.q-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: .4rem; }
.q-meta {
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  text-align: right;
}
.q-body { position: relative; padding: 1rem 0 .6rem; }
.q-quote {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 7rem;
  line-height: .6;
  color: var(--red);
  opacity: .22;
  position: absolute;
  top: .4rem; left: -0.6rem;
  pointer-events: none;
}
.q-text {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(1.7rem, 7vw, 2.2rem);
  line-height: 1.22;
  padding-top: 1.6rem;
}
.q-text-small { font-size: clamp(1.25rem, 5vw, 1.55rem); padding-top: .8rem; }
.q-hint {
  font-style: italic;
  color: var(--ink-soft);
  margin-top: .9rem;
  font-size: 1.05rem;
  line-height: 1.45;
}

/* ── Bottone PARLA ── */
.btn-record {
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  margin: 1.2rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--red);
  color: #FFF7EA;
  border: 4px solid var(--red-deep);
  box-shadow: 0 5px 0 rgba(42, 33, 24, 0.35);
  font-family: 'Literata', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
}
.btn-record:active { transform: translateY(4px); box-shadow: none; }
.btn-record .mic { width: 3rem; height: 3rem; }
.record-help { text-align: center; color: var(--ink-soft); font-size: 1rem; margin-top: .3rem; }

/* ── Registrazione ── */
.screen-rec { text-align: center; padding-top: 1.6rem; }
.rec-label {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--red);
  font-weight: 600;
}
.rec-pulse {
  width: 9rem; height: 9rem;
  margin: 1.6rem auto 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(166, 58, 43, 0.12);
  animation: breathe 1.6s ease-in-out infinite;
}
.rec-dot { width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--red); }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) { .rec-pulse { animation: none; } }
.rec-timer {
  font-family: 'Fraunces', serif;
  font-size: 3.4rem;
  font-weight: 700;
  margin-top: .8rem;
  font-variant-numeric: tabular-nums;
}
.btn-stop {
  display: block;
  width: 100%;
  margin-top: 1.2rem;
  padding: 1.4rem 1.2rem;
  background: var(--ink);
  color: var(--paper);
  border: 3px solid #000;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: 'Literata', Georgia, serif;
  cursor: pointer;
}
.btn-stop:active { transform: translateY(3px); box-shadow: none; }
.rec-note { margin-top: 1.1rem; font-style: italic; color: var(--ink-soft); font-size: 1rem; }

/* ── Riascolta ── */
.rev-dur { color: var(--ink-soft); margin-top: .6rem; font-size: 1.05rem; }

/* ── Salvata ── */
.saved-check {
  width: 6rem; height: 6rem;
  margin: 2.4rem auto 1rem;
  border-radius: 50%;
  background: #3E6B35;
  color: #FFF7EA;
  font-size: 3.2rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.saved-title {
  font-family: 'Fraunces', serif;
  font-size: 2.4rem;
  text-align: center;
}
.saved-sub { text-align: center; color: var(--ink-soft); margin-top: .5rem; font-size: 1.1rem; line-height: 1.5; }

/* ── Archivio ── */
.archive-intro { margin: 1rem 0 .4rem; color: var(--ink-soft); font-size: 1.05rem; }
.story-list { list-style: none; margin-top: .6rem; }
.story-item {
  background: var(--paper-deep);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: .9rem;
}
.story-q {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.3;
}
.story-meta { color: var(--ink-soft); font-size: .95rem; margin-top: .35rem; }
.story-actions { display: flex; gap: .4rem; margin-top: .8rem; flex-wrap: wrap; }
.story-actions button {
  flex: 1 1 30%;
  min-height: 3.4rem;
  font-family: 'Literata', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
}
.story-actions button:active { transform: translateY(2px); }
.story-actions .act-del { border-color: var(--line); color: var(--ink-soft); font-weight: 400; }
.story-actions .act-del.confirm { background: var(--red); border-color: var(--red-deep); color: #FFF7EA; font-weight: 700; }
.archive-actions { margin-top: 1.6rem; }
.tiny-note { font-size: .9rem; color: var(--ink-soft); line-height: 1.5; text-align: center; }
.archive-empty { font-style: italic; color: var(--ink-soft); padding: 1.4rem 0; }

/* ── Codice regalo ── */
.locked-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.7rem, 7vw, 2.2rem);
  line-height: 1.2;
  padding-top: 1.4rem;
}
.locked-text { margin-top: 1rem; font-size: 1.15rem; line-height: 1.55; }
.code-label { font-size: 1.05rem; font-weight: 600; }
.code-input {
  width: 100%;
  min-height: 4rem;
  font-family: 'Literata', Georgia, serif;
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: .08em;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: #FFFDF6;
  color: var(--ink);
  text-transform: uppercase;
}
.code-input:focus { outline: 4px solid var(--red); outline-offset: 2px; }
.code-error { color: var(--red-deep); font-weight: 600; min-height: 1.4rem; font-size: 1.05rem; }

/* focus visibile ovunque (tastiera / switch access) */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 4px solid var(--red);
  outline-offset: 2px;
}

#player { display: none; }
