/* ShowKontrol manual — one stylesheet, no web fonts (works offline in the app bundle). */
:root {
  --bg: #f6f6f8;
  --panel: #ffffff;
  --panel-2: #eeeef2;
  --text: #1b1b21;
  --muted: #5e5e6a;
  --line: #dcdce3;
  --accent: #d81b76;
  --accent-soft: #fde6f1;
  --led: #11884a;
  --amber: #a86400;
  --code-bg: #eeeef3;
  --code-text: #2b2b36;
  --pre-bg: #17171d;
  --pre-text: #e9e9ef;
  --top: #0e0e12;
  --top-text: #e7e7ee;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111116; --panel: #19191f; --panel-2: #22222a; --text: #e6e6ec; --muted: #9a9aa8;
    --line: #2d2d36; --accent: #f32a8b; --accent-soft: #3a1528; --led: #3ddc84; --amber: #f0a830;
    --code-bg: #25252e; --code-text: #f0d3e2; --pre-bg: #0b0b0f; --pre-text: #e9e9ef;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111116; --panel: #19191f; --panel-2: #22222a; --text: #e6e6ec; --muted: #9a9aa8;
  --line: #2d2d36; --accent: #f32a8b; --accent-soft: #3a1528; --led: #3ddc84; --amber: #f0a830;
  --code-bg: #25252e; --code-text: #f0d3e2; --pre-bg: #0b0b0f; --pre-text: #e9e9ef;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }

/* top bar — always dark, like the app */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 18px;
  padding: 0 16px; background: var(--top); color: var(--top-text); border-bottom: 1px solid #000;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; flex: none; }
.brand img { height: 22px; width: auto; }
.brand span { font-size: 11px; letter-spacing: .18em; color: #f32a8b; font-weight: 600; }
.mainnav { display: flex; gap: 2px; }
.mainnav a { color: #b9b9c6; padding: 6px 10px; border-radius: 6px; font-size: 14px; white-space: nowrap; }
.mainnav a:hover { color: #fff; background: #1e1e26; text-decoration: none; }
.mainnav a.on { color: #fff; background: #26262f; box-shadow: inset 0 -2px 0 #f32a8b; }
.search { position: relative; margin-left: auto; flex: 0 1 320px; min-width: 120px; }
.search input {
  width: 100%; height: 34px; border-radius: 8px; border: 1px solid #2c2c36; background: #1a1a21; color: #fff;
  padding: 0 12px; font: inherit; font-size: 14px; outline: none;
}
.search input:focus { border-color: #f32a8b; }
.results {
  position: absolute; right: 0; top: 42px; width: min(520px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); padding: 6px;
}
.results a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); }
.results a:hover, .results a.sel { background: var(--accent-soft); text-decoration: none; }
.results b { display: block; font-size: 14px; }
.results small { color: var(--muted); font-size: 12px; }
.results .snip { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 2px; }
.results mark { background: none; color: var(--accent); font-weight: 600; }
.results .none { padding: 10px; color: var(--muted); font-size: 14px; }
.theme-btn, .menu-btn {
  background: none; border: 1px solid #2c2c36; color: #c9c9d4; width: 34px; height: 34px; border-radius: 8px;
  cursor: pointer; font-size: 16px; flex: none;
}
.menu-btn { display: none; }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 40px; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.layout.with-side { grid-template-columns: 240px minmax(0, 1fr) 220px; }
.sidebar {
  position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow: auto;
  padding: 28px 0 40px; font-size: 14px;
}
.sidebar h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 10px 10px; }
.sidebar h2 a { color: inherit; }
.chapters, .chapters ul { list-style: none; margin: 0; padding: 0; }
.chapters > li > a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); }
.chapters > li > a:hover { background: var(--panel-2); text-decoration: none; }
.chapters > li.on > a { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chapters ul { margin: 4px 0 8px 10px; border-left: 1px solid var(--line); }
.chapters ul a { display: block; padding: 3px 12px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.content { min-width: 0; padding: 32px 0 48px; max-width: 800px; }
.onpage { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow: auto; padding: 32px 0; font-size: 13px; }
.onpage h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 8px; }
.onpage ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.onpage a { display: block; padding: 3px 12px; color: var(--muted); line-height: 1.4; }
.onpage a:hover { color: var(--text); text-decoration: none; }
.onpage a.on { color: var(--accent); box-shadow: -1px 0 0 var(--accent); }
.onpage .l3 a { padding-left: 24px; font-size: 12px; }

/* type */
h1 { font-size: 34px; line-height: 1.2; margin: 6px 0 12px; letter-spacing: -.01em; }
h2 { font-size: 24px; line-height: 1.3; margin: 44px 0 12px; padding-top: 8px; }
.msec + .msec h2:first-child { border-top: 1px solid var(--line); padding-top: 32px; }
h3 { font-size: 18px; margin: 28px 0 8px; }
h4 { font-size: 16px; margin: 22px 0 6px; }
h1 .anchor, h2 .anchor, h3 .anchor, h4 .anchor { margin-left: 8px; color: var(--line); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 24px; }
.crumbs { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
p, ul, ol { margin: 0 0 14px; }
li { margin: 3px 0; }
li > ul, li > ol { margin: 4px 0 6px; }
strong { font-weight: 650; }
code { background: var(--code-bg); color: var(--code-text); padding: 1px 5px; border-radius: 4px; font-size: .86em; overflow-wrap: anywhere; }
pre {
  background: var(--pre-bg); color: var(--pre-text); padding: 14px 16px; border-radius: 10px; overflow: auto;
  font-size: 13.5px; line-height: 1.55; margin: 0 0 16px; position: relative;
}
pre code { background: none; color: inherit; padding: 0; font-size: inherit; overflow-wrap: normal; }
pre[data-lang]::after { content: attr(data-lang); position: absolute; top: 6px; right: 10px; font-size: 11px; color: #777; }
kbd { background: var(--panel); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-size: .85em; }
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--panel-2); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 0 0 16px; }
.callout p:last-child { margin: 0; }
.callout.tip { border-color: var(--led); background: color-mix(in srgb, var(--led) 12%, transparent); }
.callout.warning, .callout.live { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.secref { white-space: nowrap; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 0 0 24px; }
.card {
  display: block; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 16px 14px; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card h3 { margin: 6px 0 4px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.card .num { font: 600 12px/1 "SF Mono", ui-monospace, Menlo, monospace; color: var(--accent); }
.card .mins { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.lvl { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }
.lvl.beginner { background: color-mix(in srgb, var(--led) 16%, transparent); color: var(--led); }
.lvl.intermediate { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.lvl.advanced { background: var(--accent-soft); color: var(--accent); }
.meta { margin: -4px 0 12px; color: var(--muted); font-size: 14px; }
.related { margin-top: 40px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.related h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 6px; padding: 0; }
.related p { margin: 0; }

/* home */
.hero { padding: 16px 0 8px; }
.hero h1 { font-size: 44px; }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 24px 0 8px; }
.door { background: var(--top); color: #cfcfda; border-radius: 14px; padding: 20px; border: 1px solid #26262f; }
.door b { display: block; color: #fff; font-size: 18px; margin-bottom: 6px; }
.door b::after { content: " →"; color: #f32a8b; }
.door span { font-size: 14px; line-height: 1.5; }
.door:hover { border-color: #f32a8b; text-decoration: none; }
.news { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 20px 10px; margin-top: 12px; }
.news h2 { font-size: 18px; margin: 16px 0 8px; }
.news small { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 6px; }

/* what's new */
.day h2 { font-size: 18px; margin: 32px 0 8px; color: var(--muted); }
.day ul { padding-left: 20px; }
.day li { margin: 8px 0; }
.day li p { margin: 4px 0; }

.release { border-top: 1px solid var(--line); margin-top: 36px; }
.release h2 small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.release h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 20px 0 6px; }

/* quick reference: man-page feel */
.is-manpage .content { max-width: 900px; }
.manhead { display: flex; justify-content: space-between; font: 12px/1 "SF Mono", ui-monospace, Menlo, monospace; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.manpage h2 { font: 700 14px/1.3 "SF Mono", ui-monospace, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; margin: 36px 0 10px; color: var(--accent); }
.manpage h3 { font-size: 15px; }
.manpage table { font-size: 14px; }
.manpage td:first-child { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 13px; }

.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; }
.prevnext a { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--panel); color: var(--text); }
.prevnext a span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.prevnext a.next { text-align: right; }
.prevnext a:hover { border-color: var(--accent); text-decoration: none; }
.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

@media (max-width: 1180px) {
  .layout, .layout.with-side { grid-template-columns: minmax(0, 1fr); }
  .layout.with-side { grid-template-columns: 220px minmax(0, 1fr); }
  .onpage { display: none; }
}
@media (max-width: 860px) {
  .layout, .layout.with-side { grid-template-columns: minmax(0, 1fr); padding: 0 16px; gap: 0; }
  .mainnav { display: none; }
  .menu-btn { display: block; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; width: 280px; max-height: none; z-index: 15;
    background: var(--panel); border-right: 1px solid var(--line); padding: 20px 12px; transform: translateX(-100%);
    transition: transform .2s;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); padding-top: 104px; }
  body.nav-open .mainnav {
    display: flex; position: fixed; top: 56px; left: 0; width: 280px; z-index: 16; background: var(--top);
    padding: 8px; gap: 4px; flex-wrap: wrap;
  }
  body.nav-open:not(:has(.sidebar)) .mainnav { flex-direction: column; }
  body.nav-open:not(:has(.sidebar)) .mainnav a { padding: 10px 12px; }
  .topbar { gap: 10px; }
  .brand span { display: none; }
  .brand img { height: 14px; }
  .search { min-width: 0; flex: 1 1 auto; }
  .topbar { padding: 0 12px; }
  .doors { grid-template-columns: 1fr; }
  h1 { font-size: 28px; } .hero h1 { font-size: 34px; }
  td:first-child { white-space: normal; }
}
@media print {
  .topbar, .sidebar, .onpage, .prevnext, .anchor { display: none !important; }
  .layout { display: block; padding: 0; }
  pre { white-space: pre-wrap; }
}
