:root {
  color-scheme: light;
  --bg: #fbfaf6;
  --bg-dot: rgba(28, 26, 22, 0.05);
  --surface: #ffffff;
  --surface-2: #f4f1e9;
  --surface-3: #ebe7d9;
  --border: #e4e0d2;
  --border-strong: #d2ccb9;
  --ink: #1c1a16;
  --ink-muted: #726c5a;
  --ink-faint: #a39d89;
  --accent: #2a4cdb;
  --accent-hover: #2140c4;
  --accent-ink: #ffffff;
  --accent-soft: #e9edfc;
  --good: #137a5c;
  --good-soft: #e4f3ec;
  --warn: #a8690c;
  --warn-soft: #fbf0da;
  --bad: #b23a3a;
  --bad-soft: #fbeae8;
  --shadow-sm: 0 1px 2px rgba(28, 26, 22, 0.06);
  --shadow-md:
    0 6px 20px -6px rgba(28, 26, 22, 0.14),
    0 2px 6px -2px rgba(28, 26, 22, 0.08);
  --shadow-lg: 0 20px 50px -18px rgba(28, 26, 22, 0.28);
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #101219;
  --bg-dot: rgba(255, 255, 255, 0.045);
  --surface: #171a23;
  --surface-2: #1e222e;
  --surface-3: #272c3a;
  --border: #2b3040;
  --border-strong: #3a4055;
  --ink: #edeef3;
  --ink-muted: #9298ac;
  --ink-faint: #5c6377;
  --accent: #7c97ff;
  --accent-hover: #96adff;
  --accent-ink: #0c1130;
  --accent-soft: #1e2745;
  --good: #3fcb98;
  --good-soft: #15291f;
  --warn: #e3a53d;
  --warn-soft: #332711;
  --bad: #f0716a;
  --bad-soft: #372022;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:
    0 6px 24px -8px rgba(0, 0, 0, 0.5), 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(circle at 1px 1px, var(--bg-dot) 1px, transparent 1px) 0
      0/22px 22px,
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  padding: 40px 20px 90px;
  transition:
    background-color 0.35s ease,
    color 0.35s ease;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
}

