:root {
  --ink: #17130f;
  --paper: #f2e7cf;
  --paper-light: #fffaf0;
  --paper-dark: #d9c49d;
  --pink: #f45bab;
  --pink-dark: #cf347f;
  --orange: #f58b3a;
  --bean: #b87549;
  --green: #51b96b;
  --shadow: 9px 9px 0 var(--ink);
  --border: 3px solid var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(23, 19, 15, 0.12) 0.7px, transparent 0.7px);
  background-size: 8px 8px;
  font-family: "Arial Narrow", "Franklin Gothic Medium", Arial, sans-serif;
  line-height: 1.4;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 4px solid var(--orange);
  outline-offset: 3px;
}

.page-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-right: 1px solid rgba(23, 19, 15, 0.16);
  border-left: 1px solid rgba(23, 19, 15, 0.16);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px clamp(20px, 4vw, 58px);
  border-bottom: var(--border);
  background: var(--paper-light);
}

.wordmark {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-size: clamp(1.1rem, 2.2vw, 1.55rem);
  font-weight: 950;
  letter-spacing: -0.045em;
  text-decoration: none;
}

.wordmark-dot {
  width: 19px;
  height: 19px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 3px 3px 0 var(--ink);
}

.header-tag {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.header-nav {
  display: flex;
  gap: 9px;
  align-items: center;
}

.header-nav a {
  padding: 8px 12px 7px;
  border: 2px solid var(--ink);
  background: var(--paper-light);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-decoration: none;
  white-space: nowrap;
}

.header-nav a:hover {
  background: var(--orange);
}

.hero {
  display: grid;
  grid-template-columns: minmax(330px, 0.82fr) minmax(490px, 1.18fr);
  gap: clamp(28px, 5vw, 78px);
  align-items: center;
  min-height: calc(100vh - 72px);
  padding: clamp(36px, 6vw, 84px) clamp(20px, 4vw, 58px);
  overflow: hidden;
}

.character-panel {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 15px;
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow span {
  display: inline-block;
  margin-right: 7px;
  padding: 3px 7px 2px;
  color: white;
  background: var(--pink-dark);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-2deg);
}

h1 {
  max-width: 710px;
  margin: 0;
  font-size: clamp(2.7rem, 5.2vw, 5.9rem);
  font-weight: 950;
  letter-spacing: -0.07em;
  line-height: 0.88;
  text-wrap: balance;
}

.intro-copy {
  max-width: 570px;
  margin: 25px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  line-height: 1.55;
}

.character-stage {
  position: relative;
  height: clamp(250px, 30vw, 410px);
  margin-top: 9px;
}

.spotlight {
  position: absolute;
  top: 2%;
  left: 50%;
  width: 75%;
  aspect-ratio: 1;
  border: 3px dashed rgba(23, 19, 15, 0.42);
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.58);
  transform: translateX(-50%);
}

.roastie-art {
  position: absolute;
  z-index: 2;
  right: 5%;
  bottom: -9%;
  width: min(96%, 455px);
  height: auto;
  filter: drop-shadow(11px 11px 0 rgba(23, 19, 15, 0.15));
  transform: rotate(1.5deg);
}

.stage-line {
  position: absolute;
  right: -20%;
  bottom: 2%;
  left: -20%;
  height: 3px;
  background: var(--ink);
  box-shadow: 0 7px 0 rgba(23, 19, 15, 0.12);
}

.burst {
  position: absolute;
  z-index: 3;
  top: 18%;
  right: -2%;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  background: var(--orange);
  box-shadow: 5px 5px 0 var(--ink);
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  transform: rotate(8deg);
}

.chat-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 650px;
  max-height: 770px;
  border: var(--border);
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: var(--border);
  background: #fffdf7;
}

.chat-identity {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mini-avatar,
.message-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--bean);
  color: white;
  font-weight: 950;
  box-shadow: 2px 2px 0 var(--ink);
}

.mini-avatar {
  width: 40px;
  height: 40px;
  font-size: 1.05rem;
}

.chat-identity h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.chat-identity p {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 1px 0 0;
  color: #594f45;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--green);
}

