/* Utiluse design system: tokens, shell chrome, components. Spec: docs/DESIGN.md. Every tool ships a copy (+ its tool.css).
   New shared components are prefixed u- ; legacy class names (.card .btn .chip .tabs .res …) are kept and restyled. */
:root {
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Roboto Mono", monospace;
  --col: 480px;
  /* type */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-base: 16px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px; --fs-3xl: 40px;
  --fs-display: clamp(44px, 12vw, 72px);
  /* space, size, radius */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --h-sm: 32px; --h-md: 40px; --h-lg: 48px;
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;
  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1); --dur-1: .12s; --dur-2: .2s; --dur-3: .28s;
  /* color: light */
  --bg: #f7f7f5;
  --card: #ffffff;
  --fill: #f0f0ee;
  --fill-2: #e6e6e3;
  --line: rgb(20 20 24 / 0.1);
  --line-2: rgb(20 20 24 / 0.18);
  --sep: var(--line);
  --fg: #18181b;
  --fg-2: #4b4b53;
  --fg-3: #6e6e78;
  --accent: #6b36e8;
  --accent-2: #5a27d4;
  --accent-fg: #ffffff;
  --accent-soft: #f2edfd;
  --accent-line: rgb(107 54 232 / 0.35);
  --accent-text: #5a2bd0;
  --ring: rgb(107 54 232 / 0.22);
  --gold: #f3c94f;
  --gold-deep: #d9ac2c;
  --gold-soft: #fdf3d4;
  --ok: #157347;
  --ok-soft: #e6f4ec;
  --warn: #9a5b00;
  --warn-soft: #fbf0dc;
  --bad: #c42b2b;
  --bad-soft: #fbe9e9;
  --nav: rgb(247 247 245 / 0.86);
  --scrim: rgb(15 15 17 / 0.36);
  --toast: #18181b;
  --toast-fg: #f7f7f5;
  --shadow: none; /* legacy: cards are hairline-bordered now */
  --shadow-pop: 0 1px 2px rgb(20 20 24 / 0.06), 0 8px 24px rgb(20 20 24 / 0.1);
  --shadow-sheet: 0 24px 64px rgb(20 20 24 / 0.2), 0 2px 8px rgb(20 20 24 / 0.08);
  --shadow-lg: var(--shadow-sheet);
  --thumb: 0 1px 2px rgb(20 20 24 / 0.08);
  color-scheme: light;
}
/* Japanese: the system Japanese stack. Russian: Pretendard has no Cyrillic, so the system stack (never two Latin fonts). */
:root:lang(ja) { --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, "Segoe UI", system-ui, sans-serif; }
:root:lang(ru) { --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", system-ui, sans-serif; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0f0f11; --card: #18181b; --fill: #222226; --fill-2: #2c2c31; --line: rgb(255 255 255 / 0.09); --line-2: rgb(255 255 255 / 0.16);
  --fg: #ededef; --fg-2: #b5b5bd; --fg-3: #8d8d97;
  --accent: #7c55f0; --accent-2: #8b67f5; --accent-fg: #ffffff; --accent-soft: rgb(139 103 245 / 0.16); --accent-line: rgb(155 124 247 / 0.5); --accent-text: #b9a5ff; --ring: rgb(155 124 247 / 0.35);
  --gold-soft: #3a2f12; --ok: #4cc38a; --ok-soft: rgb(76 195 138 / 0.13); --warn: #e0a84a; --warn-soft: rgb(224 168 74 / 0.13); --bad: #f07a7a; --bad-soft: rgb(240 122 122 / 0.13);
  --nav: rgb(15 15 17 / 0.86); --scrim: rgb(0 0 0 / 0.6); --toast: #ededef; --toast-fg: #18181b;
  --shadow-pop: 0 0 0 1px rgb(255 255 255 / 0.04), 0 12px 32px rgb(0 0 0 / 0.5); --shadow-sheet: 0 24px 64px rgb(0 0 0 / 0.6); --thumb: 0 1px 2px rgb(0 0 0 / 0.4);
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f11; --card: #18181b; --fill: #222226; --fill-2: #2c2c31; --line: rgb(255 255 255 / 0.09); --line-2: rgb(255 255 255 / 0.16);
  --fg: #ededef; --fg-2: #b5b5bd; --fg-3: #8d8d97;
  --accent: #7c55f0; --accent-2: #8b67f5; --accent-fg: #ffffff; --accent-soft: rgb(139 103 245 / 0.16); --accent-line: rgb(155 124 247 / 0.5); --accent-text: #b9a5ff; --ring: rgb(155 124 247 / 0.35);
  --gold-soft: #3a2f12; --ok: #4cc38a; --ok-soft: rgb(76 195 138 / 0.13); --warn: #e0a84a; --warn-soft: rgb(224 168 74 / 0.13); --bad: #f07a7a; --bad-soft: rgb(240 122 122 / 0.13);
  --nav: rgb(15 15 17 / 0.86); --scrim: rgb(0 0 0 / 0.6); --toast: #ededef; --toast-fg: #18181b;
  --shadow-pop: 0 0 0 1px rgb(255 255 255 / 0.04), 0 12px 32px rgb(0 0 0 / 0.5); --shadow-sheet: 0 24px 64px rgb(0 0 0 / 0.6); --thumb: 0 1px 2px rgb(0 0 0 / 0.4);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: var(--fs-base); line-height: 1.5; letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "ss06" 0; min-height: 100vh; display: flex; flex-direction: column; }
