/* home.css: DIGITCA homepage 2.0, "Návod k obsluze" (owner's manual).
   Only the generated homepages use this file; /press, /changelog, /speedrun keep styles.css.
   The calculator (.dg) is painted by js/calc.js from the app's palettes (--c-* vars). */

:root {
  --paper: #F2EBDB;
  --paper-hi: #FBF8F2;
  --ink: #171717;
  --ink-2: #3A3632;
  --taupe: #7D7468;
  --coral: #C8443A;
  --line: rgba(23, 23, 23, 0.14);
  --grid: rgba(23, 23, 23, 0.045);
  --grid-major: transparent;
  --hover: rgba(23, 23, 23, 0.06);
  --line-strong: rgba(23, 23, 23, 0.4);
  --solid-bg: var(--ink); --solid-fg: var(--paper);
  --full-bg: var(--ink); --full-fg: var(--paper); --full-sub: rgba(242, 235, 219, 0.7); --full-line: rgba(242, 235, 219, 0.16);
  --sig-filter: none; --sig-blend: multiply;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1280px;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: Jost, system-ui, sans-serif;
  --keyfont: -apple-system, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  color: var(--ink);
  font: 400 18px/1.55 var(--sans);
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

/* ── dark: a very dark blueprint ─────────────────────────────
   Follows the system unless the visitor picked a mode (html[data-theme]). Deep drafting
   navy, pale cyan-white ink, a fine 24 px grid with a stronger 120 px major grid. */
:root[data-theme="dark"] {
  --paper: #050F1E; --paper-hi: #0A1A31; --ink: #D9E7F7; --ink-2: #A7BCD5; --taupe: #6E88A8; --coral: #F0604F;
  --line: rgba(140, 190, 245, 0.17); --line-strong: rgba(170, 210, 250, 0.42);
  --grid: rgba(110, 170, 240, 0.065); --grid-major: rgba(110, 170, 240, 0.12);
  --hover: rgba(140, 190, 245, 0.1);
  --solid-bg: #D9E7F7; --solid-fg: #050F1E;
  --full-bg: #0F2C55; --full-fg: #E6F0FB; --full-sub: rgba(214, 232, 250, 0.7); --full-line: rgba(170, 210, 250, 0.2);
  --sig-filter: invert(1) hue-rotate(180deg) brightness(1.1); --sig-blend: screen;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #050F1E; --paper-hi: #0A1A31; --ink: #D9E7F7; --ink-2: #A7BCD5; --taupe: #6E88A8; --coral: #F0604F;
    --line: rgba(140, 190, 245, 0.17); --line-strong: rgba(170, 210, 250, 0.42);
    --grid: rgba(110, 170, 240, 0.065); --grid-major: rgba(110, 170, 240, 0.12);
    --hover: rgba(140, 190, 245, 0.1);
    --solid-bg: #D9E7F7; --solid-fg: #050F1E;
    --full-bg: #0F2C55; --full-fg: #E6F0FB; --full-sub: rgba(214, 232, 250, 0.7); --full-line: rgba(170, 210, 250, 0.2);
    --sig-filter: invert(1) hue-rotate(180deg) brightness(1.1); --sig-blend: screen;
    color-scheme: dark;
  }
}
.mode {
  appearance: none; border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; padding: 0;
}
.mode:hover { border-color: var(--line-strong); }
.mode svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.mode .i-sun { display: none; }
:root[data-theme="dark"] .mode .i-sun { display: block; }
:root[data-theme="dark"] .mode .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mode .i-sun { display: block; }
  :root:not([data-theme="light"]) .mode .i-moon { display: none; }
}

