@layer reset, tokens, base, layout, components, states, responsive, motion;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { color-scheme: light; scroll-behavior: smooth; }
  body, h1, h2, h3, p, ul, ol, fieldset { margin: 0; }
  ul, ol { padding: 0; }
  button, input, textarea, select { font: inherit; }
  button, a { -webkit-tap-highlight-color: transparent; }
  img, svg { display: block; max-width: 100%; }
  [hidden] { display: none !important; }
}

@layer tokens {
  :root {
    --paper: #f6f0e7;
    --paper-deep: #ebe0d1;
    --card: #fffdf9;
    --card-muted: #faf5ed;
    --ink: #211c1a;
    --ink-soft: #655d58;
    --ink-faint: #8b8078;
    --line: #d9ccbd;
    --line-strong: #bfae9c;
    --coral: #df5a47;
    --coral-dark: #a93427;
    --coral-pale: #ffe6de;
    --violet: #6850a3;
    --violet-pale: #eee8ff;
    --green: #277857;
    --green-pale: #e2f3e9;
    --amber: #9a6323;
    --amber-pale: #fff1d8;
    --red: #a72c2c;
    --red-pale: #ffe7e4;
    --shadow: 0 22px 60px rgba(60, 42, 29, 0.12);
    --shadow-small: 0 8px 22px rgba(60, 42, 29, 0.09);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --shell: min(1180px, calc(100% - 40px));
  }
}

@layer base {
  body {
    min-height: 100vh;
    background:
      radial-gradient(circle at 8% 3%, rgba(223, 90, 71, 0.09), transparent 27rem),
      radial-gradient(circle at 91% 11%, rgba(104, 80, 163, 0.08), transparent 28rem),
      var(--paper);
    color: var(--ink);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
  }

  a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
  button { color: inherit; }
  button, summary, input[type="radio"], input[type="range"] { cursor: pointer; }
  textarea { resize: vertical; }
  :focus-visible { outline: 3px solid rgba(104, 80, 163, 0.44); outline-offset: 3px; }
  ::selection { background: var(--coral-pale); color: var(--ink); }

  .shell { width: var(--shell); margin-inline: auto; }
  .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
  .skip-link {
    position: fixed;
    z-index: 1000;
    inset: 10px auto auto 10px;
    transform: translateY(-160%);
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--ink);
    color: white;
  }
  .skip-link:focus { transform: translateY(0); }
}

@layer layout {
  .site-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(191, 174, 156, 0.58);
  }
  .wordmark {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 1.1rem;
    font-weight: 820;
    letter-spacing: -0.025em;
    text-decoration: none;
  }
  .wordmark-mark {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.94rem;
  }
  .header-nav { display: flex; align-items: center; gap: 22px; }
  .header-nav a, .header-create-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 720;
    text-decoration: none;
    color: var(--ink-soft);
  }
  .header-nav a:hover, .header-create-link:hover { color: var(--ink); }

  .hero { padding-block: 28px 68px; }
  .hero-copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.66fr);
    gap: 54px;
    align-items: end;
    margin-bottom: 18px;
  }
  .hero-copy h1 {
    max-width: 780px;
    font-size: clamp(2.65rem, 5.2vw, 4.8rem);
    line-height: 0.97;
    letter-spacing: -0.065em;
    text-wrap: balance;
  }
  .hero-copy > p {
    max-width: 520px;
    color: var(--ink-soft);
    font-size: clamp(1.04rem, 1.7vw, 1.25rem);
    line-height: 1.48;
  }
  .trust-line {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 18px;
    list-style: none;
    color: var(--ink-soft);
    font-size: 0.83rem;
    font-weight: 700;
  }
  .trust-line li { display: inline-flex; align-items: center; gap: 7px; }
  .trust-line li::before { content: "✓"; color: var(--green); font-weight: 900; }

  .instrument {
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(400px, 0.94fr);
    gap: 16px;
    align-items: stretch;
  }
  .composer-panel, .result-panel {
    min-width: 0;
    border: 1px solid rgba(191, 174, 156, 0.78);
    border-radius: var(--radius-xl);
    background: rgba(255, 253, 249, 0.94);
    box-shadow: var(--shadow);
  }
  .composer-panel { padding: 19px; }
  .result-panel {
    position: relative;
    overflow: hidden;
    min-height: 632px;
    padding: 24px;
    background:
      linear-gradient(150deg, rgba(104, 80, 163, 0.08), transparent 44%),
      linear-gradient(330deg, rgba(223, 90, 71, 0.08), transparent 48%),
      var(--card);
  }

  .method { padding-block: 76px; border-top: 1px solid var(--line); }
  .section-heading {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr;
    align-items: end;
    gap: 48px;
    margin-bottom: 34px;
  }
  .section-heading h2, .limits h2 {
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1.02;
    letter-spacing: -0.052em;
    text-wrap: balance;
  }
  .section-kicker, .legal-kicker, .track-kicker, .response-kicker {
    color: var(--coral-dark);
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .method-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    list-style: none;
  }
  .method-steps li {
    min-height: 210px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 249, 0.62);
  }
  .method-steps li > span { color: var(--coral-dark); font-weight: 900; font-size: 0.82rem; }
  .method-steps h3 { margin-top: 34px; font-size: 1.27rem; letter-spacing: -0.025em; }
  .method-steps p { margin-top: 9px; color: var(--ink-soft); }

  .limits {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 64px;
    padding-block: 76px 92px;
    border-top: 1px solid var(--line);
  }
  .limits .section-kicker { margin-bottom: 12px; }
  .limits-copy { display: grid; gap: 18px; color: var(--ink-soft); font-size: 1.04rem; }

  .site-footer {
    min-height: 96px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.82rem;
  }
  .site-footer nav { display: flex; align-items: center; gap: 8px; }
  .site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 750; }
  .footer-fine { justify-self: end; }
}