:lang(ja) body, body:lang(ja) { letter-spacing: 0; }
/* Korean breaks between words (eojeol), not inside them; very long tokens still wrap */
:lang(ko) { word-break: keep-all; overflow-wrap: break-word; }
:lang(ko) textarea, :lang(ko) pre, :lang(ko) code, :lang(ko) .mono { word-break: normal; overflow-wrap: anywhere; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
img, svg, canvas, video { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); color: var(--fg); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ── Top bar: text wordmark · tool name … language · theme · all tools ── */
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--nav); -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px); border-bottom: 1px solid var(--line); }
.nav-in { max-width: 1240px; margin: 0 auto; height: 52px; display: flex; align-items: center; gap: 4px; }
@media (min-width: 1024px) { .nav-in { height: 56px; } }
.u-brand { flex: none; display: inline-flex; align-items: center; height: 32px; padding: 0 2px; font-size: 16px; font-weight: 650; letter-spacing: -0.03em; color: var(--fg); text-decoration: none; }
.u-brand:hover { color: var(--fg-2); }
.u-crumb { flex: none; color: var(--fg-3); opacity: .55; font-size: 18px; font-weight: 300; margin: 0 6px 0 4px; }
.svc { margin: 0; min-width: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.012em; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc span { overflow: hidden; text-overflow: ellipsis; }
.svc .ico { display: none; }
@media (max-width: 599px) { .nav.is-tool .u-brand, .nav.is-tool .u-crumb { display: none; } }
.grow { flex: 1; min-width: 4px; }
.nbtn { height: 36px; min-width: 36px; padding: 0 8px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--fg-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: 14px; font-weight: 500; flex: none; transition: background var(--dur-1), color var(--dur-1); }
.nbtn:hover { background: var(--fill); color: var(--fg); }
.nbtn .ico { width: 20px; height: 20px; }
.nbtn .lbl-d { display: none; }
@media (min-width: 900px) { .nbtn .lbl-d { display: inline; } .u-all { padding: 0 10px 0 8px; } }
/* theme toggle shows the mode you switch to */
.u-theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .u-theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .u-theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .u-theme-btn .i-sun { display: block; } :root:not([data-theme="light"]) .u-theme-btn .i-moon { display: none; } }
/* language menu: <details> disclosure of plain links (works without JS); shell.js adds keyboard navigation */
.u-lang { position: relative; flex: none; }
.u-lang > summary { list-style: none; cursor: pointer; }
.u-lang > summary::-webkit-details-marker { display: none; }
.u-lang > summary .code { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.u-lang > summary .name { display: none; }
@media (min-width: 900px) { .u-lang > summary .code { display: none; } .u-lang > summary .name { display: inline; } }
.u-lang > summary .chev { width: 14px; height: 14px; color: var(--fg-3); transition: transform var(--dur-2) var(--ease); }
.u-lang[open] > summary { background: var(--fill); color: var(--fg); }
.u-lang[open] > summary .chev { transform: rotate(180deg); }
.u-menu { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; min-width: 200px; max-height: min(420px, 70vh); overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.u-lang[open] > .u-menu { animation: u-pop var(--dur-2) var(--ease); }
@keyframes u-pop { from { opacity: 0; transform: translateY(-4px); } }
.u-menu a, .u-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--fg); font-size: 14px; font-weight: 450; text-decoration: none; text-align: left; }
.u-menu a:hover, .u-menu a:focus-visible, .u-menu button:hover { background: var(--fill); outline: none; }
.u-menu .tag { margin-left: auto; font-size: 12px; color: var(--fg-3); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.u-menu .ico { width: 16px; height: 16px; color: var(--accent-text); visibility: hidden; }
.u-menu [aria-current]:not([aria-current="false"]) { font-weight: 600; }
.u-menu [aria-current]:not([aria-current="false"]) .ico { visibility: visible; }
/* legacy (pre-2026-11 markup) */
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); flex: none; }
.logo svg { width: 28px; height: 28px; display: block; }
.word { font-size: 17px; font-weight: 650; letter-spacing: -0.03em; }
.word b { font-weight: inherit; color: inherit; }
.lang { position: relative; display: inline-flex; align-items: center; gap: 5px; flex: none; height: 36px; padding: 0 8px; border-radius: var(--r-md); font-size: 13px; font-weight: 600; color: var(--fg-2); }
.lang select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
@media (max-width: 380px) { .nav .hide-xs { display: none; } }

/* ── Ads (transparent; collapse when not configured) ── */
.ad { display: block; text-align: center; overflow: hidden; }
.ad-top { max-width: 728px; min-height: 90px; margin: 16px auto 0; }
.ad-mid { min-height: 250px; margin-block: 8px; }
.ad-bottom { max-width: 728px; min-height: 90px; margin: 16px auto 24px; }
@media (max-width: 760px) { .ad-top, .ad-bottom { min-height: 50px; max-width: 320px; } }

/* ── Page ── */
.page { width: 100%; max-width: 1240px; margin: 0 auto; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 16px 16px; }
.rail { display: none; }
@media (min-width: 1100px) {
  .page { grid-template-columns: 160px minmax(0, 1fr) 160px; padding-block: 24px 16px; }
  .rail { display: block; }
  .rail .ad { position: sticky; top: calc(80px + env(safe-area-inset-top, 0px)); min-height: 600px; }
  .page.wide, .page:not(:has(> .rail)) { grid-template-columns: minmax(0, 1fr); }
  .page > :only-child { grid-column: 1 / -1; }
}
.app { width: 100%; max-width: var(--col); margin: 0 auto; display: grid; gap: 12px; align-content: start; min-width: 0; }

