:root {
  --paper: #f3e9d2; --paper2: #eadcbc; --card: #fffaf0; --ink: #1f2a3a; --muted: #6b6250;
  --red: #b3261e; --navy: #1d3557; --line: #cdbb93; --straw: #e8b84a; --sea: #1d3557;
  --poster: #f8ecd0; --poster-edge: #e2c999; --newsprint: #f1ede4;
  /* Onde seigaiha: archi concentrici in fila */
  --waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cg fill='none' stroke='%231d3557' stroke-opacity='.45' stroke-width='1.1'%3E%3Cpath d='M0 12a12 12 0 0 1 24 0M4 12a8 8 0 0 1 16 0M8 12a4 4 0 0 1 8 0'/%3E%3C/g%3E%3C/svg%3E");
}
* { box-sizing: border-box }
html, body { margin: 0 }
body {
  font-family: Inter, system-ui, sans-serif; color: var(--ink); min-height: 100vh;
  /* Carta nautica: griglia di latitudine/longitudine su pergamena */
  background:
    radial-gradient(1200px 600px at 50% -10%, #fff7e3 0%, transparent 60%),
    repeating-linear-gradient(0deg, rgba(29,53,87,.07) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(90deg, rgba(29,53,87,.07) 0 1px, transparent 1px 72px),
    var(--paper);
  display: flex; justify-content: center; padding: 32px 16px 48px;
}
main { width: 100%; max-width: 560px; position: relative; z-index: 1 }

/* Rosa dei venti sullo sfondo */
.compass-rose { position: fixed; right: -60px; bottom: -60px; width: 340px; height: 340px; opacity: .09; pointer-events: none; color: var(--navy); z-index: 0 }
@media (max-width: 600px) { .compass-rose { width: 220px; height: 220px; right: -50px; bottom: -50px } }

/* Switch lingua */
.lang { display: flex; justify-content: flex-end; margin: -12px 0 10px }
.lang button {
  font: 600 12px Inter, sans-serif; letter-spacing: .08em; padding: 5px 10px; border-radius: 0;
  background: var(--card); color: var(--ink); box-shadow: none; border: 2px solid var(--ink);
}
.lang button + button { border-left: 0 }
.lang button:first-child { border-radius: 8px 0 0 8px }
.lang button:last-child { border-radius: 0 8px 8px 0 }
.lang button[aria-pressed="true"] { background: var(--navy); color: #fff; cursor: default }
.lang button:active { transform: none; box-shadow: none }

header { text-align: center; margin-bottom: 22px }
.kicker { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--red); font-weight: 600 }
h1 { font-family: Fraunces, serif; font-weight: 800; font-size: clamp(30px, 7vw, 44px); line-height: 1.05; margin: 8px 0 10px; color: var(--navy) }
h1 .hl { background: linear-gradient(transparent 58%, var(--straw) 58% 88%, transparent 88%); padding: 0 .08em }
.sub { color: var(--muted); font-size: 15px; margin: 0 }

/* Form: campo data con bussola, pulsante "Salpa!" */
form { display: flex; gap: 10px; margin: 22px 0 18px }
.field { flex: 1; position: relative; min-width: 0; display: flex }
.field svg { position: absolute; left: 12px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); color: var(--navy); pointer-events: none }
input[type=date] {
  flex: 1; font: 500 16px Inter, sans-serif; padding: 13px 14px 13px 42px; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--card); color: var(--ink); min-width: 0; width: 100%;
}
button {
  font: 600 15px Inter, sans-serif; padding: 0 18px; border-radius: 10px; border: 2px solid var(--ink);
  background: var(--red); color: #fff; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
form button { font-family: Rye, Fraunces, serif; font-weight: 400; font-size: 17px; letter-spacing: .02em; white-space: nowrap }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink) }
button:disabled { opacity: .55; cursor: progress }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px }

/* ── Scheda ─────────────────────────────────────────────
   #card: contenitore con l'ombra a retino e il chiodo; .poster: il foglio. */
