:root {
  color-scheme: dark;
  --bg: #030303;
  --surface: rgba(10, 10, 11, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f5f0;
  --muted: #a6a6a0;
  --signal: #e9ff70;
  --danger: #ff5c7a;
  --green: #54ff84;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(115deg, rgba(233, 255, 112, 0.08), transparent 28rem),
    linear-gradient(245deg, rgba(255, 255, 255, 0.06), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

button,
input { font: inherit; }

.app {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 0 72px;
}

.hero {
  display: grid;
  justify-items: center;
  padding: 28px 0 clamp(34px, 6vw, 58px);
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 38px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 760;
}

.brand-mark {
  width: 17px;
  height: 17px;
  border: 2px solid var(--text);
  border-radius: 50%;
  box-shadow: inset 6px 0 0 var(--signal);
}

.kicker {
  margin: 0;
  color: var(--signal);
  font-size: 12px;
  font-weight: 860;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 860;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  margin-top: 14px;
  font-size: clamp(58px, 11vw, 132px);
  line-height: 0.86;
}

h2 {
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.9;
}

.lede {
  max-width: 760px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.22;
}

.panel,
.verdict-card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 70%),
    var(--surface);
}

.panel {
  padding: clamp(18px, 4vw, 34px);
}

#setup-form {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: clamp(18px, 4vw, 34px);
  align-items: start;
}

.setup-copy,
.setup-options,
.field {
  display: grid;
  gap: 12px;
}

.setup-copy {
  justify-items: start;
}

.setup-copy p:not(.kicker) {
  max-width: 30ch;
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 720;
  line-height: 1.32;
}

.field span {
  color: var(--signal);
  font-size: 12px;
  font-weight: 860;
  text-transform: uppercase;
}

.sender-picker {
  display: grid;
  gap: 10px;
}

.sender-picker > span {
  color: var(--signal);
  font-size: 12px;
  font-weight: 860;
  text-transform: uppercase;
}

#sender-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sender-option {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
  font-weight: 820;
  padding: 0 14px;
}

.sender-option.active {
  border-color: rgba(233, 255, 112, 0.76);
  background: rgba(233, 255, 112, 0.14);
  color: var(--signal);
}

.field input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

.upload-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  padding: 7px;
}

.file-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(233, 255, 112, 0.45);
  border-radius: 999px;
  background: rgba(233, 255, 112, 0.12);
  color: var(--signal);
  padding: 0 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 840;
  white-space: nowrap;
}

.file-button input { display: none; }

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 44px;
  width: fit-content;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 780;
  white-space: nowrap;
}

.button-light {
  border: 1px solid #eff2d6;
  background: #f5f7e9;
  color: #11120e;
}

.render-button {
  justify-self: center;
  margin-top: 10px;
}

.status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.results {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.verdict-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: clamp(22px, 5vw, 42px);
}

.verdict-card p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 720;
}

#cooked-score {
  color: var(--danger);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: clamp(64px, 12vw, 138px);
  font-weight: 900;
  line-height: 0.86;
  text-shadow: 0 0 38px rgba(255, 92, 122, 0.28);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 144px;
  align-content: end;
  padding: 18px;
  color: var(--text);
  text-align: left;
}

.avg-reply-card {
  align-content: center;
  gap: 10px;
}

button.stat-card {
  cursor: pointer;
}

.clickable-stat {
  border-color: rgba(233, 255, 112, 0.42);
  box-shadow: 0 0 28px rgba(233, 255, 112, 0.08);
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.clickable-stat:hover {
  border-color: rgba(233, 255, 112, 0.72);
  transform: translateY(-2px);
}

.stat-card span {
  color: var(--signal);
  font-size: 12px;
  font-weight: 860;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.stat-card small,
.breakdown p {
  color: var(--muted);
  font-weight: 720;
}

.reply-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}

.reply-compare div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reply-compare div:last-child {
  justify-items: end;
}

.reply-compare strong {
  font-size: clamp(28px, 4vw, 48px);
}

.reply-compare small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-compare b {
  color: var(--muted);
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 500;
}

.breakdown {
  display: grid;
  gap: 16px;
}

#breakdown-list {
  display: grid;
  gap: 10px;
}

