:root {
  color-scheme: light;
  --paper: #F5F0E6;
  --ink: #171717;
  --muted-ink: #5C5A54;
  --signal-yellow: #FFD83D;
  --correction-red: #FF4B36;
  --electric-blue: #2B67F6;
  --success-mint: #41C986;
  --code-surface: #182128;
  --code-text: #F5F0E6;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, textarea { font: inherit; }

.layout {
  width: min(100%, 592px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(48px, 9vh, 96px) 24px 32px;
  display: flex;
  flex-direction: column;
}

h1 {
  max-width: 480px;
  margin: 0 0 32px;
  font-family: "Archivo Black", Impact, sans-serif;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.045em;
}

.composer { width: 100%; }
.paper {
  position: relative;
  padding: 24px 24px 20px;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--signal-yellow);
}

.paper-heading {
  margin: 0 0 24px;
  font-size: clamp(14px, 3.6vw, 17px);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

textarea, .wrap-mirror {
  font-size: clamp(14px, 3.6vw, 17px);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
/* 32 colonne come la carta: il browser va a capo da solo tra le parole. */
textarea {
  display: block;
  width: calc(32ch + 2px);
  max-width: 100%;
  min-height: 272px;
  margin: 0 auto;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}
/* Copia invisibile del testo: serve a leggere dove il browser va a capo. */
.wrap-mirror {
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
textarea::placeholder { color: var(--muted-ink); opacity: 1; }
.paper:focus-within { border-color: var(--electric-blue); }

.paper-counts {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 700;
}

.send-button {
  display: block;
  width: 100%;
  min-height: 60px;
  margin-top: 28px;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--signal-yellow);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  font-family: "Archivo Black", Impact, sans-serif;
  font-size: 22px;
  font-weight: 400;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.send-button:not(:disabled):hover { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--ink); }
.send-button:not(:disabled):active { transform: translate(6px, 6px); box-shadow: none; }
.send-button:disabled { opacity: .55; cursor: not-allowed; }
.send-button:focus-visible, .social-links a:focus-visible { outline: 3px solid var(--electric-blue); outline-offset: 5px; }

.status {
  min-height: 20px;
  margin: 20px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-ink);
}
.status[data-kind="error"] { color: var(--correction-red); }

.social-links { margin-top: 12px; }
.social-title {
  margin: 0 0 12px;
  color: var(--muted-ink);
  font-size: 13px;
  font-weight: 700;
}
.social-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.social-links svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.social-links a:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.social-links a:active { transform: translate(4px, 4px); box-shadow: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 440px) {
  .layout { padding: 48px 20px 28px; }
  h1 { margin-bottom: 28px; }
  .paper { padding: 20px 18px 16px; box-shadow: 6px 6px 0 var(--signal-yellow); }
  textarea { min-height: 240px; }
  .paper-counts { font-size: 11px; }
}

@media (max-width: 360px) {
  .paper { padding-inline: 12px; }
  textarea, .wrap-mirror { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .send-button, .social-links a { transition: none; }
}