.card { position: relative; display: none; margin: 26px 4px 0; transform: rotate(-.6deg) }
.card.show { display: block; animation: unroll .55s cubic-bezier(.2,.8,.25,1) }
.card::before { /* retino */
  content: ''; position: absolute; inset: 0; transform: translate(9px, 10px);
  background: radial-gradient(circle, var(--ink) 1.15px, transparent 1.55px) 0 0 / 6px 6px;
}
.pin {
  position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; z-index: 3;
  background: radial-gradient(circle at 35% 35%, #e0605a, var(--red) 55%, #6d1510);
  box-shadow: 1px 3px 3px rgba(0,0,0,.35);
}
@keyframes unroll {
  from { clip-path: inset(0 0 100% 0); transform: rotate(-.6deg) translateY(-8px) }
  to   { clip-path: inset(-40px); transform: rotate(-.6deg) }
}

.poster {
  position: relative; z-index: 1; padding: 30px 26px 22px; text-align: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(150,100,30,.13), transparent 38%),
    radial-gradient(circle at 88% 78%, rgba(130,85,25,.16), transparent 42%),
    radial-gradient(circle at 70% 25%, rgba(150,100,30,.07), transparent 25%),
    radial-gradient(ellipse at center, var(--poster) 55%, var(--poster-edge) 100%);
  /* bordi leggermente strappati */
  clip-path: polygon(0 .8%, 4% 0, 18% .6%, 33% .1%, 52% .7%, 71% 0, 88% .5%, 100% 0, 99.5% 18%, 100% 41%, 99.3% 63%, 100% 84%, 99.6% 100%, 81% 99.4%, 62% 100%, 40% 99.3%, 21% 100%, 3% 99.5%, 0 100%, .6% 77%, 0 52%, .5% 29%);
}
.poster::after { /* cornice interna */
  content: ''; position: absolute; inset: 9px; border: 1.5px solid rgba(31,42,58,.4); pointer-events: none;
}