.breakdown-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.breakdown-item strong {
  color: var(--text);
}

.airing-modal {
  width: min(980px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 70%),
    #0a0a0b;
  color: var(--text);
  padding: clamp(20px, 4vw, 34px);
}

.airing-modal::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.modal-close {
  float: right;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.modal-muted {
  color: var(--muted);
  font-weight: 720;
}

.airing-timeline {
  display: grid;
  grid-template-columns: minmax(110px, 150px) 72px minmax(0, 1fr);
  grid-template-rows: auto minmax(150px, 1fr) auto;
  grid-template-areas:
    "start line start-message"
    ". line ."
    "end line end-message";
  gap: 12px 26px;
  align-items: start;
  margin-top: 26px;
}

.timeline-time {
  display: grid;
  justify-items: end;
  line-height: 0.9;
}

.time-start {
  grid-area: start;
}

.time-end {
  grid-area: end;
  align-self: end;
}

.timeline-time strong {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 900;
}

.timeline-time span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 760;
}

.timeline-message {
  display: grid;
  gap: 8px;
}

.timeline-message blockquote,
.first-message-card blockquote {
  margin: 0;
  color: var(--text);
  font-size: clamp(20px, 2.1vw, 30px);
  font-weight: 760;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.timeline-message small,
.first-message-card small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 820;
}

.message-start {
  grid-area: start-message;
}

.message-end {
  grid-area: end-message;
  align-self: end;
}

.timeline-line {
  display: grid;
  grid-area: line;
  justify-items: center;
  position: relative;
  align-self: stretch;
  min-height: 260px;
}

.timeline-line::before {
  width: 5px;
  height: 100%;
  border-radius: 999px;
  background: var(--signal);
  box-shadow: 0 0 24px rgba(233, 255, 112, 0.26);
  content: "";
}

.timeline-line span {
  position: absolute;
  align-self: center;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #0a0a0b;
  color: var(--muted);
  padding: 7px 9px;
  font-size: 18px;
  font-weight: 760;
  white-space: nowrap;
}

.first-message-card {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: clamp(18px, 4vw, 28px);
}

.chat-log {
  display: grid;
  gap: 10px;
  max-height: min(560px, 62vh);
  overflow-y: auto;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    rgba(3, 3, 3, 0.62);
  background-size: 44px 44px;
  padding: 16px;
  scrollbar-color: var(--signal) transparent;
}

.chat-bubble {
  display: grid;
  gap: 6px;
  width: min(76%, 560px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

.chat-bubble.mine {
  justify-self: end;
  border-color: rgba(233, 255, 112, 0.36);
  background: rgba(233, 255, 112, 0.12);
}

.chat-bubble.theirs {
  justify-self: start;
  background: rgba(255, 255, 255, 0.055);
}

.chat-bubble p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.chat-bubble small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

@media (max-width: 900px) {
  #setup-form,
  .verdict-card,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .app {
    width: min(100% - 28px, 1180px);
  }

  h1 {
    font-size: clamp(46px, 16vw, 72px);
  }

  .upload-controls {
    align-items: stretch;
    flex-direction: column;
    border-radius: 18px;
  }

  .airing-timeline {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .timeline-time {
    justify-items: start;
  }

  .time-start,
  .time-end,
  .message-start,
  .message-end,
  .timeline-line {
    grid-column: 1;
    grid-row: auto;
    grid-area: auto;
  }

  .timeline-line {
    min-height: 120px;
    justify-items: start;
    padding-left: 12px;
  }

  .timeline-line span {
    position: static;
    align-self: center;
    transform: none;
    margin-left: 28px;
  }
}
