/* Scarabbocchio — stili comuni. Stile «Quaderno»: foglio a quadretti, post-it, bordi e titoli scritti a mano. */
:root {
  --ink: #1f2f56;
  --ink-2: #4a5a85;
  --paper: #fbf7ec;
  --paper-2: #fdeed3;
  --card: #ffffff;
  --coral: #ff5d73;
  --orange: #ff9f1c;
  --yellow: #ffc145;
  --green: #2fbf71;
  --teal: #12b5b0;
  --blue: #2f80ed;
  --violet: #7b5cff;
  --pink: #ff6fb1;
  --ok: #1fa463;
  --bad: #e5384f;
  --line: rgba(31, 47, 86, .16);
  --shadow: 4px 6px 0 rgba(31, 47, 86, .14);
  --grid: #d6e3f3;
  --margin: #f19a9a;
  --postit-1: #fff3a0;
  --postit-2: #ffd3e4;
  --postit-3: #cdf3d9;
  --postit-4: #d3e7ff;
  --tape-1: rgba(255, 214, 102, .75);
  --tape-2: rgba(132, 205, 255, .7);
  --wob: 255px 18px 225px 18px / 18px 225px 18px 255px; /* bordo «disegnato a mano» */
  --f-hand: 'Kalam', 'Fredoka', 'Comic Sans MS', cursive;
  --radius: 22px;
  --f-display: 'Fredoka', 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --f-text: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-text); color: var(--ink); background: var(--paper);
  background-image: linear-gradient(var(--grid) 1.5px, transparent 1.5px), linear-gradient(90deg, var(--grid) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .display, .hand { font-family: var(--f-hand); font-weight: 700; letter-spacing: .01em; margin: 0; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* pulsanti */
.btn {
  appearance: none; border: 3px solid var(--ink); background: var(--card); color: var(--ink);
  font-family: var(--f-hand); font-weight: 700; font-size: 1.2rem; line-height: 1.1;
  padding: .8em 1.2em; border-radius: var(--wob); box-shadow: 3px 4px 0 var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 54px;
  transition: transform .08s, box-shadow .08s, background .15s; touch-action: manipulation; user-select: none;
}
.btn:active:not(:disabled) { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--coral); color: #fff; }
.btn.go { background: var(--green); color: #fff; }
.btn.yellow { background: var(--yellow); }
.btn.violet { background: var(--violet); color: #fff; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.big { font-size: 1.45rem; padding: .9em 1.4em; min-height: 66px; }
.btn.wide { width: 100%; }
.btn:focus-visible, .chip:focus-visible, input:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; }

.card { background: var(--card); border: 3px solid var(--ink); border-radius: var(--wob); box-shadow: var(--shadow); }

/* logo */
.logo { position: relative; display: inline-block; white-space: nowrap; font-family: var(--f-display); font-weight: 700; line-height: 1; padding-bottom: .22em; }
.logo-word span { display: inline-block; transform: rotate(var(--r)); }
.logo-scribble { position: absolute; left: 2%; right: 4%; bottom: -.06em; width: 94%; height: .32em; color: var(--ink); opacity: .85; }
.logo-pencil { position: absolute; right: -.62em; top: -.38em; width: .8em; height: .8em; }

/* avatar */
.av { display: block; width: 100%; height: 100%; }
.avbox { width: 56px; height: 56px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); padding: 3px; flex: none; position: relative; }

/* chip / etichette */
.chip {
  display: inline-flex; align-items: center; gap: .35em; padding: .35em .8em; border-radius: 999px;
  border: 2.5px solid var(--ink); background: #fff; font-weight: 800; font-size: .95rem; line-height: 1.1;
  border-radius: var(--wob);
}
.chip.facile { background: var(--postit-3); }
.chip.media { background: var(--postit-1); }
.chip.difficile { background: var(--postit-2); }
.chip.mode { background: var(--postit-4); color: var(--ink); }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 99; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--rot)); } }

@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.pop { animation: pop .35s ease-out both; }
.shake { animation: shake .3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; flex: none; }

/* post-it: colore e leggera rotazione in base alla posizione */
.postit { border: none !important; border-radius: 3px !important; box-shadow: 5px 8px 0 rgba(31, 47, 86, .14); }
.postit:nth-child(4n+1) { background: var(--postit-1) !important; transform: rotate(-1.2deg); }
.postit:nth-child(4n+2) { background: var(--postit-2) !important; transform: rotate(1deg); }
.postit:nth-child(4n+3) { background: var(--postit-3) !important; transform: rotate(-.6deg); }
.postit:nth-child(4n+4) { background: var(--postit-4) !important; transform: rotate(.8deg); }