.wanted { font-family: Rye, Fraunces, serif; font-size: clamp(44px, 14vw, 72px); line-height: 1; letter-spacing: .04em; color: #3b2a1a; margin: 2px 0 14px }

/* Timbro */
.stamp {
  position: absolute; top: 18px; right: 16px; z-index: 2; transform: rotate(9deg);
  color: var(--red); border: 3px double currentColor; border-radius: 6px; padding: 4px 8px;
  font: 700 11px Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; background: rgba(248,236,208,.55);
  mix-blend-mode: multiply; opacity: .9;
}
.stamp--muted { color: var(--navy) }
/* Sulla foto: angolo in alto a destra, fondo carta per restare leggibile sopra l'immagine */
.photo .stamp { top: -12px; right: -10px; max-width: 70%; background: rgba(248,236,208,.92); mix-blend-mode: normal; box-shadow: 1px 2px 0 rgba(0,0,0,.15) }
.poster--chart .stamp { top: 100px; right: 20px }

/* Foto: copertina */
.cover { margin: 0 0 14px }
.cover a { display: block }
.cover .photo { position: relative; margin: 0 auto; width: min(100%, calc(400px * var(--ar, .7))) }
.cover--empty .photo { width: min(100%, 170px) }
.cover img {
  display: block; width: 100%; height: auto; aspect-ratio: var(--ar, .7);
  border: 3px solid #3b2a1a; background: var(--paper2); filter: sepia(.12) contrast(1.02);
}
.cover figcaption { margin-top: 6px; font-size: 10.5px; color: var(--muted) }
.cover--empty .blank {
  width: 100%; aspect-ratio: .72; border: 3px solid #3b2a1a; display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, rgba(59,42,26,.06) 0 8px, transparent 8px 16px), var(--paper2);
  font: 800 60px Fraunces, serif; color: rgba(59,42,26,.35);
}

.label { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: #5a4632; font-weight: 700; margin: 4px 0 6px }
.title { font-family: Fraunces, serif; font-size: 23px; font-weight: 700; line-height: 1.2; margin: 0 0 2px; text-transform: none; overflow-wrap: anywhere }
.ja { font-family: "Shippori Mincho", serif; font-size: 16px; color: var(--muted); margin: 0 0 6px; min-height: 1px }

/* "Taglia": il numero del capitolo */
.bounty {
  position: relative; display: flex; align-items: baseline; justify-content: center; gap: 8px;
  font-family: Fraunces, serif; font-weight: 800; color: #3b2a1a; margin: 6px 0 10px;
}
.bounty small { font-size: 22px; font-weight: 700 }
.bounty .num { font-size: clamp(60px, 17vw, 92px); line-height: .95; color: var(--red) }
.bounty .dash { font-size: 40px; color: #3b2a1a }
.bounty--text .num { font-size: clamp(40px, 11vw, 58px) }

/* ドン! quando il capitolo esce proprio quel giorno */
.don {
  position: absolute; right: -10px; bottom: -14px; transform: rotate(-12deg); line-height: 1; pointer-events: none;
  font: 400 clamp(34px, 10vw, 54px) "Dela Gothic One", sans-serif; color: var(--straw);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink);
  animation: don .5s .45s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes don { from { transform: rotate(-12deg) scale(0); opacity: 0 } to { transform: rotate(-12deg) scale(1); opacity: 1 } }

/* Separatore a onde */
.waves { height: 12px; margin: 12px -6px 12px; background: var(--waves) repeat-x center / 24px 12px }

.meta { font-size: 15px; line-height: 1.55 }
.meta b { color: var(--navy) }

/* Nota generica: balloon da fumetto */
.note {
  position: relative; margin: 16px 6px 6px; padding: 10px 14px; text-align: left; font-size: 14px; line-height: 1.5;
  background: #fff; border: 2px solid var(--ink); border-radius: 18px;
}
.note::before, .note::after { content: ''; position: absolute; left: 34px; border-style: solid }
.note::before { top: -14px; border-width: 0 10px 14px 4px; border-color: transparent transparent var(--ink) transparent }
.note::after { top: -10px; left: 36px; border-width: 0 7px 11px 3px; border-color: transparent transparent #fff transparent }

/* Settimana di pausa: ritaglio di giornale */
.news {
  margin: 16px 4px 6px; padding: 10px 14px 12px; text-align: left; background: var(--newsprint); color: #2a2a2a;
  border-top: 4px double #2a2a2a; border-bottom: 1px solid #2a2a2a; transform: rotate(.8deg);
  box-shadow: 2px 3px 0 rgba(0,0,0,.12); font-family: Fraunces, serif;
}
.news-mast { font: 600 10px Inter, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: #555; border-bottom: 1px solid #999; padding-bottom: 4px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px }
.news-mast span:last-child { white-space: nowrap }
.news-head { font-weight: 800; font-size: 19px; line-height: 1.15; margin: 6px 0 4px; text-transform: uppercase }
.news p { margin: 0; font-size: 14px; line-height: 1.5; font-family: Inter, sans-serif }

/* Capitolo previsto: messaggio in bottiglia */
.bottle { display: flex; gap: 12px; align-items: center; margin: 16px 4px 6px; padding: 10px 12px; text-align: left; font-size: 14px; line-height: 1.5; background: rgba(29,53,87,.08); border-radius: 12px; border: 1.5px dashed var(--navy) }
.bottle svg { flex: none; width: 34px; height: 54px; transform: rotate(-18deg) }

/* Prima del capitolo 1: carta di mare inesplorato */
.poster--chart {
  background:
    repeating-linear-gradient(0deg, rgba(29,53,87,.08) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(90deg, rgba(29,53,87,.08) 0 1px, transparent 1px 36px),
    radial-gradient(ellipse at center, #f6ecd4 55%, var(--poster-edge) 100%);
}
.chart-title { font-family: Rye, Fraunces, serif; font-size: clamp(28px, 8vw, 40px); color: var(--navy); margin: 6px 0 8px }
.island { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto 10px }

.nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 10px; margin-top: 16px }
.nav > :first-child { justify-self: start }
.nav > :last-child { justify-self: end }
.nav .wiki { justify-self: center }
@media (max-width: 480px) {
  .nav { grid-template-columns: 1fr 1fr; row-gap: 14px }
  .nav .wiki { grid-column: 1 / -1; grid-row: 2 }
}
.nav a { font-size: 14px; color: var(--navy); font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--line) }
.nav a:hover { border-color: var(--red) }

.err { color: var(--red); font-weight: 600; font-size: 14px; min-height: 20px; text-align: center }
footer { margin-top: 34px; padding-top: 22px; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.6; background: var(--waves) repeat-x top / 24px 12px }
footer a { color: inherit }

@media (prefers-reduced-motion: reduce) {
  .card.show, .don { animation: none }
}
