/* Styles of the FEM tool pages (copied from the FBG shape tool, plus the additions at the end). */
:root {
  --bg: #eef0f3; --surface: #ffffff; --surface-2: #f6f7f9; --text: #1d2125; --muted: #646b76;
  --border: #d6dae0; --border-strong: #b9bfc8; --accent: #1864ab; --accent-hover: #145591;
  --ring: rgba(24, 100, 171, 0.25); --warn: #c92a2a; --warn-bg: #fff1f1; --ok: #2b8a3e;
  --frame: #3b4048; --grid: rgba(120, 128, 140, 0.35); --domain: #dfe3e8; --mesh: rgba(60, 66, 76, 0.45);
  --ctl-h: 30px; --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181c; --surface: #202328; --surface-2: #272b31; --text: #e6e8eb; --muted: #9aa1ab;
    --border: #363b43; --border-strong: #4a515b; --accent: #4dabf7; --accent-hover: #74c0fc;
    --ring: rgba(77, 171, 247, 0.3); --warn: #ff8787; --warn-bg: #3a2020; --ok: #69db7c;
    --frame: #c9ced6; --grid: rgba(150, 158, 170, 0.35); --domain: #31363d; --mesh: rgba(200, 206, 214, 0.35);
  }
}
:root[data-theme="dark"] {
  --bg: #16181c; --surface: #202328; --surface-2: #272b31; --text: #e6e8eb; --muted: #9aa1ab;
  --border: #363b43; --border-strong: #4a515b; --accent: #4dabf7; --accent-hover: #74c0fc;
  --ring: rgba(77, 171, 247, 0.3); --warn: #ff8787; --warn-bg: #3a2020; --ok: #69db7c;
  --frame: #c9ced6; --grid: rgba(150, 158, 170, 0.35); --domain: #31363d; --mesh: rgba(200, 206, 214, 0.35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
}
.sym { font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; font-style: italic; font-size: 1.08em; }
.sym sub, .sym sup { font-style: normal; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: .68em; }

/* ---- controls ---- */
.btn {
  height: var(--ctl-h); padding: 0 14px; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-stop { background: var(--warn); border-color: var(--warn); color: #fff; font-weight: 600; }
.btn-link { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }
select {
  height: var(--ctl-h); padding: 0 28px 0 9px; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23808893' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 9px center;
  border: 1px solid var(--border-strong); border-radius: var(--radius); appearance: none;
  max-width: 100%; min-width: 0;
}
select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--accent); }
input[type=range] { width: 96px; accent-color: var(--accent); margin: 0; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
label.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap; }

/* numeric field (ui.js) */
.num {
  display: inline-flex; align-items: stretch; height: var(--ctl-h); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; flex: none;
}
.num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.num.invalid, .num.invalid:focus-within { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(201, 42, 42, .18); background: var(--warn-bg); }
.num input {
  border: 0; outline: 0; background: transparent; color: inherit; font: inherit;
  text-align: right; padding: 0 6px; font-variant-numeric: tabular-nums; min-width: 0;
}
.num button {
  width: 24px; flex: none; border: 0; padding: 0; cursor: pointer; font-size: 15px; line-height: 1;
  background: var(--surface-2); color: var(--muted); user-select: none; touch-action: none;
}
.num button:first-child { border-right: 1px solid var(--border); }
.num button:last-child { border-left: 1px solid var(--border); }
.num button:hover:not(:disabled) { color: var(--text); background: var(--border); }
.num button:disabled { color: var(--border-strong); cursor: default; }
.num.disabled { opacity: .55; }