a {
  color: inherit;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

::-webkit-scrollbar {
  height: 7px;
  width: 7px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  opacity: 0;
  animation: riseIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  position: relative;
  animation: bob 3.6s ease-in-out infinite;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.brand-text p.tag {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.theme-toggle button {
  width: 32px;
  height: 32px;
  border-radius: 100px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.theme-toggle button svg {
  width: 16px;
  height: 16px;
}

.theme-toggle button.active {
  background: var(--surface-3);
  color: var(--ink);
}

.theme-toggle button:hover {
  color: var(--ink);
}

/* ---------- hero copy ---------- */
.lede {
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 56ch;
  margin: 22px 0 30px;
  opacity: 0;
  animation: riseIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

.lede strong {
  color: var(--ink);
  font-weight: 600;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- search row ---------- */
.search-block {
  opacity: 0;
  animation: riseIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 15px;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-field svg {
  flex-shrink: 0;
  opacity: 0.55;
  color: var(--ink-muted);
}

.search-field input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 15px;
  padding: 14px 0;
  font-family: var(--font-mono);
  min-width: 0;
}

.search-field input::placeholder {
  color: var(--ink-faint);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 12px;
  padding: 0 24px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    background 0.15s,
    transform 0.1s,
    box-shadow 0.15s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-primary svg {
  transition: transform 0.2s;
}

.btn-primary:hover svg {
  transform: translateX(2px);
}

.samples {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-faint);
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.samples button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.15s;
}

.samples button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ---------- status / error ---------- */
.msg {
  margin-top: 18px;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  display: none;
}

.msg.show {
  display: block;
  animation: riseIn 0.3s ease both;
}

.msg.error {
  background: var(--bad-soft);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  color: var(--bad);
}

.msg.loading {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 11px;
}

.spin {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  flex-shrink: 0;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes unfurlIn {
  0% {
    opacity: 0;
    transform: scaleY(0.88) translateY(14px);
    transform-origin: top center;
  }

  60% {
    opacity: 1;
  }

  100% {
    opacity: 1;
    transform: scaleY(1) translateY(0);
    transform-origin: top center;
  }
}

.tally.show,
.tabs.show,
.stage.show,
.raw.show {
  animation: unfurlIn 0.55s cubic-bezier(0.19, 1, 0.28, 1.02) both;
}

/* ---------- tally lights ---------- */
.tally {
  display: none;
  margin-top: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.tally.show {
  display: block;
}

.tally-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.tally-head h2 {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin: 0;
  font-weight: 600;
}

.tally-score {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-muted);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 100px;
}

.tally-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
}

.lamp {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
  opacity: 0;
  animation: riseIn 0.4s ease both;
}

.tally-grid .lamp:nth-child(1) {
  animation-delay: 0.03s;
}

.tally-grid .lamp:nth-child(2) {
  animation-delay: 0.07s;
}

.tally-grid .lamp:nth-child(3) {
  animation-delay: 0.11s;
}

.tally-grid .lamp:nth-child(4) {
  animation-delay: 0.15s;
}

.tally-grid .lamp:nth-child(5) {
  animation-delay: 0.19s;
}

.tally-grid .lamp:nth-child(6) {
  animation-delay: 0.23s;
}

.lamp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.lamp-dot.pass {
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-soft);
}

.lamp-dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}

.lamp-dot.fail {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

.lamp-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.lamp-msg {
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.4;
  margin-top: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lamp-body {
  min-width: 0;
  flex: 1;
}

/* ---------- tabs ---------- */
.tabs {
  display: none;
  margin-top: 28px;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.tabs.show {
  display: flex;
}

.tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 17px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- stage ---------- */
.stage {
  display: none;
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 24px;
  box-shadow: var(--shadow-sm);
}

.stage.show {
  display: block;
}

.stage-caption {
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}

/* container for stage content */
#stageContent {
  min-height: 0;
}

#stageContent.anim {
  animation: unfurlIn 0.5s cubic-bezier(0.19, 1, 0.28, 1.02) both;
}

/* preview cards - generic (mimic each platform's own fixed chrome) */
.pv-wrap {
  max-width: 520px;
  margin: 0 auto;
}

.pv-card {
  background: #f4f2ec;
  color: #14161a;
  border-radius: 8px;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.pv-img {
  width: 100%;
  aspect-ratio: 1.91/1;
  object-fit: cover;
  background: #dedbd1;
  display: block;
}

.pv-img.square {
  aspect-ratio: 1/1;
}

.pv-noimg {
  width: 100%;
  aspect-ratio: 1.91/1;
  background: #dedbd1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5b6270;
  font-size: 12px;
  font-family: var(--font-mono);
}

.pv-body {
  padding: 10px 14px 14px;
}

.pv-domain {
  font-size: 11.5px;
  color: #5b6270;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pv-title {
  font-size: 15px;
  font-weight: 600;
  margin: 3px 0 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pv-desc {
  font-size: 13px;
  color: #5b6270;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pv-card.x {
  border: 1px solid #cbc7ba;
  border-radius: 14px;
}

.pv-card.x .pv-body {
  padding: 8px 14px 12px;
}

.pv-card.li .pv-body {
  padding: 10px 14px;
}

.pv-card.li .pv-title {
  -webkit-line-clamp: 1;
  line-clamp: 1;
  font-size: 14.5px;
}

.pv-card.li .pv-desc {
  display: none;
}

.pv-discord {
  background: #313338;
  border-radius: 6px;
  padding: 0;
  max-width: 480px;
  margin: 0 auto;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.pv-discord-inner {
  border-left: 4px solid #5865f2;
  padding: 10px 14px 14px;
}

.pv-d-site {
  font-size: 12px;
  color: #dbdee1;
  margin-bottom: 3px;
}

.pv-d-title {
  font-size: 14.5px;
  color: #00a8fc;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.pv-d-desc {
  font-size: 13px;
  color: #dbdee1;
  line-height: 1.35;
  margin-bottom: 10px;
}

.pv-d-img {
  width: 100%;
  max-width: 400px;
  border-radius: 5px;
  display: block;
  object-fit: cover;
  max-height: 260px;
}

.pv-slack {
  background: #f8f8f8;
  border-radius: 5px;
  max-width: 480px;
  margin: 0 auto;
  font-family: 'Inter', sans-serif;
  color: #1d1c1d;
  padding: 1px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.pv-slack-inner {
  border-left: 4px solid #dddddd;
  padding: 8px 12px;
  display: flex;
  gap: 12px;
}

.pv-slack-text {
  flex: 1;
  min-width: 0;
}

.pv-s-site {
  font-size: 12.5px;
  color: #616061;
  margin-bottom: 2px;
}

.pv-s-title {
  font-size: 14.5px;
  color: #1264a3;
  font-weight: 700;
  margin-bottom: 3px;
  line-height: 1.3;
}

.pv-s-desc {
  font-size: 13px;
  color: #1d1c1d;
  line-height: 1.4;
}

.pv-s-img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.pv-google {
  max-width: 520px;
  margin: 0 auto;
  font-family: arial, sans-serif;
}

.pv-g-site {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.pv-g-fav {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.pv-g-fav img {
  width: 16px;
  height: 16px;
}

.pv-g-domain {
  font-size: 13px;
  color: #202124;
  line-height: 1.2;
}

.pv-g-domain span {
  display: block;
  font-size: 12px;
  color: #4d5156;
}

.pv-g-title {
  font-size: 19px;
  color: #1a0dab;
  margin: 2px 0 3px;
  line-height: 1.3;
}

.pv-g-desc {
  font-size: 13.5px;
  color: #4d5156;
  line-height: 1.5;
}

.pv-badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--surface-3);
  color: var(--ink-muted);
  padding: 3px 9px;
  border-radius: 100px;
  margin-bottom: 14px;
}

/* ---------- raw panel ---------- */
.raw {
  display: none;
  margin-top: 20px;
}

.raw.show {
  display: block;
}

.raw-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 15px 19px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-radius 0.15s;
}

.raw-head h2 {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin: 0;
  font-weight: 600;
}

.raw-head .chev {
  color: var(--ink-faint);
  transition: transform 0.25s;
}

.raw-head.open {
  border-radius: 14px 14px 0 0;
}

.raw-head.open .chev {
  transform: rotate(180deg);
}

.raw-body {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  padding: 6px 19px 17px;
}

.raw-body.open {
  display: block;
  animation: unfoldDown 0.3s ease both;
}

@keyframes unfoldDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.raw-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
  min-width: 0;
}

.raw-row:first-child {
  border-top: 0;
}

.raw-key {
  color: var(--accent);
  flex-shrink: 0;
  width: 155px;
}

.raw-val {
  color: var(--ink-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.copy-btn {
  margin-top: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 12.5px;
  padding: 8px 15px;
  border-radius: 9px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.15s;
}

.copy-btn:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

.footnote {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

@media (max-width: 640px) {
  body {
    padding: 26px 14px 70px;
  }

  .site-header {
    align-items: center;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-text h1 {
    font-size: 19px;
  }

  .brand-text p.tag {
    font-size: 11px;
  }

  .lede {
    font-size: 14px;
    margin: 16px 0 22px;
  }

  .search-row {
    flex-direction: column;
  }

  .btn-primary {
    padding: 14px 22px;
    justify-content: center;
  }

  .tally {
    padding: 15px;
  }

  .tally-grid {
    grid-template-columns: 1fr;
  }

  .stage {
    padding: 22px 15px;
  }

  .raw-head {
    padding: 13px 15px;
  }

  .raw-body {
    padding: 4px 15px 15px;
  }

  .raw-row {
    flex-direction: column;
    gap: 2px;
  }

  .raw-key {
    width: auto;
  }

  .tab {
    font-size: 12.5px;
    padding: 8px 13px;
  }

  .pv-g-title {
    font-size: 17px;
  }
}

@media (max-width: 400px) {
  .samples {
    font-size: 11.5px;
  }
}