/* ── header ─────────────────────────────────────────────── */
.top {
  max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.top-logo { font: 700 18px/1 var(--sans); letter-spacing: 0.16em; text-decoration: none; }
.top-logo i, h1 i, .dg-plate-mark i { font-style: normal; color: var(--coral); }
.top-mid { margin: 0; color: var(--taupe); }
.top-end { display: flex; align-items: center; gap: 20px; }
.top-store { text-decoration: none; white-space: nowrap; }
.top-store:hover, .foot a:hover { color: var(--coral); }
.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; padding: 6px 2px; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: " ▾"; }
.lang ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px;
  list-style: none; background: var(--paper-hi); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.25); min-width: 160px;
}
.lang a { display: block; padding: 7px 10px; border-radius: 6px; text-decoration: none; font-size: 15px; }
.lang a:hover { background: var(--hover); }
.lang a[aria-current] { color: var(--coral); }
@media (max-width: 820px) { .top-mid { display: none; } }

/* ── hero ───────────────────────────────────────────────── */
.hero {
  max-width: var(--max); margin: 0 auto; padding: 40px var(--gutter) 72px;
  display: grid; gap: 48px; align-items: start;
  grid-template-columns: minmax(0, 1fr);
}
.kicker { margin: 0 0 18px; color: var(--coral); }
.hero-text { container-type: inline-size; min-width: 0; }
/* Sized to the column so the longest word (KALKULAČKA, in every language) never breaks. */
.hero h1 {
  margin: 0 0 24px; font: 900 min(88px, var(--h1-fit, 11.4cqi))/1.14 var(--sans);
  text-transform: uppercase; letter-spacing: -0.01em; hyphens: manual;
}
.lead { margin: 0 0 28px; max-width: 30em; font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.badge img { height: 50px; width: auto; }
.rating { text-decoration: none; color: var(--ink-2); }
.platforms { margin: 22px 0 0; color: var(--taupe); }
.hero-calc { margin: 0; position: relative; justify-self: center; width: min(100%, 400px); }
.hero-try { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--taupe); flex-wrap: wrap; }
.pal-step { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.pal-step button {
  border: 1px solid var(--line); background: var(--paper-hi); border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; font-size: 16px; line-height: 1;
}
.pal-step button:hover { border-color: var(--ink); }
.pal-step [data-palette-name] { min-width: 7.5em; text-align: center; }
.callouts { display: none; }

@media (min-width: 980px) {
  .hero { grid-template-columns: minmax(0, 1fr) 400px; padding-top: 56px; }
  .hero-calc { justify-self: end; }
}
@media (min-width: 1240px) {
  /* Callouts sit in a gutter to the right of the calculator; leader lines point left into it. */
  .hero { grid-template-columns: minmax(0, 1fr) 620px; gap: 40px; }
  .hero-calc { justify-self: start; width: 400px; }
  .callouts { display: block; list-style: none; margin: 0; padding: 0; }
  .co { position: absolute; left: calc(100% + 64px); width: 150px; display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
  .co b { font-weight: 600; color: var(--ink); }
  .co span { color: var(--taupe); letter-spacing: 0.06em; font-size: 10px; }
  .co::before { content: ""; position: absolute; top: 7px; right: calc(100% + 8px); width: 80px; border-top: 1px solid var(--ink); }
  .co::after { content: ""; position: absolute; top: 4px; right: calc(100% + 84px); width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
  .co--tape { top: 92px; }
  .co--screen { top: 236px; }
  .co--keys { top: 420px; }
  .co--plate { top: 584px; }
  .co--plate::before { width: 60px; } .co--plate::after { right: calc(100% + 64px); }
}

/* ── contents strip ─────────────────────────────────────── */
.toc {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.toc a { padding: 20px 12px 20px 0; text-decoration: none; display: flex; flex-direction: column; gap: 6px; font-size: 10.5px; }
.toc a b { font-weight: 500; color: var(--taupe); }
.toc a:hover { color: var(--coral); }
@media (max-width: 980px) {
  .toc { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: max-content; gap: 22px; overflow-x: auto; scrollbar-width: none; }
  .toc::-webkit-scrollbar { display: none; }
}

/* ── chapters ───────────────────────────────────────────── */
.ch {
  max-width: var(--max); margin: 0 auto; padding: 72px var(--gutter);
  display: grid; gap: 28px 48px; grid-template-columns: minmax(0, 1fr);
  border-bottom: 1px solid var(--line); scroll-margin-top: 8px;
}
.ch-no { margin: 0; display: flex; gap: 12px; align-items: baseline; }
.ch-no b { color: var(--coral); font-weight: 600; }
.ch h2 { margin: 0 0 18px; font: 700 clamp(30px, 4.2vw, 50px)/1.02 var(--sans); letter-spacing: -0.01em; }
.ch-text > p { margin: 0 0 24px; max-width: 34em; color: var(--ink-2); }
.ch-fig { margin: 0; min-width: 0; }
.spec { list-style: none; margin: 0; padding: 0; max-width: 34em; font-size: 11.5px; letter-spacing: 0.06em; }
.spec li { padding: 11px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; }
.spec li::before { content: "•"; color: var(--taupe); }
.spec li:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 980px) {
  .ch { grid-template-columns: 180px minmax(0, 1fr) minmax(0, 1fr); align-items: start; padding: 96px var(--gutter); }
  .ch-no { position: sticky; top: 24px; flex-direction: column; gap: 6px; }
  .ch--wide .ch-text { grid-column: 2 / 4; }
  .ch--pal .ch-text { grid-column: 2; grid-row: 1; }
  .ch--pal .ch-fig { grid-column: 3; grid-row: 1; position: sticky; top: 24px; }
  .ch-fig { justify-self: center; width: 100%; max-width: 440px; }
}

/* paper tape (static illustrations) */
.paper {
  background: var(--paper-hi); border-radius: 4px 4px 0 0; padding: 22px 22px 30px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 18px 40px -22px rgba(0, 0, 0, 0.35);
  font: 400 17px/1.4 var(--keyfont); font-variant-numeric: tabular-nums;
  -webkit-mask: radial-gradient(7px at 50% 100%, transparent 98%, #000) 50% 100% / 14px 100% repeat-x;
          mask: radial-gradient(7px at 50% 100%, transparent 98%, #000) 50% 100% / 14px 100% repeat-x;
}
.pr { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 7px 0; }
.pr-l { font: 500 10.5px/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--taupe); }
.pr-v { white-space: nowrap; }
.pr-v i { font-style: normal; color: #E27445; margin-right: 10px; }
.pr--struck .pr-v, .pr--struck .pr-l { text-decoration: line-through; opacity: 0.45; }
.pr--note { padding-top: 0; }
.pr--note .pr-l { text-transform: none; letter-spacing: 0.02em; font-style: italic; }
.pr--res { border-top: 1px dashed var(--line-strong); margin-top: 6px; padding-top: 12px; }
.pr--res .pr-v { color: #E27445; font-size: 26px; font-weight: 300; }

.say { display: flex; flex-direction: column; gap: 12px; }
.say-in {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--paper-hi); border-radius: 16px; padding: 16px 18px; font-size: 19px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.say-in svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--coral); stroke-width: 1.7; stroke-linecap: round; }
.say-arrow { text-align: center; color: var(--taupe); font-size: 14px; }

.conv { display: grid; gap: 16px; }
.conv-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.conv-codes span { border: 1px solid var(--line); border-radius: 8px; padding: 9px 0; text-align: center; background: var(--paper-hi); }
.conv-codes .conv-more { background: var(--solid-bg); color: var(--solid-fg); border-color: var(--solid-bg); }
.conv-rows { background: var(--paper-hi); border-radius: 14px; padding: 6px 18px; box-shadow: inset 0 0 0 1px var(--line); }
.cr { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 0; font-size: 19px; font-variant-numeric: tabular-nums; }
.cr + .cr { border-top: 1px solid var(--line); }
.cr i { font-style: normal; color: var(--coral); }
.cr span:last-child { text-align: right; }

.arch { list-style: none; margin: 0; padding: 6px 0; background: var(--paper-hi); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.arch li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 20px; font-size: 17px; }
.arch li + li { border-top: 1px solid var(--line); }
.arch .mono { color: var(--taupe); }
.arch-vault span:first-child { display: flex; align-items: center; gap: 10px; color: var(--coral); font-weight: 500; }
.arch-vault svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.fmt { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fmt li { padding: 18px 14px; border-radius: 10px; background: var(--paper-hi); box-shadow: inset 0 0 0 1px var(--line); text-transform: none; letter-spacing: 0.04em; font-size: 13px; }
.fmt .fmt-own { background: var(--solid-bg); color: var(--solid-fg); box-shadow: none; }
@media (min-width: 560px) { .fmt { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* palettes */
.swatches { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sw {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-hi); font-size: 15px;
}
.sw:hover { border-color: var(--line-strong); }
.sw[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sw-chip { display: flex; flex: none; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.sw-chip i { width: 9px; height: 22px; background: var(--a); }
.sw-chip i:nth-child(2) { background: var(--b); }
.sw-chip i:nth-child(3) { background: var(--c); }
.sw-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; overflow-wrap: anywhere; }
.sw-free { font-size: 8.5px; color: var(--coral); letter-spacing: 0.08em; margin-top: 2px; }
.pal-preview { max-width: 320px; }
@media (max-width: 979px) { .ch--pal .ch-fig { order: 3; justify-self: center; width: min(100%, 320px); } }

/* price */
.price { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin: 8px 0 28px; }
.price-col { border: 1px solid var(--line); border-radius: 16px; padding: 28px; background: var(--paper-hi); }
.price-col h3 { margin: 0 0 4px; font: 700 22px/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; }
.price-tag { margin: 0 0 18px; color: var(--taupe); text-transform: none; letter-spacing: 0.04em; font-size: 12.5px; }
.price-col ul { list-style: none; margin: 0; padding: 0; }
.price-col li { padding: 9px 0 9px 22px; border-top: 1px solid var(--line); position: relative; font-size: 16px; }
.price-col li::before { content: "+"; position: absolute; left: 0; font-family: var(--mono); color: var(--taupe); }
.price-col--full { background: var(--full-bg); color: var(--full-fg); border-color: var(--full-bg); }
.price-col--full .price-tag { color: var(--full-sub); }
.price-col--full li { border-top-color: var(--full-line); }
.price-col--full li::before { color: var(--coral); }
.note { color: var(--taupe); text-transform: none; letter-spacing: 0.04em; font-size: 12px; }
@media (min-width: 760px) { .price { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* reviews, faq, about */
.rv { margin: 0; }
.rv blockquote { margin: 0; }
.rv blockquote p { margin: 0 0 10px; }
.rv figcaption { color: var(--taupe); }
.rv--lead blockquote { font: 500 clamp(21px, 2.4vw, 28px)/1.35 var(--sans); max-width: 36em; }
.rv-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); }
.rv-grid blockquote { font-size: 16px; color: var(--ink-2); }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 18px 32px 18px 0; font-weight: 500; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 16px; font-family: var(--mono); color: var(--coral); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 20px; max-width: 42em; color: var(--ink-2); }
.about p { max-width: 36em; }
.about-em { font-weight: 600; color: var(--ink) !important; }
.about-kicker { font-weight: 700; color: var(--ink) !important; margin-bottom: 8px !important; }
.about-sig { width: 150px; height: auto; mix-blend-mode: var(--sig-blend); filter: var(--sig-filter); }

/* footer */
.foot {
  max-width: var(--max); margin: 0 auto; padding: 40px var(--gutter) 56px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 28px; color: var(--taupe);
}
.foot .top-logo { color: var(--ink); font-size: 15px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.foot a { text-decoration: none; }

/* ═════════════ the calculator (ABS) ═════════════════════════════════
   Mirrors the app: tape on the ground colour, body = panel mixed toward the
   special-key colour, display housing, 6×4 keys, nameplate. ABS = matte caps,
   moulded rim, darker side wall (36 % / 45 %), warm contact shadow, 1.5 pt travel. */
.dg {
  --c-digit-bg: #F4EFEA; --c-special-bg: #EDE3DB; --c-op-bg: #E27445; --c-eq-bg: #E27445;
  --c-digit: #292827; --c-special: rgba(41, 40, 39, 0.65); --c-body: #EEEBE8; --c-screen: #FDFCFA;
  --c-screen-text: #E27445; --c-screen-fg: #1E1B19; --c-result: #E27445; --c-ground: #F9F6F1; --c-tape: #292827;
  --c-plate-ink: #292827; --c-accent: #E27445;
  --wall-mix: 36%; --rim: rgba(255, 255, 255, 0.55); --contact: rgba(70, 45, 20, 0.16);
  container-type: inline-size;
  font-family: var(--keyfont);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.dg.is-dark { --wall-mix: 45%; --rim: rgba(255, 255, 255, 0.12); --contact: rgba(0, 0, 0, 0.4); }

/* The tape is a paper roll printed by the machine: narrower than the body, a torn top edge,
   and its foot runs into a slot cut in the top of the body (the body sits over it). */
.dg-tape-card {
  position: relative; z-index: 0;
  background:
    linear-gradient(to bottom, transparent 70%, rgba(0, 0, 0, 0.07)),
    var(--c-ground);
  margin: 0 30px -14px; padding: 16px 18px 22px;
  height: 176px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.05), inset -1px 0 0 rgba(0, 0, 0, 0.05);
  -webkit-mask: radial-gradient(5px at 50% 0, transparent 96%, #000) 50% 0 / 10px 100% repeat-x;
          mask: radial-gradient(5px at 50% 0, transparent 96%, #000) 50% 0 / 10px 100% repeat-x;
}
.dg.is-dark .dg-tape-card {
  background: linear-gradient(to bottom, transparent 65%, rgba(0, 0, 0, 0.35)), color-mix(in srgb, var(--c-ground), #fff 5%);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.09), inset -1px 0 0 rgba(255, 255, 255, 0.09);
}
/* The slot the tape feeds out of. */
.dg-tape-card + .dg-body::before {
  content: ""; position: absolute; top: 5px; left: 22px; right: 22px; height: 6px; border-radius: 3px;
  background: color-mix(in srgb, var(--c-body), #000 30%);
  box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.35), 0 1px 0 var(--rim);
}
.dg-tape { list-style: none; margin: 0; padding: 0; color: var(--c-tape); font-variant-numeric: tabular-nums; }
.t-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 17px; line-height: 27px; height: 27px; }
.t-op { color: var(--c-result); width: 1.2em; }
.t-v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-live .t-v { opacity: 0.5; }
.dg[data-live] .t-row[data-row] { cursor: text; border-radius: 6px; margin: 0 -6px; padding: 0 6px; }
.dg[data-live] .t-row[data-row]:hover { background: color-mix(in srgb, var(--c-result) 10%, transparent); }
.dg[data-live] .t-row[data-row]:hover .t-v { text-decoration: underline dotted color-mix(in srgb, var(--c-result) 70%, transparent); text-underline-offset: 4px; }
.t-edit {
  width: 9ch; text-align: right; font: inherit; color: var(--c-tape); background: var(--c-ground);
  border: 0; border-radius: 6px; padding: 0 6px; outline: 2px solid var(--c-result); outline-offset: 0; height: 25px;
}
@keyframes t-flash { from { background: color-mix(in srgb, var(--c-result) 28%, transparent); } to { background: transparent; } }
.t-flash { animation: t-flash 900ms ease-out; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .t-flash { animation: none; } }
.t-res { border-top: 1px dashed color-mix(in srgb, var(--c-tape) 30%, transparent); color: var(--c-result); }

.dg-body {
  position: relative; z-index: 1; background: var(--c-body); border-radius: 30px; padding: 12px 12px 0;
  box-shadow: inset 0 1px 0 var(--rim), 0 4px 10px rgba(0, 0, 0, 0.1), 0 30px 60px -24px rgba(40, 25, 10, 0.35);
}
.dg.is-dark .dg-body { box-shadow: inset 0 1px 0 var(--rim), 0 4px 10px rgba(0, 0, 0, 0.45), 0 30px 60px -24px rgba(0, 0, 0, 0.6); }

.dg-screen {
  background: var(--c-screen); border-radius: 18px; margin: 4px 4px 14px; height: 126px;
  display: flex; flex-direction: column; color: var(--c-screen-fg);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--c-body), #fff 18%),
    0 0 0 6px rgba(0, 0, 0, 0.06),
    inset 0 3px 5px rgba(0, 0, 0, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.3);
}
.dg.is-dark .dg-screen { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c-body), #fff 6%), 0 0 0 6px rgba(0, 0, 0, 0.3), inset 0 3px 6px rgba(0, 0, 0, 0.45); }
.dg-row { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 18px; min-width: 0; }
.dg-rule { height: 1px; margin: 0 14px; background: color-mix(in srgb, var(--c-screen-fg) 8%, transparent); }
.dg-lbl { font: 600 7.5px/1 ui-monospace, "SF Mono", var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.dg-row--total .dg-lbl { color: color-mix(in srgb, var(--c-screen-text) 58%, transparent); }
.dg-row--in .dg-lbl { color: color-mix(in srgb, var(--c-screen-fg) 30%, transparent); }
.dg-lblcol { display: flex; flex-direction: column; gap: 2px; width: 50px; flex: none; }
.dg-op { font-size: 24px; font-weight: 600; line-height: 1; height: 24px; color: var(--c-screen-text); }
.dg-total, .dg-in {
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  font-weight: 300; letter-spacing: -0.01em;
}
.dg-total { color: var(--c-screen-text); font-size: clamp(22px, 8.2cqi, 34px); }
.dg-total.is-neg { opacity: 0.5; }
.dg-in { font-size: calc(clamp(20px, 7.4cqi, 31px) * var(--fit, 1)); }

.dg-keys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 7px; padding: 0 2px; }
.k {
  --face: var(--c-digit-bg); --wall: color-mix(in srgb, var(--face), #000 var(--wall-mix));
  appearance: none; border: 0; margin: 0 0 3px; padding: 0; cursor: pointer;
  aspect-ratio: 1 / 0.92; border-radius: 26%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--face), #fff 7%), var(--face) 46%, color-mix(in srgb, var(--face), #000 3%));
  color: var(--c-digit); font: 400 clamp(17px, 6.6cqi, 27px)/1 var(--keyfont);
  box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px rgba(0, 0, 0, 0.035), 0 2.5px 0 var(--wall), 0 3.5px 3px var(--contact);
  transform: translateY(0); transition: transform 100ms ease-out, box-shadow 100ms ease-out;
  touch-action: manipulation;
}
.k.is-down { transform: translateY(1.5px); transition-duration: 65ms;
  box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px rgba(0, 0, 0, 0.035), 0 1px 0 var(--wall), 0 1.5px 1px var(--contact); }
.k--s { --face: var(--c-special-bg); color: var(--c-special); }
.k--o { --face: var(--c-op-bg); color: rgba(255, 255, 255, 0.92); }
.k--e { --face: var(--c-eq-bg); color: #fff; }
.k--s.is-on { --face: var(--c-eq-bg); color: #fff; }
.k--txt { font-size: clamp(16px, 6.2cqi, 25px); }
.k svg { width: 46%; height: auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.k-dot { width: 15%; aspect-ratio: 1; border-radius: 50%; background: var(--c-result); }
.k:focus-visible { outline-offset: 2px; }

.dg-plate {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px;
  height: 46px; margin: 4px -2px 0; position: relative; color: var(--c-plate-ink);
}
.dg-plate::before {
  content: ""; position: absolute; top: 0; left: 6px; right: 6px; height: 1px;
  background: rgba(0, 0, 0, 0.08); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
.dg.is-dark .dg-plate::before { background: rgba(0, 0, 0, 0.32); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); }
.dg-plate button {
  appearance: none; border: 0; background: none; cursor: pointer; height: 46px; padding: 0 10px;
  font: 600 9.5px/1 ui-monospace, "SF Mono", var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c-plate-ink) 62%, transparent); white-space: nowrap;
}
.dg-plate .dg-plate-share { justify-self: start; color: var(--c-accent); }
.dg-plate-end { justify-self: end; display: flex; }
.dg-plate .dg-plate-more { width: 44px; padding: 0; font-size: 13px; letter-spacing: 0.05em; }
.dg-plate-mark { font: 600 9.5px/1 var(--keyfont); letter-spacing: 0.32em; color: color-mix(in srgb, var(--c-plate-ink) 32%, transparent); }
.dg-plate-mark i { color: var(--c-accent); }

.dg-toast {
  position: absolute; left: 50%; bottom: 64px; transform: translate(-50%, 8px); margin: 0; pointer-events: none;
  background: rgba(23, 23, 23, 0.88); color: #fff; border-radius: 999px; padding: 9px 16px; white-space: nowrap;
  font: 500 13px/1 var(--sans); opacity: 0; transition: opacity 160ms, transform 160ms;
}
.dg-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* keys-only plate (scientific chapter) */
.dg--keysonly .dg-body { padding: 14px 12px 12px; border-radius: 26px; }
.dg-keys--sci { gap: 9px 6px; }
.dg-keys--sci .k { cursor: default; aspect-ratio: 1 / 0.78; font-size: clamp(11px, 4.3cqi, 17px); }
/* mini preview (palettes chapter): no tape */
/* full phone mockup (palettes chapter): the app's whole screen on the palette ground */
.phone {
  position: relative; width: 100%; max-width: 320px; margin: 0 auto; padding: 10px; border-radius: 56px;
  background: linear-gradient(145deg, #2c2c30, #111113 60%, #232327);
  box-shadow: inset 0 0 0 1.5px #4a4a50, inset 0 0 0 4px #0b0b0c, 0 1px 0 rgba(255, 255, 255, 0.4), 0 40px 80px -30px rgba(0, 0, 0, 0.5), 0 12px 24px -12px rgba(0, 0, 0, 0.35);
}
.ph-island { position: absolute; top: 21px; left: 50%; transform: translateX(-50%); width: 92px; height: 27px; border-radius: 14px; background: #000; }
.dg--phone {
  position: relative; display: flex; flex-direction: column; aspect-ratio: 300 / 650;
  border-radius: 46px; overflow: hidden; background: var(--c-ground); transition: background-color 200ms;
}
.ph-status { display: flex; justify-content: space-between; align-items: center; padding: 15px 26px 0 34px; height: 46px; flex: none;
  font: 600 14px/1 var(--keyfont); color: var(--c-tape); }
.ph-icons { display: flex; gap: 5px; align-items: center; }
.ph-icons svg { height: 11px; width: auto; fill: currentColor; }
.dg.dg--phone .dg-tape-card {
  flex: 1; height: auto; margin: 0; padding: 8px 22px 14px; background: none; box-shadow: none; -webkit-mask: none; mask: none;
}
.dg--phone .dg-body { border-radius: 28px 28px 0 0; padding-bottom: 18px; flex: none; }
.dg--phone .dg-body::before { display: none; }
.dg--phone .dg-plate { height: 40px; }
.ph-home { position: absolute; z-index: 2; bottom: 7px; left: 50%; transform: translateX(-50%); width: 34%; height: 4px; border-radius: 3px;
  background: color-mix(in srgb, var(--c-plate-ink) 75%, transparent); }

@media (max-width: 380px) {
  .dg-keys { gap: 8px 5px; }
  .dg-body { padding: 10px 10px 0; border-radius: 26px; }
}
