:root {
  --paper: #f4efdf;
  --ink: #171713;
  --muted: #625e52;
  --red: #e24a2a;
  --yellow: #f3c746;
  --line: #292820;
  --panel: rgba(255, 253, 244, 0.72);
  --shadow: 8px 8px 0 var(--ink);
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(23, 23, 19, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 19, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 15% 8%, rgba(226, 74, 42, 0.12), transparent 28rem);
  background-size: 24px 24px, 24px 24px, auto;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 28px;
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 24px;
  border-bottom: 4px solid var(--ink);
}

.eyebrow,
.section-number,
.label,
.case-tab,
.footer-mark {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-block;
  padding: 6px 9px;
  color: var(--paper);
  background: var(--ink);
}

h1 {
  max-width: 820px;
  margin: 16px 0 0;
  font-size: clamp(2.8rem, 7.5vw, 6.9rem);
  line-height: 0.88;
  letter-spacing: -0.075em;
  text-transform: uppercase;
}

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

.stamp {
  flex: 0 0 190px;
  margin-top: 4px;
  padding: 13px 12px 11px;
  color: var(--red);
  border: 4px double var(--red);
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(2.5deg);
}

.stamp span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

.ip-dossier {
  position: relative;
  margin-top: 38px;
  padding: 48px clamp(22px, 5vw, 62px) 34px;
  border: 3px solid var(--ink);
  background: var(--yellow);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ip-dossier::after {
  position: absolute;
  right: -35px;
  bottom: -58px;
  width: 190px;
  height: 190px;
  border: 26px solid rgba(23, 23, 19, 0.08);
  border-radius: 50%;
  content: "";
}

.case-tab {
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px 12px;
  color: var(--paper);
  background: var(--ink);
}

.ip-display-wrap {
  position: relative;
  z-index: 1;
}

.label {
  color: #494022;
}

.ip-address {
  max-width: 100%;
  margin: 12px 0 10px;
  font-family: var(--mono);
  font-size: clamp(2rem, 7vw, 5.8rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.07em;
  overflow-wrap: anywhere;
}

.ip-address.is-loading {
  animation: blink 0.9s steps(2, end) infinite;
}

.loading-note {
  margin: 0;
  color: #4d4327;
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 700;
}

.actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  min-height: 46px;
  padding: 11px 16px;
  color: var(--ink);
  border: 2px solid var(--ink);
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--mono);
  font-size: 0.77rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.button-primary {
  color: var(--paper);
  background: var(--ink);
}

.button:hover:not(:disabled) {
  background: var(--red);
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

.button:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.button:focus-visible {
  outline: 4px solid white;
  outline-offset: 3px;
}

.button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.verdict-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 26px;
  margin-top: 48px;
}

.verdict-card,
.details-card {
  border: 3px solid var(--ink);
  background: var(--panel);
}

.verdict-card {
  display: flex;
  flex-direction: column;
  min-height: 430px;
  padding: clamp(24px, 4vw, 40px);
}

.section-number {
  color: var(--red);
}

.verdict-card h2,
.fine-print h2 {
  margin: 20px 0 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.roast-copy {
  margin: 24px 0 36px;
  color: #39372f;
  font-size: clamp(1.08rem, 2vw, 1.42rem);
  font-weight: 650;
  line-height: 1.48;
}

.meter {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.meter-track {
  height: 14px;
  margin: 8px 0;
  border: 2px solid var(--ink);
  background: transparent;
}

.meter-fill {
  width: 97%;
  height: 100%;
  background: repeating-linear-gradient(135deg, var(--red) 0 8px, var(--ink) 8px 16px);
}

.details-card {
  padding: clamp(24px, 4vw, 40px);
}

.details-list {
  margin: 22px 0 0;
  border-top: 2px solid var(--ink);
}

.details-list > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.65fr) minmax(0, 1.35fr);
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(23, 23, 19, 0.48);
}

.details-list dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.details-list dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.91rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.fine-print {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 50px;
  margin-top: 32px;
  padding: 32px 0;
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.fine-print h2 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
}

.fine-print > p {
  margin: 0;
  color: #403e35;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.72;
}

footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding: 23px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

footer p {
  margin: 0;
}

.footer-mark {
  color: var(--ink);
  text-align: right;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 44px));
  padding: 14px 16px;
  color: var(--paper);
  border: 2px solid var(--ink);
  background: var(--red);
  box-shadow: 5px 5px 0 var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes blink {
  50% { opacity: 0.42; }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 720px);
    padding-top: 18px;
  }

  .masthead {
    display: block;
  }

  .stamp {
    width: 180px;
    margin-top: 24px;
  }

  .verdict-grid,
  .fine-print {
    grid-template-columns: 1fr;
  }

  .fine-print {
    gap: 22px;
  }

  footer {
    display: grid;
  }

  .footer-mark {
    text-align: left;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: clamp(2.7rem, 15vw, 4.2rem);
  }

  .ip-dossier {
    box-shadow: 5px 5px 0 var(--ink);
  }

  .ip-address {
    font-size: clamp(1.65rem, 11vw, 3rem);
    letter-spacing: -0.065em;
  }

  .actions,
  .button {
    width: 100%;
  }

  .details-list > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

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