:root {
  --ink: #101820;
  --muted: #66717d;
  --line: #d7dfdc;
  --paper: #f6f8f3;
  --panel: #ffffff;
  --panel-soft: #f8faf7;
  --red: #e9553f;
  --teal: #109c8e;
  --yellow: #f5be32;
  --blue: #315f91;
  --green: #3c9f65;
  --violet: #8655a7;
  --orange: #dd7c32;
  --shadow: 0 18px 40px rgba(16, 24, 32, 0.08);
  --shadow-strong: 0 22px 56px rgba(16, 24, 32, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 24, 32, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(16, 24, 32, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, #f8faf4 0%, #eef4f0 46%, #f9f7ee 100%);
  background-size: 44px 44px, 44px 44px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.dialog-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.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;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid rgba(16, 24, 32, 0.08);
  background: rgba(246, 248, 243, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 900;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
}

.brand-mark svg,
.icon-btn svg,
.global-search svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 29px;
  height: 29px;
  stroke: var(--ink);
  stroke-width: 3;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav a {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 780;
  text-decoration: none;
}

.nav a:hover {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: clamp(24px, 4vw, 40px);
  align-items: center;
  min-height: calc(100svh - 72px);
  padding: clamp(34px, 7vw, 84px) 0 42px;
}

.hero-copy {
  display: grid;
  gap: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 0;
  font-size: clamp(3.5rem, 10vw, 7.6rem);
  line-height: 0.9;
  font-weight: 950;
}

.lead-copy {
  max-width: 820px;
  margin-bottom: 4px;
  color: #25313c;
  font-size: clamp(1.05rem, 2.1vw, 1.35rem);
  line-height: 1.55;
}

.global-search {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(860px, 100%);
  min-height: 66px;
  padding: 8px;
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 8px 8px 0 rgba(16, 24, 32, 0.9);
}

.global-search svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.4;
}

.search-icon {
  margin-left: 10px;
  color: var(--teal);
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 730;
}

.global-search button,
.primary-btn,
.ghost-btn,
.small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 880;
}

.global-search button,
.primary-btn {
  min-height: 48px;
  border: 0;
  color: white;
  background: var(--ink);
}

.global-search button {
  min-width: 132px;
}

.global-search button:hover,
.primary-btn:hover {
  background: #253443;
}

.ghost-btn,
.small-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.ghost-btn:hover,
.small-btn:hover {
  border-color: var(--ink);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-links a,
.filter-group button {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #25303a;
  font-size: 0.92rem;
  font-weight: 840;
  text-decoration: none;
}

.quick-links a:hover,
.filter-group button.active,
.filter-group button:hover {
  border-color: var(--ink);
  background: var(--yellow);
}

.hero-panel,
.tool-panel,
.code-status,
.search-results,
.detail-dialog,
.rebirth-tools,
.brainrot-card,
.guide-grid article,
.faq details,
.mutation-chip,
.saved-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel {
  overflow: hidden;
  display: grid;
  gap: 0;
  border: 1px solid rgba(16, 24, 32, 0.16);
  box-shadow: var(--shadow-strong);
}

.hero-art {
  margin: 0;
  background: linear-gradient(180deg, #152538 0%, #183649 36%, #eff5ec 100%);
}

.hero-art img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-top: 1px solid rgba(16, 24, 32, 0.08);
  border-bottom: 1px solid rgba(16, 24, 32, 0.08);
  background: #101820;
  color: white;
}

.panel-top span,
.panel-top strong {
  font-size: 0.88rem;
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.live-stats div {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(245, 190, 50, 0.14), transparent 62%),
    white;
}

.live-stats div:last-child {
  border-right: 0;
}

.live-stats span {
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1;
  font-weight: 950;
}

.live-stats small,
.answer-strip p {
  color: var(--muted);
  font-weight: 730;
  line-height: 1.45;
}

.answer-strip {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: #fbfcf8;
}

.answer-strip p {
  margin: 0;
}

.search-results {
  display: none;
  gap: 12px;
  margin: 0 0 54px;
  padding: 18px;
}

.search-results.active {
  display: grid;
}

.search-results h2 {
  margin: 0;
  font-size: 1.35rem;
}

.hit-list {
  display: grid;
  gap: 8px;
}

.hit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
}

.hit b {
  display: block;
}

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

.section-head,
.controls,
.brainrot-grid,
.tool-grid,
.rebirth-tools,
.rebirth-table-wrap,
.mutation-list,
.codes,
.guide-band,
.faq,
.sources {
  margin-top: 74px;
}

.section-head {
  max-width: 860px;
}

.section-head.tight {
  margin: 0;
}

.section-head h2,
.guide-band h2,
.faq h2 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.section-head p,
.sources p,
.faq p {
  color: var(--muted);
  line-height: 1.65;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(150px, 190px));
  gap: 14px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

select,
input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 780;
}

.result-meta {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 760;
}

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

.brainrot-card {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 330px;
  padding: 18px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(16, 24, 32, 0.08);
}

.brainrot-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: var(--accent, var(--ink));
}