/* ── Layout helpers ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.u-card-h { margin: 0 0 4px; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.012em; }
.stack { display: grid; gap: 12px; min-width: 0; }
.stack.tight { gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.row.nowrap { flex-wrap: nowrap; }
.row > .fill { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.center { text-align: center; }
.muted { color: var(--fg-3); }
.hint { color: var(--fg-3); font-size: var(--fs-sm); line-height: 1.45; }
.err { color: var(--bad); font-size: 14px; font-weight: 500; }
.ok-text { color: var(--ok); font-weight: 600; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.lbl { display: block; font-size: var(--fs-sm); font-weight: 500; color: var(--fg-2); margin: 0 0 6px 2px; }
.h2 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.018em; margin: 24px 2px 0; line-height: 1.3; }
.big { font-size: clamp(36px, 11vw, 52px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.08; font-variant-numeric: tabular-nums; }
.u-display { font-size: var(--fs-display); font-weight: 650; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.u-overline { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); }
:lang(ja) .u-overline, :lang(ko) .u-overline { letter-spacing: 0; text-transform: none; }
.u-divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ── Segmented control (legacy .tabs > .tab, new .u-seg > button) ── */
.tabs, .u-seg { display: flex; gap: 2px; padding: 3px; background: var(--fill); border-radius: var(--r-md); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar, .u-seg::-webkit-scrollbar { display: none; }
.tab, .u-seg > button, .u-seg > a { flex: 1 0 auto; position: relative; height: 34px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--fg-2); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background var(--dur-2) var(--ease), color var(--dur-1); }
.tab .ico, .u-seg .ico { width: 16px; height: 16px; }
.tab:hover, .u-seg > :hover { color: var(--fg); }
.tab[aria-selected="true"], .tab[aria-pressed="true"], .tab.on, .u-seg > [aria-pressed="true"], .u-seg > [aria-selected="true"], .u-seg > [aria-current]:not([aria-current="false"]) { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: var(--thumb), 0 0 0 1px var(--line); }
@media (max-width: 400px) { .tab, .u-seg > button { padding: 0 8px; font-size: 13.5px; } }
/* underline tabs for switching panes */
.u-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.u-tabs > * { flex: none; height: 40px; padding: 0; border: 0; background: none; color: var(--fg-3); font-size: var(--fs-md); font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; box-shadow: inset 0 -2px 0 transparent; }
.u-tabs > :hover { color: var(--fg); }
.u-tabs > [aria-selected="true"], .u-tabs > [aria-current]:not([aria-current="false"]) { color: var(--fg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

/* ── Fields ── */
.field, .app textarea, .app input[type="text"], .app input[type="number"], .app input[type="search"], .app input[type="date"], .app input[type="time"], .app input[type="datetime-local"], .app input[type="month"], .app input[type="week"], .app input[type="tel"], .app input[type="url"], .app input[type="email"], .app input[type="password"], .app input:not([type]), .app select {
  width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line-2); background: var(--card); color: var(--fg); border-radius: var(--r-md); padding: 10px 12px; font-size: 16px; line-height: 1.4; outline: none; transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.app select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378787f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-position: right 10px center; background-size: 18px; background-repeat: no-repeat; cursor: pointer; }
.app textarea { resize: vertical; min-height: 140px; display: block; }
.app textarea.mono, .field.mono { font-family: var(--mono); font-size: 14px; letter-spacing: 0; }
.field:hover, .app textarea:hover, .app input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):hover, .app select:hover { border-color: color-mix(in srgb, var(--fg) 28%, transparent); }
.field:focus, .app textarea:focus, .app input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus, .app select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.app input::placeholder, .app textarea::placeholder { color: var(--fg-3); opacity: 1; }
.app input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.app input[type="checkbox"], .app input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.app input[type="color"] { border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--card); padding: 3px; height: 44px; cursor: pointer; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); cursor: pointer; }
.u-field { display: grid; gap: 6px; min-width: 0; }
.u-field > .lbl { margin: 0 0 0 2px; }
/* unit inside a field: <span class="u-affix"><input><span>kg</span></span> */
.u-affix { position: relative; display: flex; align-items: center; min-width: 0; }
.u-affix > input { padding-right: 48px !important; }
.u-affix > span { position: absolute; right: 12px; color: var(--fg-3); font-size: 14px; pointer-events: none; }
/* number stepper: <div class="u-stepper"><button>−</button><input inputmode="numeric"><button>+</button></div> */
.u-stepper { display: inline-flex; flex: none; align-items: stretch; height: 44px; max-width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--card); overflow: hidden; }
.u-stepper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.u-stepper button { flex: none; width: 42px; border: 0; background: none; color: var(--fg-2); display: grid; place-items: center; }
.u-stepper button:hover { background: var(--fill); color: var(--fg); }
.u-stepper button .ico { width: 18px; height: 18px; }
.app .u-stepper input { flex: 1 1 56px; width: 64px; min-height: 0; border: 0 !important; box-shadow: none !important; text-align: center; padding: 0 4px; font-variant-numeric: tabular-nums; font-weight: 600; background: none; }
/* locale-proof time / date entry: separate fields instead of a native picker that speaks the browser's language */
.u-datetime { display: flex; align-items: center; gap: 6px; }
.app .u-datetime input { width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.u-datetime .sep { color: var(--fg-3); font-weight: 600; }
/* switch */
.u-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-md); }
.u-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.u-switch > span { flex: none; width: 36px; height: 22px; border-radius: var(--r-full); background: var(--fill-2); position: relative; transition: background var(--dur-2); }
.u-switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform var(--dur-2) var(--ease); }
.u-switch input:checked + span { background: var(--accent); }
.u-switch input:checked + span::after { transform: translateX(14px); }
.u-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Buttons ── */
.btn { height: var(--h-md); padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--card); color: var(--fg); font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.008em; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1); }
.btn:hover { background: var(--fill); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); height: 44px; padding: 0 20px; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.btn.soft:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--fill); color: var(--fg); }
.btn.danger { color: var(--bad); }
.btn.sm { height: var(--h-sm); font-size: 14px; padding: 0 10px; gap: 6px; }
.btn.lg { height: var(--h-lg); font-size: var(--fs-base); padding: 0 22px; }
.btn.icon { width: var(--h-md); padding: 0; }
.btn.sm.icon { width: var(--h-sm); }
.btn.block { width: 100%; white-space: normal; text-align: center; line-height: 1.2; height: auto; min-height: var(--h-md); padding-block: 8px; }
.btn.primary.block { min-height: 48px; }
.btn .ico { width: 18px; height: 18px; }
.btn.sm .ico { width: 16px; height: 16px; }

