:root {
  --cream: #fff6e9;
  --paper: #ffffff;
  --ink: #1d1b3a;
  --muted: #5d5a7a;
  --coral: #ff5a4e;
  --coral-dark: #d93a2f;
  --sun: #ffc93c;
  --line: #ecdcc4;
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 201, 60, .35), transparent 40%),
    radial-gradient(circle at 92% 90%, rgba(255, 90, 78, .18), transparent 45%),
    var(--cream);
}

.top {
  padding: 20px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}

.brand b { color: var(--coral-dark); }

main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 16px 40px;
}

.card {
  width: 100%;
  max-width: 680px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--ink);
  padding: clamp(22px, 5vw, 44px);
}

h1 {
  font-size: clamp(1.6rem, 4.4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}

h1 em {
  font-style: normal;
  background: linear-gradient(transparent 60%, var(--sun) 60%);
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 24px;
}

textarea, input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 14px 16px;
}

textarea {
  resize: vertical;
  min-height: 64px;
  max-height: 260px;
}

textarea:focus, input:focus, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s ease, box-shadow .08s ease;
  box-shadow: 3px 3px 0 var(--ink);
}

.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active, .btn.pressed { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }

.btn-primary { background: var(--coral); color: #fff; }
.btn-primary:hover { background: var(--coral-dark); }
.btn-ghost { box-shadow: none; border-color: transparent; text-decoration: underline; }
.btn-ghost:hover { box-shadow: none; transform: none; }

#make-form { display: grid; gap: 14px; }
#make-form .btn { justify-self: start; }

.error {
  margin: 0;
  color: var(--coral-dark);
  font-weight: 600;
}

.result {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 2px dashed var(--line);
}

.result label { display: block; font-weight: 700; margin-bottom: 8px; }

.share-row { display: flex; gap: 10px; }
.share-row input { flex: 1; min-width: 0; font-size: 1rem; }

.share-meta { margin: 10px 0 0; display: flex; gap: 14px; flex-wrap: wrap; }
.share-meta a { color: var(--coral-dark); font-weight: 700; }
#copy-status { color: var(--muted); }

.player .step {
  font-weight: 700;
  margin: 0 0 14px;
  min-height: 1.5em;
}

.ask-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.fake-input {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  max-height: 168px;
  overflow: hidden;
  font-size: 1.1rem;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 13px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transition: box-shadow .2s ease;
}

.fake-input.focused { box-shadow: 0 0 0 4px rgba(255, 90, 78, .35); }

.caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--ink);
  visibility: hidden;
}

.fake-input.focused .caret {
  visibility: visible;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.roast {
  margin: 26px 0 0;
  font-size: clamp(1.3rem, 3.6vw, 1.75rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.01em;
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes pop {
  from { opacity: 0; transform: scale(.92) translateY(6px); }
  to { opacity: 1; transform: none; }
}

.send-note {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-left: 4px solid var(--sun);
  background: rgba(255, 201, 60, .14);
  border-radius: 0 8px 8px 0;
  font-weight: 600;
  font-size: .98rem;
}

.countdown { margin: 8px 0 0; color: var(--muted); }

.player-actions {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fake-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .2));
}

.lost { text-align: left; }
.big-404 {
  margin: 0;
  font-size: clamp(4rem, 14vw, 7rem);
  font-weight: 900;
  line-height: 1;
  color: var(--coral);
  -webkit-text-stroke: 2px var(--ink);
}

.foot {
  text-align: center;
  padding: 18px 16px 28px;
  color: var(--muted);
  font-size: .9rem;
}
.foot p { margin: 0; }

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

[hidden] { display: none !important; }

@media (max-width: 520px) {
  .top { padding: 16px; }
  .brand { font-size: 1rem; }
  .card { box-shadow: 5px 5px 0 var(--ink); }
  .share-row { flex-direction: column; }
  .ask-box { flex-direction: column; }
  .ask-box .btn { align-self: flex-end; }
  #make-form .btn { justify-self: stretch; }
}

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