@layer components {
  .field-group { display: grid; gap: 7px; }
  .field-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  label, legend { font-size: 0.9rem; font-weight: 820; letter-spacing: -0.01em; }
  .counter { color: var(--ink-faint); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
  .scenario-row {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-block: 2px 3px;
    scrollbar-width: none;
  }
  .scenario-row::-webkit-scrollbar { display: none; }
  .scenario-chip {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card-muted);
    color: var(--ink-soft);
    font-size: 0.77rem;
    font-weight: 760;
  }
  .scenario-chip:hover, .scenario-chip.is-selected { border-color: var(--coral); background: var(--coral-pale); color: var(--ink); }

  textarea, input[type="text"] {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: white;
    color: var(--ink);
    box-shadow: inset 0 1px 1px rgba(60, 42, 29, 0.04);
  }
  textarea {
    min-height: 88px;
    max-height: 160px;
    padding: 13px 14px;
    line-height: 1.43;
  }
  input[type="text"] { min-height: 44px; padding: 9px 12px; }
  textarea::placeholder, input::placeholder { color: #9a8e85; }
  textarea:hover, input[type="text"]:hover { border-color: #9e8c7a; }
  textarea:focus, input[type="text"]:focus { border-color: var(--violet); outline: 3px solid rgba(104, 80, 163, 0.17); }
  [aria-invalid="true"] { border-color: var(--red) !important; }
  .field-help, .submit-note { color: var(--ink-faint); font-size: 0.72rem; line-height: 1.4; }
  .field-error { color: var(--red); font-size: 0.76rem; font-weight: 700; }

  .vibe-fieldset { margin-top: 11px; padding: 0; border: 0; }
  .vibe-fieldset legend { margin-bottom: 8px; }
  .vibe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .vibe-card {
    position: relative;
    min-height: 56px;
    display: grid;
    align-content: center;
    gap: 1px;
    padding: 8px 9px 8px 27px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card-muted);
    cursor: pointer;
  }
  .vibe-card:hover { border-color: var(--line-strong); background: white; }
  .vibe-card:has(input:checked) { border-color: var(--violet); background: var(--violet-pale); box-shadow: 0 0 0 1px rgba(104, 80, 163, 0.2); }
  .vibe-card input { position: absolute; opacity: 0; pointer-events: none; }
  .vibe-card:has(input:focus-visible) { outline: 3px solid rgba(104, 80, 163, 0.44); outline-offset: 2px; }
  .vibe-check {
    position: absolute;
    left: 9px;
    top: 50%;
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--line-strong);
    border-radius: 50%;
    transform: translateY(-50%);
  }
  input:checked + .vibe-check { border: 4px solid var(--violet); background: white; }
  .vibe-name { font-size: 0.77rem; font-weight: 850; }
  .vibe-note { color: var(--ink-faint); font-size: 0.64rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .sender-details {
    margin-top: 10px;
    border-block: 1px solid var(--line);
  }
  .sender-details summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    font-size: 0.78rem;
    font-weight: 800;
  }
  .sender-details summary::-webkit-details-marker { display: none; }
  .sender-details summary::after { content: "+"; font-size: 1.1rem; color: var(--ink-soft); }
  .sender-details[open] summary::after { content: "−"; }
  .sender-details summary span { color: var(--ink-faint); font-size: 0.68rem; font-weight: 650; }
  .compact-field { padding-bottom: 12px; }

  .reply-context {
    min-height: 37px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 13px;
    padding: 7px 10px;
    border: 1px solid #cfc2ee;
    border-radius: 10px;
    background: var(--violet-pale);
    color: #493378;
    font-size: 0.76rem;
    font-weight: 760;
  }

  .verification-shell {
    min-height: 66px;
    display: grid;
    align-items: center;
    margin-top: 5px;
    overflow: hidden;
  }
  #turnstile-widget { min-height: 65px; }
  .verification-retry {
    width: fit-content;
    min-height: 36px;
    margin-top: -3px;
    padding-inline: 2px;
    font-size: 0.76rem;
  }
  .form-status {
    margin-top: 9px;
    padding: 10px 12px;
    border: 1px solid #e0aaa4;
    border-radius: 10px;
    background: var(--red-pale);
    color: #7e2624;
    font-size: 0.78rem;
    font-weight: 720;
  }

  .primary-button, .secondary-button, .text-button, .icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    border-radius: 13px;
    font-weight: 840;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
  }
  .primary-button {
    padding: 11px 18px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: white;
    box-shadow: 0 7px 16px rgba(33, 28, 26, 0.16);
  }
  .primary-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(33, 28, 26, 0.2); }
  .primary-button:active:not(:disabled) { transform: translateY(0); }
  .primary-button:disabled { opacity: 0.46; cursor: not-allowed; box-shadow: none; }
  .secondary-button {
    padding: 10px 15px;
    border: 1px solid var(--line-strong);
    background: white;
    color: var(--ink);
  }
  .secondary-button:hover:not(:disabled) { border-color: var(--ink); background: var(--card-muted); }
  .text-button {
    min-height: 44px;
    padding: 7px 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    text-decoration: underline;
    text-underline-offset: 0.22em;
  }
  .text-button:hover { color: var(--ink); }
  .danger-button { color: var(--red); }
  .icon-button {
    width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    background: white;
    font-size: 1.5rem;
  }
  .make-button { width: 100%; min-height: 50px; margin-top: 2px; font-size: 0.96rem; }
  .submit-note { margin-top: 6px; text-align: center; }

  .result-topline, .result-meta, .time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--ink-faint);
    font-size: 0.72rem;
    font-weight: 750;
  }
  .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-pale); }
  .result-topline span:nth-child(2) { margin-right: auto; color: var(--ink-soft); }
  .result-empty { min-height: 580px; display: flex; flex-direction: column; }
  .result-empty h2 {
    max-width: 390px;
    margin-top: 22px;
    font-size: clamp(1.75rem, 3vw, 2.55rem);
    line-height: 1.06;
    letter-spacing: -0.046em;
  }
  .record-note {
    position: relative;
    width: 150px;
    height: 150px;
    display: grid;
    place-items: center;
    margin: 28px auto 17px;
    border-radius: 50%;
    background:
      radial-gradient(circle, var(--coral) 0 18%, #171311 19% 25%, #2c2623 26% 28%, #171311 29% 35%, #2c2623 36% 38%, #171311 39% 48%, #2c2623 49% 51%, #171311 52% 100%);
    box-shadow: 0 18px 34px rgba(33, 28, 26, 0.22);
  }
  .record-label {
    position: relative;
    z-index: 2;
    color: white;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.13em;
  }
  .record-groove { position: absolute; inset: 8px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 50%; }
  .example-lyrics { display: grid; gap: 2px; text-align: center; font-weight: 760; font-size: 0.91rem; }
  .example-lyrics span:last-child { color: var(--coral-dark); }
  .mini-wave, .track-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 46px;
    margin-block: 16px;
  }
  .mini-wave i, .track-wave i {
    flex: 1;
    height: var(--h);
    min-height: 3px;
    border-radius: 99px;
    background: linear-gradient(to top, var(--violet), var(--coral));
    opacity: 0.68;
    transform-origin: center;
  }
  .result-empty .secondary-button { width: 100%; }
  .example-note { margin-top: 9px; color: var(--ink-faint); font-size: 0.7rem; text-align: center; }

  .result-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 19px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.72rem;
  }
  .result-notice strong { font-size: 0.78rem; }
  .result-notice span { color: var(--ink-soft); text-align: right; }
  .success-notice { border: 1px solid #a7d2bb; background: var(--green-pale); }
  .partial-notice { align-items: flex-start; flex-direction: column; gap: 2px; border: 1px solid #e6c586; background: var(--amber-pale); }
  .partial-notice span { text-align: left; }
  .example-notice { border: 1px solid #cfc2ee; background: var(--violet-pale); }

  .track-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
  .track-heading h2 { margin-top: 4px; font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.04; letter-spacing: -0.047em; }
  .track-kicker { color: var(--violet); }
  .track-badge {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 0.67rem;
    font-weight: 800;
  }
  .sender-reveal { margin-bottom: 16px; color: var(--ink-soft); }
  .sender-reveal strong { color: var(--ink); }

  .audio-instrument {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(250, 245, 237, 0.78);
  }
  .round-play {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: white;
    box-shadow: var(--shadow-small);
  }
  .round-play.is-playing { background: var(--coral-dark); }
  .round-play span { line-height: 1; }
  .wave-and-time { min-width: 0; }
  .track-wave { --played: 0%; position: relative; min-height: 37px; margin: 0; overflow: hidden; }
  .track-wave::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--played);
    background: linear-gradient(90deg, rgba(255, 253, 249, 0), rgba(255, 253, 249, 0.28));
    border-right: 2px solid var(--ink);
    pointer-events: none;
  }
  .track-wave.is-playing i:nth-child(3n + 1) { animation: wave-pulse 760ms ease-in-out infinite alternate; }
  .track-wave.is-playing i:nth-child(3n + 2) { animation: wave-pulse 620ms ease-in-out 120ms infinite alternate; }
  .track-wave.is-playing i:nth-child(3n) { animation: wave-pulse 880ms ease-in-out 210ms infinite alternate; }
  .track-progress { width: 100%; height: 44px; margin: -12px 0; position: relative; z-index: 1; accent-color: var(--ink); }
  .time-row { margin-top: -2px; font-variant-numeric: tabular-nums; }

  .lyric-lines { display: grid; gap: 5px; margin-top: 20px; list-style: none; }
  .lyric-lines li {
    padding: 7px 9px;
    border-left: 3px solid transparent;
    border-radius: 0 9px 9px 0;
    color: var(--ink-soft);
    font-size: 0.91rem;
    font-weight: 690;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
  }
  .lyric-lines li.is-active { border-color: var(--coral); background: var(--coral-pale); color: var(--ink); transform: translateX(3px); }

  .result-actions { display: grid; grid-template-columns: 1.2fr 0.8fr 0.9fr; gap: 8px; margin-top: 20px; }
  .result-actions button { min-width: 0; font-size: 0.76rem; }
  .share-field {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.58);
  }
  .share-field span { color: var(--ink-faint); font-size: 0.65rem; font-weight: 820; text-transform: uppercase; letter-spacing: 0.07em; }
  .share-field output { overflow: hidden; color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
  .result-meta { margin-top: 10px; }
  .result-next { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 5px; }

  .result-loading, .result-error, .result-deleted {
    min-height: 580px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .loading-record, .gone-record, .error-symbol, .result-deleted > span {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    margin-bottom: 22px;
    border-radius: 50%;
    background: var(--ink);
    color: white;
    font-size: 2.1rem;
    box-shadow: var(--shadow);
  }
  .loading-record { animation: record-turn 3.8s linear infinite; }
  .result-loading h2, .result-error h2, .result-deleted h2 { margin-top: 7px; font-size: 2rem; letter-spacing: -0.04em; }
  .result-loading > p:not(.section-kicker), .result-error > p, .result-deleted > p { max-width: 390px; margin-top: 8px; color: var(--ink-soft); }
  .loading-stages { width: min(100%, 370px); display: grid; gap: 7px; margin-top: 24px; list-style: none; text-align: left; }
  .loading-stages li { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; color: var(--ink-faint); font-size: 0.79rem; font-weight: 700; }
  .loading-stages li span { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 0.67rem; }
  .loading-stages li.is-active { color: var(--ink); }
  .loading-stages li.is-active span { border-color: var(--coral); background: var(--coral-pale); }
  .loading-stages li.is-done { color: var(--green); }
  .loading-stages li.is-done span { border-color: #9ccbb4; background: var(--green-pale); }
  .loading-honesty { margin-top: 18px !important; font-size: 0.68rem; }
  .error-symbol { background: var(--red); font-weight: 900; }
  .result-error .secondary-button, .result-deleted .primary-button { margin-top: 22px; }

  .legal-dialog, .report-dialog {
    width: min(720px, calc(100% - 28px));
    max-height: min(780px, calc(100dvh - 28px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--card);
    box-shadow: 0 28px 90px rgba(28, 20, 16, 0.32);
  }
  .legal-dialog::backdrop, .report-dialog::backdrop { background: rgba(28, 20, 16, 0.48); backdrop-filter: blur(4px); }
  .legal-dialog-frame { display: grid; grid-template-rows: auto auto minmax(0, 1fr); max-height: min(780px, calc(100dvh - 28px)); }
  .legal-dialog-header, .report-frame > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px 12px;
  }
  .legal-dialog-header h2, .report-frame h2 { margin-top: 2px; font-size: 1.35rem; letter-spacing: -0.035em; }
  .legal-tabs { display: flex; gap: 7px; padding: 0 20px 12px; border-bottom: 1px solid var(--line); }
  .legal-tabs button {
    min-height: 44px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card-muted);
    font-weight: 800;
  }
  .legal-tabs button.is-active { border-color: var(--ink); background: var(--ink); color: white; }
  .legal-scroll { overflow: auto; padding: 22px 24px 30px; }
  .legal-copy { max-width: 68ch; margin-inline: auto; }
  .legal-copy h2 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1; letter-spacing: -0.052em; }
  .legal-copy h3 { margin-top: 27px; font-size: 1rem; }
  .legal-copy p { margin-top: 8px; color: var(--ink-soft); }
  .legal-effective { font-size: 0.8rem; }
  .dialog-open { overflow: hidden; }

  .report-frame { padding-bottom: 18px; }
  .report-frame fieldset { display: grid; gap: 7px; margin: 0; padding: 0 20px; border: 0; }
  .report-frame fieldset label { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-muted); }
  .report-note { margin: 14px 20px 0; color: var(--ink-soft); font-size: 0.75rem; }
  .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 17px 20px 0; }
  .report-frame .form-status { margin-inline: 20px; }

  .noscript { position: fixed; inset: auto 12px 12px; z-index: 100; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow-small); }
}

