/* Hesabla: one stylesheet, no external fonts. Light and dark themes.
   Signature element: the deep navy "display" (home hero and result panel).
   Category colours encode the five sections. */
:root {
  color-scheme: light;
  --bg: #edf1f4;
  --surface: #ffffff;
  --surface-2: #f4f7f9;
  --ink: #102131;
  --muted: #566677;
  --line: #d3dbe2;
  --brand: #0b6a99;
  --on-brand: #ffffff;
  --display: #0f2a3d;
  --display-2: #163a52;
  --display-ink: #f2f7fa;
  --display-muted: #a7bccb;
  --err: #b42318;
  --err-bg: #fdecea;
  --up: #1f7a3a;
  --down: #b42318;
  --warn: #9a5b00;
  --focus: #f0a500;
  --c-maliyye: #2e7d32;
  --c-tarix: #0b6a99;
  --c-saglamliq: #c0392b;
  --c-gundelik: #a8620a;
  --c-metn: #6b46c1;
  --c-riyaziyyat: #0f766e;
  --tabbar-h: 0px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 33, 49, 0.06), 0 6px 20px rgba(16, 33, 49, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b131b; --surface: #121d27; --surface-2: #182531; --ink: #e5edf3; --muted: #97a8b8; --line: #263644;
    --brand: #56b6e8; --on-brand: #06121b; --display: #12324a; --display-2: #1b4462; --display-ink: #f2f7fa; --display-muted: #a9c2d3;
    --err: #ff8f84; --err-bg: #3a1a17; --up: #6fcf8e; --down: #ff8f84; --warn: #f0b45b;
    --c-maliyye: #6fbf73; --c-tarix: #56b6e8; --c-saglamliq: #f07b6e; --c-gundelik: #e5a74a; --c-metn: #a98bf5; --c-riyaziyyat: #4fd1c5;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b131b; --surface: #121d27; --surface-2: #182531; --ink: #e5edf3; --muted: #97a8b8; --line: #263644;
  --brand: #56b6e8; --on-brand: #06121b; --display: #12324a; --display-2: #1b4462; --display-ink: #f2f7fa; --display-muted: #a9c2d3;
  --err: #ff8f84; --err-bg: #3a1a17; --up: #6fcf8e; --down: #ff8f84; --warn: #f0b45b;
  --c-maliyye: #6fbf73; --c-tarix: #56b6e8; --c-saglamliq: #f07b6e; --c-gundelik: #e5a74a; --c-metn: #a98bf5; --c-riyaziyyat: #4fd1c5;
  --shadow: none;
}
[data-cat="maliyye"] { --cat: var(--c-maliyye); }
[data-cat="tarix"] { --cat: var(--c-tarix); }
[data-cat="saglamliq"] { --cat: var(--c-saglamliq); }
[data-cat="gundelik"] { --cat: var(--c-gundelik); }
[data-cat="metn"] { --cat: var(--c-metn); }
[data-cat="riyaziyyat"] { --cat: var(--c-riyaziyyat); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr, .offscreen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -200px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 8px; }
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- header ---------- */
.top { background: var(--display); color: var(--display-ink); position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; gap: 8px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; margin-right: auto; padding: 8px 0; }
.logo { width: 30px; height: 30px; }
.logo-star { fill: #e8b33a; }
.logo-eq { stroke: var(--display); stroke-width: 2.6; stroke-linecap: round; }
.jump-btn, .theme-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; background: rgba(255, 255, 255, 0.06);
  color: inherit; font: inherit; font-size: 0.95rem; cursor: pointer;
}
.theme-btn { width: 44px; padding: 0; justify-content: center; }
.theme-btn[data-mode="light"] .ic path { fill: currentColor; }
.jump-btn:hover, .theme-btn:hover { background: rgba(255, 255, 255, 0.14); }
@media (max-width: 420px) { .jump-btn span { display: none; } .jump-btn { width: 44px; padding: 0; justify-content: center; } }

