:root {
  --bg: #f7f1e3;
  --bg-soft: rgba(255, 255, 255, 0.62);
  --ink: #10100d;
  --ink-soft: rgba(16, 16, 13, 0.7);
  --border: rgba(16, 16, 13, 0.12);
  --accent: #d8ff59;
  --accent-soft: rgba(216, 255, 89, 0.22);
  --shadow: 0 30px 80px rgba(16, 16, 13, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(216, 255, 89, 0.38), transparent 28%),
    radial-gradient(circle at 82% 24%, rgba(255, 120, 74, 0.16), transparent 24%),
    linear-gradient(180deg, #fbf7ed 0%, var(--bg) 100%);
}

body.modal-open {
  overflow: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(16, 16, 13, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 16, 13, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 95%);
  pointer-events: none;
}

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: min(1120px, calc(100% - 32px));
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 0 18px;
}

.masthead,
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.brand-mark,
.console-top,
.footer {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-mark,
.footer,
.console-top {
  color: var(--ink-soft);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: fit-content;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.1em;
  color: var(--ink);
}

.support-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid rgba(16, 16, 13, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), transparent 38%),
    linear-gradient(135deg, #ffe269 0%, #ffd400 54%, #ffef9e 100%);
  box-shadow:
    0 16px 32px rgba(255, 212, 0, 0.2),
    0 8px 16px rgba(16, 16, 13, 0.08);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.support-button:hover,
.support-button:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 22px 38px rgba(255, 212, 0, 0.24),
    0 10px 18px rgba(16, 16, 13, 0.1);
  filter: saturate(1.05);
}

.support-button:active {
  transform: translateY(0);
}

.support-button__icon {
  width: 28px;
  height: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.9fr);
  gap: clamp(28px, 5vw, 72px);
  min-width: 0;
  align-items: center;
  flex: 1;
  padding: clamp(32px, 7vw, 68px) 0;
}

.intro {
  min-width: 0;
  max-width: 34rem;
}

.intro h1 {
  max-width: 8.2ch;
  margin: 0 0 14px;
  font-size: clamp(2.9rem, 7.2vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
  text-wrap: balance;
}

.lede {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(0.98rem, 1.4vw, 1.06rem);
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: balance;
}

.console {
  position: relative;
  min-width: 0;
  max-width: 100%;
  padding: clamp(20px, 3.2vw, 28px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.console-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.console-top p,
.console-top label,
.footer p {
  margin: 0;
}

.input-row {
  display: block;
  align-items: end;
  margin: 18px 0 18px;
}

#characterInput {
  width: 100%;
  border: 0;
  border-bottom: 2px solid rgba(16, 16, 13, 0.45);
  padding: 10px 2px 14px;
  color: var(--ink);
  background: transparent;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(0.92rem, 1.7vw, 1.3rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  outline: none;
}

#characterInput:focus {
  border-bottom-color: var(--ink);
}

#characterInput::placeholder {
  color: rgba(16, 16, 13, 0.34);
}

.response {
  position: relative;
  overflow: hidden;
  max-width: 100%;
  padding: 18px 18px 20px;
  border-radius: 22px;
  color: var(--bg);
  background:
    linear-gradient(150deg, rgba(216, 255, 89, 0.16), transparent 30%),
    var(--ink);
}

.response::after {
  position: absolute;
  inset: auto -10% -42% auto;
  width: 220px;
  height: 220px;
  content: "";
  border-radius: 999px;
  background: radial-gradient(circle, rgba(216, 255, 89, 0.24), transparent 70%);
  pointer-events: none;
}

.response-meta {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 241, 227, 0.72);
}

#leadCharacter {
  color: var(--accent);
  font-size: 1rem;
}

#roastLine,
#subLine,
.roast-line-row {
  position: relative;
  z-index: 1;
}

.roast-line-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 14px 0 12px;
}

#roastLine {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.05em;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    filter 180ms ease;
}

#subLine {
  max-width: 34ch;
  margin: 0;
  color: rgba(247, 241, 227, 0.7);
  font-size: 0.98rem;
  line-height: 1.5;
}

.reroll-button[hidden] {
  display: none;
}

