@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/fraunces-600.woff2") format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/fraunces-600-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/outfit-latin.woff2") format("woff2");
}

:root {
  --bg: #140c09;
  --ink: #fff6ee;
  --muted: #e4cbb8;
  --dim: #c7a894;
  --line: rgba(255, 196, 150, 0.18);
  --ember: #ff7a32;
  --flame: #e23c0f;
  --gold: #ffc56a;
  --paper: #f6e6d4;
  --paper-ink: #2b140f;
  --paper-dim: #6d4636;
  --good: #1f7a45;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.5;
  background:
    radial-gradient(900px 480px at 100% -10%, rgba(255, 106, 40, 0.28), transparent 60%),
    radial-gradient(680px 420px at -10% 8%, rgba(160, 32, 12, 0.38), transparent 58%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.embers { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

.ember {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0.35;
}

.ember-a { top: 18%; right: 8%; background: rgba(255, 120, 40, 0.45); animation: drift 14s ease-in-out infinite alternate; }
.ember-b { bottom: 0; left: 12%; background: rgba(255, 70, 20, 0.28); animation: drift 18s ease-in-out infinite alternate-reverse; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-24px, 18px, 0); }
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--gold);
  color: #2a120c;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  z-index: 5;
}

.skip:focus { top: 12px; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.site-header { padding: 2.4rem 0 1.2rem; }

.eyebrow {
  margin: 0 0 0.4rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 600;
}

.title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.logo { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 8px 16px rgba(255, 90, 20, 0.35)); }

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.7rem, 12vw, 5.3rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
}

h1 em {
  font-style: italic;
  color: var(--ember);
}

.lede {
  max-width: 38rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 1.4rem;
  align-items: start;
  padding-bottom: 2rem;
}

