:root {
  --text: #222222;
  --muted-text: #5f6368;
  --background: #fefefe;
  --surface: #ffffff;
  --surface-subtle: #fafaf9;
  --surface-hover: #f5f5f4;
  --border: #d6d3d1;
  --border-strong: #a8a29e;

  --primary: #1e40af;
  --primary-hover: #1e3a8a;
  --primary-soft: #dbeafe;
  --primary-soft-strong: #bfdbfe;
  --primary-on: #ffffff;

  --warning: #92400e;
  --warning-soft: #fef3c7;
  --warning-border: #d97706;

  --error: #b91c1c;
  --error-soft: #fee2e2;

  --focus-ring: rgba(30, 64, 175, 0.24);
  --focus-shadow: rgba(30, 64, 175, 0.11);
  --header-border: rgba(34, 34, 34, 0.12);
  --badge-background: #eff6ff;
  --badge-border: #bfdbfe;
  --ad-background: rgba(255, 255, 255, 0.48);
  --ad-text: #78716c;
  --table-header: #f5f5f4;
  --hash-text: #374151;
  --invalid-row: #fff7f7;
  --card-shadow: 0 14px 38px rgba(41, 37, 36, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

::selection {
  color: var(--primary-on);
  background: var(--primary);
}

html {
  scroll-behavior: smooth;
}

body.dark-mode {
  --text: #e7e5e4;
  --muted-text: #a8a29e;
  --background: #121212;
  --surface: #1c1917;
  --surface-subtle: #292524;
  --surface-hover: #34302e;
  --border: #44403c;
  --border-strong: #78716c;

  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-soft: #172554;
  --primary-soft-strong: #1e3a8a;
  --primary-on: #0f172a;

  --warning: #fbbf24;
  --warning-soft: #451a03;
  --warning-border: #d97706;

  --error: #f87171;
  --error-soft: #450a0a;

  --focus-ring: rgba(96, 165, 250, 0.34);
  --focus-shadow: rgba(96, 165, 250, 0.16);
  --header-border: rgba(231, 229, 228, 0.14);
  --badge-background: #172554;
  --badge-border: #1e3a8a;
  --ad-background: rgba(28, 25, 23, 0.62);
  --ad-text: #a8a29e;
  --table-header: #292524;
  --hash-text: #d6d3d1;
  --invalid-row: #2b1818;
  --card-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
}

body.myspace-mode {
  --text: #f8fafc;
  --muted-text: #cbd5e1;
  --background: #0b1026;
  --surface: #16213e;
  --surface-subtle: #101a35;
  --surface-hover: #1f2f5f;
  --border: #38bdf8;
  --border-strong: #fde047;

  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-soft: #1f2f5f;
  --primary-soft-strong: #075985;
  --primary-on: #082f49;

  --warning: #facc15;
  --warning-soft: #422006;
  --warning-border: #facc15;

  --error: #fb7185;
  --error-soft: #4c0519;

  --focus-ring: rgba(253, 224, 71, 0.72);
  --focus-shadow: rgba(56, 189, 248, 0.28);
  --header-border: #38bdf8;
  --badge-background: #1f2f5f;
  --badge-border: #ec4899;
  --ad-background: rgba(22, 33, 62, 0.9);
  --ad-text: #fde047;
  --table-header: #1f2f5f;
  --hash-text: #e0f2fe;
  --invalid-row: #3b1022;
  --card-shadow: 8px 8px 0 rgba(236, 72, 153, 0.38);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
  color-scheme: light;
}

body.dark-mode {
  color-scheme: dark;
}

body.myspace-mode {
  background-color: var(--background);
  background-image:
    radial-gradient(circle at 15px 15px, rgba(236, 72, 153, 0.24) 2px, transparent 3px),
    radial-gradient(circle at 45px 45px, rgba(56, 189, 248, 0.2) 2px, transparent 3px);
  background-size: 60px 60px;
  color-scheme: dark;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

.site-header,
main,
footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border-bottom: 1px solid var(--header-border);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: var(--primary-on);
  background: var(--primary);
  font-size: 1.45rem;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 1px;
  color: var(--muted-text);
  font-size: 0.76rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.theme-picker {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 34px;
  padding-left: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted-text);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 700;
  transition:
    color 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.theme-picker:hover,
.theme-picker:focus-within {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-hover);
}

.theme-picker-label {
  color: var(--muted-text);
}

.theme-picker select {
  min-height: 32px;
  padding: 6px 28px 6px 8px;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

.theme-picker select:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

body.myspace-mode .site-header {
  border: 2px solid var(--border);
  border-top: 0;
  background: var(--surface);
  box-shadow: 5px 5px 0 rgba(168, 85, 247, 0.42);
}

body.myspace-mode .brand-mark {
  border: 2px solid #fde047;
  border-radius: 4px;
  color: #ffffff;
  background: #ec4899;
  box-shadow: 3px 3px 0 #a855f7;
}

body.myspace-mode .brand strong,
body.myspace-mode h1,
body.myspace-mode h2 {
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

body.myspace-mode h1 {
  color: #ffffff;
  text-shadow:
    3px 3px 0 #a855f7,
    -1px -1px 0 #0284c7;
}

body.myspace-mode .theme-picker {
  border: 2px solid #fde047;
  border-radius: 3px;
  color: #ffffff;
  background: #a855f7;
  box-shadow: 3px 3px 0 #ec4899;
}

body.myspace-mode .theme-picker:hover,
body.myspace-mode .theme-picker:focus-within {
  border-color: #ffffff;
  color: #0b1026;
  background: #fde047;
}

body.myspace-mode .theme-picker-label {
  color: inherit;
}

body.myspace-mode .theme-picker select {
  border-left-color: #fde047;
  border-radius: 0;
  color: #ffffff;
  background: #260033;
}

.local-badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  color: var(--primary-hover);
  background: var(--badge-background);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

main {
  padding-block: 76px 50px;
}

.hero {
  max-width: 850px;
  margin-inline: auto;
  text-align: center;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 20px;
  font-size: clamp(2.3rem, 7vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 7px;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.hero-copy {
  max-width: 690px;
  margin: 0 auto 26px;
  color: var(--muted-text);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.privacy-proof {
  display: inline-flex;
  max-width: 690px;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--badge-border);
  border-radius: 14px;
  text-align: left;
  background: var(--badge-background);
}

.privacy-proof p {
  margin: 3px 0 0;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.shield {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: var(--primary-on);
  background: var(--primary);
  font-weight: 900;
}

.ad-slot {
  display: flex;
  min-height: 86px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 50px auto 26px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--ad-text);
  background: var(--ad-background);
  text-align: center;
}

.ad-slot span {
  font-size: 0.82rem;
  font-weight: 700;
}

.ad-slot small {
  margin-top: 2px;
  font-size: 0.72rem;
}

body.myspace-mode .ad-slot {
  border: 2px dashed #ec4899;
  border-radius: 3px;
  box-shadow: 4px 4px 0 rgba(56, 189, 248, 0.3);
}

body.myspace-mode .ad-slot::before {
  content: "TOP 8 AD SLOT";
  margin-bottom: 4px;
  color: #38bdf8;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.tool-card,
.results-section {
  padding: clamp(22px, 5vw, 42px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

body.myspace-mode .tool-card,
body.myspace-mode .results-section {
  border-width: 2px;
  border-radius: 5px;
}

.tool-heading,
.results-heading {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.text-button {
  padding: 3px;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-subtle);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

textarea:focus,
input:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-shadow);
}

.input-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted-text);
  font-size: 0.78rem;
}

.input-meta p {
  margin-bottom: 0;
}

.options {
  margin: 34px 0 0;
  padding: 0;
  border: 0;
}

.options legend {
  margin-bottom: 14px;
  font-size: 1.05rem;
  font-weight: 800;
}

.options legend .step-label {
  display: block;
}

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

.option-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.option-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

body.myspace-mode .option-card {
  border-width: 2px;
  border-radius: 4px;
  background: var(--surface-subtle);
}

body.myspace-mode .option-card:has(input:checked) {
  border-color: #ec4899;
  box-shadow: 3px 3px 0 rgba(168, 85, 247, 0.55);
}

.option-card-legacy:has(input:checked) {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

.option-card input {
  margin-top: 4px;
  accent-color: var(--primary);
}

.option-card strong,
.option-card small,
.checkbox-row strong,
.checkbox-row small {
  display: block;
}

.option-card small,
.checkbox-row small {
  margin-top: 2px;
  color: var(--muted-text);
  font-size: 0.78rem;
}

.option-card em {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--primary-hover);
  background: var(--primary-soft-strong);
  font-size: 0.61rem;
  font-style: normal;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

body.myspace-mode .option-card em {
  border: 1px solid #fde047;
  border-radius: 3px;
  color: #0b1026;
  background: #fde047;
  transform: rotate(-1deg);
}

.option-card-legacy em {
  color: var(--warning);
  background: var(--warning-soft);
}

.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--primary);
}

.primary-actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-actions {
  margin-top: 30px;
}

.button {
  min-height: 46px;
  padding: 10px 17px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.button-primary {
  min-width: 170px;
  border-color: var(--primary);
  color: var(--primary-on);
  background: var(--primary);
}

.button-primary:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

body.myspace-mode .button {
  border-width: 2px;
  border-radius: 3px;
  box-shadow: 3px 3px 0 rgba(168, 85, 247, 0.42);
}

body.myspace-mode .button-primary {
  border-color: #fde047;
  color: #ffffff;
  background: #ec4899;
  box-shadow: 4px 4px 0 #a855f7;
}

body.myspace-mode .button-primary:hover {
  border-color: #ffffff;
  color: #0b1026;
  background: #fde047;
}

.button-secondary {
  color: var(--muted-text);
}

.button-small {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.78rem;
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--primary-hover);
  font-size: 0.84rem;
  font-weight: 700;
}

.message.error {
  color: var(--error);
}

.results-section {
  margin-top: 24px;
}

.results-heading {
  margin-bottom: 24px;
}

.results-heading p {
  margin-bottom: 0;
  color: var(--muted-text);
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

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

tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--muted-text);
  background: var(--table-header);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

body.myspace-mode .table-wrap {
  border-width: 2px;
  border-radius: 4px;
}

body.myspace-mode th {
  color: #fde047;
}

td:first-child {
  min-width: 220px;
}

.hash-value {
  min-width: 310px;
  max-width: 520px;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: var(--hash-text);
}

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--primary-hover);
  background: var(--primary-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

body.myspace-mode .status-pill {
  border: 1px solid #fde047;
  border-radius: 3px;
  color: #0b1026;
  background: #38bdf8;
  box-shadow: 2px 2px 0 #a855f7;
  transform: rotate(-1deg);
}

.status-pill.invalid {
  color: var(--error);
  background: var(--error-soft);
}

.invalid-row {
  background: var(--invalid-row);
}

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

.info-grid article {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--ad-background);
}

body.myspace-mode .info-grid article {
  border-width: 2px;
  border-radius: 4px;
  box-shadow: 4px 4px 0 rgba(2, 132, 199, 0.42);
}

.info-grid h2 {
  margin-top: 18px;
  font-size: 1.05rem;
}

.info-grid p {
  margin-bottom: 0;
  color: var(--muted-text);
  font-size: 0.83rem;
}

.info-icon {
  color: var(--primary);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 800;
}

.ad-slot-bottom {
  margin-top: 26px;
}

footer {
  display: flex;
  justify-content: space-between;
  padding-block: 25px 40px;
  border-top: 1px solid var(--header-border);
  color: var(--muted-text);
  font-size: 0.75rem;
}

footer p {
  margin-bottom: 0;
}

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

@media (max-width: 760px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    min-height: 70px;
  }

  .brand small {
    display: none;
  }

  .local-badge {
    padding: 7px 9px;
    font-size: 0.7rem;
  }

  .header-actions {
    gap: 7px;
  }

  main {
    padding-top: 52px;
  }

  .option-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .tool-heading,
  .results-heading,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .export-actions {
    width: 100%;
  }

  .export-actions .button {
    flex: 1 1 130px;
  }

  .primary-actions .button {
    flex: 1 1 auto;
  }

  .input-meta {
    gap: 8px;
    align-items: flex-end;
  }

  .input-meta p:first-child {
    max-width: 70%;
  }

  footer {
    gap: 5px;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 2.55rem;
  }

  .local-badge {
    font-size: 0;
  }

  .local-badge::after {
    content: "Local only";
    font-size: 0.7rem;
  }

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

  .tool-card,
  .results-section {
    padding: 20px 16px;
  }

  .privacy-proof {
    padding: 14px;
  }
}

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