/* minitool.app design system. Every page links this; pages add their own <style> using the tokens below. */
/* Self-hosted fonts (SIL Open Font License, see static/fonts/LICENSE-*). */
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/bricolage-grotesque-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/bricolage-grotesque-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 800; font-display: swap; src: url('/static/fonts/bricolage-grotesque-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --bg-dots: rgba(22, 24, 45, 0.07);
  --card: #ffffff;
  --surface-2: #f1ede4;
  --text: #16182d;
  --muted: #676a80;
  --border: #e3ded2;
  --ink: #16182d;            /* hard-shadow / outline color */
  --primary: #5b3df5;
  --primary-dark: #4527d9;
  --primary-soft: #ece8ff;
  --on-primary: #ffffff;
  --accent: #c8f04a;         /* acid lime highlight */
  --on-accent: #16182d;
  --danger: #e5484d;
  --success: #1f9d55;
  --warning: #f59e0b;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(22, 24, 45, 0.04), 0 8px 24px -12px rgba(22, 24, 45, 0.18);
  --shadow-hard: 4px 4px 0 var(--ink);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111222;
    --bg-dots: rgba(255, 255, 255, 0.05);
    --card: #1b1d33;
    --surface-2: #24273f;
    --text: #eceaf6;
    --muted: #9c9eb8;
    --border: #2f3250;
    --ink: #000000;
    --primary: #8b75ff;
    --primary-dark: #a594ff;
    --primary-soft: #2a2552;
    --on-primary: #0f0f1f;
    --accent: #c8f04a;
    --danger: #ff6b6f;
    --success: #3ccf7e;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111222;
  --bg-dots: rgba(255, 255, 255, 0.05);
  --card: #1b1d33;
  --surface-2: #24273f;
  --text: #eceaf6;
  --muted: #9c9eb8;
  --border: #2f3250;
  --ink: #000000;
  --primary: #8b75ff;
  --primary-dark: #a594ff;
  --primary-soft: #2a2552;
  --on-primary: #0f0f1f;
  --accent: #c8f04a;
  --danger: #ff6b6f;
  --success: #3ccf7e;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; overflow-x: hidden; }
body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; line-height: 1.2; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: 1040px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
.site-logo { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--text); margin-right: auto; letter-spacing: -0.02em; }
.site-logo:hover { text-decoration: none; }
.site-logo .mark { width: 30px; height: 30px; flex: none; }
.site-logo .tld { color: var(--muted); font-weight: 500; }
.icon-button {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); display: grid; place-items: center; cursor: pointer; font-size: 1.05rem;
}
.icon-button:hover { border-color: var(--text); }
.nav-button {
  display: inline-flex; align-items: center; gap: 8px; height: 40px;
  padding: 0 14px; font: 600 0.95rem var(--font);
  background: var(--text); color: var(--bg); border: none; border-radius: 12px; cursor: pointer;
}
.nav-button svg { width: 16px; height: 16px; }
.nav-button:hover { background: var(--primary); color: var(--on-primary); }

.nav-overlay { position: fixed; inset: 0; background: rgba(10, 10, 25, 0.5); display: none; z-index: 90; }
.nav-panel {
  position: fixed; top: 68px; right: max(16px, calc((100vw - 1040px) / 2 + 16px)); left: 16px; margin-left: auto;
  max-width: 460px; max-height: calc(100vh - 92px); overflow-y: auto;
  background: var(--card); border: 2px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  padding: 16px; display: none; z-index: 100;
}
.nav-open .nav-overlay, .nav-open .nav-panel { display: block; }
.nav-open { overflow: hidden; }
.nav-search { position: relative; margin-bottom: 12px; }
.nav-search input { padding-left: 38px !important; }
.nav-search::before { content: '⌕'; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); font-size: 1.2rem; color: var(--muted); }
.nav-empty { padding: 18px; text-align: center; color: var(--muted); }

