/* Kobako design system v2 — flat, card-based, category tones (spec §4.3).
   Tokens use light-dark(); browsers without it get the light theme. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --brand: #ea580c;
  --primary: #c2410c;
  --primary-hover: #9a3412;
  --on-primary: #ffffff;
  --primary-soft: #fff4ec;
  --primary-line: #fed7bf;
  --success: #047857;
  --danger: #b91c1c;
  --focus: #2563eb;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 6%);
  --shadow-md: 0 4px 16px rgb(16 24 40 / 8%), 0 1px 3px rgb(16 24 40 / 6%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 14%);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", "Hiragino Sans",
    "Yu Gothic UI", "Noto Sans CJK TC", "Noto Sans CJK JP", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --dur: 180ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --container: 1200px;
  --gutter: 20px;
}

/* Fallback tone for browsers without light-dark(); must come before the tone classes. */
.tile,
.cat-chip {
  --t-bg: #e5e9f0;
  --t-fg: #334155;
}

@supports (color: light-dark(#000, #fff)) {
  :root {
    --bg: light-dark(#f6f7f9, #0e1014);
    --surface: light-dark(#ffffff, #171a20);
    --surface-2: light-dark(#f1f3f6, #20242c);
    --ink: light-dark(#111827, #f3f4f6);
    --ink-2: light-dark(#4b5563, #c6cad3);
    --ink-3: light-dark(#6b7280, #9aa1ad);
    --line: light-dark(#e5e7eb, #2a2f39);
    --line-strong: light-dark(#d1d5db, #3a404c);
    --brand: light-dark(#ea580c, #f97316);
    --primary: light-dark(#c2410c, #fb923c);
    --primary-hover: light-dark(#9a3412, #fdba74);
    --on-primary: light-dark(#ffffff, #1a0d04);
    --primary-soft: light-dark(#fff4ec, rgb(249 115 22 / 12%));
    --primary-line: light-dark(#fed7bf, rgb(249 115 22 / 35%));
    --success: light-dark(#047857, #6ee7b7);
    --danger: light-dark(#b91c1c, #fca5a5);
    --focus: light-dark(#2563eb, #7aa7ff);
    --shadow-sm: light-dark(0 1px 2px rgb(16 24 40 / 6%), 0 1px 2px rgb(0 0 0 / 40%));
  }
  :root[data-theme="light"] {
    color-scheme: light;
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
  }

  /* Category tones: tile/chip background and foreground. */
  .tone-blue { --t-bg: light-dark(#e0ecff, rgb(96 165 250 / 16%)); --t-fg: light-dark(#1d4ed8, #93c5fd); }
  .tone-orange { --t-bg: light-dark(#ffead9, rgb(251 146 60 / 16%)); --t-fg: light-dark(#c2410c, #fdba74); }
  .tone-violet { --t-bg: light-dark(#ede7fe, rgb(167 139 250 / 16%)); --t-fg: light-dark(#6d28d9, #c4b5fd); }
  .tone-indigo { --t-bg: light-dark(#e3e6fd, rgb(129 140 248 / 16%)); --t-fg: light-dark(#4338ca, #a5b4fc); }
  .tone-emerald { --t-bg: light-dark(#dbf5ea, rgb(52 211 153 / 14%)); --t-fg: light-dark(#047857, #6ee7b7); }
  .tone-rose { --t-bg: light-dark(#fde3e7, rgb(251 113 133 / 16%)); --t-fg: light-dark(#be123c, #fda4af); }
  .tone-amber { --t-bg: light-dark(#fef0c7, rgb(251 191 36 / 14%)); --t-fg: light-dark(#b45309, #fcd34d); }
  .tone-pink { --t-bg: light-dark(#fce4f3, rgb(244 114 182 / 16%)); --t-fg: light-dark(#be185d, #f9a8d4); }
  .tone-teal { --t-bg: light-dark(#d5f5f1, rgb(45 212 191 / 14%)); --t-fg: light-dark(#0f766e, #5eead4); }
  .tone-slate { --t-bg: light-dark(#e5e9f0, rgb(148 163 184 / 16%)); --t-fg: light-dark(#334155, #cbd5e1); }
  .tone-lime { --t-bg: light-dark(#e8f7cc, rgb(163 230 53 / 14%)); --t-fg: light-dark(#4d7c0f, #bef264); }
  .tone-cyan { --t-bg: light-dark(#d4f3fa, rgb(34 211 238 / 14%)); --t-fg: light-dark(#0e7490, #67e8f9); }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
main {
  flex: 1;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  text-wrap: balance;
}
h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.375rem);
  letter-spacing: -0.022em;
}
h2 {
  font-size: 1.375rem;
  letter-spacing: -0.014em;
}
p {
  margin: 0;
}
a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--primary-hover);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-2);
  padding: 0.12em 0.4em;
  border-radius: 6px;
}
code.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.num {
  font-variant-numeric: tabular-nums;
}
.icon {
  flex-shrink: 0;
  display: block;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: -9999px;
  z-index: 100;
}
.skip:focus {
  left: 16px;
  top: 12px;
  padding: 8px 14px;
  background: var(--surface);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}
[hidden] {
  display: none !important;
}
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container.narrow {
  max-width: 800px;
}
@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }
}

/* Theme toggle icon visibility */
.show-dark {
  display: none;
}
:root[data-theme="dark"] .show-dark {
  display: block;
}
:root[data-theme="dark"] .show-light {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .show-dark {
    display: block;
  }
  :root:not([data-theme="light"]) .show-light {
    display: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-secondary:hover {
  background: var(--surface-2);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.875rem;
}
.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 1.0625rem;
}
.btn[data-state="done"],
.icon-btn[data-state="done"] {
  color: var(--success);
}
.btn-primary[data-state="done"] {
  color: var(--on-primary);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.icon-btn-lg {
  min-width: 52px;
  height: 52px;
  border-radius: 12px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.logo:hover {
  color: var(--ink);
}
.header-spacer {
  flex: 1;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.lang-current {
  font-size: 0.875rem;
  font-weight: 600;
}
.chev {
  transition: transform var(--dur) var(--ease);
}
details[open] > summary .chev {
  transform: rotate(180deg);
}
.menu {
  position: relative;
}
.menu > summary {
  list-style: none;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 168px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.menu-list a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9375rem;
}
.menu-list a:hover {
  background: var(--surface-2);
}
.menu-list a[aria-current] {
  font-weight: 650;
  color: var(--primary);
}
@media (max-width: 720px) {
  .header-row {
    flex-wrap: wrap;
    row-gap: 10px;
    padding-block: 10px;
  }
  .header-row .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
  .header-row .header-spacer {
    display: none;
  }
}

/* ---------- Search ---------- */
.search {
  position: relative;
  flex: 1;
  max-width: 520px;
  margin-inline: auto;
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.search-input::placeholder {
  color: var(--ink-3);
}
.search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}
.search-lg {
  max-width: 640px;
  width: 100%;
  flex: none;
}
.search-lg .search-icon {
  left: 18px;
}
.search-lg .search-input {
  height: 58px;
  padding-left: 52px;
  font-size: 1.0625rem;
  border-radius: 16px;
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.search-results {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.search-results a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.search-results a:hover,
.search-results a.active {
  background: var(--surface-2);
}
.search-results .empty {
  padding: 10px 12px;
  color: var(--ink-3);
}

/* ---------- Hero (home, 404, root) ---------- */
.hero {
  padding: 64px 0 48px;
  background:
    radial-gradient(60% 80% at 50% 0%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}
.hero h1 {
  font-size: clamp(2rem, 1.3rem + 3.4vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero .lede {
  max-width: 600px;
  margin-bottom: 12px;
}
.lede {
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.6;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--t-bg);
  color: var(--t-fg);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter var(--dur) var(--ease);
}
.cat-chip:hover {
  color: var(--t-fg);
  filter: brightness(0.96);
}
@media (max-width: 640px) {
  .hero {
    padding: 40px 0 32px;
  }
}

/* ---------- Tiles ---------- */
.tile {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--t-bg);
  color: var(--t-fg);
}
.tile-sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}
.tile-md {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}
.tile-lg {
  width: 60px;
  height: 60px;
  border-radius: 16px;
}

/* ---------- Sections and lists ---------- */
.section {
  margin-top: 48px;
}
.section > h2 {
  margin-bottom: 18px;
}
main > .container:last-child,
.tool-layout {
  padding-bottom: 72px;
}
.count {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 600;
  vertical-align: middle;
  letter-spacing: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tool-card-link {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.tool-card-link:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.tool-card-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.tool-card-title {
  font-weight: 650;
  line-height: 1.35;
}
.tool-card-desc {
  color: var(--ink-3);
  font-size: 0.875rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-card-chev {
  color: var(--ink-3);
  transition: transform var(--dur) var(--ease);
}
.tool-card-link:hover .tool-card-chev {
  transform: translateX(2px);
  color: var(--ink);
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.cat-head:hover {
  color: var(--ink);
}
.cat-name {
  flex: 1;
  font-weight: 700;
  font-size: 1.0625rem;
}
.cat-head:hover .cat-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cat-tools {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cat-tools a {
  display: block;
  padding: 7px 10px;
  margin-inline: -10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.9375rem;
}
.cat-tools a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.cat-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Page head ---------- */
.page-head {
  padding: 20px 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  margin-top: 4px;
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--ink-3);
}
.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.breadcrumbs a {
  color: var(--ink-2);
  text-decoration: none;
}
.breadcrumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.crumb-sep {
  color: var(--ink-3);
}
.tool-title {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.tool-title h1 {
  margin: 2px 0 6px;
}
.tool-title .lede {
  max-width: 680px;
}
@media (max-width: 640px) {
  .tool-title {
    gap: 14px;
  }
  .tool-title .tile-lg {
    width: 48px;
    height: 48px;
    border-radius: 13px;
  }
}

/* ---------- Tool page layout ---------- */
.tool-layout {
  display: grid;
  gap: 40px;
  padding-top: 28px;
}
.tool-main {
  min-width: 0;
}
.tool-aside {
  display: grid;
  gap: 16px;
  align-content: start;
}
@media (min-width: 1024px) {
  .tool-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .tool-aside {
    position: sticky;
    top: 88px;
  }
}
.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 640px) {
  .tool-panel {
    padding: 28px;
  }
}
.side-card {
  display: block;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.side-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.side-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.side-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-inline: -8px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 550;
  line-height: 1.35;
}
.side-list a:hover {
  background: var(--surface-2);
}
.side-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}
.side-cat > span:not(.tile) {
  flex: 1;
}
.side-cat:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* Content */
.steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  line-height: 1.6;
}
.step-num {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-top: -1px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.875rem;
}
.prose {
  max-width: 72ch;
  line-height: 1.75;
  color: var(--ink);
}
.prose > h2:first-child,
article.prose > :first-child {
  margin-top: 0;
}
.prose > h2:first-child {
  margin-bottom: 18px;
}
.prose h2:not(:first-child) {
  font-size: 1.125rem;
  margin: 32px 0 10px;
}
.prose h3 {
  font-size: 1.0625rem;
  margin: 24px 0 8px;
}
.prose p {
  margin: 0 0 14px;
}
.prose ul,
.prose ol {
  margin: 0 0 14px;
  padding-left: 1.3em;
}
.prose li {
  margin-bottom: 6px;
}
.prose li::marker {
  color: var(--ink-3);
}
.prose strong {
  font-weight: 650;
}
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.table th,
.table td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  background: var(--surface-2);
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
}
.table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.table tr:last-child td {
  border-bottom: 0;
}
.sym-cell {
  font-size: 1.375rem;
}
.faq {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.faq details + details {
  border-top: 1px solid var(--line);
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary:hover {
  background: var(--surface-2);
}
.faq summary .chev {
  color: var(--ink-3);
}
.faq-a {
  padding: 0 18px 16px;
  color: var(--ink-2);
  line-height: 1.7;
}
.faq-a p {
  margin: 0;
}

/* ---------- Tool widgets ---------- */
.tool {
  display: grid;
  gap: 18px;
}
.tool-hint {
  color: var(--ink-3);
  font-size: 0.9375rem;
}
.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
}
.field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}
.field-label::first-letter {
  text-transform: uppercase;
}
.field-box {
  display: flex;
  align-items: center;
  min-height: 60px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field-box:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}
.field-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.field-input:focus {
  outline: none;
}
.unit {
  padding-right: 14px;
  color: var(--ink-3);
  font-weight: 600;
  white-space: nowrap;
}
.field-box.is-result {
  background: var(--primary-soft);
  border-color: var(--primary-line);
}
.copy-inline {
  margin-right: 8px;
  border-color: transparent;
  background: transparent;
}
.copy-inline:hover {
  background: var(--surface);
}
.tool-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.tool-foot.end {
  justify-content: flex-end;
}
.formula {
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.formula strong {
  color: var(--ink);
  font-weight: 650;
}

/* Converter */
.conv-grid {
  display: grid;
  gap: 12px;
}
@media (min-width: 640px) {
  .conv-grid {
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
  }
}
.swap-btn {
  justify-self: center;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.swap-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.swap-btn:active {
  transform: rotate(180deg);
}
@media (max-width: 639px) {
  .swap-btn {
    margin: 0;
    transform: rotate(90deg);
  }
  .swap-btn:active {
    transform: rotate(270deg);
  }
}

/* Calculator */
.calc-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
}
.result-hero {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
}
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.result-value {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.result-row .icon-btn {
  background: transparent;
  border-color: transparent;
}
.result-row .icon-btn:hover {
  background: var(--surface);
}
.result-list {
  display: grid;
  margin: 8px 0 0;
}
.result-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--primary-line);
}
.result-list dt {
  color: var(--ink-2);
}
.result-list dd {
  margin: 0;
  font-weight: 650;
}

/* Timer */
.timer-face {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 40px 16px 28px;
  border-radius: 18px;
  background: var(--surface-2);
}
.timer-digits {
  font-size: clamp(4rem, 2rem + 12vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.timer-status {
  min-height: 1.5em;
  font-weight: 700;
  color: var(--primary);
}
.timer-track {
  width: min(100%, 420px);
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.timer-bar {
  display: block;
  height: 100%;
  background: var(--brand);
  transform-origin: left;
  transition: transform 200ms linear;
}
.phase-done .timer-face {
  background: var(--primary-soft);
  animation: pulse 900ms var(--ease) 3;
}
@keyframes pulse {
  50% {
    transform: scale(1.015);
  }
}
.timer-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.timer .segmented {
  justify-self: center;
}
.timer:fullscreen {
  background: var(--bg);
  padding: 32px;
  align-content: center;
}

/* Segmented control */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
  width: fit-content;
  max-width: 100%;
}
.seg {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 550;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg:hover {
  color: var(--ink);
}
.seg[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
}

/* Document converter (doc-convert) */
.doc-tool {
  container-type: inline-size;
  display: grid;
  gap: 14px;
}
.doc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.doc-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}
.doc-switch .seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.doc-panes {
  display: grid;
  gap: 16px;
}
.doc-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.doc-pane-head {
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 650;
}
.doc-input,
.doc-html,
.doc-frame {
  height: clamp(360px, 62vh, 640px);
}
.textarea.doc-input,
.textarea.doc-html {
  resize: none;
  font-variant-ligatures: none;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}
.doc-frame {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
}
.doc-frame[hidden] {
  display: none;
}
.doc-notice {
  margin: 0;
  color: #b42318;
  font-size: 0.875rem;
}
.doc-hint {
  margin: -4px 0 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-align: right;
}
/* Narrow: one pane at a time, switched with Edit / Preview. Wide: side by side. */
.doc-tool[data-view="edit"] .doc-pane-out,
.doc-tool[data-view="preview"] .doc-pane-edit {
  display: none;
}
@container (min-width: 680px) {
  .doc-switch {
    display: none;
  }
  .doc-panes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .doc-tool[data-view] .doc-pane-edit,
  .doc-tool[data-view] .doc-pane-out {
    display: flex;
  }
}

/* Symbols */
.symbol-group + .symbol-group {
  margin-top: 4px;
}
.group-title {
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
}
.symbol {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.625rem;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.symbol:hover {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.symbol:active {
  transform: scale(0.96);
}

/* Text tools */
.textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}
.textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}
.textarea.is-result {
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.9375rem;
}
.textarea.is-code {
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.55;
  font-variant-ligatures: none;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  tab-size: 4;
}
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
.tool-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}
.tool-note[hidden] {
  display: none;
}
.tool-note.is-ok {
  color: var(--success);
}
.tool-note.is-error {
  color: var(--danger);
}
.tool-note::before {
  flex: none;
  width: 1.25em;
  text-align: center;
}
.tool-note.is-ok::before {
  content: "✓";
}
.tool-note.is-error::before {
  content: "!";
  border-radius: 50%;
  background: var(--danger);
  color: var(--surface);
  font-size: 0.8em;
  line-height: 1.5em;
  height: 1.5em;
  width: 1.5em;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
  margin: 0;
}
.stat {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}
.stat dt {
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.stat dd {
  margin: 2px 0 0;
  font-size: 1.625rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

/* ---------- Root language chooser ---------- */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  width: 100%;
  max-width: 760px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.lang-card {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.lang-card:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.lang-card .icon {
  color: var(--primary);
}
.lang-card-name {
  font-weight: 700;
  font-size: 1.0625rem;
}
.lang-card-tag {
  color: var(--ink-3);
  font-size: 0.875rem;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  padding: 48px 0 24px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}
.footer-grid {
  display: grid;
  gap: 32px;
}
@media (min-width: 760px) {
  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr;
  }
}
.footer-brand p {
  margin-top: 12px;
  max-width: 360px;
  color: var(--ink-3);
  line-height: 1.6;
}
.footer-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.footer-links {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-links a {
  color: var(--ink-2);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.875rem;
}

/* ---------- Ads (reserved space, spec §6) ---------- */
.ad {
  margin: 32px 0;
  text-align: center;
}
.ad-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ad-top {
  display: none;
  margin: 16px 0 0;
}
@media (min-width: 900px) {
  .ad-top {
    display: block;
  }
}
@media (max-width: 1023px) {
  .ad-sidebar {
    display: none;
  }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in 160ms var(--ease);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

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

/* ---------- M2 widgets ---------- */
.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 0.9375rem;
  color: var(--ink-2);
  cursor: pointer;
  width: fit-content;
}
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}
.field-date {
  font-size: 1.125rem;
  color-scheme: inherit;
}
.result-text {
  font-size: clamp(1.375rem, 1.1rem + 1.4vw, 2rem);
}
.result-sub {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding: 10px 0 0;
  list-style: none;
  border-top: 1px solid var(--primary-line);
  color: var(--ink-2);
}

/* Countdown */
.cd-event {
  text-align: center;
  color: var(--ink-2);
  font-size: 1.0625rem;
}
.cd-event strong {
  color: var(--ink);
}
.cd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.cd-cell {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 22px 8px 16px;
  border-radius: 16px;
  background: var(--surface-2);
}
.cd-num {
  font-size: clamp(2rem, 1rem + 5vw, 3.5rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
}
.cd-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-3);
}
.cd-target {
  text-align: center;
  color: var(--ink-3);
  font-size: 0.875rem;
}

/* Picker wheel */
.wheel-wrap {
  position: relative;
  width: min(100%, 340px);
  margin-inline: auto;
}
.wheel {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}
.wheel.spinning {
  transition: transform 4.2s cubic-bezier(0.12, 0.8, 0.12, 1);
}
.wheel-pointer {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: -6px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid var(--ink);
}
.picker-result {
  text-align: center;
  justify-items: center;
}

/* Reference tables */
.table-filter {
  max-width: 360px;
  padding-left: 14px;
}
.table-scroll {
  max-height: 70vh;
  overflow: auto;
}
.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td.mono {
  font-family: var(--mono);
  font-size: 0.875rem;
}

/* Tables inside article prose (GFM tables in spec bodies). */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.prose th,
.prose td {
  padding: 8px 14px;
  border: 1px solid var(--line);
  text-align: left;
}
.prose th {
  background: var(--surface-2);
  font-weight: 650;
}