/* ---------- jump dialog ---------- */
dialog.jump {
  width: min(36rem, calc(100vw - 24px)); max-height: min(80vh, 40rem); padding: 0; border: 0; border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  margin-top: 10vh;
}
dialog.jump::backdrop { background: rgba(8, 18, 28, 0.55); }
.jump-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.jump-input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; font: inherit; font-size: 1.05rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); }
.jump-close { width: 48px; min-height: 48px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.jump-list { padding: 6px; overflow: auto; max-height: calc(min(80vh, 40rem) - 74px); }
.jump-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.jump-item:hover, .jump-item:focus-visible { background: var(--surface-2); }
.jump-item .txt { display: flex; flex-direction: column; min-width: 0; }
.jump-item .txt span { color: var(--muted); font-size: 0.9rem; }
.empty { padding: 16px; color: var(--muted); }

/* ---------- tiles, cards, chips ---------- */
.tile {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  color: var(--cat, var(--brand)); background: var(--surface-2);
  background: color-mix(in srgb, var(--cat, var(--brand)) 13%, transparent);
}
.tile.big { width: 52px; height: 52px; border-radius: 14px; }
.tile.big .ic { width: 28px; height: 28px; }
.cat-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .cat-grid { grid-template-columns: 1fr 1fr 1fr; } }
.card {
  display: flex; gap: 14px; align-items: center; padding: 14px; min-height: 76px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.card:hover { border-color: var(--cat); }
.card .txt { display: flex; flex-direction: column; min-width: 0; }
.card strong { font-size: 1.02rem; }
.card .txt span { color: var(--muted); font-size: 0.92rem; line-height: 1.35; }

/* ---------- home ---------- */
.hero {
  background: var(--display); color: var(--display-ink); padding: 28px 0 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 .5l4.3 5.6 7-.9-.9 7 5.6 4.3-5.6 4.3.9 7-7-.9L16 31.5l-4.3-5.6-7 .9.9-7L0 16.5l5.6-4.3-.9-7 7 .9z' fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 420px; background-position: right -120px center;
}
.hero h1 { font-size: clamp(1.95rem, 7.2vw, 3.1rem); font-weight: 800; letter-spacing: -0.03em; margin: 0 0 10px; max-width: 16ch; }
.hero .lead { color: var(--display-muted); margin: 0 0 22px; max-width: 46ch; }
.search { position: relative; max-width: 40rem; }
.search-ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 24px; height: 24px; }
.search input {
  width: 100%; min-height: 58px; padding: 0 16px 0 50px; border: 0; border-radius: 16px;
  font: inherit; font-size: 1.12rem; background: var(--surface); color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.search-count { min-height: 1.5em; margin: 10px 0 0; color: var(--display-muted); font-size: 0.95rem; }
.home main h2 { font-size: 1.15rem; margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; }
.cat-section h2 .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--cat); transform: rotate(45deg); }
.pop-row { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x proximity; }
@media (min-width: 760px) { .pop-row { flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0; } }
.chip {
  display: inline-flex; align-items: center; gap: 10px; flex: none; scroll-snap-align: start;
  padding: 8px 14px 8px 8px; min-height: 52px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600;
}
.chip:hover { border-color: var(--cat); }
.chip .tile { width: 36px; height: 36px; border-radius: 10px; }
.chip .txt span { display: none; }
.no-results { padding: 24px 0; color: var(--muted); font-size: 1.05rem; }

/* ---------- tool page ---------- */
.page { padding-bottom: 40px; }
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; color: var(--muted); padding: 14px 0 4px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; gap: 14px; align-items: flex-start; margin: 6px 0 16px; }
.page-head h1 { font-size: clamp(1.5rem, 5.6vw, 2.2rem); font-weight: 800; margin: 2px 0 4px; }
.page-head .lead { margin: 0; color: var(--muted); max-width: 60ch; }
.tool { min-height: 320px; }
.tool-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
  .tool-grid .result { position: sticky; top: 74px; }
}

.fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; align-content: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow);
}
.field { grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: span 1; }
.lbl { display: block; font-weight: 650; font-size: 0.93rem; margin-bottom: 6px; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 0.86rem; }
.err { margin: 6px 0 0; color: var(--err); font-size: 0.9rem; font-weight: 600; }

