:root {
  --fondo: #ffffff;
  --carta: #fdfcfa;
  --inchiostro: #1d1b18;
  --grigio: #77726a;
  --tenue: #b9b3aa;
  --linea: rgba(29, 27, 24, 0.08);
  --accento: #d9632b;
  --accento-tenue: rgba(217, 99, 43, 0.12);
  --riga: clamp(38px, 9.6vh, 54px);
  --font: 'Mona Sans Variable', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 32px) 12px;
}

.notes {
  position: relative;
  width: min(400px, 92vw);
  padding: clamp(12px, 2.6vh, 20px) clamp(12px, 3.6vw, 18px) clamp(10px, 2.2vh, 16px);
  border-radius: 22px;
  background:
    radial-gradient(120% 60% at 15% 0%, rgba(217, 99, 43, 0.06), transparent 60%),
    var(--carta);
  border: 1px solid rgba(29, 27, 24, 0.07);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(29, 27, 24, 0.05),
    0 8px 20px -6px rgba(29, 27, 24, 0.12),
    0 30px 60px -24px rgba(29, 27, 24, 0.22);
  overflow: hidden;
}

.notes__head { display: flex; align-items: center; gap: 10px; margin-bottom: clamp(8px, 2vh, 14px); }
.notes__app {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #e57a43, #c4521f);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 10px -3px rgba(196, 82, 31, 0.55);
}
.notes__app svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.notes__meta { display: flex; flex-direction: column; line-height: 1.15; flex: 1; min-width: 0; }
.notes__brand { font-weight: 640; font-size: 15px; letter-spacing: -0.01em; }
.notes__sub { font-size: 12px; color: var(--grigio); }
.notes__new {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--linea);
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 27, 24, 0.06);
  transition: transform 0.25s cubic-bezier(.3, 1.6, .5, 1), background 0.2s;
}
.notes__new svg { width: 16px; height: 16px; fill: none; stroke: var(--inchiostro); stroke-width: 1.6; stroke-linecap: round; }
@media (hover: hover) { .notes__new:hover { transform: rotate(90deg) scale(1.06); background: var(--accento-tenue); } }

.notes__label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--grigio); font-weight: 560;
  margin: 0 2px clamp(4px, 1vh, 8px);
}
.notes__label--recent { margin-top: clamp(8px, 2vh, 14px); }
.notes__pin { width: 13px; height: 13px; fill: var(--accento); stroke: var(--accento); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.notes__hint { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 450; color: var(--tenue); }

.notes__pinned, .notes__recent { list-style: none; margin: 0; padding: 0; position: relative; }
.notes__pinned { height: calc(var(--riga) * 3 + 8px); }

.row {
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--riga);
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 8px;
  border-radius: 13px;
  background: #fff;
  border: 1px solid var(--linea);
  box-shadow: 0 1px 1px rgba(29, 27, 24, 0.03);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.notes__recent .row { position: relative; background: transparent; border-color: transparent; box-shadow: none; margin-bottom: 2px; }
.row__grip { width: 14px; height: 14px; flex: none; cursor: grab; opacity: 0.5; transition: opacity 0.2s; }
.row__grip svg { width: 100%; height: 100%; stroke: var(--grigio); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.row__swatch { width: 4px; align-self: stretch; margin: 9px 0; border-radius: 3px; flex: none; }
.row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; cursor: pointer; }
.row__title { font-size: clamp(13px, 1.9vh, 14px); font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__preview { font-size: 12px; color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__date { font-size: 11.5px; color: var(--tenue); flex: none; font-variant-numeric: lining-nums; }
.row__chev { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--tenue); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s cubic-bezier(.3, 1.6, .5, 1), stroke 0.2s; }
.row__inner { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.row.is-hover { background: #fffaf6; border-color: rgba(217, 99, 43, 0.18); }
.notes__recent .row.is-hover { background: rgba(29, 27, 24, 0.035); border-color: transparent; }
.row.is-hover .row__chev { transform: translateX(2px); stroke: var(--accento); }
.row.is-hover .row__grip { opacity: 0.9; }
.row.is-drag { z-index: 5; cursor: grabbing; border-color: rgba(217, 99, 43, 0.3); }
.row.is-drag .row__grip { cursor: grabbing; opacity: 1; }

.reader {
  position: absolute;
  left: 0; top: 0;
  padding: clamp(12px, 2.6vh, 20px) clamp(14px, 4vw, 20px);
  border-radius: 13px;
  background: #fff;
  border: 1px solid var(--linea);
  box-shadow: 0 20px 50px -20px rgba(29, 27, 24, 0.35);
  visibility: hidden;
  overflow: hidden;
  z-index: 10;
  display: flex;
  flex-direction: column;
}
.reader__bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: clamp(8px, 2vh, 14px); }
.reader__back { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 560; color: var(--accento); padding: 4px 6px 4px 0; border-radius: 8px; }
.reader__back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s; }
@media (hover: hover) { .reader__back:hover svg { transform: translateX(-2px); } }
.reader__tag { font-size: 11px; font-weight: 560; padding: 4px 9px; border-radius: 999px; background: var(--accento-tenue); color: #a8461a; }
.reader__title { margin: 0; font-size: clamp(18px, 3.4vh, 23px); font-weight: 680; letter-spacing: -0.02em; font-stretch: 92%; line-height: 1.1; }
.reader__date { margin: 4px 0 clamp(8px, 2vh, 14px); font-size: 12px; color: var(--grigio); }
.reader__body { font-size: clamp(13px, 2vh, 14px); line-height: 1.5; color: #3b3732; }
.reader__body p { margin: 0 0 8px; }
.reader__item { display: flex; align-items: center; gap: 9px; padding: clamp(3px, 0.8vh, 5px) 0; }
.reader__box { width: 16px; height: 16px; flex: none; border-radius: 5px; border: 1.5px solid var(--tenue); display: grid; place-items: center; transition: background 0.2s, border-color 0.2s; }
.reader__box svg { width: 11px; height: 11px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reader__item.is-done .reader__box { background: var(--accento); border-color: var(--accento); }
.reader__item.is-done span:last-child { color: var(--tenue); text-decoration: line-through; text-decoration-color: rgba(119, 114, 106, 0.5); }
.reader__progress { margin-top: auto; padding-top: clamp(8px, 2vh, 14px); border-top: 1px solid var(--linea); }
.reader__plabel { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 560; color: var(--grigio); margin-bottom: 7px; font-variant-numeric: tabular-nums; }
.reader__track { height: 4px; border-radius: 4px; background: rgba(29, 27, 24, 0.07); overflow: hidden; }
.reader__fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #e8834f, var(--accento)); transform-origin: 0 50%; transform: scaleX(0); }
.reader__foot { margin: 8px 0 0; font-size: 11.5px; color: var(--tenue); }

.pointer {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: #1d1b18; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 20;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.reader__back:focus:not(:focus-visible), .notes__row:focus:not(:focus-visible) { outline: none; }
.reader__back:focus-visible, .notes__row:focus-visible, .notes__add:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
