/* ─── 101 Desideri — stile "dream" ──────────────────────────────── */
:root {
  --paper: #f4f0fb;          /* bianco lavanda */
  --paper-deep: #eae3f8;
  --card: #fdfcff;
  --ink: #322b4d;            /* indaco profondo */
  --ink-soft: #6f6795;
  --line: #e1d8f1;
  --accent: #8b5fbf;         /* violetto sogno */
  --accent-soft: #b394dd;
  --dawn: #d678a6;           /* rosa alba (bella) */
  --gold: #d4a537;
  --green: #3f9d6f;          /* spunta verde */
  --red: #c0392b;
  --shadow: 0 4px 18px rgba(90, 70, 150, .10);
  --radius: 16px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 15% -5%, #fdeef6 0%, rgba(253,238,246,0) 45%),
    radial-gradient(ellipse at 90% 0%, #e8e0fb 0%, rgba(232,224,251,0) 50%),
    radial-gradient(ellipse at 50% 110%, #e3ecfb 0%, rgba(227,236,251,0) 55%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, .brand, .io-voglio { font-family: var(--serif); }
a { color: var(--accent); }
.hidden { display: none !important; }

/* ─── lingue ─── */
.lang-block { display: none; }
body.lang-it .lang-block[data-lang="it"],
body.lang-en .lang-block[data-lang="en"],
body.lang-de .lang-block[data-lang="de"] { display: block; }
.lang-block-inline { display: none; }
body.lang-it .lang-block-inline[data-lang="it"],
body.lang-en .lang-block-inline[data-lang="en"],
body.lang-de .lang-block-inline[data-lang="de"] { display: inline; }

.lang-switch { display: flex; gap: 2px; background: var(--paper-deep); border-radius: 999px; padding: 3px; }
.lang-switch button {
  border: none; background: transparent; cursor: pointer;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-soft); padding: 4px 9px; border-radius: 999px;
}
.lang-switch button.active { background: var(--card); color: var(--accent); box-shadow: 0 1px 4px rgba(90,70,150,.18); }
.lang-switch-big { width: max-content; margin: 0 auto 20px; }
.lang-switch-big button { font-size: .85rem; padding: 7px 14px; letter-spacing: 0; }

/* ─── percorso: tab bloccate finché non leggi le regole ─── */
body.locked .gated { display: none !important; }

/* ─── topbar ─── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: rgba(250, 247, 253, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { font-size: 1.25rem; font-weight: 600; text-decoration: none; color: var(--ink); }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a {
  text-decoration: none; color: var(--ink-soft);
  padding: 6px 12px; border-radius: 999px; font-size: .92rem; font-weight: 500;
}
.topbar nav a:hover { background: var(--paper-deep); }
.topbar nav a.active { background: var(--ink); color: #fff; }
.pill {
  display: inline-block; min-width: 20px; text-align: center;
  background: var(--paper-deep); border-radius: 999px;
  font-size: .72rem; padding: 1px 6px; margin-left: 2px; color: var(--ink-soft);
}
.topbar nav a.active .pill { background: rgba(255,255,255,.25); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.account-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: .88rem;
}
.account-btn:hover { border-color: var(--accent-soft); }

.sync-banner {
  text-align: center; font-size: .85rem; padding: 6px 16px;
  background: #f3ebfb; border-bottom: 1px solid var(--line); color: var(--ink-soft);
}

/* ─── layout ─── */
main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 32px 20px 80px; }
.view { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ─── benvenuto ─── */
.welcome-stars { position: relative; height: 0; max-width: 560px; margin: 0 auto; }
.welcome-stars span {
  position: absolute; font-size: 1.3rem; opacity: .7;
  animation: floaty 5s ease-in-out infinite;
}
.welcome-stars span:nth-child(1) { left: -4%;  top: 40px;  animation-delay: 0s; }
.welcome-stars span:nth-child(2) { left: 12%;  top: 190px; animation-delay: 1.2s; font-size: 1rem; }
.welcome-stars span:nth-child(3) { right: -2%; top: 60px;  animation-delay: .6s; font-size: 1.6rem; }
.welcome-stars span:nth-child(4) { right: 14%; top: 230px; animation-delay: 1.8s; }
.welcome-stars span:nth-child(5) { left: 45%;  top: -14px; animation-delay: 2.4s; }
.welcome-stars span:nth-child(6) { right: 40%; top: 300px; animation-delay: 3s;   font-size: .9rem; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.welcome-box { margin-top: 40px; }
.welcome-title { font-size: clamp(2.4rem, 7vw, 3.4rem); font-weight: 600; margin: 4px 0 10px;
  background: linear-gradient(100deg, var(--ink), var(--accent) 60%, var(--dawn));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-credit { font-size: .85rem; color: var(--ink-soft); margin: -2px 0 14px; }
.welcome-disclaimer {
  font-size: .72rem; line-height: 1.45; color: var(--ink-soft); opacity: .8;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.welcome-credit a { text-decoration: none; font-weight: 600; }
.auth-loading { padding: 30px 0; color: var(--ink-soft); font-style: italic; }
.skip-link { margin-top: 18px; opacity: .75; }

/* ─── hero / regole ─── */
.hero { text-align: center; padding: 36px 0 26px; }
.hero-kicker {
  text-transform: uppercase; letter-spacing: .2em; font-size: .78rem;
  color: var(--accent); font-weight: 600;
}
.hero h1 { font-size: clamp(2.6rem, 7vw, 4rem); font-weight: 600; margin: 6px 0 14px;
  background: linear-gradient(100deg, var(--ink) 30%, var(--accent) 75%, var(--dawn));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { max-width: 620px; margin: 0 auto; color: var(--ink-soft); font-size: 1.05rem; }
.hero-points { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.hero-points span {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 16px; font-size: .86rem; font-weight: 600; color: var(--ink);
  box-shadow: 0 2px 8px rgba(90,70,150,.08);
}

.rules-intro {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; margin: 26px 0; box-shadow: var(--shadow);
}
.rules-intro h2 { font-size: 1.4rem; margin-bottom: 10px; }
.rules-intro p + p { margin-top: 10px; }

.rules-title { text-align: center; font-size: 1.8rem; margin: 40px 0 20px; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.rule-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 20px 18px 60px; box-shadow: var(--shadow);
}
.rule-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.rule-card p { font-size: .92rem; color: var(--ink-soft); }
.rule-num {
  position: absolute; left: 16px; top: 18px;
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--ink));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600;
}
.rule-advice .rule-num { background: linear-gradient(135deg, var(--dawn), var(--accent)); }
.tag {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
  background: #f6e4ef; color: #a2487c; border-radius: 999px; padding: 2px 8px;
  vertical-align: middle; font-family: var(--sans); font-weight: 600;
}

.video-section { margin-top: 44px; text-align: center; }
.video-section h2 { font-size: 1.6rem; margin-bottom: 6px; }
.video-caption { color: var(--ink-soft); font-size: .92rem; margin-bottom: 16px; }
.video-box {
  position: relative; aspect-ratio: 16 / 9; max-width: 720px; margin: 0 auto;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: #000;
}
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

.how-it-works {
  margin-top: 44px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow);
}
.how-it-works h2 { margin-bottom: 14px; }
.steps { padding-left: 20px; display: grid; gap: 10px; }

.rules-cta { text-align: center; margin: 40px 0 10px; }

/* ─── quaderni ─── */
.notebook-head { text-align: center; margin-bottom: 24px; }
.notebook-head h1 { font-size: 2rem; }
.notebook-sub { color: var(--ink-soft); max-width: 560px; margin: 6px auto 16px; }
.progressbar {
  height: 10px; background: var(--paper-deep); border-radius: 999px; overflow: hidden;
  max-width: 420px; margin: 0 auto;
}
.progressbar-fill { height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 999px; transition: width .4s ease; }
.progressbar.gold .progressbar-fill { background: linear-gradient(90deg, #eba7c9, var(--dawn)); }
.progress-label { font-size: .85rem; color: var(--ink-soft); margin-top: 6px; }

/* form */
.wish-form {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.wish-input-row { display: flex; align-items: baseline; gap: 10px; }
.io-voglio { font-size: 1.35rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
#wishInput {
  flex: 1; border: none; border-bottom: 2px dashed var(--line);
  background: transparent; font-size: 1.15rem; font-family: var(--serif);
  padding: 6px 2px; color: var(--ink); outline: none;
}
#wishInput:focus { border-bottom-color: var(--accent-soft); }
.wish-meta { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.word-counter { font-size: .85rem; color: var(--ink-soft); flex: 1; }
.word-counter.over { color: var(--red); font-weight: 600; }

.wish-feedback { margin-top: 10px; display: grid; gap: 6px; }
.fb { font-size: .88rem; border-radius: 10px; padding: 8px 12px; border: 1px solid; }
.fb-error { background: #fbe9e5; border-color: #eac4bb; color: #8e2f1c; }
.fb-warn { background: #fdf4dd; border-color: #ecdcae; color: #7c5e14; }
.fb-ok { background: #e9f3ea; border-color: #c4dcc9; color: #2f5e3c; }

.milestone {
  background: linear-gradient(120deg, #f3eafd, #fdeaf4);
  border: 1px solid #e5d3f0; border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 18px; font-size: .95rem;
  animation: fadeIn .4s ease;
}

.list-tools { display: flex; gap: 14px; align-items: center; margin: 18px 0 10px; flex-wrap: wrap; }
#searchBrutta {
  flex: 1; min-width: 200px; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; background: var(--card); font-size: .92rem; outline: none;
}
.checkline { font-size: .85rem; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; }

/* wish list */
.wish-list { list-style: none; display: grid; gap: 8px; }
.wish-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 1px 5px rgba(90,70,150,.06);
}
.wish-item .num {
  font-family: var(--serif); font-weight: 600; color: var(--ink-soft);
  min-width: 30px; text-align: right; padding-top: 2px;
}
.wish-item .text { flex: 1; font-family: var(--serif); font-size: 1.08rem; }
.wish-item .text .iv { color: var(--accent); font-weight: 600; }
.wish-item.realized { border-color: #cfe7da; background: #f7fcf9; }
.wish-item.realized .text { opacity: .85; }
.check { color: var(--green); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.wish-item .badge-bella { font-size: .7rem; background: #f6e4ef; color: #a2487c; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.wish-actions { display: flex; gap: 2px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; font-size: 1rem;
  padding: 4px 6px; border-radius: 8px; opacity: .55; transition: opacity .15s, background .15s;
}
.icon-btn:hover { opacity: 1; background: var(--paper-deep); }

.empty-note { text-align: center; color: var(--ink-soft); padding: 30px 10px; font-style: italic; }
.notice {
  background: #eef1fb; border: 1px solid #d3d9f0; color: #45518a;
  border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-size: .92rem;
}

/* ─── realizzati ─── */
.done-counter { font-family: var(--serif); font-size: 1.15rem; color: var(--green); margin-top: 4px; }
.done-list .wish-item { border-color: #cfe7da; background: #f7fcf9; }
.done-list .check-big {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--green); color: #fff; font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}
.done-date { display: block; font-size: .75rem; color: var(--ink-soft); font-family: var(--sans); margin-top: 2px; }

/* ─── lettura ─── */
.streak-row { display: flex; gap: 14px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.streak-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 22px; text-align: center; min-width: 110px; box-shadow: var(--shadow);
}
.streak-num { display: block; font-family: var(--serif); font-size: 1.9rem; font-weight: 600; color: var(--accent); }
.streak-label { font-size: .75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.reading-intro { text-align: center; padding: 40px 0; }
.reading-intro .hint { color: var(--ink-soft); font-size: .9rem; margin-top: 12px; }

.reading-mode { text-align: center; padding: 20px 0; }
.reading-progress { font-size: .85rem; color: var(--ink-soft); margin-bottom: 16px; }
.reading-card {
  background: linear-gradient(160deg, var(--card), #f6f1fd);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 60px 30px; margin: 0 auto 22px; max-width: 620px;
  font-family: var(--serif); font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.4;
  min-height: 220px; display: flex; align-items: center; justify-content: center;
}
.reading-card .iv { color: var(--accent); font-weight: 600; }
.reading-nav { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
.reading-done { text-align: center; padding: 60px 0; }
.reading-done h2 { font-size: 2rem; margin-bottom: 10px; }
.reading-done p { color: var(--ink-soft); max-width: 480px; margin: 0 auto 24px; }

/* ─── auth box ─── */
.auth-box {
  max-width: 460px; margin: 20px auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 34px 30px; box-shadow: var(--shadow); text-align: center;
  position: relative;
}
.auth-sub { color: var(--ink-soft); font-size: .95rem; margin-bottom: 22px; }
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; border: 1px solid #d9d2ea; color: var(--ink); font-weight: 600;
}
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 18px 0;
  color: var(--ink-soft); font-size: .8rem;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { display: grid; gap: 10px; }
.auth-form input {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  font-size: .95rem; background: var(--paper); outline: none;
}
.auth-form input:focus { border-color: var(--accent-soft); }
.auth-actions { display: flex; gap: 10px; }
.auth-actions .btn { flex: 1; }
.linklike { border: none; background: none; color: var(--accent); cursor: pointer; font-size: .82rem; margin-top: 4px; }
.auth-error { margin-top: 14px; font-size: .88rem; color: #8e2f1c; background: #fbe9e5; border-radius: 10px; padding: 10px 12px; }

/* ─── bottoni ─── */
.btn {
  display: inline-block; border: none; cursor: pointer;
  border-radius: 999px; padding: 10px 22px; font-size: .95rem; font-weight: 600;
  font-family: var(--sans); text-decoration: none; transition: transform .1s, box-shadow .15s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(120deg, #46387a, var(--accent));
  color: #fff; box-shadow: 0 4px 14px rgba(90,70,150,.35);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--accent-soft); color: var(--ink); }
.btn-big { font-size: 1.1rem; padding: 14px 30px; }
.btn-small { font-size: .8rem; padding: 6px 14px; }

/* ─── tabbar mobile ─── */
.tabbar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: rgba(252, 250, 255, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.tabbar a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  text-decoration: none; color: var(--ink-soft);
  font-size: .66rem; font-weight: 600; letter-spacing: .02em;
  padding: 4px 8px; border-radius: 12px; min-width: 56px;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a .t-ico { font-size: 1.35rem; line-height: 1.2; }
.tabbar a.active { color: var(--accent); background: var(--paper-deep); }
.tab-badge {
  position: absolute; top: 0; right: 6px;
  background: linear-gradient(120deg, var(--accent), var(--dawn));
  color: #fff; font-size: .58rem; font-weight: 700; line-height: 1.5;
  border-radius: 999px; padding: 0 5px; min-width: 16px; text-align: center;
  box-shadow: 0 1px 4px rgba(90,70,150,.35);
}
.tab-badge:empty { display: none; }

/* ─── footer / toast ─── */
.footer {
  border-top: 1px solid var(--line); text-align: center; padding: 22px 20px;
  color: var(--ink-soft); font-size: .82rem; background: rgba(234, 227, 248, .5);
}
.footer-credit { margin-bottom: 6px; }
.footer-disclaimer {
  font-size: .75rem; line-height: 1.5; max-width: 640px; margin: 0 auto 6px;
  opacity: .85;
}
.footer-source { font-size: .75rem; opacity: .85; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 10px 22px; font-size: .9rem; box-shadow: 0 6px 20px rgba(40,30,80,.35);
  z-index: 100; animation: fadeIn .25s ease;
}

/* ─── mobile ─── */
@media (max-width: 680px) {
  .topbar { gap: 8px; padding: 8px 14px; justify-content: space-between; }
  .topbar nav { display: none; }
  .brand { font-size: 1.3rem; }
  main { padding: 20px 14px calc(96px + env(safe-area-inset-bottom)); }
  .footer { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; }
  body.welcome-mode .tabbar { display: none; }

  .hero { padding: 18px 0 16px; }
  .rules-intro, .how-it-works { padding: 20px 18px; }
  .rule-card { padding: 18px 16px 16px 56px; }

  .wish-input-row { flex-direction: column; align-items: stretch; gap: 4px; }
  #wishInput { font-size: 1.2rem; padding: 10px 2px; }
  #searchBrutta, .auth-form input { font-size: 16px; padding: 12px 16px; }
  .wish-meta { flex-direction: column; align-items: stretch; }
  .wish-meta .btn { width: 100%; padding: 14px 22px; }
  .word-counter { text-align: center; }

  .wish-item { padding: 12px 10px; gap: 8px; flex-wrap: wrap; }
  .wish-item .num { min-width: 24px; }
  .wish-item .text { font-size: 1.02rem; flex: 1 1 60%; }
  .wish-actions { margin-left: auto; }
  .icon-btn { font-size: 1.2rem; padding: 9px 10px; opacity: .8; }

  .streak-box { padding: 10px 14px; min-width: 92px; }
  .streak-num { font-size: 1.5rem; }
  .reading-card { padding: 30px 18px; min-height: 46dvh; font-size: clamp(1.5rem, 6.5vw, 2rem); }
  .reading-nav .btn { padding: 14px 26px; }
  .auth-box { padding: 26px 18px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); width: max-content; max-width: 92vw; }
}