/* ---------- tool grid (menu + homepage) ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tool-card {
  --tile: #ece8ff;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px 12px; border-radius: 14px; background: var(--surface-2); color: var(--text);
  border: 1.5px solid transparent;
  text-align: center; font-size: 0.8rem; font-weight: 600; line-height: 1.2;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.tool-card:hover { text-decoration: none; border-color: var(--ink); transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); background: var(--card); }
.tool-card.current { border-color: var(--primary); }
.tool-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  font-size: 25px; line-height: 1; background: color-mix(in srgb, var(--tile) 70%, transparent);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tool-icon { background: color-mix(in srgb, var(--tile) 22%, transparent); } }
:root[data-theme="dark"] .tool-icon { background: color-mix(in srgb, var(--tile) 22%, transparent); }
@media (min-width: 640px) { .tool-grid.wide { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .tool-grid.wide { grid-template-columns: repeat(6, 1fr); } }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; flex: 1; }
.container.wide { max-width: 1040px; }
.page-title {
  font-size: clamp(1.9rem, 6vw, 2.8rem); font-weight: 800; text-align: center; margin: 10px 0 8px; letter-spacing: -0.03em;
}
.page-title .hl, .hl {
  background: linear-gradient(transparent 58%, var(--accent) 58%, var(--accent) 92%, transparent 92%);
  padding: 0 0.08em;
}
:root[data-theme="dark"] .hl { background: none; color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hl { background: none; color: var(--accent); } }
.page-subtitle { text-align: center; color: var(--muted); margin: 0 auto 24px; max-width: 560px; font-size: 1.02rem; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 1.2rem; margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 0.8rem; font-weight: 600;
}

/* ---------- forms ---------- */
label, .label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="password"], input[type="search"], input[type="email"],
input[type="url"], input[type="date"], input[type="time"], input[type="tel"], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--card);
  transition: border-color 0.12s, box-shadow 0.12s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
textarea { resize: vertical; min-height: 100px; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; vertical-align: middle; }
input[type="color"] { width: 48px; height: 40px; border: 1.5px solid var(--border); border-radius: 10px; padding: 3px; background: var(--card); cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem var(--font); padding: 11px 20px; min-height: 46px;
  border: 2px solid var(--ink); border-radius: 12px; cursor: pointer;
  background: var(--primary); color: var(--on-primary); box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn.block { width: 100%; }
.btn.secondary { background: var(--card); color: var(--text); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn.small { font-size: 0.85rem; padding: 6px 12px; min-height: 36px; border-width: 1.5px; box-shadow: 2px 2px 0 var(--ink); }
.btn.small:hover { box-shadow: 3px 3px 0 var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); transform: none; }

/* segmented control: <div class="segmented"><button class="active">A</button><button>B</button></div> */
.segmented { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 12px; gap: 4px; flex-wrap: wrap; }
.segmented button {
  border: none; background: transparent; color: var(--muted); font: 600 0.9rem var(--font);
  padding: 8px 14px; border-radius: 9px; cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.active, .segmented button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data th { background: var(--surface-2); color: var(--text); font-weight: 700; position: sticky; top: 0; font-size: 0.85rem; }
table.data tr:hover td { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }

/* ---------- description / FAQ block ---------- */
.desc {
  border: 1.5px dashed var(--border); background: color-mix(in srgb, var(--card) 70%, transparent);
  padding: 20px; border-radius: var(--radius);
  color: var(--muted); line-height: 1.7; font-size: 0.95rem; margin-top: 28px;
}
.desc h2 { font-size: 1.15rem; margin: 0 0 8px; color: var(--text); }
.desc h3 { font-size: 1rem; margin: 16px 0 4px; color: var(--text); }
.desc p + p { margin-top: 10px; }
.desc ul, .desc ol { padding-left: 20px; margin-top: 6px; }
.desc b, .desc strong { color: var(--text); }

/* ---------- toast ---------- */
.mt-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-size: 0.92rem; font-weight: 600; opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 200; max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.mt-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- footer ---------- */
.site-footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 22px 16px 30px; border-top: 1px solid var(--border); margin-top: 20px; }
.site-footer a { color: var(--muted); margin: 0 8px; }
.site-footer a:hover { color: var(--text); }
.site-footer .made { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