@layer states {
  .recipient-main { min-height: calc(100dvh - 168px); display: grid; place-items: center; padding-block: 34px 50px; }
  .recipient-card {
    width: min(680px, 100%);
    min-height: 620px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background:
      linear-gradient(145deg, rgba(104, 80, 163, 0.07), transparent 42%),
      linear-gradient(335deg, rgba(223, 90, 71, 0.08), transparent 46%),
      var(--card);
    box-shadow: var(--shadow);
  }
  .sealed-note { min-height: 562px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
  .sealed-record {
    width: 154px;
    height: 154px;
    display: grid;
    place-items: center;
    margin-bottom: 25px;
    border: 2px solid #342d29;
    border-radius: 50%;
    background: repeating-radial-gradient(circle, #211c1a 0 7px, #332b27 8px 9px);
    color: white;
    box-shadow: 0 22px 42px rgba(33, 28, 26, 0.24);
  }
  .sealed-record span { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); font-size: 1.7rem; }
  .sealed-note h1 { max-width: 520px; margin-top: 7px; font-size: clamp(2.25rem, 6vw, 4rem); line-height: 0.98; letter-spacing: -0.06em; }
  .sealed-note > p:not(.section-kicker):not(.recipient-privacy) { max-width: 440px; margin-top: 12px; color: var(--ink-soft); font-size: 1.05rem; }
  .recipient-play { min-width: min(100%, 320px); margin-top: 27px; }
  .recipient-privacy { margin-top: 10px; color: var(--ink-faint); font-size: 0.72rem; }
  .recipient-unsealed { padding: 4px; }
  .recipient-response { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
  .recipient-response h2 { margin-top: 4px; font-size: 1.8rem; letter-spacing: -0.04em; }
  .reaction-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 15px; }
  .reaction-row button {
    min-height: 66px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 7px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card-muted);
    font-size: 0.76rem;
    font-weight: 800;
  }
  .reaction-row button > span:first-child { font-size: 1.25rem; color: var(--coral-dark); }
  .reaction-row button output { color: var(--ink-faint); }
  .reaction-row button.is-selected { border-color: var(--coral); background: var(--coral-pale); }
  .reply-button { width: 100%; margin-top: 11px; }
  .recipient-secondary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 14px; margin-top: 10px; }
  .expiry-line { margin-top: 12px; color: var(--ink-faint); font-size: 0.72rem; }

  .gone-main { min-height: calc(100dvh - 168px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding-block: 50px; text-align: center; }
  .gone-main h1 { margin-top: 8px; font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 0.98; letter-spacing: -0.06em; }
  .gone-main > p:not(.section-kicker) { max-width: 600px; margin-top: 14px; color: var(--ink-soft); }
  .gone-main .primary-button { margin-top: 25px; }

  .legal-page-main { padding-block: 44px 88px; }
  .back-link { min-height: 44px; display: inline-flex; align-items: center; margin-bottom: 33px; color: var(--ink-soft); font-weight: 750; }
  .legal-page-copy { padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--card); box-shadow: var(--shadow-small); }
}