/* ── Chips: scroll inside their row with fade edges (shell.js sets data-fade) ── */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding: 2px; margin: -2px; min-width: 0; scroll-padding-inline: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips[data-fade="e"] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
.chips[data-fade="s"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
.chips[data-fade="se"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.chips.wrap { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
.chip { flex: none; height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--card); color: var(--fg-2); font-size: 14px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; scroll-snap-align: start; font-variant-numeric: tabular-nums; white-space: nowrap; transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1); }
.chip .ico { width: 16px; height: 16px; }
.chip:hover { background: var(--fill); color: var(--fg); }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip[aria-current]:not([aria-current="false"]), .chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.chip.sm { height: 28px; padding: 0 9px; font-size: 13px; }

/* ── One-line options (icon over label) ── */
.opts { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.opts::-webkit-scrollbar { display: none; }
.opt { flex: 1 1 0; min-width: 64px; max-width: 112px; height: 56px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--card); color: var(--fg-2); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 12px; font-weight: 500; padding: 4px; transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1); }
.opt .ico { width: 18px; height: 18px; }
.opt:hover { background: var(--fill); color: var(--fg); }
.opt[aria-pressed="true"], .opt.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }

/* ── Result rows: tap to copy ── */
.list { padding: 2px 0; }
.res { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 16px; border: 0; background: none; text-align: left; position: relative; color: var(--fg); transition: background var(--dur-1); }
.res + .res::before, .res + .item::before, .item + .res::before, .item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--line); }
button.res:hover { background: color-mix(in srgb, var(--fill) 60%, transparent); }
button.res:active { background: var(--fill); }
.res .k { flex: none; max-width: 45%; color: var(--fg-3); font-size: 14px; font-weight: 450; }
.res .v { flex: 1; min-width: 0; text-align: right; font-size: var(--fs-base); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.res .v.mono { font-family: var(--mono); font-size: 14px; font-weight: 500; }
.res .cp { flex: none; width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--fg-3); opacity: .55; transition: opacity var(--dur-1), background var(--dur-1), color var(--dur-1); }
button.res:hover .cp, button.res:focus-visible .cp { opacity: 1; background: var(--fill); }
.res .cp .ico { width: 15px; height: 15px; }
.res.ok .cp { opacity: 1; background: var(--accent); color: var(--accent-fg); }
.res.block { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 4px 12px; }
.res.block .k { max-width: none; }
.res.block .cp { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.res.block .v { grid-column: 1; text-align: left; white-space: pre-wrap; }
.res.empty .v { color: var(--fg-3); font-weight: 450; }
.item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; position: relative; }

/* ── Stat tiles: cells of one card divided by hairlines ── */
.u-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.u-stat { display: grid; gap: 2px; padding: 12px 16px; box-shadow: -1px 0 0 var(--line), 0 -1px 0 var(--line); min-width: 0; }
.u-stat .k, .u-stat dt { font-size: var(--fs-sm); color: var(--fg-3); }
.u-stat .v, .u-stat dd { margin: 0; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ── Tables ── */
.u-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.u-table th { position: sticky; top: 0; background: var(--fill); color: var(--fg-2); font-weight: 600; font-size: var(--fs-sm); text-align: left; padding: 8px 12px; }
.u-table td { padding: 10px 12px; border-top: 1px solid var(--line); }
.u-table .n, .u-table td.num, .u-table th.num { text-align: right; }
.u-table tr:hover td { background: color-mix(in srgb, var(--fill) 50%, transparent); }

/* ── Empty state, badges ── */
.u-empty { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; text-align: center; color: var(--fg-3); font-size: var(--fs-md); }
.u-empty .ico { width: 24px; height: 24px; color: var(--fg-3); }
.u-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: var(--r-xs); background: var(--fill); color: var(--fg-2); font-size: var(--fs-xs); font-weight: 600; }

/* ── Drop zone ── */
.drop { display: grid; place-items: center; gap: 8px; text-align: center; min-height: 168px; padding: 24px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--card); color: var(--fg-2); cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1); font-weight: 500; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.drop .ico { width: 28px; height: 28px; color: var(--fg-3); }
.drop:hover .ico, .drop.over .ico { color: var(--accent-text); }
.drop small { display: block; color: var(--fg-3); font-weight: 400; font-size: var(--fs-sm); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }

/* ── Themed surfaces (event pages): flat paper tone + low-contrast pattern. docs/DESIGN.md §8 ── */
.u-theme { --th-bg: var(--card); --th-fg: var(--fg); --th-fg-2: var(--fg-2); --th-accent: var(--accent-text); --th-line: var(--line); --th-pat: currentColor; --th-pat-o: .07;
  position: relative; isolation: isolate; overflow: hidden; background: var(--th-bg); color: var(--th-fg); border: 1px solid var(--th-line); border-radius: var(--r-xl); }