.panel, .ticket {
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.panel {
  background: rgba(32, 18, 13, 0.78);
  border: 1px solid var(--line);
  padding: 1.2rem 1.2rem 1.15rem;
  backdrop-filter: blur(8px);
}

.composer {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.panel-head h2, .ticket h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.panel-head h2 { margin: 0 0 0.25rem; font-size: 1.7rem; }

.panel-head p, .hint, .method p, .rewrite-intro p {
  color: var(--dim);
  margin: 0;
}

textarea {
  width: 100%;
  margin-top: 0.9rem;
  min-height: 190px;
  resize: vertical;
  border-radius: 18px;
  border: 1px solid rgba(255, 220, 190, 0.12);
  background: rgba(8, 4, 3, 0.48);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.45;
  padding: 0.95rem 1rem;
}

textarea::placeholder { color: #b89a88; }

textarea:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

.composer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.count { margin: 0; color: var(--dim); font-size: 0.92rem; }
.count.is-long { color: var(--gold); }

.roast-btn, .copy, .chip {
  font: inherit;
  cursor: pointer;
}

.roast-btn {
  border: 1px solid #ffb07a;
  background: linear-gradient(180deg, #c83712, #9a1f0c);
  color: #fff8f3;
  font-weight: 700;
  border-radius: 999px;
  min-height: 48px;
  padding: 0.75rem 1.15rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 24px rgba(180, 40, 10, 0.28);
}

.roast-btn:hover { filter: brightness(1.06); }
.roast-btn:active { transform: translateY(1px); }

.hint { margin-top: 0.7rem; font-size: 0.88rem; }

.form-error {
  margin: 0.7rem 0 0;
  color: #ffd0b0;
  background: rgba(180, 40, 12, 0.28);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}

.examples { margin-top: 1.15rem; }
.examples > p {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.chip {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 150, 0.28);
  background: rgba(255, 244, 232, 0.04);
  color: var(--ink);
  padding: 0.45rem 0.8rem;
}

.chip:hover, .chip.is-on {
  background: rgba(255, 140, 60, 0.16);
  border-color: rgba(255, 180, 110, 0.7);
}

.method { margin-top: 1rem; }
.method summary { cursor: pointer; color: var(--muted); }
.method p { margin-top: 0.55rem; font-size: 0.95rem; }

.ticket {
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.4), transparent 28px),
    var(--paper);
  color: var(--paper-ink);
  padding: 1.15rem 1.2rem 1.3rem;
}

.ticket-brand {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px dashed rgba(43, 20, 15, 0.28);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}

.ticket-rule { color: var(--paper-dim); }

.placeholder { padding-top: 1rem; }
.placeholder-kicker {
  font-family: var(--display);
  font-size: 1.8rem;
  margin: 0 0 0.4rem;
}
.placeholder ol { margin: 0; padding-left: 1.15rem; color: var(--paper-dim); }
.placeholder li + li { margin-top: 0.3rem; }

.score-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

.dial {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: conic-gradient(#c83712 calc(var(--p) * 1%), rgba(43, 20, 15, 0.12) 0);
}

.ticket[data-band="high"] .dial {
  background: conic-gradient(#e23c0f 0 calc(var(--p) * 0.7%), #ffc56a calc(var(--p) * 1%), rgba(43, 20, 15, 0.12) 0);
}

.ticket[data-band="low"] .dial {
  background: conic-gradient(#8d2e16 calc(var(--p) * 1%), rgba(43, 20, 15, 0.12) 0);
}

.dial-hole {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #f8ecdf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dial-hole strong {
  font-family: var(--display);
  font-size: 2.35rem;
  line-height: 0.9;
}

.dial-hole span { color: var(--paper-dim); font-size: 0.85rem; }

.stamp {
  display: inline-block;
  margin: 0;
  border: 3px solid #c43716;
  color: #c43716;
  border-radius: 10px;
  padding: 0.25rem 0.5rem 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  transform: rotate(-6deg);
}

.kind { margin: 0.7rem 0 0; color: var(--paper-dim); }

.roast {
  margin: 0.9rem 0 0.3rem;
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.meters { display: grid; gap: 0.7rem; margin-top: 0.9rem; }

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.track {
  height: 8px;
  border-radius: 999px;
  background: rgba(43, 20, 15, 0.1);
  overflow: hidden;
  margin-top: 0.28rem;
}

.fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #9a1f0c, #ff7a32 70%, #ffc56a);
}

.meter-note { margin: 0.22rem 0 0; color: var(--paper-dim); font-size: 0.88rem; }

.ticket h3 { margin: 1.15rem 0 0.4rem; font-size: 1.35rem; }

.tips { margin: 0; padding-left: 1.15rem; }
.tips li + li { margin-top: 0.35rem; }

.rewrite-intro { margin-top: 0.4rem; }
.rewrite-intro p { color: var(--paper-dim); font-size: 0.92rem; }

.rewrites { display: grid; gap: 0.7rem; margin-top: 0.7rem; }

.rewrite {
  background: rgba(255, 250, 244, 0.62);
  border: 1px solid rgba(43, 20, 15, 0.08);
  border-radius: 16px;
  padding: 0.75rem 0.8rem 0.85rem;
}

.rewrite-head { display: flex; justify-content: space-between; gap: 0.7rem; align-items: flex-start; }

.style {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #9a1f0c;
}

.kicker-sm { margin: 0.1rem 0 0; color: var(--paper-dim); font-size: 0.88rem; }

.copy {
  border: 1px solid rgba(43, 20, 15, 0.18);
  background: #fffaf4;
  color: var(--paper-ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
}

.copy:hover { border-color: #9a1f0c; }
.copy.is-copied { background: #1f7a45; color: #f3fff6; border-color: #1f7a45; }

.rewrite-text { margin: 0.55rem 0 0; font-size: 1.02rem; }

.site-footer {
  margin-top: auto;
  padding: 0.4rem 0 1.6rem;
  color: var(--dim);
}

.site-footer a { color: var(--gold); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
::selection { background: #ff8a3d; color: #2a100a; }

.is-shaking { animation: shake 0.4s linear; }

@keyframes shake {
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

@media (max-width: 520px) {
  .score-row { align-items: flex-start; }
  .stamp { font-size: 1.05rem; }
  .dial { width: 108px; height: 108px; }
  .dial-hole { width: 82px; height: 82px; }
  .dial-hole strong { font-size: 2rem; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .composer { position: static; }
  .site-header { padding-top: 1.5rem; }
  .logo { width: 42px; height: 42px; }
  .composer-bar { align-items: stretch; flex-direction: column; }
  .roast-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