@layer responsive {
  @media (max-width: 940px) {
    :root { --shell: min(100% - 28px, 760px); }
    .hero-copy { grid-template-columns: 1fr; gap: 12px; }
    .hero-copy > p { max-width: 680px; }
    .trust-line { grid-column: auto; }
    .instrument { grid-template-columns: 1fr; }
    .result-panel { min-height: 580px; }
    .section-heading, .limits { grid-template-columns: 1fr; gap: 22px; }
    .method-steps { grid-template-columns: 1fr; }
    .method-steps li { min-height: 0; }
    .method-steps h3 { margin-top: 18px; }
  }

  @media (max-width: 640px) {
    :root { --shell: calc(100% - 24px); --radius-xl: 22px; }
    body { font-size: 15px; }
    .site-header { min-height: 60px; }
    .header-nav { gap: 12px; }
    .header-nav a:first-child { display: none; }
    .header-nav a, .header-create-link { font-size: 0.76rem; }
    .wordmark { font-size: 0.98rem; }
    .wordmark-mark { width: 28px; height: 28px; }

    .hero { padding-block: 18px 52px; }
    .hero-copy { margin-bottom: 10px; }
    .hero-copy h1 { font-size: clamp(2.35rem, 12vw, 3.35rem); }
    .hero-copy > p { font-size: 0.98rem; }
    .trust-line { gap: 5px 12px; font-size: 0.72rem; }
    .composer-panel, .result-panel { border-radius: 20px; }
    .composer-panel { padding: 14px; }
    .result-panel { min-height: 530px; padding: 18px; }
    .field-heading { align-items: flex-start; }
    .counter { max-width: 130px; text-align: right; line-height: 1.3; }
    .scenario-row { margin-inline: -2px; }
    textarea { min-height: 91px; }
    .vibe-fieldset { margin-top: 10px; }
    .vibe-grid { gap: 5px; }
    .vibe-card { min-height: 57px; padding: 7px 6px 7px 23px; }
    .vibe-check { left: 7px; width: 11px; height: 11px; }
    .vibe-name { font-size: 0.69rem; }
    .vibe-note { font-size: 0.56rem; }
    .sender-details { margin-top: 6px; }
    .verification-shell { min-height: 63px; margin-top: 4px; transform-origin: left top; }
    #turnstile-widget { max-width: 100%; overflow: hidden; }
    .make-button { min-height: 48px; }
    .submit-note { font-size: 0.64rem; }

    .result-empty, .result-loading, .result-error, .result-deleted { min-height: 492px; }
    .result-empty h2 { margin-top: 17px; font-size: 1.75rem; }
    .record-note { width: 126px; height: 126px; margin-block: 22px 14px; }
    .example-lyrics { font-size: 0.82rem; }
    .mini-wave { min-height: 38px; margin-block: 12px; }
    .example-note { font-size: 0.64rem; }
    .result-notice { align-items: flex-start; flex-direction: column; gap: 2px; }
    .result-notice span { text-align: left; }
    .track-heading h2 { font-size: 1.55rem; }
    .audio-instrument { grid-template-columns: 50px minmax(0, 1fr); gap: 10px; padding: 11px; }
    .round-play { width: 48px; height: 48px; }
    .track-wave { min-height: 31px; }
    .lyric-lines { margin-top: 14px; }
    .lyric-lines li { padding-block: 6px; font-size: 0.82rem; }
    .result-actions { grid-template-columns: 1fr 1fr; }
    .result-actions .primary-button { grid-column: 1 / -1; }
    .result-meta { align-items: flex-start; flex-direction: column; gap: 3px; }
    .result-next { align-items: flex-start; }
    .loading-record, .gone-record, .error-symbol, .result-deleted > span { width: 76px; height: 76px; font-size: 1.7rem; }
    .loading-stages { margin-top: 18px; }

    .method { padding-block: 54px; }
    .section-heading { margin-bottom: 24px; }
    .section-heading h2, .limits h2 { font-size: 2.18rem; }
    .method-steps li { padding: 20px; }
    .limits { padding-block: 54px 66px; }
    .site-footer { grid-template-columns: 1fr auto; min-height: 112px; gap: 7px 18px; padding-block: 22px; }
    .footer-fine { grid-column: 1 / -1; justify-self: start; }

    .legal-dialog, .report-dialog {
      width: 100%;
      max-width: none;
      max-height: calc(100dvh - 10px);
      margin: auto 0 0;
      border-radius: 22px 22px 0 0;
    }
    .legal-dialog-frame { max-height: calc(100dvh - 10px); }
    .legal-scroll { padding: 19px 18px 28px; }
    .legal-dialog-header, .report-frame > header { padding-inline: 16px; }
    .legal-tabs { padding-inline: 16px; }
    .report-frame fieldset { padding-inline: 16px; }
    .report-note, .dialog-actions, .report-frame .form-status { margin-inline: 16px; }

    .recipient-header { min-height: 60px; }
    .recipient-main { min-height: calc(100dvh - 150px); padding-block: 16px 34px; }
    .recipient-card { min-height: 600px; padding: 18px; border-radius: 22px; }
    .sealed-note { min-height: 560px; }
    .sealed-record { width: 130px; height: 130px; }
    .sealed-note h1 { font-size: 2.65rem; }
    .reaction-row { gap: 5px; }
    .reaction-row button { min-height: 64px; grid-template-columns: 1fr; justify-items: center; gap: 1px; padding: 6px; }
    .recipient-secondary-actions { align-items: stretch; flex-direction: column; }
    .recipient-secondary-actions .secondary-button { width: 100%; }
    .legal-page-main { padding-block: 28px 58px; }
    .legal-page-copy { padding: 22px 18px; }
  }

  @media (max-width: 360px) {
    :root { --shell: calc(100% - 18px); }
    .composer-panel, .result-panel, .recipient-card { padding-inline: 13px; }
    .vibe-card { padding-left: 20px; }
    .vibe-check { left: 5px; }
    .vibe-note { display: none; }
    .trust-line li:last-child { display: none; }
  }
}

@layer motion {
  @keyframes record-turn { to { transform: rotate(360deg); } }
  @keyframes wave-pulse { from { transform: scaleY(0.7); opacity: 0.55; } to { transform: scaleY(1.12); opacity: 0.88; } }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
  }
}
