/* ToolKosh — base styles */
:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #f1eee5;
  --text: #1d2321;
  --muted: #5d6662;
  --border: #e3ded1;
  --brand: #0f5c55;
  --brand-ink: #ffffff;
  --brand-soft: #e2efec;
  --accent: #d9902a;
  --accent-soft: #fbefdc;
  --danger: #b3261e;
  --ok: #1d7a46;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 6px 20px rgba(20, 30, 25, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1120px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #111615;
  --surface: #182020;
  --surface-2: #1f2928;
  --text: #e8ece9;
  --muted: #9aa6a1;
  --border: #2c3837;
  --brand: #46b3a6;
  --brand-ink: #08201d;
  --brand-soft: #1b3431;
  --accent: #f0ac4b;
  --accent-soft: #3a2d18;
  --danger: #ff8a80;
  --ok: #6fd39a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: 1.35rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-ink); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 10px; top: 10px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 750; font-size: 1.2rem; letter-spacing: -.02em; }
.logo svg { width: 32px; height: 32px; flex: none; }
.logo b { color: var(--brand); font-weight: 750; }
.lg-body { fill: var(--brand); }
.lg-line { stroke: var(--bg); stroke-width: 2; }
.lg-lid { fill: none; stroke: var(--brand); stroke-width: 3; }
.lg-lock { fill: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 550; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 20px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* Hero */
.hero { padding: 56px 0 28px; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.badge { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--text); padding: 5px 12px; border-radius: 99px; font-size: .85rem; font-weight: 600; margin-bottom: 16px; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.search-box { margin-top: 22px; max-width: 560px; position: relative; }
.search-box input { padding-left: 44px; height: 52px; font-size: 1.05rem; border-radius: 12px; }
.search-box svg { position: absolute; left: 14px; top: 15px; width: 22px; height: 22px; color: var(--muted); pointer-events: none; }

/* Sections & cards */
.section { padding: 24px 0 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head p { color: var(--muted); margin: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-decoration: none; color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.card .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 6px; }
.card .ico svg { width: 22px; height: 22px; }
.card strong { font-size: 1.02rem; }
.card span { color: var(--muted); font-size: .92rem; line-height: 1.45; }
.section-tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.tile { padding: 24px; }
.tile .count { margin-top: auto; padding-top: 10px; font-weight: 600; color: var(--brand); font-size: .92rem; }
.hidden { display: none !important; }

/* Breadcrumb */
.crumbs { font-size: .88rem; color: var(--muted); padding: 22px 0 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs span { margin: 0 6px; }

/* Tool layout */
.tool-head { padding: 6px 0 18px; }
.tool-head p { color: var(--muted); font-size: 1.05rem; max-width: 720px; margin: 0; }
.privacy-note { display: inline-flex; gap: 8px; align-items: center; margin-top: 12px; font-size: .88rem; color: var(--ok); font-weight: 600; }
.privacy-note svg { width: 18px; height: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.tool-grid { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 860px) { .tool-grid { grid-template-columns: 1fr; } }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="email"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 220px; resize: vertical; font-family: var(--mono); font-size: .9rem; line-height: 1.5; }
textarea.prose { font-family: var(--font); font-size: 1rem; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.inline-input { display: flex; gap: 10px; align-items: center; }
.inline-input input[type="number"] { max-width: 150px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.seg { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 10px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: .95rem; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--brand); filter: none; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* Results */
.result-big { background: var(--brand-soft); border-radius: var(--radius-sm); padding: 18px; margin-bottom: 14px; }
.result-big .k { color: var(--muted); font-size: .9rem; font-weight: 600; }
.result-big .v { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 750; letter-spacing: -.02em; color: var(--brand); word-break: break-word; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat .v { font-size: 1.2rem; font-weight: 700; word-break: break-word; }
.bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 14px 0 6px; }
.bar i { display: block; height: 100%; }
.bar .a { background: var(--brand); }
.bar .b { background: var(--accent); }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.legend .a { background: var(--brand); } .legend .b { background: var(--accent); }
.msg { padding: 10px 14px; border-radius: var(--radius-sm); font-size: .92rem; margin-top: 12px; }
.msg.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.msg.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.mono { font-family: var(--mono); }
.out-line { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.out-line code { flex: 1; font-family: var(--mono); font-size: .95rem; word-break: break-all; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.table-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 14px; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--brand); }

/* Drop zone */
.drop {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 34px 20px; text-align: center;
  background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop svg { width: 40px; height: 40px; color: var(--brand); }
.drop strong { display: block; font-size: 1.05rem; margin: 6px 0 2px; }
.drop span { color: var(--muted); font-size: .9rem; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.file-list .thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--border); flex: none; }
.file-list .meta { flex: 1; min-width: 0; }
.file-list .name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-list .size { color: var(--muted); font-size: .82rem; }
.file-list .saving { color: var(--ok); font-weight: 700; }
.file-list .acts { display: flex; gap: 6px; }
.file-list .acts button { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 1rem; line-height: 1; }
.file-list .acts button:hover { border-color: var(--brand); }

/* Content */
.content { padding: 34px 0 10px; max-width: 780px; }
.content h2 { margin-top: 1.4em; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin-bottom: .35em; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 12px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.related { padding: 26px 0 10px; }
.page { padding: 10px 0 40px; max-width: 780px; }

/* Ad slot placeholder (enabled later) */
.ad-slot { margin: 26px 0; min-height: 0; }

/* Footer */
.site-footer { margin-top: 50px; border-top: 1px solid var(--border); background: var(--surface); padding: 36px 0 26px; font-size: .92rem; color: var(--muted); }
.foot-grid { display: grid; gap: 24px; grid-template-columns: 2fr 1fr 1fr 1fr; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > :first-child { grid-column: 1 / -1; } }
.site-footer h3 { font-size: .9rem; color: var(--text); margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.copyright { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .85rem; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: .92rem; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.mt { margin-top: 18px; }
.w-num { width: 90px !important; display: inline-block; padding: 4px 8px !important; margin: 0 4px; }
select.w-auto { width: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
textarea.tall { min-height: 340px; }
.check + .check { margin-top: 8px; }
.kw-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kw-list span { background: var(--surface-2); padding: 4px 10px; border-radius: 99px; font-size: .88rem; }
.hash-row { margin-bottom: 12px; }
.hash-row .k { font-weight: 650; font-size: .88rem; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.match { color: var(--ok); } .nomatch { color: var(--danger); }
table.data td.left { text-align: left; word-break: break-all; }
.search-box input[type="search"] { padding-left: 46px; }
.inline-input .seg { flex: none; flex-wrap: nowrap; }
.inline-input .seg button { padding: 7px 10px; }
