/* FixAndTest — shared styles */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #0f172a;
  --muted: #5b6474;
  --border: #e2e6eb;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-ink: #ffffff;
  --warn-bg: #fff7e6;
  --warn-border: #f5c26b;
  --warn-text: #7a4b00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --surface: #121922;
    --surface-2: #1a2330;
    --text: #e6edf3;
    --muted: #9aa5b4;
    --border: #253142;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #0f2f2c;
    --accent-ink: #042f2a;
    --warn-bg: #2a2110;
    --warn-border: #6b5220;
    --warn-text: #f3d08a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
}

a { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

img, svg { max-width: 100%; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 820px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1120px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: transform .25s ease, box-shadow .2s ease;
}
.site-header.is-scrolled { box-shadow: 0 2px 12px rgba(15, 23, 42, .08); }
.site-header.is-hidden { transform: translateY(-100%); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.02em;
  color: var(--text);
  text-decoration: none;
}
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand b { color: var(--accent); font-weight: 800; }
.site-nav { display: flex; gap: 6px; font-size: 15px; font-weight: 600; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a.is-active { color: var(--cat, var(--text)); background: var(--cat-soft, var(--surface-2)); }

/* Page head */
.page-head { padding: 32px 0 8px; }
.breadcrumb { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.breadcrumb a { color: var(--muted); }
h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 10px;
}
.lede { font-size: 18px; color: var(--muted); margin: 0; max-width: 64ch; }
.page-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; margin-bottom: 12px; color: #fff; background: var(--cat, var(--accent)); }

/* Category colors */
.cat-audio { --cat: #0d9488; --cat-soft: #ccfbf1; }
.cat-screen { --cat: #4f46e5; --cat-soft: #e0e7ff; }
.cat-classroom { --cat: #d97706; --cat-soft: #fef3c7; }
@media (prefers-color-scheme: dark) {
  .cat-audio { --cat: #2dd4bf; --cat-soft: #0f2f2c; }
  .cat-screen { --cat: #818cf8; --cat-soft: #1e1b4b; }
  .cat-classroom { --cat: #fbbf24; --cat-soft: #3a2a0a; }
  .page-icon { color: #0b0f14; }
}

h2 { font-size: 24px; line-height: 1.3; letter-spacing: -.01em; margin: 40px 0 12px; }
h3 { font-size: 19px; line-height: 1.35; margin: 24px 0 8px; }
p, ul, ol { margin: 0 0 14px; }
li { margin-bottom: 6px; }

.content { padding-bottom: 48px; }
.content > p, .content > ul, .content > ol, .content > h2, .content > h3,
.content > .callout, .content > .faq { max-width: 64ch; }

/* Cards & callouts */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.callout {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
}
.callout strong { color: inherit; }

/* Home */
.hero { background: var(--surface); border-bottom: 1px solid var(--border); padding: 44px 0 28px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); max-width: 20ch; }
.cat-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 15px;
  padding: 8px 14px; border-radius: 999px; color: var(--cat); background: var(--cat-soft);
}
.cat-chip span { font-size: 13px; opacity: .8; }
.cat-chip:hover { outline: 2px solid var(--cat); }
.cat-section { padding-top: 36px; scroll-margin-top: 64px; }
.cat-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.cat-head h2 { margin: 0; }
.cat-head p { margin: 0; color: var(--muted); }

/* Tool cards (home + related tools) */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  grid-auto-rows: 1fr;
  gap: 14px;
  margin: 16px 0 8px;
  padding: 0;
  list-style: none;
}
.tool-grid li { margin: 0; }
.tool-card {
  display: flex; gap: 14px; align-items: flex-start;
  height: 100%; padding: 16px;
  color: var(--text); text-decoration: none;
  transition: transform .15s ease, border-color .15s ease;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--cat, var(--accent)); }
.tool-icon {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--cat, var(--accent)); background: var(--cat-soft, var(--accent-soft));
}
.tool-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-name { display: block; margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.tool-desc { color: var(--muted); font-size: 14px; line-height: 1.45; }
.tool-grid-compact { grid-template-columns: 1fr; }
@media (min-width: 560px) { .tool-grid-compact { grid-template-columns: 1fr 1fr; } }
.tool-grid-compact .tool-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-tools { margin-top: 40px; }
.related-tools h2 { margin-bottom: 4px; }

.why { padding: 40px 0 56px; }
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding: 0;
  list-style: none;
}
@media (min-width: 900px) { .features { grid-template-columns: repeat(4, 1fr); } }
.features li { margin: 0; padding: 16px; }
.features strong { display: block; margin-bottom: 4px; }
.features span { color: var(--muted); font-size: 15px; }

/* FAQ */
.faq details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 650;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 16px 6px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  padding: 32px 0 28px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 24px; }
.footer-about .brand { font-size: 18px; }
.footer-about p { margin: 10px 0 0; max-width: 32ch; }
.footer-copy { font-size: 13px; }
.footer-title { margin: 0 0 8px; font-weight: 700; color: var(--text); font-size: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 0 0 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }

/* Full-screen solid color stage (white/black screen, backlight bleed) */
.ss-lock, .ss-lock body { overflow: hidden; }
#ss-stage { position: fixed; inset: 0; z-index: 1000; }
#ss-stage.no-cursor { cursor: none; }
#ss-hint {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  font: 600 15px/1.4 var(--font); text-align: center;
  padding: 8px 14px; border-radius: 10px; background: rgba(127, 127, 127, .22);
  opacity: 0; transition: opacity .3s; pointer-events: none; margin: 0;
}
#ss-hint.show { opacity: 1; }
#ss-close {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(127, 127, 127, .3); font: 700 20px/1 var(--font); cursor: pointer;
}
.tool { padding: 20px; margin: 20px 0 8px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.color-btn {
  font: inherit; font-weight: 700; cursor: pointer; min-height: 84px;
  border-radius: 14px; border: 2px solid var(--border);
  display: flex; align-items: flex-end; padding: 10px 12px; text-align: left;
}
.color-btn:hover { border-color: var(--accent); }
.dl-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.dl-row select { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn-dl { font: inherit; font-weight: 700; padding: 9px 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.dl-note { color: var(--muted); font-size: 14px; min-height: 1.4em; margin: 6px 0 0; }

/* Utility */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .site-nav { gap: 0; font-size: 14px; }
  .site-nav a { padding: 6px 7px; }
  .site-nav .nav-about { display: none; }
  .hero { padding: 28px 0 20px; }
  h2 { font-size: 21px; }
}

html { scroll-padding-top: 64px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