.num { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.num:focus-within { border-color: var(--brand); }
.num input {
  flex: 1; min-width: 0; width: 100%; min-height: 52px; padding: 0 12px; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.num input:focus { outline: none; }
.num:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.suffix { display: flex; align-items: center; padding: 0 12px 0 4px; color: var(--muted); font-size: 0.95rem; white-space: nowrap; }
.step { width: 48px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.4rem; cursor: pointer; flex: none; }
.step:hover { background: var(--line); }
.f-int .num input { text-align: center; }
[aria-invalid="true"] { color: var(--err); }
.num:has([aria-invalid="true"]) { border-color: var(--err); }

input[type="date"], select, textarea {
  width: 100%; min-height: 52px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: 1.05rem;
}
textarea { resize: vertical; line-height: 1.5; min-height: 120px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 18px center, right 12px center; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }

input[type="range"] { width: 100%; margin: 10px 0 0; accent-color: var(--brand); height: 28px; }

.seg { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 6px 8px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 0.93rem; line-height: 1.2; color: var(--muted); }
.seg input:checked + label { background: var(--ink); color: var(--surface); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg[data-n="4"], .seg[data-n="6"] { --n: 2; }
@media (min-width: 560px) { .seg[data-n="4"] { --n: 4; } .seg[data-n="6"] { --n: 3; } }
.f-segment.half .seg[data-n="4"] { --n: 2; }

.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.track { width: 48px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn-action { width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--brand); color: var(--on-brand); font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; }

/* ---------- result display ---------- */
.result {
  background: var(--display); color: var(--display-ink); border-radius: 18px; padding: 18px 18px 14px;
  border-left: 6px solid var(--cat, var(--brand)); box-shadow: var(--shadow); min-width: 0;
}
.out-label { margin: 0 0 2px; color: var(--display-muted); font-size: 0.95rem; }
.out-main {
  margin: 0; font-size: clamp(2.2rem, 10vw, 3.1rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.out-main.long { font-size: clamp(1.6rem, 7vw, 2.3rem); }
.out-main .unit { font-size: 0.45em; font-weight: 600; color: var(--display-muted); letter-spacing: 0; }
.out-main.tone-up { color: #8fe3a8; }
.out-main.tone-down { color: #ffb3a8; }
.out-main.tone-warn { color: #ffd27a; }
.out-text { margin: 4px 0 0; font-size: 1.2rem; font-weight: 600; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto; }
.out-sub { margin: 6px 0 0; color: var(--display-muted); }
.out-wait { margin: 6px 0 4px; font-size: 1.05rem; color: var(--display-ink); }
.result.is-empty .out-label { margin-bottom: 0; }
.out-rows { margin: 14px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.out-rows > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
.out-rows dt { color: var(--display-muted); }
.out-rows dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.out-rows .strong dd { font-weight: 800; }
.out-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn-copy, .btn-link {
  min-height: 44px; padding: 0 16px; border-radius: 999px; font: inherit; font-weight: 650; font-size: 0.95rem; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: var(--display-ink);
}
.btn-copy { background: var(--display-ink); color: var(--display); border-color: var(--display-ink); }
.btn-copy.small { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.btn-copy.done, .btn-link.done { background: #8fe3a8; border-color: #8fe3a8; color: #0b2a17; }
.blk-note { margin: 12px 0 0; color: var(--display-muted); font-size: 0.88rem; }
.blk-text { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.blk-label { margin: 0; color: var(--display-muted); font-size: 0.9rem; }
.blk-body { margin: 4px 0 10px; font-weight: 600; font-size: 1.05rem; }
.blk-table { margin-top: 12px; }
.blk-table summary {
  cursor: pointer; min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 14px; list-style: none;
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 12px; font-weight: 650; color: var(--display-ink);
}
.blk-table summary::-webkit-details-marker { display: none; }
.blk-table summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); flex: none; }
.blk-table[open] summary::before { transform: rotate(45deg); }
.blk-table[open] summary { margin-bottom: 8px; }
.scroll { overflow-x: auto; max-height: 26rem; overflow-y: auto; border-radius: 10px; background: rgba(0, 0, 0, 0.15); }
.scroll table { border-collapse: collapse; width: 100%; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.scroll th, .scroll td { padding: 7px 10px; text-align: right; white-space: nowrap; }
.scroll th { position: sticky; top: 0; background: var(--display-2); color: var(--display-muted); font-weight: 600; }
.scroll th:first-child, .scroll td:first-child { text-align: left; }
.scroll tr + tr td { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.blk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; max-height: 16rem; overflow: auto; }
.nchip { padding: 4px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); font-weight: 700; font-variant-numeric: tabular-nums; }

.blk-scale { margin-top: 14px; }
.scale-bar { position: relative; display: flex; height: 14px; border-radius: 7px; overflow: visible; }
.scale-bar > span[class^="seg-"] { height: 100%; opacity: 0.35; }
.scale-bar > span[class^="seg-"].active { opacity: 1; }
.scale-bar > span:first-child { border-radius: 7px 0 0 7px; }
.scale-bar > span:nth-last-child(2) { border-radius: 0 7px 7px 0; }
.marker { position: absolute; top: -5px; width: 4px; height: 24px; margin-left: -2px; border-radius: 2px; background: var(--display-ink); box-shadow: 0 0 0 2px var(--display); }
.seg-cool { background: #6cb4e4; } .seg-good { background: #5cc27a; } .seg-warn { background: #f2c14e; }
.seg-bad { background: #f08a4b; } .seg-worse { background: #e5534b; } .seg-worst { background: #b3261e; }
.scale-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 0.84rem; color: var(--display-muted); }
.scale-legend li { display: flex; align-items: center; gap: 6px; background: none; }
.scale-legend li.active { color: var(--display-ink); font-weight: 700; }
.scale-legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.scale-legend .seg-cool .dot { background: #6cb4e4; } .scale-legend .seg-good .dot { background: #5cc27a; } .scale-legend .seg-warn .dot { background: #f2c14e; }
.scale-legend .seg-bad .dot { background: #f08a4b; } .scale-legend .seg-worse .dot { background: #e5534b; } .scale-legend .seg-worst .dot { background: #b3261e; }

/* ---------- explanation, related, footer ---------- */
.explain { max-width: 46rem; margin-top: 36px; }
.explain h2, .related h2 { font-size: 1.3rem; margin: 0 0 8px; }
.explain h3 { font-size: 1.05rem; margin: 22px 0 6px; }
.explain p { margin: 0 0 10px; }
.related { margin-top: 36px; }
.noscript { padding: 16px; background: var(--err-bg); color: var(--err); border-radius: 12px; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; padding: 18px 0 36px; margin-top: 24px; }
.foot p { margin: 4px 0; }

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

/* ---------- v3: phone app shell ---------- */
body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.tabbar { display: none; }
@media (max-width: 759px) { :root { --tabbar-h: 64px; } }
.standalone { --tabbar-h: 64px; }
@media (max-width: 759px) {
  .tabbar { display: grid; }
  .top .jump-btn { display: none; }
}
.standalone .tabbar { display: grid; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; grid-template-columns: repeat(4, 1fr);
  height: calc(64px + env(safe-area-inset-bottom)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(16, 33, 49, 0.06);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 64px; min-width: 0;
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.72rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.tab .ic { width: 24px; height: 24px; }
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.home .tab[href="/"] { color: var(--brand); }
.tab:active { background: var(--surface-2); }
.jump-title { margin: 0; font-size: 1.1rem; flex: 1; align-self: center; }
@media (max-width: 759px) {
  dialog.jump { margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 85vh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .jump-list { max-height: calc(85vh - 74px); }
}

/* favourites star */
.page-head { flex-wrap: wrap; }
.page-title { flex: 1 1 14rem; min-width: 0; }
.fav-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; margin-left: auto;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.fav-btn[aria-pressed="true"] { color: #8a5a00; border-color: #e8b33a; background: #fff6dc; }
.fav-btn[aria-pressed="true"] .ic path { fill: #e8b33a; stroke: #b98a1c; }
:root[data-theme="dark"] .fav-btn[aria-pressed="true"] { background: #3a2f12; color: #f3cf6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fav-btn[aria-pressed="true"] { background: #3a2f12; color: #f3cf6b; } }
@media (max-width: 480px) { .fav-btn { width: 44px; padding: 0; justify-content: center; } .fav-btn .fav-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.searching { display: none !important; }

/* install card */
.install { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); position: relative; }
.install-body { flex: 1 1 14rem; padding-right: 36px; }
.install h2 { margin: 0 0 4px !important; font-size: 1.02rem !important; }
.install p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.install .btn-action { width: auto; padding: 0 22px; }
.install-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }

/* chips and ghost buttons */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--ink); font: inherit; font-size: 0.93rem; font-weight: 650; cursor: pointer;
}
.chip-btn:active { background: var(--line); }
.btn-ghost {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--ink); font: inherit; font-weight: 650; cursor: pointer;
}
.btn-ghost.big { min-height: 56px; font-size: 1.05rem; }
.f-action .btn-ghost { min-height: 44px; }
.out-text.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.3rem; letter-spacing: 0.04em; word-break: break-all; }

/* result peek bar on phones: shows the main result while the panel is off screen */
.peek {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); z-index: 4;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 52px;
  border: 0; border-radius: 14px; background: var(--display); color: var(--display-ink); font: inherit; text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28); cursor: pointer; border-left: 5px solid var(--cat, var(--brand));
}
.peek .pk-label { color: var(--display-muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.peek .pk-value { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 900px) { .peek { display: none; } }

/* calculator */
.tool-grid.single { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .tool-grid.single { grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); } }
.calc { background: var(--display); color: var(--display-ink); border-radius: 18px; padding: 14px; border-left: 6px solid var(--cat); }
.calc-input {
  width: 100%; min-height: 60px; padding: 8px 12px; border: 0; border-radius: 12px; background: rgba(0, 0, 0, 0.22); color: var(--display-ink);
  font: inherit; font-size: 1.6rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums;
}
.calc-preview { min-height: 1.6em; margin: 6px 4px 0; text-align: right; color: var(--display-muted); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.calc-preview.bad { color: #ffb3a8; font-size: 0.95rem; }
.calc-copy { display: flex; justify-content: flex-end; margin: 6px 0 10px; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.key {
  min-height: 56px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.1); color: var(--display-ink);
  font: inherit; font-size: 1.35rem; font-weight: 650; cursor: pointer;
}
.key.digit { background: rgba(255, 255, 255, 0.18); }
.key:active { background: rgba(255, 255, 255, 0.3); }
.key.eq { grid-column: 1 / -1; background: #e8b33a; color: #0f2a3d; font-weight: 800; }
.calc-side h2 { font-size: 1.15rem; margin: 0 0 8px; }
.calc-history { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.hist-item {
  width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.hist-expr { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* stopwatch and timer */
.stopwatch { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 14px; }
.sw-display { margin: 0; text-align: center; font-size: clamp(2.8rem, 15vw, 4.5rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sw-display.done { color: var(--err); }
.sw-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sw-buttons .btn-action { min-height: 56px; }
.tm-set { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 8px 10px; align-items: center; }
.tm-set label { font-weight: 650; }
.tm-in { min-height: 52px; width: 100%; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 1.3rem; text-align: center; }
.tm-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.laps { list-style: none; margin: 0; padding: 0; }
.laps li { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }

/* currency rates table */
.rates-section { margin-top: 28px; }
.rates-section h2 { font-size: 1.3rem; margin: 0 0 10px; }
.rates-section h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.rates-section input[type="search"] { width: 100%; min-height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 1.05rem; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table.rates { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.rates th, table.rates td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.rates th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
table.rates .num-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rates tr:last-child td { border-bottom: 0; }

/* very narrow phones */
@media (max-width: 359px) {
  .fields { padding: 12px; gap: 14px 8px; }
  .field.half { grid-column: 1 / -1; }
  .result { padding: 14px 12px 12px; }
  .out-rows > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .out-rows dd { text-align: left; }
  .seg label { font-size: 0.85rem; padding: 6px 4px; }
  .hero h1 { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .page-title { flex: 1 1 0; }
  .page-head { flex-wrap: nowrap; gap: 10px; }
  .tile.big { width: 44px; height: 44px; }
  .tile.big .ic { width: 24px; height: 24px; }
}