.brainrot-card.saved {
  border-color: rgba(16, 24, 32, 0.42);
  box-shadow: 6px 6px 0 rgba(16, 24, 32, 0.12);
}

.brainrot-card.rarity-Common {
  --accent: var(--green);
}

.brainrot-card.rarity-Rare {
  --accent: var(--teal);
}

.brainrot-card.rarity-Epic {
  --accent: var(--blue);
}

.brainrot-card.rarity-Legendary {
  --accent: var(--red);
}

.brainrot-card.rarity-Mythic {
  --accent: var(--violet);
}

.brainrot-card.rarity-BrainrotGod,
.brainrot-card.rarity-Secret {
  --accent: var(--ink);
}

.brainrot-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.brainrot-top h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.16;
}

.pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: white;
  font-size: 0.72rem;
  font-weight: 950;
}

.pill.Common {
  background: var(--green);
}

.pill.Rare {
  background: var(--teal);
}

.pill.Epic {
  background: var(--blue);
}

.pill.Legendary {
  background: var(--red);
}

.pill.Mythic {
  background: var(--violet);
}

.pill.BrainrotGod,
.pill.Secret {
  background: var(--ink);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  display: grid;
  gap: 3px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.metric span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric strong {
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.card-note {
  margin: 0;
  color: #33414e;
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.tag-row span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #34414e;
  background: #f8faf8;
  font-size: 0.76rem;
  font-weight: 790;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.tool-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px;
}

.saved-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.saved-summary div,
.result-box {
  display: grid;
  gap: 4px;
  min-height: 100px;
  padding: 16px;
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff8d5 0%, #fff3a5 100%);
}

.saved-summary span,
.result-box span {
  color: rgba(16, 24, 32, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.saved-summary strong,
.result-box strong {
  font-size: clamp(1.45rem, 3.6vw, 2.55rem);
  line-height: 1;
}

.result-box small {
  color: #26323d;
  font-weight: 820;
}

.saved-list {
  display: grid;
  gap: 8px;
}

.saved-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fbfcf8;
}

.saved-item b {
  display: block;
}

.saved-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.calc-form,
.rebirth-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.calc-form .result-box,
.rebirth-tools .result-box {
  grid-column: 1 / -1;
}

.rebirth-tools {
  padding: 20px;
  background: white;
  box-shadow: var(--shadow);
}

.rebirth-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.rebirth-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.rebirth-table th,
.rebirth-table td {
  padding: 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rebirth-table th {
  background: var(--ink);
  color: white;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.rebirth-table td {
  color: #273441;
  font-size: 0.94rem;
  line-height: 1.45;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 780;
}

.check-list input {
  width: 18px;
  height: 18px;
}

.status-good {
  color: #1d7c4d;
  font-weight: 900;
}

.status-warn {
  color: #a8561b;
  font-weight: 900;
}

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

.mutation-chip {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(16, 24, 32, 0.06);
}

.mutation-chip strong {
  font-size: 1.05rem;
}

.mutation-chip span {
  color: var(--teal);
  font-size: 1.6rem;
  font-weight: 950;
}

.mutation-chip small {
  color: var(--muted);
  font-weight: 740;
  line-height: 1.45;
}

.codes {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 0.72fr);
  gap: 24px;
  align-items: start;
  padding-top: 28px;
  border-top: 2px solid var(--ink);
}

.code-status {
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid rgba(16, 24, 32, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbf6 100%);
}

.code-status span,
.code-status small {
  color: var(--muted);
  font-weight: 820;
  line-height: 1.45;
}

.code-status strong {
  color: var(--red);
  font-size: clamp(3rem, 8vw, 5.4rem);
  line-height: 1;
}

.guide-band,
.faq,
.sources {
  padding: 34px 0;
  border-top: 2px solid var(--ink);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.guide-grid article,
.faq details {
  box-shadow: var(--shadow);
}

.guide-grid article {
  min-height: 172px;
  padding: 18px;
}

.guide-grid h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.guide-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.faq-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.faq details {
  padding: 16px 18px;
  background: white;
}

.faq summary {
  font-weight: 900;
  cursor: pointer;
}

.faq details p {
  margin: 12px 0 0;
}

.sources {
  border-bottom: 0;
}

.sources h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.sources ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.sources a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--blue);
  font-weight: 830;
  text-decoration: none;
}

.detail-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(760px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
}

.detail-dialog::backdrop {
  background: rgba(16, 24, 32, 0.46);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 3px 0 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1;
}

.icon-btn {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.icon-btn svg {
  width: 23px;
  height: 23px;
  stroke-width: 2.4;
}

.detail-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.detail-note {
  margin: 0;
  color: #273441;
  line-height: 1.6;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(18px, 5vw, 64px);
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  font-size: 0.9rem;
  font-weight: 780;
}

@media (max-width: 1040px) {
  .hero,
  .tool-grid,
  .codes {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .brainrot-grid,
  .mutation-list,
  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    background-size: 34px 34px, 34px 34px, auto;
  }

  main {
    width: min(100% - 24px, 1180px);
  }

  .topbar,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: sticky;
    gap: 12px;
    min-height: auto;
    padding: 12px;
  }

  .nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 10px;
    font-size: 0.88rem;
  }

  .hero {
    gap: 24px;
    min-height: auto;
    padding: 24px 0 34px;
  }

  h1 {
    max-width: 15ch;
    font-size: clamp(2.35rem, 11vw, 3.2rem);
    line-height: 0.98;
  }

  .lead-copy {
    font-size: 0.98rem;
  }

  .hero-panel {
    box-shadow: 0 14px 28px rgba(16, 24, 32, 0.1);
  }

  .hero-art img {
    aspect-ratio: 16 / 9;
  }

  .global-search {
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: auto;
    box-shadow: 5px 5px 0 rgba(16, 24, 32, 0.9);
  }

  .global-search button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .controls,
  .brainrot-grid,
  .calc-form,
  .rebirth-tools,
  .mutation-list,
  .guide-grid,
  .faq-list,
  .detail-metrics {
    grid-template-columns: 1fr;
  }

  .quick-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .quick-links::-webkit-scrollbar {
    display: none;
  }

  .quick-links a {
    flex: 0 0 auto;
  }

  .panel-top {
    padding: 12px;
  }

  .live-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .live-stats div {
    min-height: 100px;
    padding: 12px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .live-stats div:last-child {
    border-right: 0;
  }

  .live-stats span {
    font-size: 1.7rem;
  }

  .live-stats small {
    font-size: 0.78rem;
  }

  .answer-strip {
    padding: 14px;
  }

  .section-head,
  .controls,
  .brainrot-grid,
  .tool-grid,
  .rebirth-tools,
  .rebirth-table-wrap,
  .mutation-list,
  .codes,
  .guide-band,
  .faq,
  .sources {
    margin-top: 48px;
  }

  .section-head h2,
  .guide-band h2,
  .faq h2 {
    font-size: clamp(1.85rem, 10vw, 2.6rem);
  }

  .controls {
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
  }

  .filter-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .filter-group::-webkit-scrollbar {
    display: none;
  }

  .filter-group button {
    flex: 0 0 auto;
  }

  .brainrot-card,
  .tool-panel,
  .rebirth-tools {
    padding: 16px;
  }

  .brainrot-card {
    min-height: auto;
  }

  .brainrot-top h3 {
    font-size: 1.08rem;
  }

  .card-note {
    font-size: 0.96rem;
    line-height: 1.48;
  }

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

  .metric {
    min-height: 66px;
    padding: 9px;
  }

  .metric span {
    font-size: 0.66rem;
  }

  .metric strong {
    font-size: 0.88rem;
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: normal;
  }

  .saved-summary {
    grid-template-columns: 1fr 1fr;
  }

  .saved-summary strong,
  .result-box strong {
    font-size: clamp(1.35rem, 8vw, 2rem);
  }

  .codes {
    gap: 16px;
  }

  .detail-dialog {
    width: calc(100% - 18px);
    max-height: calc(100% - 18px);
  }

  .dialog-head {
    padding: 16px;
  }

  .detail-body {
    padding: 16px;
  }
}

@media (max-width: 520px) {
  .brand {
    font-size: 0.98rem;
  }

  .brand-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  .hero-copy {
    gap: 14px;
  }

  h1 {
    max-width: 16ch;
    font-size: clamp(2.05rem, 10vw, 2.55rem);
    line-height: 1.02;
  }

  .global-search {
    grid-template-columns: 22px minmax(0, 1fr);
    padding: 7px;
  }

  .global-search input {
    font-size: 0.94rem;
  }

  .global-search button {
    min-height: 44px;
  }

  .live-stats {
    grid-template-columns: 1fr;
  }

  .live-stats div {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .live-stats div:last-child {
    border-bottom: 0;
  }

  .brainrot-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .saved-summary,
  .card-actions {
    grid-template-columns: 1fr;
  }

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

  .metric {
    min-width: 0;
    min-height: 64px;
    padding: 9px 8px;
  }

  .metric span {
    font-size: 0.64rem;
  }

  .metric strong {
    font-size: clamp(0.82rem, 4vw, 0.98rem);
    line-height: 1.12;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .tag-row {
    gap: 6px;
  }

  .tag-row span {
    font-size: 0.72rem;
  }

  .rebirth-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .rebirth-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 12px;
  }

  .rebirth-table thead {
    display: none;
  }

  .rebirth-table,
  .rebirth-table tbody,
  .rebirth-table tr,
  .rebirth-table td {
    display: block;
    width: 100%;
  }

  .rebirth-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .rebirth-table td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .rebirth-table td:last-child {
    border-bottom: 0;
  }

  .rebirth-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .check-list label {
    align-items: flex-start;
  }

  .sources a {
    width: 100%;
  }

  .footer {
    padding: 18px 12px;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 1.95rem;
    max-width: 16ch;
  }

  .lead-copy {
    font-size: 0.96rem;
  }

  .brainrot-card {
    padding: 14px;
  }

  .metric-grid {
    gap: 6px;
  }

  .metric {
    padding: 8px 7px;
  }

  .metric strong {
    font-size: 0.82rem;
  }
}