.u-theme .muted, .u-theme .hint { color: var(--th-fg-2); }
.u-theme[data-tone="night"] { --th-bg: #14162b; --th-fg: #f2f1ea; --th-fg-2: #b9b9c9; --th-accent: #f3c94f; --th-line: rgb(255 255 255 / .08); --th-pat-o: .14; }
.u-theme[data-tone="winter"] { --th-bg: #eef3f6; --th-fg: #14303d; --th-fg-2: #4a6572; --th-accent: #b3322f; --th-line: rgb(20 48 61 / .1); }
.u-theme[data-tone="festive"] { --th-bg: #1f3a2e; --th-fg: #f6f1e6; --th-fg-2: #c3cfc2; --th-accent: #e2b24a; --th-line: rgb(255 255 255 / .08); --th-pat-o: .1; }
.u-theme[data-tone="autumn"] { --th-bg: #f6eee4; --th-fg: #3a2414; --th-fg-2: #7a5a40; --th-accent: #c2541b; --th-line: rgb(58 36 20 / .1); }
.u-theme[data-tone="spring"] { --th-bg: #f1f5ec; --th-fg: #1f3320; --th-fg-2: #566b55; --th-accent: #c2457a; --th-line: rgb(31 51 32 / .1); }
.u-theme[data-tone="summer"] { --th-bg: #fbf5e6; --th-fg: #2c2410; --th-fg-2: #6b5d3a; --th-accent: #d9771f; --th-line: rgb(44 36 16 / .1); }
.u-theme[data-tone="love"] { --th-bg: #fbeff1; --th-fg: #3a1520; --th-fg-2: #84505d; --th-accent: #c8304f; --th-line: rgb(58 21 32 / .1); }
.u-theme[data-tone="paper"] { --th-bg: #f5f2ea; --th-fg: #26231c; --th-fg-2: #6b6658; --th-accent: var(--accent-text); --th-line: rgb(38 35 28 / .1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .u-theme:is([data-tone="winter"], [data-tone="autumn"], [data-tone="spring"], [data-tone="summer"], [data-tone="love"], [data-tone="paper"]) { --th-fg: #f3f1ec; --th-fg-2: #c4c0b8; --th-line: rgb(255 255 255 / .08); --th-pat-o: .1; }
  :root:not([data-theme="light"]) .u-theme[data-tone="winter"] { --th-bg: #16242c; --th-accent: #e8a39f; }
  :root:not([data-theme="light"]) .u-theme[data-tone="autumn"] { --th-bg: #2a1c12; --th-accent: #f0915a; }
  :root:not([data-theme="light"]) .u-theme[data-tone="spring"] { --th-bg: #1a2419; --th-accent: #ee8fb6; }
  :root:not([data-theme="light"]) .u-theme[data-tone="summer"] { --th-bg: #2a2312; --th-accent: #f2a65a; }
  :root:not([data-theme="light"]) .u-theme[data-tone="love"] { --th-bg: #2b161c; --th-accent: #f08aa0; }
  :root:not([data-theme="light"]) .u-theme[data-tone="paper"] { --th-bg: #22201b; --th-accent: var(--accent-text); }
}
:root[data-theme="dark"] .u-theme:is([data-tone="winter"], [data-tone="autumn"], [data-tone="spring"], [data-tone="summer"], [data-tone="love"], [data-tone="paper"]) { --th-fg: #f3f1ec; --th-fg-2: #c4c0b8; --th-line: rgb(255 255 255 / .08); --th-pat-o: .1; }
:root[data-theme="dark"] .u-theme[data-tone="winter"] { --th-bg: #16242c; --th-accent: #e8a39f; }
:root[data-theme="dark"] .u-theme[data-tone="autumn"] { --th-bg: #2a1c12; --th-accent: #f0915a; }
:root[data-theme="dark"] .u-theme[data-tone="spring"] { --th-bg: #1a2419; --th-accent: #ee8fb6; }
:root[data-theme="dark"] .u-theme[data-tone="summer"] { --th-bg: #2a2312; --th-accent: #f2a65a; }
:root[data-theme="dark"] .u-theme[data-tone="love"] { --th-bg: #2b161c; --th-accent: #f08aa0; }
:root[data-theme="dark"] .u-theme[data-tone="paper"] { --th-bg: #22201b; --th-accent: var(--accent-text); }
.u-theme[data-pattern]::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--th-pat); opacity: var(--th-pat-o); -webkit-mask-repeat: repeat; mask-repeat: repeat; pointer-events: none; }
.u-theme[data-pattern="dots"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Ccircle cx='2' cy='2' r='1.2'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Ccircle cx='2' cy='2' r='1.2'/%3E%3C/svg%3E"); }
.u-theme[data-pattern="grid"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M24 0H0v24' fill='none' stroke='%23000'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M24 0H0v24' fill='none' stroke='%23000'/%3E%3C/svg%3E"); }
.u-theme[data-pattern="stars"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg%3E%3Ccircle cx='12' cy='18' r='1'/%3E%3Ccircle cx='70' cy='9' r='.8'/%3E%3Ccircle cx='101' cy='40' r='1.3'/%3E%3Ccircle cx='38' cy='62' r='.8'/%3E%3Ccircle cx='84' cy='88' r='1'/%3E%3Ccircle cx='20' cy='104' r='1.2'/%3E%3Cpath d='M55 30l1.2 3 3 1.2-3 1.2L55 38.4l-1.2-3-3-1.2 3-1.2z'/%3E%3Cpath d='M108 100l.9 2.2 2.2.9-2.2.9-.9 2.2-.9-2.2-2.2-.9 2.2-.9z'/%3E%3C/g%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg%3E%3Ccircle cx='12' cy='18' r='1'/%3E%3Ccircle cx='70' cy='9' r='.8'/%3E%3Ccircle cx='101' cy='40' r='1.3'/%3E%3Ccircle cx='38' cy='62' r='.8'/%3E%3Ccircle cx='84' cy='88' r='1'/%3E%3Ccircle cx='20' cy='104' r='1.2'/%3E%3Cpath d='M55 30l1.2 3 3 1.2-3 1.2L55 38.4l-1.2-3-3-1.2 3-1.2z'/%3E%3Cpath d='M108 100l.9 2.2 2.2.9-2.2.9-.9 2.2-.9-2.2-2.2-.9 2.2-.9z'/%3E%3C/g%3E%3C/svg%3E"); }
.u-theme[data-pattern="snow"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='none' stroke='%23000' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M20 12v12M14 18h12M15.8 13.8l8.4 8.4M24.2 13.8l-8.4 8.4M70 54v8M66 58h8M67.2 55.2l5.6 5.6M72.8 55.2l-5.6 5.6'/%3E%3Ccircle cx='60' cy='16' r='1' fill='%23000'/%3E%3Ccircle cx='30' cy='70' r='1.4' fill='%23000'/%3E%3Ccircle cx='86' cy='86' r='1' fill='%23000'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='none' stroke='%23000' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M20 12v12M14 18h12M15.8 13.8l8.4 8.4M24.2 13.8l-8.4 8.4M70 54v8M66 58h8M67.2 55.2l5.6 5.6M72.8 55.2l-5.6 5.6'/%3E%3Ccircle cx='60' cy='16' r='1' fill='%23000'/%3E%3Ccircle cx='30' cy='70' r='1.4' fill='%23000'/%3E%3Ccircle cx='86' cy='86' r='1' fill='%23000'/%3E%3C/svg%3E"); }
.u-theme[data-pattern="confetti"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M10 14l5 3M60 10l-2 5M84 34l4 3M30 44l-4 4M52 60l5 1M14 80l3 5M76 76l-3 4M40 88l5-1'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M10 14l5 3M60 10l-2 5M84 34l4 3M30 44l-4 4M52 60l5 1M14 80l3 5M76 76l-3 4M40 88l5-1'/%3E%3C/svg%3E"); }
.u-theme[data-pattern="leaves"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' fill='none' stroke='%23000' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M12 26c0-8 6-14 14-14 0 8-6 14-14 14zM12 26l8-8M54 66c0-8 6-14 14-14 0 8-6 14-14 14zM54 66l8-8'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' fill='none' stroke='%23000' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M12 26c0-8 6-14 14-14 0 8-6 14-14 14zM12 26l8-8M54 66c0-8 6-14 14-14 0 8-6 14-14 14zM54 66l8-8'/%3E%3C/svg%3E"); }
.u-theme[data-pattern="hearts"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' fill='none' stroke='%23000' stroke-width='1' stroke-linejoin='round'%3E%3Cpath d='M18 24s-6-3.4-6-7.6A3.3 3.3 0 0 1 18 14a3.3 3.3 0 0 1 6 2.4c0 4.2-6 7.6-6 7.6zM54 60s-6-3.4-6-7.6A3.3 3.3 0 0 1 54 50a3.3 3.3 0 0 1 6 2.4c0 4.2-6 7.6-6 7.6z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' fill='none' stroke='%23000' stroke-width='1' stroke-linejoin='round'%3E%3Cpath d='M18 24s-6-3.4-6-7.6A3.3 3.3 0 0 1 18 14a3.3 3.3 0 0 1 6 2.4c0 4.2-6 7.6-6 7.6zM54 60s-6-3.4-6-7.6A3.3 3.3 0 0 1 54 50a3.3 3.3 0 0 1 6 2.4c0 4.2-6 7.6-6 7.6z'/%3E%3C/svg%3E"); }
.u-theme[data-pattern="waves"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' fill='none' stroke='%23000' stroke-width='1'%3E%3Cpath d='M0 8c6 0 6-5 12-5s6 5 12 5 6-5 12-5 6 5 12 5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' fill='none' stroke='%23000' stroke-width='1'%3E%3Cpath d='M0 8c6 0 6-5 12-5s6 5 12 5 6-5 12-5 6 5 12 5'/%3E%3C/svg%3E"); }
.u-theme-art { position: absolute; z-index: -1; pointer-events: none; color: var(--th-accent); fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ── Under the tool: actions, disclaimer, related ── */
.actions { display: flex; gap: 8px; margin-top: 4px; }
.actions .btn { flex: 1; }
.actions .btn.icon { flex: none; }
.disclaimer { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: transparent; color: var(--fg-3); font-size: var(--fs-sm); line-height: 1.5; }
.disclaimer .ico { width: 16px; height: 16px; margin-top: 1px; color: var(--fg-3); }
.related { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rel { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; text-decoration: none; color: var(--fg); font-weight: 500; font-size: var(--fs-md); min-width: 0; position: relative; transition: background var(--dur-1); }
.rel + .rel { box-shadow: inset 0 1px 0 var(--line); }
.rel:hover { background: color-mix(in srgb, var(--fill) 60%, transparent); }
.rel i { width: 32px; height: 32px; border-radius: var(--r-md); border: 1px solid var(--line); color: var(--fg-2); display: grid; place-items: center; flex: none; }
.rel i .ico { width: 18px; height: 18px; }
.rel span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel > .ico { width: 16px; height: 16px; color: var(--fg-3); }

/* ── Visible page copy under the tool (intro, how to use, about, FAQ) ── */
.info { overflow-wrap: anywhere; margin: 24px 2px 0; color: var(--fg-2); font-size: var(--fs-md); line-height: 1.7; max-width: 68ch; }
.info h2 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.018em; line-height: 1.3; color: var(--fg); margin: 32px 0 8px; }
.info > h2:first-child, .info > .lead:first-child + h2 { margin-top: 24px; }
.info h3 { font-size: var(--fs-md); font-weight: 600; color: var(--fg); margin: 16px 0 2px; }
.info p, .info ul, .info ol { margin: 0 0 10px; }
.info ul { padding-left: 1.2em; }
.info li { margin: 4px 0; padding-left: 2px; }
.info li::marker { color: var(--fg-3); }
.info ol { list-style: none; padding: 0; counter-reset: st; }
.info ol > li { counter-increment: st; position: relative; padding-left: 34px; margin: 8px 0; }
.info ol > li::before { content: counter(st); position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--fg-2); font-variant-numeric: tabular-nums; line-height: 1; }
.info .lead { font-size: var(--fs-base); color: var(--fg); line-height: 1.65; }
.info .faq { border-top: 1px solid var(--line); margin-top: 8px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--fg); font-size: var(--fs-md); line-height: 1.45; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 16px; height: 16px; margin-top: 2px; background: var(--fg-3); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform var(--dur-2) var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--accent-text); }
.faq details > p, .faq details > div { margin: -4px 0 16px; color: var(--fg-2); font-size: var(--fs-md); line-height: 1.65; }

/* ── Footer ── */
.foot { width: 100%; max-width: 1240px; margin: 32px auto 0; padding-block: 28px calc(32px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 16px; color: var(--fg-3); font-size: var(--fs-sm); border-top: 1px solid var(--line); }
.foot-top { display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; align-items: flex-start; }
.foot-brand { display: grid; gap: 4px; max-width: 42ch; }
.foot-brand p { margin: 0; line-height: 1.5; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.foot a { color: var(--fg-2); text-decoration: none; }
.foot a:hover { color: var(--fg); text-decoration: underline; }
.foot .u-brand { height: auto; color: var(--fg); }
.foot .foot-langs a { color: var(--fg-3); }
.foot .foot-langs a[aria-current]:not([aria-current="false"]) { color: var(--fg); font-weight: 600; }
.foot .legal { margin: 0; max-width: 80ch; line-height: 1.55; font-size: var(--fs-xs); }
.foot-meta { font-size: var(--fs-xs); }
/* legacy footer logo */
.foot .logo svg { width: 20px; height: 20px; }
.foot .logo .word { display: inline; font-size: 15px; }

/* ── Sheets (share / help) ── */
.sheet { border: 1px solid var(--line); padding: 0; margin: auto auto 0; width: 100%; max-width: 460px; max-height: 88vh; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--card); color: var(--fg); box-shadow: var(--shadow-sheet); overflow: hidden; }
.sheet:focus { outline: none; }
.sheet::backdrop { background: var(--scrim); }
.sheet[open] { display: flex; flex-direction: column; animation: up var(--dur-3) var(--ease); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 600px) { .sheet { margin: auto; border-radius: var(--r-xl); } }
.sheet-h { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px 20px; }
.sheet-h h2 { margin: 0; flex: 1; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.018em; }
.sheet-b { padding: 6px 20px calc(24px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; display: grid; gap: 16px; }
.sheet-b > * { min-height: min-content; } /* scrolling rows (chips, tabs) inside a scrolling grid must not collapse to zero height */
.sheet-b h3 { margin: 6px 0 -6px; font-size: var(--fs-xs); font-weight: 600; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; }
:lang(ja) .sheet-b h3, :lang(ko) .sheet-b h3 { text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); }
.sheet-b ol, .sheet-b ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--fg-2); font-size: var(--fs-md); }
.sheet-b p { margin: 0; color: var(--fg-2); font-size: var(--fs-md); }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: var(--r-xs); background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 1px 0 var(--line-2); font-family: var(--mono); font-size: 12px; text-align: center; color: var(--fg-2); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; font-size: var(--fs-md); color: var(--fg-2); }
.sheet .preview { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.sheet .preview img { display: block; width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--fill); }
.sheet .preview div { padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.sheet .preview b { display: block; font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .preview span { font-size: var(--fs-sm); color: var(--fg-3); }
.apps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px 6px; }
.appbtn { display: grid; justify-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--fg-2); font-size: 11.5px; font-weight: 500; text-decoration: none; min-width: 0; }
.appbtn i { width: 48px; height: 48px; border-radius: var(--r-lg); display: grid; place-items: center; color: #fff; font-style: normal; transition: transform var(--dur-1); }
.appbtn:active i { transform: scale(.94); }
.appbtn i svg { width: 22px; height: 22px; }
.appbtn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codebox { display: block; width: 100%; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--fill); border-radius: var(--r-md); padding: 12px; border: 1px solid var(--line); color: var(--fg); resize: none; min-height: 96px; }
.qrbox { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: var(--r-lg); border: 1px solid var(--line); }
.qrbox canvas, .qrbox img { width: 200px; height: 200px; image-rendering: pixelated; }

/* ── Toast ── */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 50; transform: translate(-50%, 8px); opacity: 0; background: var(--toast); color: var(--toast-fg); padding: 10px 14px 10px 12px; border-radius: var(--r-md); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; pointer-events: none; transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); max-width: calc(100vw - 32px); box-shadow: var(--shadow-pop); }
.toast svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast.err svg { stroke: var(--bad); }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
/* "View in <language>" bar */
.langbar { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 8px 6px 16px; background: var(--card); border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.langbar a { color: var(--accent-text); text-decoration: none; padding: 4px 8px; border-radius: var(--r-sm); }
.langbar a:hover { background: var(--fill); }
.langbar a::after { content: " →"; }
.langbar button { width: 30px; height: 30px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--fg-3); display: grid; place-items: center; }
.langbar button:hover { background: var(--fill); color: var(--fg); }
.langbar button svg { width: 16px; height: 16px; }

/* ── Embed mode ── */
.embed body, body.embed { background: var(--bg); }
.embed .page { padding-block: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; justify-self: center; font-size: var(--fs-xs); font-weight: 500; color: var(--fg-3); text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm); }
.badge:hover { background: var(--fill); color: var(--fg); }
.badge svg { width: 16px; height: 16px; }

/* ── Misc ── */
.scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
.app pre { margin: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }
@media print { .nav, .foot, .actions, .related, .ad, .rail, .langbar, .toast { display: none !important; } body { background: #fff; } .card, .related { border-color: #ccc; } }

/* Keyboard tester */
.kt { display: grid; gap: 14px; padding: 14px; outline: none; transition: box-shadow .2s; }
.kt:focus-visible { outline: none; }
.kt[data-armed="1"] { border-color: var(--accent-line); }
.kt-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kt-bar .chips { flex: 1; min-width: 0; }
.kt-status { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: var(--r-sm); background: var(--fill); color: var(--fg-3); font-size: 13px; font-weight: 500; white-space: nowrap; }
.kt-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); }
.kt[data-armed="1"] .kt-status { background: var(--accent-soft); color: var(--accent-text); }
.kt[data-armed="1"] .kt-status i { background: var(--accent); animation: ktpulse 1.6s ease-in-out infinite; }
@keyframes ktpulse { 50% { opacity: .35; } }

.kb-wrap { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding: 2px 0; }
.kb { position: relative; margin: 0 auto; --u: 30px; user-select: none; -webkit-user-select: none; }
.key { position: absolute; display: grid; place-items: center; align-content: center; gap: 0; padding: 2px; border-radius: calc(var(--u) * 0.16); background: var(--fill); color: var(--fg-2); font-size: calc(var(--u) * 0.36); font-weight: 500; line-height: 1.05; text-align: center; overflow: hidden; box-shadow: inset 0 calc(var(--u) * -0.06) 0 var(--fill-2); transition: background .25s, color .25s, transform .08s; border: calc(var(--u) * 0.05) solid var(--card); }
.key span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78em; font-weight: 500; color: var(--fg-3); }
.key small.ls { font-size: .56em; order: 2; }
.key.wide { font-size: calc(var(--u) * 0.27); }
.key.half { font-size: calc(var(--u) * 0.28); }
.key.na { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--fg-3); }
.key.done { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 calc(var(--u) * -0.06) 0 color-mix(in srgb, var(--accent) 22%, transparent); }
.key.done small { color: inherit; opacity: .7; }
.key.down { background: var(--accent); color: var(--accent-fg); transform: translateY(1px); box-shadow: none; transition: none; }
.key.down small { color: inherit; }
.key.iso-enter { clip-path: polygon(0 0, 100% 0, 100% 100%, 16.7% 100%, 16.7% 50%, 0 50%); }
.kb.small .key small { display: none; }
.kb.tiny .key { font-size: calc(var(--u) * 0.42); padding: 0; border-radius: 3px; }
.kb.tiny .key small.ls { font-size: .56em; order: 2; }
.key.wide { font-size: calc(var(--u) * 0.3); }
.kt.all .key.done { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 calc(var(--u) * -0.06) 0 color-mix(in srgb, var(--ok) 25%, transparent); }

.kt-in { text-align: center; }
/* stat tiles: cells of one hairline box */
.kt-stats { gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kt-stats .stat { position: relative; display: grid; justify-items: center; padding: 10px 4px 12px; min-width: 0; overflow: hidden; }
.kt-stats .stat + .stat { border-left: 1px solid var(--line); }
.kt-stats .num { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.kt-stats .num small { font-size: 14px; font-weight: 500; color: var(--fg-3); letter-spacing: 0; }
.kt-stats .stat > small { font-size: 13px; font-weight: 400; color: var(--fg-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-stats .bar { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 3px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.kt-stats .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .25s; }
.kt.all .kt-stats .bar i { background: var(--ok); }
.opt[data-opt="reset"] { color: var(--fg-2); }

.kt-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 4px 18px; }
.kt-log .kt-h { padding: 0 0 8px 4px; }
.kt-h h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.kt-type { font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--fg-3); }
.kt-last .res .k { font-family: var(--mono); font-size: 13px; }
.log { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; max-height: 140px; overflow: hidden; align-content: flex-start; }
.lk { display: inline-block; min-width: 28px; padding: 3px 8px; border-radius: var(--r-xs); background: var(--card); border: 1px solid var(--line-2); border-bottom-width: 2px; font-family: var(--mono); font-size: 13px; text-align: center; color: var(--fg); }
.lk:first-child { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }

/* wide layout: the keyboard gets room on desktop, everything else keeps the 480px column */
@media (min-width: 760px) {
  .app:has(#kt:not([hidden])) { max-width: 940px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .app:has(#kt:not([hidden])) > * { grid-column: 1 / -1; width: 100%; max-width: var(--col); justify-self: center; }
  .app:has(#kt:not([hidden])) > #kt { max-width: none; }
  .app:has(#kt:not([hidden])) > .kt-last { grid-column: 1; max-width: none; align-self: start; }
  .app:has(#kt:not([hidden])) > .kt-log { grid-column: 2; max-width: none; align-self: start; }
  .app:has(#kt:not([hidden])) .kt-stats, .app:has(#kt:not([hidden])) .kt .opts { width: 100%; max-width: 560px; margin: 0 auto; }
  .kt-log .log { max-height: 330px; }
}
@media (prefers-reduced-motion: reduce) { .key.down { transform: none; } .kt-status i { animation: none !important; } }

/* keyboard / mouse switch */
.ktabs .tab .ico { width: 18px; height: 18px; }
.app:has(#kt:not([hidden])) > .ktabs { max-width: var(--col); }
.ms-logc { padding: 14px; }
.ms-logc .kt-h { padding: 0 0 8px 4px; }

/* mouse test */
.ms { display: grid; gap: 12px; padding: 12px; }
.ms-pad { position: relative; height: 300px; border-radius: var(--r-lg); background: var(--fill); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; cursor: crosshair; }
.ms-pad:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ms-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ms-svg { position: absolute; left: 50%; top: 50%; width: 120px; height: 180px; margin: -98px 0 0 -60px; pointer-events: none; }
.ms-body { fill: var(--card); stroke: var(--fg-3); stroke-width: 1.5; }
.ms-btn { fill: var(--card); stroke: var(--fg-3); stroke-width: 1.5; transition: fill .12s; }
.ms-btn.done { fill: var(--accent-soft); stroke: var(--accent); }
.ms-btn.down { fill: var(--accent); stroke: var(--accent); transition: none; }
.ms-arrow { fill: var(--fg-3); opacity: .35; transition: opacity .25s, fill .25s; }
.ms-arrow.on { fill: var(--accent); opacity: 1; transition: none; }
.ms-hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 13.5px; font-weight: 500; color: var(--fg-3); pointer-events: none; padding: 0 10px; }
.ms-btns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.ms-b { display: grid; justify-items: center; gap: 1px; padding: 8px 2px; background: var(--card); min-width: 0; transition: background var(--dur-1); }
.ms-b b { font-size: 19px; font-weight: 600; line-height: 1.2; }
.ms-b small { font-size: 12px; font-weight: 400; color: var(--fg-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-b.done { background: var(--accent-soft); color: var(--accent-text); }
.ms-b.down { background: var(--accent); color: var(--accent-fg); transition: none; }
.ms-b.down small, .ms-b.done small { color: inherit; opacity: .8; }
/* stat tiles: hairline cells of one card */
.ms-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; padding: 0; background: var(--line); overflow: hidden; }
.ms-st { display: grid; gap: 1px; align-content: start; padding: 12px 14px; background: var(--card); min-width: 0; }
.ms-st small { font-size: 13px; font-weight: 400; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-st b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-st span { font-size: 13px; font-weight: 400; color: var(--fg-3); overflow-wrap: anywhere; }
.ms-st.hi { box-shadow: inset 0 -2px 0 var(--accent); }
.ms-st.bad b { color: var(--bad); }
.ms-thr .chips { gap: 4px; margin: 6px 0 0; flex-wrap: wrap; overflow: visible; }
.ms-thr .chip.sm { padding: 0 8px; }
.ms-log { display: grid; gap: 2px; max-height: 220px; overflow: auto; font-size: 13.5px; }
.ms-log > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ms-log > div span:last-child { color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ms-log > div.bad span { color: var(--bad); font-weight: 600; }
@media (min-width: 760px) { .ms-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