.new-chat-button {
  padding: 8px 10px 7px;
  border: 2px solid var(--ink);
  background: transparent;
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.new-chat-button:hover:not(:disabled) {
  background: var(--ink);
  color: white;
}

.transcript {
  flex: 1;
  min-height: 360px;
  padding: clamp(18px, 3vw, 30px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--ink) var(--paper-dark);
}

.empty-state {
  display: grid;
  min-height: 340px;
  place-content: center;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-kicker {
  width: fit-content;
  margin: 0 auto 14px !important;
  padding: 5px 10px 4px;
  border: 2px solid var(--ink);
  background: var(--pink);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.65rem !important;
  font-weight: 950;
  letter-spacing: 0.14em;
  transform: rotate(-2deg);
}

.empty-state h2 {
  max-width: 460px;
  margin: 0 auto;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  letter-spacing: -0.045em;
  line-height: 1;
  text-wrap: balance;
}

.empty-state > p:not(.empty-kicker) {
  margin: 17px auto 21px;
  color: #695e52;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.prompt-chips button {
  padding: 8px 11px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: white;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.prompt-chips button:hover:not(:disabled) {
  background: var(--orange);
}

.message-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 22px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-avatar {
  width: 33px;
  height: 33px;
  font-size: 0.68rem;
}

.message-row.user .message-avatar {
  background: var(--ink);
  font-size: 0.5rem;
}

.message-bubble {
  max-width: min(80%, 510px);
  padding: 12px 15px 14px;
  border: 2px solid var(--ink);
  background: white;
  box-shadow: 4px 4px 0 var(--ink);
}

.message-row.user .message-bubble {
  background: var(--pink);
}

.speaker-label {
  margin: 0 0 4px;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.message-content {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.96rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.typing-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 0 clamp(18px, 3vw, 30px) 14px;
}

.typing-row[hidden] {
  display: none;
}

.typing-bubble {
  display: flex;
  gap: 5px;
  align-items: center;
  min-width: 62px;
  min-height: 38px;
  padding: 10px 13px;
  border: 2px solid var(--ink);
  background: white;
  box-shadow: 3px 3px 0 var(--ink);
}

.typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  animation: typing 1.15s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) {
  animation-delay: 0.14s;
}

.typing-bubble span:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes typing {
  0%,
  70%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  35% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 16px 8px;
  border-top: var(--border);
  background: #fffdf7;
}

.input-wrap {
  position: relative;
  flex: 1;
}

textarea {
  display: block;
  width: 100%;
  min-height: 56px;
  max-height: 132px;
  padding: 14px 84px 14px 14px;
  resize: none;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: white;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.35;
}

textarea::placeholder {
  color: #776b5e;
}

textarea:disabled {
  background: #e7dfcf;
  cursor: wait;
}

.character-count {
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: #776b5e;
  font-size: 0.57rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.send-button {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.send-button:hover:not(:disabled) {
  background: var(--pink-dark);
}

.send-button:disabled,
.new-chat-button:disabled,
.prompt-chips button:disabled {
  opacity: 0.48;
  cursor: wait;
}

.fine-print,
.chat-status {
  min-height: 17px;
  margin: 0;
  padding: 0 16px 8px;
  background: #fffdf7;
  color: #73675b;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: right;
}

.chat-status {
  min-height: 0;
  padding-bottom: 2px;
  color: #3f382f;
  text-align: left;
}

.chat-status:empty {
  display: none;
}

.chat-status.error {
  color: #9d194f;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 24px clamp(20px, 4vw, 58px);
  border-top: var(--border);
  background: var(--ink);
  color: var(--paper-light);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

footer p {
  margin: 0;
}

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

.noscript-message {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  left: 20px;
  margin: 0;
  padding: 15px;
  border: var(--border);
  background: var(--orange);
  box-shadow: 5px 5px 0 var(--ink);
  font-weight: 900;
  text-align: center;
}

@media (max-width: 1000px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .character-panel {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    column-gap: 20px;
  }

  .eyebrow,
  .character-panel h1,
  .intro-copy {
    grid-column: 1;
  }

  .character-stage {
    grid-column: 2;
    grid-row: 1 / 5;
    align-self: end;
    width: 100%;
    height: 100%;
    min-height: 310px;
    margin: 0;
  }

  .roastie-art {
    right: -8%;
    width: 120%;
  }

  .chat-card {
    min-height: 680px;
  }
}

@media (max-width: 720px) {
  .site-header {
    min-height: 62px;
  }

  .header-tag {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-top: 31px;
  }

  .character-panel {
    display: block;
  }

  .character-stage {
    height: 270px;
    min-height: 0;
    margin: 10px 0 -12px;
  }

  .roastie-art {
    right: 50%;
    width: min(93%, 360px);
    transform: translateX(50%) rotate(1.5deg);
  }

  .burst {
    right: 7%;
  }

  .chat-card {
    min-height: min(690px, 82vh);
    max-height: none;
    box-shadow: 6px 6px 0 var(--ink);
  }

  .composer {
    align-items: stretch;
    flex-direction: column;
  }

  .send-button {
    width: 100%;
  }

  .fine-print {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .site-header {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .header-nav {
    gap: 6px;
  }

  .header-nav a {
    padding: 6px 9px 5px;
    font-size: 0.6rem;
  }

  h1 {
    font-size: clamp(2.6rem, 14vw, 4rem);
  }

  .intro-copy {
    font-size: 0.95rem;
  }

  .character-stage {
    height: 235px;
  }

  .chat-header {
    align-items: flex-start;
  }

  .new-chat-button {
    max-width: 100px;
    line-height: 1.2;
  }

  .transcript {
    min-height: 330px;
    padding: 18px 14px;
  }

  .empty-state {
    min-height: 300px;
  }

  .message-bubble {
    max-width: calc(100% - 42px);
  }

  .typing-row {
    padding-right: 14px;
    padding-left: 14px;
  }

  footer {
    gap: 12px;
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .typing-bubble span {
    animation: none;
  }
}