/* ---- sidebar ---- */
.sidebar {
  width: 312px; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.brand > a { display: block; flex: none; }
.brand-logo { display: block; height: 52px; width: auto; }
/* dark theme: the blue logo on a light tile (keeps the logo colors unchanged) */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo { background: #fff; border-radius: 6px; padding: 3px 5px; } }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { color: var(--muted); font-size: 12px; }
.brand-sub a { color: var(--accent); text-decoration: none; }
.brand-sub a:hover { text-decoration: underline; }
.sidebar-run { padding: 0 18px; border-bottom: 1px solid var(--border); flex: none; }
.sidebar-run .section { border-bottom: none; padding-bottom: 12px; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 0 18px 20px; }
/* status and message scroll with the parameters (only the run buttons and the progress bar stay fixed) */
.sidebar-status { padding: 10px 0 4px; border-bottom: 1px solid var(--border); }
.sidebar-status .msg:empty { display: none; }
.section { padding: 14px 0 6px; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: none; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.run { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.run .btn { padding-left: 4px; padding-right: 4px; white-space: nowrap; }
.run .btn { height: 34px; }
.progress { height: 4px; background: var(--surface-2); border-radius: 2px; margin: 12px 0 10px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.progress.done > div { background: var(--ok); }
.status { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-variant-numeric: tabular-nums; }
.status dt { color: var(--muted); }
.status dd { margin: 0; text-align: right; }
.msg { margin: 10px 0 4px; padding: 7px 10px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.msg:empty { display: none; }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.pgroup { margin: 4px 0 12px; }
.pgroup-title { font-weight: 600; font-size: 13px; margin: 0 0 4px; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 36px; }
.prow > label { color: var(--text); cursor: help; }
.prow select { width: 132px; }

/* ---- main area ---- */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.views { display: flex; gap: 4px; padding: 0 16px; height: 46px; align-items: flex-end; background: var(--surface); border-bottom: 1px solid var(--border); }
.views button {
  height: 38px; padding: 0 14px; border: none; background: none; cursor: pointer; font: inherit;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.views button:hover { color: var(--text); }
.views button.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; min-height: 52px;
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.tgroup { display: flex; align-items: center; gap: 8px; }
.tgroup .fgrp { display: inline-flex; align-items: center; gap: 4px; }
.tlabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
.tsep { display: none; }                      /* groups are separated by spacing (clean when wrapping) */
.unit { color: var(--muted); }
.readout { min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.swatch { width: 20px; height: 20px; border: 1px solid var(--border-strong); border-radius: 4px; flex: none; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; height: var(--ctl-h); }
.seg button { border: none; padding: 0 12px; font: inherit; background: var(--surface); color: var(--text); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.active { background: var(--accent); color: #fff; }
.toolbar .info { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.canvas-wrap { flex: 1; min-height: 0; position: relative; }
.canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#view-theory { overflow-y: auto; display: block; }   /* block: the article never grows wider than the view */

/* ---- theory page: style of the lecture notes (Latin Modern = Computer Modern, KaTeX) ---- */
#view-theory { background: var(--surface); }
article.notes {
  max-width: 46em; margin: 0 auto; padding: 32px 36px 72px; color: var(--text);
  font-family: KaTeX_Main, "Latin Modern Roman", "CMU Serif", "Times New Roman", serif; font-size: 18px; line-height: 1.5;
  text-align: justify; hyphens: auto;
}
article.notes h1 { font-size: 1.75em; font-weight: bold; margin: 0 0 .6em; text-align: left; }
article.notes h2 { font-size: 1.3em; font-weight: bold; margin: 1.7em 0 .5em; text-align: left; }
article.notes .secnum { display: inline-block; min-width: 1.7em; }
article.notes .lead { color: var(--muted); }
article.notes ul, article.notes ol { padding-left: 1.6em; }
article.notes li { margin: .3em 0; }
article.notes .katex { font-size: 1.05em; }
article.notes .katex-display { margin: .9em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
/* a wide equation scrolls instead of running under its tag (equal space on both sides keeps it centered) */
article.notes .katex-display > .katex > .katex-html { width: max-content; min-width: 100%; padding: 0 3.2em; }
/* keypoint box of the script: colframe yellow!50!black, colback yellow!8!white, square corners */
article.notes .keypoint { border: 1px solid #808000; background: #fffeeb; margin: 1.1em 0; padding: 0 10px 8px; text-align: left; }
article.notes .kp-title { background: #808000; color: #fff; font-weight: bold; margin: 0 -10px 6px; padding: 2px 10px; }
/* algorithm float (ruled) */
article.notes .algorithm { border-top: 1.5px solid var(--text); border-bottom: 1.5px solid var(--text); margin: 1.2em 0; text-align: left; }
article.notes .alg-caption { border-bottom: 1px solid var(--text); padding: 4px 0; }
article.notes .algorithm ol { margin: .4em 0 .5em; }
article.notes .algorithm li { margin: .15em 0; }
/* booktabs table */
article.notes table.booktabs { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .92em; text-align: left; }
article.notes table.booktabs thead tr { border-top: 1.5px solid var(--text); border-bottom: 1px solid var(--text); }
article.notes table.booktabs tbody tr:last-child { border-bottom: 1.5px solid var(--text); }
article.notes table.booktabs th, article.notes table.booktabs td { padding: 4px 10px 4px 0; vertical-align: top; }
article.notes table.booktabs th { font-weight: bold; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) article.notes .keypoint { background: rgba(128, 128, 0, .14); border-color: #a3a326; }
  :root:not([data-theme="light"]) article.notes .kp-title { background: #8a8a1f; }
}
:root[data-theme="dark"] article.notes .keypoint { background: rgba(128, 128, 0, .14); border-color: #a3a326; }
:root[data-theme="dark"] article.notes .kp-title { background: #8a8a1f; }

@media (max-width: 860px) and (min-height: 501px) {
  body { flex-direction: column; height: auto; min-height: 100%; }
  /* narrow screens: run block on top, then the views, then the parameters */
  .sidebar { display: contents; }
  .brand, .sidebar-run, .sidebar-scroll { background: var(--surface); }
  .brand { order: 1; }
  .sidebar-run { order: 2; }
  main { order: 3; }
  .sidebar-scroll { display: contents; }
  .sidebar-status { order: 2; padding: 0 18px 8px; background: var(--surface); }
  .sidebar-scroll > .section { order: 4; padding-left: 18px; padding-right: 18px; background: var(--surface); }
  .canvas-wrap { min-height: 60vh; }
  .toolbar { gap: 10px 16px; padding: 10px 12px; }
  .tgroup { flex-wrap: wrap; row-gap: 8px; min-width: 0; max-width: 100%; }
  .toolbar .info { margin-left: 0; }
  #resCanvas, #convCanvas { touch-action: pan-y; }   /* no drag gestures: let the page scroll */
  article.notes { padding: 20px 16px 48px; font-size: 16px; }
  article.notes table.booktabs { display: block; overflow-x: auto; }
}
#canvas { cursor: crosshair; }
#canvas.edit { cursor: default; }
#canvas.drag { cursor: grabbing; }
.toolbar .hint { color: var(--muted); font-size: 13px; flex-basis: 100%; margin-top: -4px; }
.prow .num { justify-self: end; }
/* readout over the canvas (bottom left): changes on mouse moves must not resize the toolbar */
.view-info {
  position: absolute; left: 12px; bottom: 10px; max-width: calc(100% - 24px); pointer-events: none;
  padding: 4px 9px; border-radius: var(--radius); background: var(--surface); opacity: .9;
  border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.view-info:empty { display: none; }
/* ---- phones: landscape only; compact menu left, view right ("Optimieren" and the canvas both visible) ---- */
.rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  html, body { height: 100%; overflow: hidden; }
  .sidebar { width: 236px; font-size: 12px; }
  .brand { gap: 10px; padding: 4px 10px; }
  .brand-logo { height: 26px; }
  .brand-name { font-size: 13px; }
  .brand-sub { font-size: 11px; line-height: 1.2; }
  .sidebar-run { padding: 0 10px; }
  .sidebar-status { padding: 6px 0 2px; }
  .sidebar-run .section { padding: 8px 0 6px; }
  .sidebar-run .section-head { display: none; }
  .run { gap: 5px; }
  .run .btn { height: 28px; font-size: 12px; padding: 0 2px; }
  .progress { margin: 6px 0; }
  .status { font-size: 11.5px; gap: 0 8px; line-height: 1.3; }
  .msg { font-size: 12px; margin: 6px 0 2px; padding: 4px 8px; }
  .sidebar-scroll { padding: 0 10px 12px; }
  .sidebar-scroll .section { padding-top: 8px; }
  .section-head { margin-bottom: 4px; }
  .pgroup { margin: 2px 0 6px; }
  .pgroup-title { font-size: 12px; }
  .prow { min-height: 30px; gap: 6px; }
  .prow select { width: 108px; }
  .views { height: 34px; padding: 0 10px; }
  .views button { height: 30px; padding: 0 10px; }
  /* one toolbar row that scrolls sideways: the canvas keeps its height */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; min-height: 0; padding: 5px 10px; gap: 14px; }
  .tgroup { flex: none; }
  .toolbar .info { margin-left: 0; flex: none; }
  .toolbar .hint { display: none; }
  article.notes { padding: 14px 16px 40px; font-size: 15px; }
  article.notes table.booktabs { display: block; overflow-x: auto; }
}
/* phones in portrait: ask to turn the device (a page cannot rotate itself) */
@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) {
  body > .sidebar, body > main { display: none; }
  .rotate-hint {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    position: fixed; inset: 0; padding: 24px; text-align: center; background: var(--surface); font-size: 16px;
  }
  .rotate-hint svg { width: 72px; height: 72px; color: var(--accent); }
}
/* ---- additions of the FEM tool ---- */
:root { --rdir: #2b8a3e; --sdir: #e8590c; --geo-line: #1d2125; --geo-point: #1d2125; --sel: #f08c00; --dir: #1c7ed6; --load: #e03131; --moved: #f08c00; --bad: rgba(224, 49, 49, .45); --ref: #9aa1ab; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --geo-line: #e6e8eb; --geo-point: #e6e8eb; --sel: #ffa94d; --dir: #4dabf7; --load: #ff6b6b; --ref: #6c737d; } }
:root[data-theme="dark"] { --geo-line: #e6e8eb; --geo-point: #e6e8eb; --sel: #ffa94d; --dir: #4dabf7; --load: #ff6b6b; --ref: #6c737d; }
#preCanvas { cursor: crosshair; }
#preCanvas.select { cursor: default; }
#preCanvas.drag { cursor: grabbing; }
.steps { margin: 0; padding-left: 1.3em; color: var(--muted); font-size: 13px; }
.steps li { margin: 3px 0; }
.steps li.done { color: var(--ok); }
.steps li.now { color: var(--text); font-weight: 600; }
#params .prow select { width: 150px; }
#params .punit { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
#params .pnote { color: var(--muted); font-size: 12px; margin: -4px 0 8px; }
@media (orientation: landscape) and (max-height: 500px) { #params .prow select { width: 130px; } }
.proc-wrap { flex: 1; min-height: 0; display: flex; }
.run #btnIter { grid-column: 1 / -1; }
.pre-wrap { flex: 1; min-height: 0; display: flex; }
.pre-wrap > .canvas-wrap { flex: 1; min-width: 0; }
.elem-panel { position: relative; width: 380px; flex: none; overflow-y: auto; padding: 12px 16px 20px; border-left: 1px solid var(--border); background: var(--surface); font-size: 13.5px; }
.elem-panel h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 6px; }
.elem-panel h3:first-child { margin-top: 0; }
#elemSpy { display: block; width: 100%; aspect-ratio: 1; touch-action: none; cursor: crosshair; }
#refCanvas { display: block; width: 100%; aspect-ratio: 1 / 0.7; touch-action: none; cursor: crosshair; }
.elem-legend { color: var(--muted); font-size: 12.5px; margin: 2px 0 4px; }
.elem-legend .sw { display: inline-block; width: 14px; height: 3px; vertical-align: middle; }
.sw-r { background: var(--rdir); } .sw-s { background: var(--sdir); }
.elem-panel p { margin: 6px 0; }
.elem-panel .katex-display { margin: 6px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.elem-panel .katex { font-size: 1.02em; }
.elem-panel table { border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 4px 0; }
.elem-panel th, .elem-panel td { padding: 2px 10px 2px 0; text-align: right; }
.elem-panel th { color: var(--muted); font-weight: 600; }
.elem-panel td.bad { color: var(--warn); font-weight: 600; }
@media (max-width: 860px) { .pre-wrap { flex-direction: column; } .elem-panel { width: auto; border-left: none; border-top: 1px solid var(--border); } }
.proc-wrap .canvas-wrap { flex: 1; }
.proc-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.proc-main > .proc-progress { flex: none; }
.proc-progress { flex: none; padding: 4px 24px 14px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.proc-progress .progress { margin: 0 0 6px; height: 6px; }
.proc-progress .progress > div { height: 100%; width: 0; background: var(--accent); }
.proc-progress.done .progress > div { background: var(--ok); }
/* readouts that change during playback have a fixed width: a rewrapping toolbar would resize the canvas */
.proc-times table { border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.proc-times th, .proc-times td { padding: 1px 18px 1px 0; text-align: left; }
.proc-times td:last-child, .proc-times th:last-child { text-align: right; }
.proc-times th { font-weight: 600; }
.proc-times tfoot td { border-top: 1px solid var(--border); font-weight: 600; color: var(--text); }
.proc-times tr.now td { color: var(--accent); font-weight: 600; }
#timeOut { display: inline-block; width: 7.5em; text-align: left; white-space: nowrap; }
#postInfo { width: 25em; max-width: 100%; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#playSpeed { width: 5.2em; }
.proc-text { position: relative; width: 320px; flex: none; overflow-y: auto; padding: 14px 18px; border-left: 1px solid var(--border); background: var(--surface); font-size: 13.5px; }
.proc-text h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 6px; }
.proc-text p { margin: 6px 0; }
@media (max-width: 860px) { .proc-wrap { flex-direction: column; } .proc-text { width: auto; border-left: none; border-top: 1px solid var(--border); } }

.proc-text table.ftable { border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 4px 0; }
.proc-text table.ftable th, .proc-text table.ftable td { padding: 2px 12px 2px 0; text-align: right; }
.proc-text table.ftable th { color: var(--muted); font-weight: 600; }

/* ---- diagram below the result (dynamics) ---- */
/* Postprocessing: the model view fills the visible area (the head of the diagram peeks in), the diagram follows
   below and is reached by scrolling; on narrow screens the page itself scrolls */
.post-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.post-scroll > .canvas-wrap { height: calc(100% - 44px); }
.post-scroll:has(> #chartWrap[hidden]) > .canvas-wrap { height: 100%; }
@media (max-width: 860px) and (min-height: 501px) { .post-scroll { overflow: visible; } .post-scroll > .canvas-wrap { height: auto; } #chartCanvas { touch-action: pan-y; } }
.chart-wrap { flex: none; height: 300px; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--surface); }
.chart-head { display: flex; align-items: center; gap: 14px; padding: 6px 16px 0; }
.chart-head .info { color: var(--muted); font-size: 13px; }
#chartCanvas { flex: 1; min-height: 0; width: 100%; touch-action: none; cursor: ew-resize; }
.btn-stop:hover:not(:disabled) { filter: brightness(1.08); }

/* ---- landing page ---- */
body.landing { display: block; overflow-y: auto; }
.landing-wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px 48px; }
.landing-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.landing-head .brand-logo { height: 64px; }
.landing-head h1 { font-size: 24px; margin: 0; }
.landing-head p { margin: 2px 0 0; color: var(--muted); }
.landing-lead { color: var(--muted); max-width: 46em; margin: 14px 0 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; min-height: 190px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
}
a.card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.card h2 { font-size: 17px; margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; flex: 1; }
.card .tag { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
a.card .tag { background: var(--accent); border-color: var(--accent); color: #fff; }
.card.soon { opacity: .65; }
.card svg { width: 100%; height: 56px; color: var(--muted); }
a.card svg { color: var(--accent); }

/* fullscreen toggle in the view tabs (touch devices with the Fullscreen API) */
.views .btn-fs { margin-left: auto; align-self: center; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.views .btn-fs:hover { color: var(--text); }
/* tooltip of a parameter, shown by tapping its label (touch devices have no hover) */
#params .prow label { cursor: help; }
#params .ptip { color: var(--muted); font-size: 12px; margin: -2px 0 6px; line-height: 1.35; }
/* hint of the current tool over the canvas where the toolbar has no room for it (phones), fades out */
.view-toast { position: absolute; left: 12px; right: 12px; top: 8px; padding: 6px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 12.5px; line-height: 1.35; pointer-events: none; opacity: 0; transition: opacity .4s; }
.view-toast.show { opacity: .95; }
/* touch screens: a vertical swipe over the diagram scrolls (back up to the model view), a horizontal one scrubs */
@media (pointer: coarse) { #chartCanvas { touch-action: pan-y; } }
/* phones in landscape: side panels stay beside the canvas (stacked, the canvas would get no height) */
@media (orientation: landscape) and (max-height: 500px) {
  .pre-wrap { flex-direction: row; }
  .elem-panel { width: 290px; border-top: none; border-left: 1px solid var(--border); padding: 8px 10px 14px; font-size: 12.5px; }
  /* Processing: one scrolling column, matrices with the full width (below each other), then times, then the text */
  .proc-wrap { flex-direction: column; overflow-y: auto; }
  .proc-main { flex: none; overflow: visible; }
  .proc-text { width: auto; flex: none; overflow: visible; border-left: none; border-top: 1px solid var(--border); padding: 8px 12px 14px; font-size: 12.5px; }
  .proc-progress { padding: 2px 10px 6px; }
}
/* the matrix structures have no drag gestures: a vertical swipe scrolls the Processing column or the element panel */
#procCanvas, #elemSpy { touch-action: pan-y; }
/* button labels never wrap ("Last–Verschiebung"); segmented groups keep their size, the info text next to them gives way */
.btn, .seg button, .views button, button { white-space: nowrap; }
.seg { flex: none; }
.chart-head { min-width: 0; }
.chart-head .info { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