.reroll-button {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(216, 255, 89, 0.28);
  border-radius: 999px;
  color: var(--accent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 45%),
    rgba(216, 255, 89, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.reroll-button:hover,
.reroll-button:focus-visible {
  transform: translateY(-1px) rotate(18deg);
  border-color: rgba(216, 255, 89, 0.54);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 24px rgba(0, 0, 0, 0.24);
}

.reroll-button:active {
  transform: rotate(42deg);
}

.reroll-button__icon {
  width: 20px;
  height: 20px;
}

.share-callout[hidden] {
  display: none;
}

.share-callout {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(247, 241, 227, 0.12);
}

.share-callout p {
  max-width: 26ch;
  margin: 0;
  color: rgba(247, 241, 227, 0.78);
  font-size: 0.94rem;
  line-height: 1.45;
}

#shareButton {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(216, 255, 89, 0.32);
  border-radius: 999px;
  color: var(--accent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 45%),
    rgba(216, 255, 89, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.22);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

#shareButton:hover,
#shareButton:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(216, 255, 89, 0.54);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 24px rgba(0, 0, 0, 0.24);
}

#shareButton:active {
  transform: translateY(0);
}

#shareButton:disabled {
  opacity: 0.7;
  cursor: wait;
}

.response.is-flashing {
  animation: pulse 260ms ease;
}

.response.is-idle-swapping #roastLine {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(5px);
}

.support-modal[hidden] {
  display: none;
}

.support-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.support-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 16, 13, 0.34);
  backdrop-filter: blur(12px);
}

.support-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background:
    radial-gradient(circle at 20% 18%, rgba(216, 255, 89, 0.14), transparent 28%),
    radial-gradient(circle at 82% 26%, rgba(255, 120, 74, 0.12), transparent 24%),
    rgba(255, 255, 255, 0.82);
  box-shadow: 0 34px 90px rgba(16, 16, 13, 0.2);
  backdrop-filter: blur(18px);
}

.support-dialog__close,
.support-dialog__kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.support-dialog__close {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 0;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.support-dialog__kicker {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.support-dialog h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.support-dialog__copy {
  max-width: 28ch;
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.support-dialog__qr-shell {
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid rgba(16, 16, 13, 0.1);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.84);
}

.support-dialog__qr-shell img {
  display: block;
  width: 100%;
  height: auto;
}

.support-dialog__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  width: 100%;
  padding: 0 20px;
  border: 1px solid rgba(16, 16, 13, 0.16);
  border-radius: 999px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), transparent 38%),
    linear-gradient(135deg, #d8ff59 0%, #c7f74b 42%, #f2ffb0 100%);
  box-shadow:
    0 16px 32px rgba(182, 220, 53, 0.28),
    0 8px 16px rgba(16, 16, 13, 0.08);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.support-dialog__link:hover,
.support-dialog__link:focus-visible {
  transform: translateY(-1px);
}

.footer {
  min-width: 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

@keyframes pulse {
  0% {
    transform: scale(0.985);
  }

  60% {
    transform: scale(1.01);
  }

  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  #roastLine,
  #shareButton,
  .reroll-button,
  .support-button,
  .response.is-flashing {
    transition: none;
    animation: none;
  }
}

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

  .intro {
    max-width: none;
  }

  .intro h1 {
    max-width: 7ch;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(1200px, calc(100% - 24px));
    padding-top: 16px;
  }

  .hero {
    padding: 24px 0 40px;
  }

  .footer,
  .console-top,
  .input-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .console-top,
  .footer {
    gap: 10px;
  }

  .masthead {
    justify-content: space-between;
  }

  .brand-mark {
    padding: 10px 14px;
    font-size: 0.72rem;
  }

  .support-button {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  #characterInput {
    font-size: 0.96rem;
  }

  .roast-line-row {
    align-items: center;
    gap: 10px;
  }

  #roastLine {
    max-width: 100%;
    font-size: clamp(1.6rem, 10vw, 2.6rem);
  }

  .reroll-button {
    width: 38px;
    height: 38px;
  }

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

  .share-callout p,
  #shareButton {
    width: 100%;
  }

  .lede {
    max-width: 24ch;
  }

  .footer p,
  .console-top p,
  .console-top label {
    overflow-wrap: anywhere;
  }

  .support-dialog {
    width: min(100%, 390px);
    padding: 18px;
  }
}
