/* Lasstegnas: calm blue theme. All colours live in the variables below. */
:root {
  color-scheme: light;
  --bg: #f2f6fb;
  --bg-2: #e7eef8;
  --card: #ffffff;
  --ink: #102035;
  --muted: #475a72;
  --line: #cfdbea;
  --accent: #1f5fbf;
  --accent-strong: #154a99;
  --accent-soft: #dce8fa;
  --on-accent: #ffffff;
  --header-bg: #0f2a4a;
  --header-ink: #eaf2fd;
  --header-muted: #a9c3e6;
  --result-bg: #eaf2fd;
  --code-bg: #e9eff8;
  --warn-bg: #fff6e0;
  --warn-ink: #6b4a00;
  --bad: #b3261e;
  --good: #1c6e8c;
  --focus: #f0a43a;
  --shadow: 0 10px 30px rgba(16, 42, 74, 0.08);
  --radius: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1626; --bg-2: #111e33; --card: #142339; --ink: #e4edf8; --muted: #a8b8cc; --line: #2a3d58;
    --accent: #7db0ff; --accent-strong: #a9cbff; --accent-soft: #1d3355; --on-accent: #0c1626;
    --header-bg: #08111e; --header-ink: #e4edf8; --header-muted: #8fa9cc;
    --result-bg: #172a45; --code-bg: #1a2b44; --warn-bg: #3a2f12; --warn-ink: #f5dc9c; --bad: #ff8a80; --good: #7fd0e8;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1626; --bg-2: #111e33; --card: #142339; --ink: #e4edf8; --muted: #a8b8cc; --line: #2a3d58;
  --accent: #7db0ff; --accent-strong: #a9cbff; --accent-soft: #1d3355; --on-accent: #0c1626;
  --header-bg: #08111e; --header-ink: #e4edf8; --header-muted: #8fa9cc;
  --result-bg: #172a45; --code-bg: #1a2b44; --warn-bg: #3a2f12; --warn-ink: #f5dc9c; --bad: #ff8a80; --good: #7fd0e8;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img, svg, canvas { max-width: 100%; }
code, kbd { font-family: var(--mono); font-size: 0.92em; background: var(--code-bg); padding: 0.05em 0.35em; border-radius: 5px; }
.wrap { width: min(1080px, calc(100% - 2rem)); margin: 0 auto; }
.narrow { max-width: 860px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); color: var(--ink); padding: 0.6rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-head { background: var(--header-bg); color: var(--header-ink); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; position: relative; }
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--header-ink); }
.brand:hover { color: #fff; }
.mark { width: 2.2rem; height: 2.2rem; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #1f5fbf); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; letter-spacing: -0.02em; }
.brand strong { display: block; font-size: 1.2rem; line-height: 1.1; }
.brand small { display: block; color: var(--header-muted); font-size: 0.75rem; }
.nav { display: flex; align-items: center; gap: 0.3rem; }
.nav a { text-decoration: none; color: var(--header-ink); padding: 0.4rem 0.7rem; border-radius: 8px; font-size: 0.97rem; }
.nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav a[aria-current="page"] { background: rgba(125,176,255,0.18); color: #fff; }
.head-actions { display: flex; align-items: center; gap: 0.4rem; }
.icon-btn { background: transparent; color: var(--header-ink); border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; padding: 0.38rem 0.8rem; font-size: 0.9rem; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,0.1); }
.menu-btn { display: none; }

/* Typography */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin: 0.3rem 0 0.5rem; font-weight: 750; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin: 1.8rem 0 0.5rem; font-weight: 700; }
h3 { font-size: 1.12rem; margin: 1rem 0 0.3rem; font-weight: 700; }
.kicker { display: inline-block; margin: 1.4rem 0 0; padding: 0.15rem 0.65rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.78rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.lede { font-size: 1.12rem; color: var(--muted); margin: 0 0 1rem; max-width: 46rem; }
.note { font-size: 0.92rem; color: var(--muted); }
.crumbs { font-size: 0.88rem; color: var(--muted); margin-top: 1rem; }
.crumbs a { color: var(--muted); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.crumbs li + li::before { content: "›"; margin-right: 0.35rem; }

/* Home */
.hero { padding: 2.2rem 0 1rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); max-width: 18ch; }
.tool-search { max-width: 30rem; margin: 1rem 0 0.4rem; }
.cat h2 { font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 2rem 0 0.7rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.9rem; }
.tool-card { display: flex; flex-direction: column; gap: 0.25rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform 0.12s ease, border-color 0.12s ease; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--ink); }
.tool-card .ico { font-size: 1.4rem; line-height: 1; }
.tool-card h3 { margin: 0.35rem 0 0; font-size: 1.08rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.tool-card .go { margin-top: auto; padding-top: 0.4rem; color: var(--accent); font-weight: 650; font-size: 0.92rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 2rem 0; }
.features div { background: var(--bg-2); border-radius: var(--radius); padding: 1rem 1.1rem; }
.features h3 { margin-top: 0; }
.features p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Panels and forms */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem 1.25rem; box-shadow: var(--shadow); margin: 0.6rem 0 1rem; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0.2rem; }
label { display: block; font-size: 0.93rem; font-weight: 600; margin: 0.8rem 0 0.3rem; }
input, select, textarea, button { font: inherit; }
input[type="text"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="time"], input[type="email"], input[type="search"], input[type="url"], input[type="password"], input[type="file"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 0.62rem 0.75rem; color: var(--ink); min-height: 2.75rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
textarea { min-height: 9rem; resize: vertical; }
textarea.code, .mono { font-family: var(--mono); font-size: 0.92rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
input[type="color"] { width: 3.2rem; height: 2.75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 0.2rem; cursor: pointer; }
.hint { font-size: 0.86rem; color: var(--muted); margin: 0.25rem 0 0; font-weight: 400; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; margin: 0.8rem 0 0.2rem; }
.checks label { margin: 0; display: flex; gap: 0.45rem; align-items: center; font-weight: 500; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.2rem; }
.seg button { background: var(--bg); color: var(--ink); border: 1px solid var(--line); padding: 0.45rem 0.85rem; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button, .btn { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0.62rem 1.15rem; cursor: pointer; text-decoration: none; display: inline-block; font-weight: 600; line-height: 1.2; }
button:hover, .btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
button.secondary, .btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.secondary:hover, .btn.secondary:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
button.small { padding: 0.3rem 0.7rem; font-size: 0.88rem; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.callout { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 0.6rem 0.85rem; font-size: 0.93rem; margin: 0.6rem 0; }
.callout.info { background: var(--accent-soft); color: var(--ink); border-left: 4px solid var(--accent); }
.result { margin-top: 1rem; background: var(--result-bg); border-radius: 12px; padding: 0.9rem 1rem; }
.result:empty { display: none; }
.result p { margin: 0.3rem 0; }
.result strong, .big { font-size: 1.7rem; font-weight: 750; color: var(--accent-strong); letter-spacing: -0.01em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; margin-top: 0.8rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; }
.stat b { display: block; font-size: 1.35rem; color: var(--accent-strong); line-height: 1.2; word-break: break-word; }
.stat span { font-size: 0.85rem; color: var(--muted); }
.words { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.words span, .chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.97rem; }
.words span sub { color: var(--muted); font-size: 0.7rem; margin-left: 0.15rem; }
.group h3 { font-size: 1rem; margin: 0.9rem 0 0.2rem; color: var(--muted); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-top: 0.6rem; }
table.data th, table.data td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.table-scroll { overflow-x: auto; }
.meter { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin: 0.5rem 0 0.2rem; }
.meter > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease, background 0.2s ease; }
.swatch { width: 100%; height: 7rem; border-radius: 12px; border: 1px solid var(--line); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 0.4rem; margin-top: 0.5rem; }
.palette button { border-radius: 8px; height: 3.2rem; border: 1px solid var(--line); font-family: var(--mono); font-size: 0.72rem; padding: 0; }
.qr-out { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin-top: 1rem; }
.qr-out canvas { border: 1px solid var(--line); border-radius: 8px; background: #fff; image-rendering: pixelated; }
.preview-img { margin-top: 0.8rem; }
.preview-img canvas { max-height: 320px; width: auto; border-radius: 8px; border: 1px solid var(--line); }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 1rem; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* Article */
.prose { max-width: 46rem; padding-bottom: 1rem; }
.prose li { margin: 0.25rem 0; }
.faq details { border-top: 1px solid var(--line); padding: 0.7rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 650; }
.faq details p { margin: 0.5rem 0 0; color: var(--muted); }
.related { margin: 1.5rem 0 2rem; }
.related .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Ad slots: invisible until AdSense is configured in js/ads.js (add ?adpreview=1 to a URL to see where they sit). */
.ad-slot { margin: 1.4rem 0; text-align: center; }
.ad-slot:empty { display: none; }
.ad-slot.on { min-height: 100px; }
.ad-slot .ad-label { display: block; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.2rem; }
.ad-slot.preview { display: grid; place-items: center; min-height: 100px; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 0.85rem; }

/* Footer */
.site-foot { margin-top: 3rem; background: var(--bg-2); border-top: 1px solid var(--line); }
.foot-grid { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 1.5rem; padding: 2rem 0 1rem; }
.foot-grid h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 0.5rem; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-grid li { margin: 0.25rem 0; font-size: 0.94rem; }
.foot-grid a { color: var(--ink); text-decoration: none; }
.foot-grid a:hover { color: var(--accent); text-decoration: underline; }
.foot-base { border-top: 1px solid var(--line); padding: 1rem 0 1.6rem; font-size: 0.88rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; }

@media (max-width: 860px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; right: 0; top: 100%; background: var(--header-bg); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; padding: 0.5rem; flex-direction: column; align-items: stretch; z-index: 20; min-width: 12rem; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .row, .row3 { grid-template-columns: 1fr; }
  .row4 { grid-template-columns: 1fr 1fr; }
  .brand small { display: none; }
  .panel { padding: 0.9rem 0.95rem 1.05rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-head, .site-foot, .ad-slot, .related { display: none; }
}

/* Language switcher */
.lang-switch { display: inline-flex; align-items: center; gap: 0.15rem; border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; padding: 0 0.2rem; font-size: 0.9rem; }
.lang-switch b, .lang-switch a { display: inline-grid; place-items: center; min-width: 2.4rem; min-height: 2.4rem; border-radius: 999px; }
.lang-switch b { color: #fff; background: rgba(125,176,255,0.22); }
.lang-switch a { color: var(--header-ink); text-decoration: none; }
.lang-switch a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.lang-switch > span { color: var(--header-muted); }
.icon-btn { min-height: 2.6rem; }

/* Unscrambler */
.pattern-note { margin: 0.45rem 0 0; font-size: 0.92rem; border-left: 4px solid var(--accent); background: var(--accent-soft); color: var(--ink); padding: 0.5rem 0.75rem; border-radius: 0 10px 10px 0; }
.pattern-note.active { box-shadow: 0 0 0 2px var(--accent) inset; }
.is-ignored { opacity: 0.55; }
.is-ignored label::after { content: " — ignored (pattern)"; font-weight: 400; color: var(--muted); }
html[lang="pl"] .is-ignored label::after { content: " — pomijane (wzorzec)"; }
.words span.all { font-weight: 750; border-color: var(--accent); }
.words u { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
details.more-opts { margin-top: 0.8rem; border: 1px solid var(--line); border-radius: 10px; padding: 0.3rem 0.8rem 0.7rem; }
details.more-opts summary { cursor: pointer; font-weight: 650; padding: 0.4rem 0; min-height: 2.2rem; }
.pw-row { display: flex; gap: 0.6rem; align-items: center; margin: 0.35rem 0; }
.pw { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 1.05rem; padding: 0.45rem 0.6rem; background: var(--card); border: 1px solid var(--line); }
.disclaimer { border-left: 4px solid #c27c0e; background: var(--warn-bg); color: var(--warn-ink); padding: 0.6rem 0.85rem; border-radius: 0 10px 10px 0; font-size: 0.93rem; margin: 0.8rem 0; }
.ip-big { font-family: var(--mono); font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 700; color: var(--accent-strong); overflow-wrap: anywhere; }

/* Touch targets and small screens */
button, .btn { min-height: 44px; }
button.small { min-height: 36px; }
.seg button { min-height: 44px; }
.checks label { min-height: 44px; }
.foot-grid a { display: inline-block; padding: 0.3rem 0; }
@media (max-width: 760px) {
  .nav a { min-height: 44px; display: flex; align-items: center; padding: 0.5rem 0.9rem; }
  .foot-grid a { padding: 0.55rem 0; }
  .top { gap: 0.5rem; }
  .head-actions { gap: 0.3rem; }
}
@media (max-width: 520px) {
  .btn-txt { display: none; }
  .icon-btn { padding: 0.35rem 0.6rem; min-width: 44px; min-height: 44px; }
  .brand strong { font-size: 1.05rem; }
  .mark { width: 2rem; height: 2rem; font-size: 0.85rem; }
  .lang-switch b, .lang-switch a { min-width: 2.15rem; min-height: 2.6rem; }
  .row4 { grid-template-columns: 1fr 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 1rem; }
  h1 { font-size: 1.85rem; }
  .hero h1 { font-size: 2.1rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  table.data { font-size: 0.9rem; }
  .pw-row { flex-wrap: wrap; }
}
@media (max-width: 360px) {
  .stats { grid-template-columns: 1fr; }
}
.brand { min-height: 44px; }
.faq summary { padding: 0.55rem 0; min-height: 44px; }
.faq details { padding: 0.15rem 0 0.5rem; }
input[type="range"] { height: 44px; }
.callout:empty, .hint:empty { display: none; }

/* ---- Equation solver: maths rendering, steps, graph, maths keyboard ---- */
.m { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", Cambria, "Times New Roman", serif; font-size: 1.12rem; line-height: 1.9; overflow-x: auto; overflow-y: hidden; max-width: 100%; white-space: nowrap; }
.m i { font-style: italic; }
.m sup, .m sub { font-size: 0.72em; line-height: 0; }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 0.12em; font-size: 0.92em; line-height: 1.25; }
.fr > span:first-child { border-bottom: 1px solid currentColor; padding: 0 0.15em; }
.fr > span:last-child { padding: 0 0.15em; }
.rad { border-top: 1px solid currentColor; padding: 0 0.1em; margin-left: 0.02em; }
sup.ri { font-size: 0.6em; margin-right: -0.35em; vertical-align: 0.9em; }
.fn { font-style: normal; }
.det { display: inline-table; border-left: 1.5px solid currentColor; border-right: 1.5px solid currentColor; padding: 0 0.3em; vertical-align: middle; line-height: 1.3; margin: 0 0.15em; }
.det table { border-collapse: collapse; margin: 0; } .det td { padding: 0 0.35em; text-align: center; border: 0; line-height: 1.35; }
.lbl { color: var(--muted); font-family: system-ui, sans-serif; font-size: 0.85em; margin-right: 0.35em; }
.eq-lbl { color: var(--muted); font-size: 0.85rem; font-weight: 650; margin: 0.4rem 0 0; text-transform: uppercase; letter-spacing: 0.03em; }
#eqPreview { color: var(--muted); min-height: 1.6rem; font-size: 0.93rem; margin: 0.35rem 0 0; overflow-x: auto; }
#eqPreview .eq-lbl { text-transform: none; letter-spacing: 0; font-size: 0.85rem; }
#eqPreview .m { display: inline; font-size: 1.02rem; }
textarea.eq-input { min-height: 5.2rem; font-family: var(--mono); font-size: 1.08rem; }
.eq-answer { background: var(--result-bg); border-radius: 10px; padding: 0.35rem 0.85rem; margin: 0.3rem 0 0.4rem; }
.eq-answer .m { font-size: 1.28rem; font-weight: 600; }
.eq-interp { margin-bottom: 0.2rem; }
ol.steps { margin: 0.4rem 0 0; padding-left: 1.4rem; }
ol.steps li { margin: 0.35rem 0; }
ol.steps li .m { display: block; }
.eq-graph-wrap { position: relative; width: 100%; }
#eqGraph { display: block; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.eq-examples { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.eq-examples button { font-family: var(--mono); font-weight: 500; }
.eq-top { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between; }
.eq-top .seg { margin: 0; }
.mkb { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.35rem; margin-top: 0.6rem; padding: 0.5rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.mkb[hidden] { display: none; }
.mkb .key { min-height: 46px; min-width: 0; padding: 0.2rem; border-radius: 9px; background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 600; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; line-height: 1.1; -webkit-tap-highlight-color: transparent; }
.mkb .key:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.mkb .key:active { transform: translateY(1px); background: var(--accent-soft); }
.mkb .key.fk { font-size: 0.95rem; color: var(--accent-strong); }
.mkb .key.vk { font-style: italic; font-family: Cambria, "Times New Roman", serif; font-size: 1.18rem; }
.mkb .key.op { background: var(--accent-soft); color: var(--accent-strong); }
.mkb .key.ctl { background: var(--bg); color: var(--muted); }
.mkb .key.go { grid-column: span 3; background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.mkb .key.go:hover { background: var(--accent-strong); color: var(--on-accent); }
.mkb .key .fr { font-size: 0.75em; }
.mkb .key sup { font-size: 0.65em; }
#kbToggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
@media (max-width: 400px) {
  .mkb { padding: 0; border: 0; background: none; gap: 0.25rem; }
  .mkb .key { font-size: 0.98rem; }
  .mkb .key.fk { font-size: 0.85rem; }
}
textarea.eq-input.kb-on { min-height: 3.6rem; }
#eqPanel .mkb { margin: 0.2rem 0 0.6rem; }
@media (max-width: 520px) {
  .eq-top .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .eq-top .seg button { padding: 0.4rem 0.3rem; font-size: 0.92rem; }
}
