:root {
  --bg: #ffe14d;
  --ink: #111;
  --paper: #fffdf5;
  --accent: #ff3d7f;
  --muted: #5a5440;
  --line: #111;
  --shadow: 5px 5px 0 var(--ink);
  --radius: 14px;
  --display: 'Archivo Black', 'Arial Black', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--body);
}
button, input, textarea { font: inherit; color: inherit; }

/* --- Header */
.site-header { max-width: 1080px; margin: 0 auto; padding: 32px 16px 8px; }
.logo {
  font: 2.6rem/1 var(--display);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo span { display: inline-block; margin-left: 6px; transform: rotate(-12deg); }
.tagline { margin: 8px 0 0; font-weight: 600; color: var(--muted); }

/* --- Layout */
.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 16px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .logo { font-size: 2rem; }
}

.panel {
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Form */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-weight: 800; font-size: 0.95rem; }
.label small { font-weight: 400; color: var(--muted); }

input:not([type=file], [type=radio], [type=checkbox]), textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
input:focus, textarea:focus { box-shadow: 0 0 0 3px var(--accent); }
textarea { resize: vertical; min-height: 80px; }

.prefixed { display: flex; align-items: stretch; }
.prefixed span {
  display: flex; align-items: center;
  padding: 0 14px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--display);
  border-radius: 10px 0 0 10px;
}
.prefixed input { border-radius: 0 10px 10px 0; border-left: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { background: var(--bg); }
.chip.active { background: var(--ink); color: var(--bg); }

.dropzone {
  display: flex; align-items: center; justify-content: center;
  min-height: 72px;
  padding: 12px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.dropzone:hover, .dropzone.drag { background: var(--bg); }

.error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #ffe0ea;
  border: 2px solid var(--accent);
  font-weight: 600;
}

/* --- Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 22px;
  border: 3px solid var(--line);
  border-radius: 12px;
  font-family: var(--display);
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); }
.btn-primary:hover, .btn-secondary:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn-primary:active, .btn-secondary:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.link-btn {
  align-self: flex-start;
  background: none; border: 0; padding: 0;
  font-weight: 600; text-decoration: underline; cursor: pointer;
  color: var(--ink);
}

/* --- Card */
.preview-wrap { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--accent), 8px 8px 0 3px var(--ink);
  padding: 28px;
  transform: rotate(-1deg);
  overflow-wrap: anywhere;
}
.card-headline {
  margin: 0 0 16px;
  font: 2.2rem/1.05 var(--display);
  letter-spacing: -0.02em;
}
.card-haista { display: block; margin-bottom: 4px; font-size: 0.6em; text-transform: uppercase; letter-spacing: 0.08em; }
.card-what {
  background: var(--accent);
  color: #fff;
  padding: 0 8px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.card-image {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
  border: 3px solid var(--line);
  border-radius: 10px;
  margin: 0 0 16px;
}
.card-message { margin: 0 0 16px; font-size: 1.15rem; white-space: pre-line; }
.card-from { margin: 0; font-weight: 800; text-align: right; }

/* --- Result dialog */
.result {
  width: min(520px, calc(100vw - 32px));
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--paper);
  padding: 28px;
}
.result::backdrop { background: rgb(0 0 0 / 0.5); }
.result h2 { margin: 0 0 8px; font-family: var(--display); font-size: 1.8rem; }
.result p { margin: 0 0 16px; color: var(--muted); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; font-size: 0.9rem; }
.copy-row .btn-primary { padding: 10px 16px; }
.result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.result-actions .link-btn { align-self: center; margin-left: auto; }

/* --- View page */
.view-main {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
}
.envelope { text-align: center; }
.envelope h1 { font: 2.2rem/1.1 var(--display); margin: 16px 0 24px; overflow-wrap: anywhere; }
.envelope-icon { font-size: 6rem; line-height: 1; animation: wobble 1.6s ease-in-out infinite; }
.card-big .card-headline { font-size: clamp(2.2rem, 9vw, 3.6rem); }
.cta { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.cta .link-btn { align-self: center; }

.reveal { animation: slam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }

@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg) scale(1.05); }
}
@keyframes slam {
  from { transform: scale(2.5) rotate(8deg); opacity: 0; }
  to { transform: scale(1) rotate(-1deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .envelope-icon, .reveal { animation: none; }
}

/* --- Name position toggle */
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.segmented label { display: flex; cursor: pointer; }
.segmented label + label { border-left: 2px solid var(--line); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { flex: 1; padding: 10px 12px; font-weight: 600; font-size: 0.9rem; text-align: center; overflow-wrap: anywhere; }
.segmented input:checked + span { background: var(--ink); color: var(--bg); }
.segmented input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--accent); }

/* --- Fine print, footers, report form */
.fineprint { margin: -4px 0 0; font-size: 0.8rem; color: var(--muted); }
.fineprint a, .site-footer a, .view-footer a { color: inherit; }
.site-footer { max-width: 1080px; margin: 0 auto; padding: 0 16px 32px; font-size: 0.85rem; color: var(--muted); }
.view-footer { font-size: 0.85rem; color: var(--muted); text-align: center; }
.view-footer p { margin: 8px 0; }
.report { text-align: left; margin: 8px auto; max-width: 480px; }
.report summary { cursor: pointer; text-align: center; font-weight: 600; text-decoration: underline; }
.report-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 16px; background: var(--paper); border: 2px solid var(--line); border-radius: 10px; color: var(--ink); }
.report-form p { margin: 0 0 4px; }
.report-form label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.report-form input[type=radio] { margin: 0; flex: none; accent-color: var(--accent); }
.report-form .btn-secondary { align-self: flex-start; padding: 10px 16px; font-size: 0.95rem; }
#report-done { font-weight: 600; color: var(--ink); text-align: center; }

/* --- Terms page */
.legal { max-width: 720px; margin: 0 auto; padding: 16px 16px 64px; }
.legal article { background: var(--paper); border: 3px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 28px; }
.legal h1 { font: 2rem/1.1 var(--display); margin: 0 0 8px; }
.legal h2 { font: 1.2rem/1.2 var(--display); margin: 28px 0 8px; }
.legal li { margin: 4px 0; }
.legal .updated { color: var(--muted); margin: 0 0 16px; }
