:root {
  color-scheme: light;
  --paper: #f7f3e9;
  --paper-deep: #eee8d9;
  --ink: #171817;
  --ink-soft: #62655e;
  --blue: #3b5bff;
  --cyan: #65d9ec;
  --rule: #cfccbf;
  --mono: "Jitters Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --round-mono: "Jitters Display", "Syne", "Arial Black", Arial, sans-serif;
  --note-speed: #dff5f8;
  --note-size: #e9f2de;
  --note-hedge: #fff1bf;
  --note-quality: #e4e8ff;
  --note-open: #fde2e4;
}

@font-face { font-family: "Jitters Display"; src: url("../assets/fonts/syne-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Jitters Mono"; src: url("../assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jitters Mono"; src: url("../assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Jitters Mono"; src: url("../assets/fonts/jetbrains-mono-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button, textarea { font: inherit; }

.page-shell {
  width: min(1440px, 100% - 80px);
  margin: 0 auto;
}

.masthead {
  padding: 54px 0 38px;
  border-bottom: 1px solid var(--rule);
}

.eyebrow, .live-label, .character-tag, .sweat-label-row, .page-footer {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
}

.eyebrow { margin: 0 0 17px; color: var(--blue); }

h1 {
  max-width: 900px;
  margin: 0;
  font-family: var(--round-mono);
  font-size: clamp(42px, 6vw, 84px);
  line-height: .96;
  letter-spacing: -.045em;
  font-weight: 800;
}

h1 span { color: var(--blue); }

.intro { margin: 20px 0 0; color: var(--ink-soft); font-family: var(--mono); font-size: 16px; line-height: 1.5; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  gap: clamp(28px, 5vw, 76px);
  padding: 36px 0 44px;
}

.editor-panel { min-width: 0; }
.section-heading, .findings-heading, .panel-topline, .sweat-label-row, .editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h2 { margin: 0; font-family: var(--round-mono); font-size: 19px; letter-spacing: -.02em; }
.live-label { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 10px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #69a36c; box-shadow: 0 0 0 3px #69a36c22; }

textarea {
  display: block;
  width: 100%;
  min-height: 310px;
  margin-top: 13px;
  padding: 20px 21px;
  resize: vertical;
  border: 1px solid var(--rule);
  border-radius: 4px;
  outline: 0;
  background: #fffdf8;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.75;
  transition: border-color .18s ease, box-shadow .18s ease;
}

textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #3b5bff18; }
textarea::placeholder { color: #99998f; }

.editor-footer { align-items: flex-start; padding: 12px 0 31px; }
.editor-footer p { margin: 4px 0 0; color: var(--ink-soft); font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.sample-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--blue);
  border-radius: 3px;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.sample-button span { margin-left: 8px; font-size: 17px; }
.sample-button:hover, .sample-button:focus-visible { background: var(--blue); color: white; }

.findings-heading { padding: 14px 0 12px; border-top: 1px solid var(--rule); }
.hit-count { color: var(--ink-soft); font-family: var(--mono); font-size: 12px; }
.empty-message { margin: 0; padding: 13px 0; color: var(--ink-soft); font-family: var(--mono); font-style: italic; font-size: 13px; }
.hit-list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 9px; margin: 0; padding: 2px 0 6px; list-style: none; }
.hit-list li { flex: 1 1 230px; max-width: 360px; }
.hit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: baseline;
  width: 100%;
  padding: 9px 12px 10px;
  border: 0;
  border-radius: 2px;
  background: var(--note, #fffdf8);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 0 #1a1a1722, 0 7px 14px -9px #1a1a1733;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .14s ease, box-shadow .14s ease;
}
.hit-row:hover, .hit-row:focus-visible { transform: rotate(0deg) translateY(-2px) scale(1.03); box-shadow: 0 1px 0 #1a1a1722, 0 12px 18px -10px #1a1a1755; outline: 2px solid var(--blue); outline-offset: 2px; z-index: 1; position: relative; }
.hit-list li:nth-child(3n+1) .hit-row { --tilt: -1.4deg; }
.hit-list li:nth-child(3n+2) .hit-row { --tilt: 1deg; }
.hit-list li:nth-child(4n+3) .hit-row { --tilt: -.6deg; }
.hit-list li:nth-child(5n) .hit-row { --tilt: 1.8deg; }
.hit-row[data-category="speed"] { --note: var(--note-speed); }
.hit-row[data-category="size and effort"] { --note: var(--note-size); }
.hit-row[data-category="hedge"] { --note: var(--note-hedge); }
.hit-row[data-category="quality"] { --note: var(--note-quality); }
.hit-row[data-category="open end"] { --note: var(--note-open); }
.hit-term { color: var(--ink); font-family: var(--round-mono); font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1; overflow-wrap: anywhere; text-decoration: underline wavy var(--blue); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.hit-term { overflow-wrap: break-word; }
.hit-category { padding: 0; border-radius: 0; background: none; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.hit-question { grid-column: 1 / -1; color: var(--ink-soft); font-family: var(--mono); font-size: 12px; line-height: 1.45; }

.jitters-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 570px;
  padding: 20px 22px 18px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #eee9dc;
}
.panel-topline { position: relative; z-index: 2; }
.character-tag { color: var(--ink-soft); font-size: 9px; }
.character-stage { position: relative; display: grid; flex: 1; min-height: 335px; place-items: center; }
.jitters-image { position: relative; z-index: 1; width: min(100%, 390px); height: auto; object-fit: contain; filter: drop-shadow(0 14px 0 #1a1a1712); }
.sweat-drop { position: absolute; z-index: 2; width: 12px; height: 18px; border-radius: 70% 35% 65% 40%; background: var(--cyan); opacity: 0; transform: translateY(-12px) rotate(30deg); }
.drop-one { top: 21%; left: 25%; }
.drop-two { top: 31%; right: 19%; width: 9px; height: 14px; }
.drop-three { top: 45%; left: 15%; width: 8px; height: 12px; }
.drop-four { top: 18%; right: 34%; width: 10px; height: 15px; }
.drop-five { top: 39%; right: 12%; width: 11px; height: 16px; }
.sweat-drop.is-visible { opacity: .95; animation: sweat-fall 1.6s ease-in infinite; }
.drop-two.is-visible { animation-delay: -.5s; }
.drop-three.is-visible { animation-delay: -.9s; }
.drop-four.is-visible { animation-delay: -.25s; }
.drop-five.is-visible { animation-delay: -.75s; }
@keyframes sweat-fall { 0% { transform: translateY(-13px) rotate(30deg); } 70% { opacity: .95; } 100% { transform: translateY(28px) rotate(40deg); opacity: 0; } }
.jitters-panel[data-level="4"] .jitters-image, .jitters-panel[data-level="5"] .jitters-image { animation: jitters-shake .12s linear infinite alternate; }
@keyframes jitters-shake { from { transform: rotate(-1deg) translateX(-1px); } to { transform: rotate(1deg) translateX(1px); } }

.sweat-readout { padding: 16px 0 0; border-top: 1px solid #c9c3b5; }
.sweat-label-row { color: var(--ink-soft); font-size: 10px; }
.sweat-label-row strong { color: var(--ink); font-family: var(--mono); font-size: 21px; }
.scale-max { color: var(--ink-soft); font-family: var(--mono); font-size: 12px; }
.sweat-meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 11px; }
.sweat-meter span { height: 7px; border-radius: 1px; background: #d1cbbb; transition: background .2s ease; }
.sweat-meter span.is-active { background: var(--cyan); }
.verdict { min-height: 26px; margin: 13px 0 0; font-family: var(--round-mono); font-size: 17px; font-weight: 800; line-height: 1.3; letter-spacing: -.02em; }
.nervous-note { margin: 14px 0 0; color: var(--ink-soft); font-family: var(--mono); font-style: italic; font-size: 12px; }

.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 17px 0 23px; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: 9px; }
.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: 760px) {
  .page-shell { width: min(100% - 36px, 600px); }
  .masthead { padding: 34px 0 25px; }
  .eyebrow { margin-bottom: 14px; font-size: 9px; }
  h1 { font-size: clamp(38px, 11vw, 58px); line-height: .98; letter-spacing: -.04em; }
  .intro { max-width: 360px; margin-top: 15px; font-size: 14px; line-height: 1.5; }
  .workspace { grid-template-columns: 1fr; gap: 24px; padding: 23px 0 28px; }
  .jitters-panel { grid-row: 2; min-height: 440px; padding: 16px; }
  .character-stage { min-height: 265px; }
  .jitters-image { width: min(100%, 310px); }
  .editor-footer { flex-wrap: wrap; gap: 9px; padding-bottom: 22px; }
  .editor-footer p { flex: 1 1 160px; }
  .sample-button { flex: 0 0 auto; }
  textarea { min-height: 265px; padding: 15px; font-size: 13px; }
  .hit-list li { flex: 1 1 160px; max-width: 100%; }
  .hit-row { grid-template-columns: 1fr; gap: 5px; }
  .hit-category { justify-self: start; }
  .hit-term { font-size: 17px; }
  .page-footer { font-size: 8px; }
}

@media (max-width: 390px) {
  .page-shell { width: calc(100% - 28px); }
  .sample-button { width: 100%; }
  .hit-list { gap: 10px 7px; }
  .hit-list li { flex: 1 1 150px; }
  .hit-row { padding: 8px 10px 9px; }
  .hit-term { font-size: 17px; }
  .page-footer { flex-direction: column; gap: 7px; }
}

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

/* Jitters stays in view while the list of fuzzy bits grows, and his drops sit on his head, not the panel. */
.masthead { padding: 34px 0 24px; }
h1 { font-size: clamp(36px, 4.2vw, 60px); max-width: 1100px; }
.workspace { align-items: start; padding-top: 26px; }
.jitters-panel { position: sticky; top: 16px; min-height: 0; }
.character-stage { display: block; flex: none; width: min(100%, 360px); min-height: 0; margin: 8px auto 14px; }
.jitters-image { display: block; width: 100%; }
.drop-one { top: 24%; left: 24%; }
.drop-two { top: 30%; right: 22%; }
.drop-three { top: 40%; left: 19%; }
.drop-four { top: 14%; right: 36%; }
.drop-five { top: 38%; right: 17%; }

@media (max-width: 760px) {
  .workspace { gap: 16px; }
  .jitters-panel { grid-row: 1; top: 0; z-index: 5; display: grid; grid-template-columns: 112px 1fr; gap: 0 14px; align-items: center; padding: 10px 12px; box-shadow: 0 6px 14px #1a1a1714; }
  .panel-topline, .nervous-note { display: none; }
  .character-stage { width: 112px; margin: 0; }
  .jitters-image { width: 100%; }
  .sweat-readout { padding: 0; border-top: 0; }
  .verdict { margin-top: 8px; font-size: 14px; min-height: 0; }
}
