/* ── Tomotriton base.css ─────────────────────────────────────────────────── */

/* Open Sans v44 - lokal gehostet (google-webfonts-helper) */
@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v44-latin-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v44-latin-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v44-latin-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v44-latin-600italic.woff2') format('woff2');
  font-weight: 600; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v44-latin-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/open-sans-v44-latin-700italic.woff2') format('woff2');
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  --bg:           #080b10;
  --panel:        #101722;
  --panel-2:      #0d131c;
  --panel-3:      #151d2a;
  --border:       #263247;
  --border-hi:    #3a4d68;
  --border-soft:  rgba(255,255,255,.08);
  --text:         #eef3ff;
  --text-muted:   #8b97aa;
  --text-dim:     #657186;
  --accent:       #dc291a;
  --accent-2:     #e8321f;
  --accent-dim:   rgba(220,41,26,.25);
  --green:        #24c47e;
  --red:          #ef3b2d;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 16px 45px rgba(0,0,0,.45);
  --sidebar-width:  320px;
  --details-width:  320px;
  --topbar-height:  48px;
  --footer-height:  36px;
  --panel-hi: #151d2a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; overflow: hidden; }

body {
  background: radial-gradient(circle at top center, #121b29 0%, #080b10 48%, #05070b 100%);
  color: var(--text);
  font-family: 'Open Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 13px; font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: var(--topbar-height) 1fr var(--footer-height);
  height: 100vh; width: 100vw;
}
.app.hidden { display: none; }

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  display: flex; align-items: center; padding: 0 16px;
  background: rgba(10,14,21,.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.brand {
  font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}
.brand::before {
  content: ""; display: inline-block; width: 8px; height: 8px;
  background: var(--accent); margin-right: 4px; vertical-align: 1px;
}
.dataset-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  padding-left: 16px; border-left: 1px solid var(--border);
}
.header-spacer { flex: 1; }
.header-toggles { display: flex; gap: 6px; }

.toggle-btn {
  background: #111827; border: 1px solid var(--border);
  color: var(--text-muted); padding: 6px 12px;
  font-size: 11px; font-family: inherit;
  letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all .12s;
}
.toggle-btn:hover { border-color: var(--border-hi); color: var(--text); background: #172133; }
.toggle-btn.active {
  background: linear-gradient(135deg, #dc291a, #a31912);
  border-color: #e8321f;
  color: #fff;
  box-shadow: 0 0 18px rgba(220,41,26,.3);
}

/* ── Main grid ───────────────────────────────────────────────────────────── */
main {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--details-width);
  min-height: 0; min-width: 0; background: var(--bg);
}

/* ── Workbench ───────────────────────────────────────────────────────────── */
.workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px; padding: 6px;
  background: var(--bg);
  min-width: 0; min-height: 0;
}
.workbench .slice-panel[data-view="oben"]   { grid-row: 1; grid-column: 1; }
.workbench .slice-panel[data-view="vorne"]  { grid-row: 1; grid-column: 2; }
.workbench .slice-panel[data-view="rechts"] { grid-row: 2; grid-column: 1; }
.workbench #panel-3d                        { grid-row: 2; grid-column: 2; }

.panel {
  position: relative; overflow: hidden;
  background: #020305;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
#panel-3d {
  background: radial-gradient(circle at center, #192232 0%, #090d14 72%);
}
.panel.maximized {
  position: fixed !important;
  inset: var(--topbar-height) 0 var(--footer-height) 0 !important;
  z-index: 200 !important; border-radius: 0 !important;
}
.panel.hidden { display: none !important; }

.panel-label {
  position: absolute; top: 12px; left: 14px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted);
  z-index: 10; pointer-events: none;
}
.panel-stats {
  position: absolute; bottom: 42px; left: 14px;
  font-size: 10px; font-family: "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-dim); z-index: 10; pointer-events: none;
}
.panel-maximize {
  position: absolute; top: 10px; right: 10px; z-index: 15;
  width: 28px; height: 28px;
  background: rgba(20,28,41,.85);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 16px;
  display: grid; place-items: center; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.panel-maximize:hover { border-color: var(--accent); color: var(--accent); }

/* Localizer-Pin-Button (3D-Panel, unter dem Maximize-Button) */
.localizer-toggle {
  position: absolute; top: 44px; right: 10px; z-index: 15;
  width: 28px; height: 28px;
  background: rgba(20,28,41,.85);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 15px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.localizer-toggle:hover { border-color: var(--accent); color: var(--accent); }
.localizer-toggle.active { border-color: var(--accent); color: #fff; background: var(--accent); }

/* ── W/L Preview-Galerie (PowerPoint-Stil) ───────────────────────────────── */
.wl-gallery {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 5px; margin: 6px 0 8px;
}
.wl-thumb {
  position: relative; padding: 0; line-height: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #000; cursor: pointer; overflow: hidden;
  aspect-ratio: 1 / 1;
  transition: border-color .12s, transform .05s;
}
.wl-thumb canvas { width: 100%; height: 100%; display: block; }
.wl-thumb .wl-thumb-lbl {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 9px; line-height: 1.4; text-align: center;
  color: var(--text); background: rgba(0,0,0,.55);
  pointer-events: none;
}
.wl-thumb:hover { border-color: var(--accent); }
.wl-thumb:active { transform: scale(.94); }

.watermark {
  position: absolute; top: 10px; right: 46px; z-index: 5;
  max-width: 110px; height: auto; opacity: .9;
  pointer-events: none;
}

/* ── Slice Controls ──────────────────────────────────────────────────────── */
.slice-panel canvas {
  display: block; width: 100%; height: 100%;
  cursor: crosshair; touch-action: none;
}
.slice-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 12px;
  background: linear-gradient(to top, rgba(5,7,11,.98), rgba(5,7,11,.3));
  display: flex; align-items: center; gap: 10px; z-index: 10;
}
.slice-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 10px;
  background: var(--border); outline: none; cursor: pointer;
}
.slice-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  background: var(--accent); border-radius: 4px; cursor: pointer;
  box-shadow: 0 0 18px rgba(220,41,26,.8);
}
.slice-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent); border-radius: 4px; cursor: pointer;
  border: none; box-shadow: 0 0 18px rgba(220,41,26,.8);
}
.slice-readout {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; color: var(--text); font-weight: 700;
  min-width: 68px; text-align: right;
}

#canvas3d { display: block; width: 100%; height: 100%; touch-action: none; }

/* ── Sidebars ────────────────────────────────────────────────────────────── */
aside.left-sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: rgba(13,19,28,.92);
  border-right: 1px solid var(--border);
}
aside.right-sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: rgba(13,19,28,.92);
  border-left: 1px solid var(--border);
}

/* ── Left Sidebar Tabs ───────────────────────────────────────────────────── */
.left-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--panel); flex-shrink: 0;
}
.left-tab {
  flex: 1; padding: 12px 6px;
  background: transparent; border: none;
  color: var(--text-muted); font-family: inherit;
  font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .12s;
}
.left-tab:hover { color: var(--text); }
.left-tab.active {
  color: #e8321f;
  border-bottom-color: var(--accent);
  background: rgba(220,41,26,.06);
}
.left-tab-count {
  display: inline-block; margin-left: 4px;
  padding: 1px 5px; border-radius: 8px;
  background: var(--bg); font-size: 10px; color: var(--text-muted);
  min-width: 18px;
}
.left-tab.active .left-tab-count {
  background: rgba(220,41,26,.3); color: #f5a09a;
}

.left-content { flex: 1; overflow-y: auto; min-height: 0; padding: 10px; }
.left-pane { display: none; }
.left-pane.active { display: block; }

/* ── Item Cards ──────────────────────────────────────────────────────────── */
.item-card {
  display: grid; grid-template-columns: 40px 1fr;
  gap: 10px; padding: 12px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, rgba(21,30,44,.95), rgba(13,19,28,.95));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .12s;
  box-shadow: inset 0 1px rgba(255,255,255,.04);
}
.item-card:hover { border-color: var(--border-hi); }
.item-card.selected {
  border-color: #e8321f;
  background: radial-gradient(circle at left, rgba(220,41,26,.22), rgba(16,23,34,.96) 55%);
  box-shadow: 0 0 0 1px rgba(220,41,26,.2), 0 0 24px rgba(220,41,26,.15);
}
.item-badge {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #e8321f, #a31912);
  color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 0 14px rgba(220,41,26,.5);
  flex-shrink: 0;
}
.item-content { min-width: 0; }
.item-title {
  font-weight: 700; font-size: 13px; color: var(--text);
  margin-bottom: 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.item-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.item-position { font-size: 10px; color: #5aa2ff; font-weight: 700;
  font-family: "SF Mono", Menlo, Consolas, monospace; }

.left-tools {
  padding: 10px 2px 10px 2px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.left-count { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.left-new-btn {
  background: linear-gradient(135deg, #dc291a, #a31912);
  color: #fff; border: 1px solid #e8321f;
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; cursor: pointer;
  text-transform: uppercase; letter-spacing: .06em;
  box-shadow: 0 0 14px rgba(220,41,26,.25);
  transition: all .12s;
}
.left-new-btn:hover { box-shadow: 0 0 22px rgba(124,60,255,.45); }
.empty-msg {
  padding: 24px 12px; text-align: center;
  color: var(--text-muted); font-size: 11px;
}

/* ── Right Sidebar ───────────────────────────────────────────────────────── */
.right-content { flex: 1; overflow-y: auto; padding: 14px; }
.detail-empty { padding: 24px 12px; text-align: center; color: var(--text-muted); font-size: 11px; }
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.detail-title { font-size: 13px; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em; }
.detail-close { background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.detail-close:hover { color: var(--text); background: rgba(255,255,255,.06); }

.detail-section { margin-top: 16px; }
.detail-section-title {
  font-size: 10px; color: var(--text-muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px;
}
.detail-box {
  background: var(--panel-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px; font-size: 12px;
}
.detail-kv {
  display: grid; grid-template-columns: 50px 1fr auto;
  gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}
.detail-kv:last-child { border-bottom: 0; }
.detail-kv-key { color: var(--text-muted); font-weight: 600; }
.detail-kv-val { color: var(--text); font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 11px; }

.detail-btn {
  display: block; width: 100%; padding: 8px; margin-top: 8px;
  background: var(--panel-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 11px; cursor: pointer;
  text-transform: uppercase; letter-spacing: .06em;
  transition: all .12s;
}
.detail-btn:hover { border-color: var(--accent); color: #e8321f; }
.detail-btn.primary {
  background: linear-gradient(135deg, #dc291a, #a31912);
  border-color: #e8321f; color: #fff;
  box-shadow: 0 0 14px rgba(220,41,26,.25);
}
.detail-btn.primary:hover { box-shadow: 0 0 22px rgba(124,60,255,.45); }

.detail-input, .detail-textarea {
  width: 100%; background: var(--panel-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 6px 8px;
  font-family: inherit; font-size: 12px;
}
.detail-textarea { resize: vertical; min-height: 60px; }

/* ── Dev Panel Sliders ───────────────────────────────────────────────────── */
.dev-slider {
  display: grid; grid-template-columns: 80px 1fr 42px;
  align-items: center; gap: 8px; margin-bottom: 6px;
}
.dev-slider label { font-size: 10px; color: var(--text-muted); }
.dev-slider input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 3px; background: var(--border); outline: none; cursor: pointer;
  border-radius: 10px;
}
.dev-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; background: var(--accent);
  cursor: pointer; border-radius: 3px;
  box-shadow: 0 0 10px rgba(220,41,26,.6);
}
.dev-slider input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; background: var(--accent);
  cursor: pointer; border-radius: 3px; border: none;
  box-shadow: 0 0 10px rgba(220,41,26,.6);
}
.dev-val {
  font-size: 10px; color: var(--text);
  font-family: "SF Mono", Menlo, Consolas, monospace; text-align: right;
}

.preset-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 5px 8px;
  font-size: 10px; font-family: inherit; cursor: pointer;
  border-radius: var(--radius-sm); transition: all .12s;
}
.preset-btn:hover { border-color: var(--border-hi); color: var(--text); }
.preset-btn.active { border-color: #e8321f; color: #e8321f; background: rgba(220,41,26,.12); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  background: rgba(10,14,21,.95);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 16px;
  font-size: 11px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-dim);
}
footer .sep { opacity: .4; }
footer .left { flex: 1; display: flex; align-items: center; gap: 12px; }
footer .right { display: flex; gap: 12px; align-items: center; }
footer a { color: var(--text-dim); text-decoration: none; cursor: pointer; }
footer a:hover { color: var(--text); }

.footer-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm);
  padding: 3px 8px; font-size: 13px; cursor: pointer;
  transition: all .12s;
}
.footer-btn:hover { color: var(--text); border-color: var(--border-hi); }

/* ── Cache / Loading ─────────────────────────────────────────────────────── */
#cache-indicator {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 6px;
  animation: pulse 1.2s ease-in-out infinite;
}
#cache-indicator.idle { background: var(--border-hi); animation: none; }
@keyframes pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

.loading, .error-msg {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  background: var(--panel); color: var(--text-muted);
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; z-index: 20;
}
.error-msg { color: #e06060; text-transform: none; }

/* ── Auth Dialog ─────────────────────────────────────────────────────────── */
#auth-overlay {
  position: fixed; inset: 0;
  background: rgba(5,7,11,.97);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; backdrop-filter: blur(12px);
}
#auth-overlay.hidden { display: none; }
#auth-dialog {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; width: 90%; max-width: 400px;
  box-shadow: var(--shadow);
}
#auth-dialog h2 { margin: 0 0 8px; font-size: 20px; font-weight: 700; color: var(--text); }
#auth-dialog p  { margin: 0 0 24px; font-size: 13px; color: var(--text-muted); }
#auth-dialog input {
  width: 100%; padding: 12px; margin-bottom: 16px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; border-radius: var(--radius-sm);
  font-family: inherit; box-sizing: border-box;
}
#auth-dialog input:focus { outline: none; border-color: var(--accent); }
#auth-dialog button {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, #dc291a, #a31912);
  border: 1px solid #e8321f; color: #fff;
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; border-radius: var(--radius-sm);
  cursor: pointer; font-family: inherit;
  box-shadow: 0 0 20px rgba(220,41,26,.3);
}
#auth-dialog button:hover { box-shadow: 0 0 30px rgba(220,41,26,.5); }
#auth-dialog button:disabled { opacity: .5; cursor: not-allowed; }
#auth-error { color: #ff6b6b; font-size: 12px; margin-top: -8px; margin-bottom: 12px; display: none; }
#auth-error.show { display: block; }

/* ── Koop Panel ──────────────────────────────────────────────────────────── */
.koop-status {
  font-size: 10px; padding: 2px 8px; border-radius: 8px;
  background: var(--panel-3); color: var(--text-muted);
}
.koop-status.online { background: rgba(36,196,126,.15); color: var(--green); }
.koop-peers { display: flex; flex-direction: column; gap: 4px; }
.koop-peer {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: var(--panel-3); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.koop-peer-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.koop-peer-name { flex: 1; font-size: 12px; }
.koop-peer-me { font-size: 10px; color: var(--text-dim); }
.koop-call-status { margin-top: 6px; font-size: 10px; color: var(--text-muted); min-height: 14px; }
.koop-cursor {
  position: absolute; pointer-events: none; z-index: 500;
  width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%); opacity: .85;
  transition: left .1s linear, top .1s linear;
}
.koop-cursor-label {
  position: absolute; pointer-events: none; z-index: 500;
  font-size: 10px; background: rgba(0,0,0,.7); color: #fff;
  padding: 1px 4px; border-radius: 3px; white-space: nowrap;
  transform: translate(8px, -50%);
}

/* ── Lizenz-/Datenschutz-Dialog ─────────────────────────────────────────── */
body.license-lock { overflow: hidden; }

.license-dialog {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(920px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  z-index: 2000;
  padding: 22px;
  overflow: hidden;
  outline: none;
}
.license-dialog.open {
  display: grid;
  grid-template-rows: auto auto auto minmax(160px, 1fr) auto auto;
  gap: 14px;
}
.license-dialog.required {
  border-color: rgba(220,41,26,.8);
  box-shadow: 0 24px 70px rgba(0,0,0,.62), 0 0 0 1px rgba(220,41,26,.18);
}
.license-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.license-dialog h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}
.license-version {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.license-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  font-family: inherit;
}
.license-icon-btn:hover {
  border-color: var(--border-hi);
  color: var(--text);
}
.license-intro {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}
.license-cookie-note {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(220,41,26,.10);
  border: 1px solid rgba(220,41,26,.28);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}
.license-cookie-note strong {
  color: var(--text);
  font-size: 12px;
}
.license-dialog .license-content {
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.18);
  font-size: 12px;
  line-height: 1.72;
  color: var(--text-muted);
  scrollbar-width: thin;
}
.license-dialog .license-content:focus {
  outline: 1px solid var(--accent-dim);
  outline-offset: -1px;
}
.license-dialog .license-content h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 8px;
}
.license-dialog .license-content h3:first-child { margin-top: 0; }
.license-dialog .license-content p { margin: 0 0 8px; }
.license-dialog .license-content ul {
  margin: 4px 0 10px 20px;
  padding: 0;
}
.license-dialog .license-content li { margin: 3px 0; }
.license-dialog .license-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}
.license-accept-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
  user-select: none;
}
.license-accept-row input {
  margin-top: 2px;
  accent-color: var(--accent);
}
.license-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.license-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: inherit;
}
.license-actions .license-primary {
  min-width: 230px;
  background: linear-gradient(135deg, #dc291a, #a31912);
  border: 1px solid #e8321f;
  color: #fff;
}
.license-actions .license-primary:hover:not(:disabled) {
  box-shadow: 0 0 30px rgba(220,41,26,.45);
}
.license-actions .license-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}
.license-actions .license-secondary {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.license-actions .license-secondary:hover {
  border-color: var(--border-hi);
  color: var(--text);
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  z-index: 1999;
  display: none;
}
.modal-overlay.open { display: block; }

@media (max-width: 720px) {
  .license-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
    padding: 14px;
  }
  .license-dialog.open {
    grid-template-rows: auto auto auto minmax(140px, 1fr) auto auto;
    gap: 10px;
  }
  .license-dialog h2 { font-size: 16px; }
  .license-cookie-note,
  .license-dialog .license-content,
  .license-accept-row { font-size: 11px; }
  .license-actions {
    flex-direction: column-reverse;
  }
  .license-actions button,
  .license-actions .license-primary {
    width: 100%;
    min-width: 0;
  }
}

/* ── Info rows ───────────────────────────────────────────────────────────── */
.info-row {
  display: flex; justify-content: space-between;
  font-size: 11px; padding: 4px 0;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  border-bottom: 1px solid var(--border-soft);
}
.info-row:last-child { border-bottom: 0; }
.info-row .k { color: var(--text-dim); }
.info-row .v { color: var(--text); font-weight: 600; }

/* ── Mesh list ───────────────────────────────────────────────────────────── */
.mesh-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.mesh-item:last-child { border-bottom: none; }
.mesh-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.mesh-name { font-size: 12px; flex: 1; }
.mesh-check {
  width: 14px; height: 14px; border: 1px solid var(--border-hi);
  position: relative; flex-shrink: 0; border-radius: 3px;
}
.mesh-item.on .mesh-check { background: var(--accent); border-color: var(--accent); }
.mesh-item.on .mesh-check::after {
  content: ""; position: absolute; left: 3px; top: 1px;
  width: 4px; height: 8px; border: solid #fff;
  border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.mesh-item.off .mesh-name { color: var(--text-dim); }

/* ── Annotation Modal ────────────────────────────────────────────────────── */
.annotation-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 100; background: var(--panel); border: 1px solid var(--border-hi);
  border-radius: var(--radius); padding: 20px; width: 320px;
  box-shadow: var(--shadow); display: none;
}
.annotation-modal.open { display: block; }
.annotation-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 99; display: none;
}
.annotation-modal-overlay.open { display: block; }
.annotation-modal h3 { font-size: 13px; margin-bottom: 16px; color: var(--text); }
.annotation-modal label {
  display: block; font-size: 10px; color: var(--text-muted);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em;
}
.annotation-modal input[type="text"],
.annotation-modal input[type="number"] {
  width: 100%; padding: 8px; margin-bottom: 12px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; border-radius: var(--radius-sm);
}
.annotation-modal input[type="range"] { width: 100%; margin-bottom: 4px; }
.annotation-modal .range-value { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
.annotation-modal-buttons { display: flex; gap: 8px; margin-top: 16px; }
.annotation-modal-buttons button {
  flex: 1; padding: 8px; font-size: 11px; cursor: pointer;
  border-radius: var(--radius-sm); font-family: inherit;
  text-transform: uppercase; letter-spacing: .06em;
}
.annotation-modal-buttons .save {
  background: linear-gradient(135deg, #dc291a, #a31912);
  border: 1px solid #e8321f; color: #fff;
}
.annotation-modal-buttons .cancel {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
}
.annotation-modal-buttons .cancel:hover { border-color: var(--border-hi); color: var(--text); }

/* ── Color Swatches ──────────────────────────────────────────────────────── */
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch { width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--border-hi); cursor: pointer; }
.color-swatch.selected { border-color: var(--accent); border-width: 2px; }

/* ── Settings Panel ──────────────────────────────────────────────────────── */
.settings-panel {
  position: fixed; top: var(--topbar-height); right: 0;
  width: 320px; bottom: var(--footer-height);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,.4);
  z-index: 100; overflow-y: auto;
  transform: translateX(100%); transition: transform .2s;
}
.settings-panel.open { transform: translateX(0); }

/* ── 3D-Dichtefenster: Histogramm + LUT-Preview ─────────────────────────── */
.tt-density-section {
  margin-top: 18px;
}
.tt-density-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.tt-density-title {
  font-size: 15px;
  line-height: 1.15;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .01em;
}
.tt-density-subtitle {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}
.tt-density-card {
  margin-top: 9px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(21,30,44,.88), rgba(11,16,24,.96));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px rgba(255,255,255,.035);
}
.tt-density-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  font-size: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.tt-density-step {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-hi);
  border-radius: 5px;
  color: #9dc8ff;
  background: rgba(42, 110, 190, .12);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
}
.tt-histogram-wrap {
  position: relative;
  padding: 6px 6px 2px;
  background: radial-gradient(circle at top, rgba(66,118,188,.08), rgba(0,0,0,.18));
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 7px;
}
.tt-density-histogram {
  display: block;
  width: 100%;
  height: 116px;
  cursor: ew-resize;
  touch-action: none;
}
.tt-density-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 9px;
}
.tt-density-fields label {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-muted);
}
.tt-density-fields input[type="number"] {
  min-width: 0;
  width: 100%;
  padding: 5px 6px;
  color: var(--text);
  background: #0b111a;
  border: 1px solid var(--border-hi);
  border-radius: 5px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
}
#vol-min-num { border-color: rgba(65,145,255,.9); }
#vol-max-num { border-color: rgba(56,204,116,.9); }
.tt-density-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 9px;
  color: var(--text-muted);
}
.tt-density-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tt-density-legend i {
  display: inline-block;
  width: 13px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,.12);
}
.tt-density-legend i.outside { background: rgba(150,160,175,.25); }
.tt-density-legend i.inside  { background: linear-gradient(90deg, #1b80ff, #28d26f); }
.tt-palette-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tt-lut-btn,
.tt-density-action,
.tt-segmented button {
  font-family: inherit;
  color: var(--text-muted);
  background: rgba(12,18,28,.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s, box-shadow .12s;
}
.tt-lut-btn {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 6px;
  padding: 6px;
  font-size: 10px;
  text-align: left;
}
.tt-lut-btn:hover,
.tt-density-action:hover,
.tt-segmented button:hover {
  color: var(--text);
  border-color: var(--border-hi);
}
.tt-lut-btn.active,
.tt-segmented button.active {
  color: #fff;
  border-color: rgba(72,145,255,.9);
  background: rgba(30,95,180,.18);
  box-shadow: 0 0 16px rgba(41,130,255,.16);
}
.lut-strip {
  display: inline-block;
  width: 26px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.13);
}
.lut-necturus     { background: linear-gradient(90deg, #000, #777, #fff); }
.lut-eurycea      { background: linear-gradient(90deg, #000, #f8dd2e, #ff9b00); }
.lut-pseudotriton { background: linear-gradient(90deg, #000, #c90016, #fff); }
.lut-mesotriton   { background: linear-gradient(90deg, #000, #045cff, #17c56d, #ff9b00); }
.tt-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.tt-preview-tile {
  position: relative;
  overflow: hidden;
  min-height: 76px;
  background: #020305;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.tt-preview-tile span {
  position: absolute;
  z-index: 2;
  top: 4px;
  left: 5px;
  font-size: 9px;
  color: var(--text);
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
}
.tt-preview-tile canvas {
  display: block;
  width: 100%;
  height: 82px;
}
.tt-segmented {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.tt-segmented button {
  padding: 7px 6px;
  font-size: 10px;
  font-weight: 700;
}
.tt-action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.tt-density-action {
  padding: 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tt-density-note {
  margin-top: 9px;
  padding: 7px 8px;
  border: 1px solid rgba(82,151,255,.24);
  border-radius: 6px;
  color: var(--text-muted);
  background: rgba(34,101,191,.08);
  font-size: 10px;
  line-height: 1.35;
}
.tt-density-native-control {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.tt-density-section.is-disabled {
  opacity: .62;
}
.tt-density-section.is-disabled canvas,
.tt-density-section.is-disabled .tt-lut-btn,
.tt-density-section.is-disabled .tt-density-action,
.tt-density-section.is-disabled .tt-segmented button,
.tt-density-section.is-disabled input {
  pointer-events: none;
}
@media (min-width: 1500px) {
  .tt-segmented,
  .tt-action-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Screenshot Preview Overlay ───────────────────────────────────────────── */
.tt-screenshot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(3, 6, 10, .72);
  backdrop-filter: blur(12px);
}
.tt-screenshot-overlay.show { display: flex; }
.tt-screenshot-dialog {
  width: min(1180px, 96vw);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(18,27,41,.98), rgba(9,13,20,.98));
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  box-shadow: 0 28px 90px rgba(0,0,0,.62);
}
.tt-screenshot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.tt-screenshot-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tt-screenshot-subtitle {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}
.tt-screenshot-icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.tt-screenshot-icon-btn:hover {
  color: var(--text);
  border-color: var(--border-hi);
  background: rgba(255,255,255,.08);
}
.tt-screenshot-stage {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05070b;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tt-screenshot-stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(94vh - 165px);
  object-fit: contain;
}
.tt-screenshot-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  background: rgba(5,7,11,.82);
}
.tt-screenshot-overlay.is-loading .tt-screenshot-loading { display: flex; }
.tt-screenshot-overlay.is-loading .tt-screenshot-stage img { opacity: .18; }
.tt-screenshot-status {
  min-height: 18px;
  color: var(--green);
  font-size: 11px;
}
.tt-screenshot-status.error { color: var(--red); }
.tt-screenshot-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.tt-btn {
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #111827;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.tt-btn:hover {
  color: var(--text);
  border-color: var(--border-hi);
  background: #172133;
}
.tt-btn.primary {
  color: #fff;
  border-color: #e8321f;
  background: linear-gradient(135deg, #dc291a, #a31912);
  box-shadow: 0 0 18px rgba(220,41,26,.24);
}
.tt-btn.primary:hover { box-shadow: 0 0 24px rgba(220,41,26,.34); }
.tt-btn.secondary { background: rgba(255,255,255,.035); }
@media (max-width: 700px) {
  .tt-screenshot-overlay { padding: 10px; }
  .tt-screenshot-dialog { width: 100%; max-height: 96vh; padding: 10px; }
  .tt-screenshot-head { align-items: center; }
  .tt-screenshot-subtitle { display: none; }
  .tt-screenshot-actions { display: grid; grid-template-columns: 1fr; }
  .tt-btn { width: 100%; }
}

/* ── Responsive Mobile Shell ──────────────────────────────────────────────── */
.tt-mobile-toolbar,
.tt-mobile-backdrop {
  display: none;
}

@media (max-width: 1024px), (max-height: 640px) and (pointer: coarse) {
  :root {
    --topbar-height: 52px;
    --footer-height: 30px;
    --mobile-toolbar-height: 44px;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    font-size: 12px;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
  }

  .app.tt-responsive-ready {
    grid-template-rows: var(--topbar-height) var(--mobile-toolbar-height) minmax(0, 1fr) var(--footer-height);
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  header {
    min-height: var(--topbar-height);
    padding: 0 max(8px, env(safe-area-inset-left)) 0 max(8px, env(safe-area-inset-left));
    gap: 8px;
    min-width: 0;
    overflow: hidden;
  }

  .brand {
    flex: 0 0 auto;
    gap: 6px;
    font-size: 10px;
    letter-spacing: .18em;
    white-space: nowrap;
  }

  .brand::before {
    width: 7px;
    height: 7px;
    margin-right: 3px;
  }

  .dataset-name {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 10px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-spacer {
    display: none;
  }

  .header-toggles {
    flex: 0 0 auto;
    display: flex;
    gap: 5px;
    min-width: 0;
  }

  .toggle-btn {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 10px;
    line-height: 1;
    letter-spacing: .09em;
    border-radius: 8px;
    white-space: nowrap;
  }

  .tt-mobile-toolbar {
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr) minmax(92px, auto);
    align-items: stretch;
    gap: 6px;
    height: var(--mobile-toolbar-height);
    padding: 5px 8px;
    background: rgba(10,14,21,.98);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    z-index: 2100;
  }

  .tt-mobile-drawer-button,
  .tt-mobile-view-button,
  .tt-mobile-view-option {
    font-family: inherit;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(17,24,39,.96);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
  }

  .tt-mobile-drawer-button,
  .tt-mobile-view-button {
    min-width: 0;
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
  }

  .tt-mobile-icon {
    font-size: 13px;
    line-height: 1;
  }

  .tt-mobile-drawer-button[aria-expanded="true"],
  .tt-mobile-view-switch.open .tt-mobile-view-button {
    color: #fff;
    border-color: #e8321f;
    background: linear-gradient(135deg, #dc291a, #a31912);
    box-shadow: 0 0 14px rgba(220,41,26,.26);
  }

  .tt-mobile-view-switch {
    position: relative;
    min-width: 0;
  }

  .tt-mobile-view-current {
    display: block;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .tt-mobile-view-caret {
    flex: 0 0 auto;
    opacity: .8;
  }

  .tt-mobile-view-menu {
    position: absolute;
    left: 50%;
    top: calc(100% + 7px);
    width: min(280px, calc(100vw - 20px));
    transform: translateX(-50%);
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
    background: rgba(13,19,28,.98);
    border: 1px solid var(--border-hi);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(0,0,0,.55);
    z-index: 2200;
  }

  .tt-mobile-view-switch.open .tt-mobile-view-menu {
    display: grid;
  }

  .tt-mobile-view-option {
    padding: 10px 8px;
    min-height: 38px;
  }

  .tt-mobile-view-option.active {
    color: #fff;
    border-color: #e8321f;
    background: rgba(220,41,26,.22);
  }

  main {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .workbench {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    padding: 0;
    background: #020305;
  }

  .workbench > .panel {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
  }

  .app.tt-responsive-ready .workbench > .panel:not(.tt-view-active) {
    display: none !important;
  }

  .app.tt-responsive-ready .workbench > .panel.tt-view-active:not(.hidden) {
    display: block !important;
  }

  .panel-label {
    top: 9px;
    left: 10px;
    font-size: 10px;
  }

  .panel-stats {
    bottom: 36px;
    left: 10px;
    font-size: 9px;
    opacity: .82;
  }

  .panel-maximize,
  .localizer-toggle {
    width: 34px;
    height: 34px;
    right: 9px;
    border-radius: 8px;
  }

  .panel-maximize {
    top: 9px;
  }

  .localizer-toggle {
    top: 48px;
  }

  .slice-controls {
    left: 10px;
    right: 10px;
    bottom: 9px;
    gap: 10px;
  }

  .slice-readout {
    min-width: 58px;
    font-size: 10px;
  }

  .watermark {
    max-width: min(150px, 36vw);
    opacity: .12;
  }

  aside.left-sidebar,
  aside.right-sidebar {
    position: fixed;
    top: calc(var(--topbar-height) + var(--mobile-toolbar-height));
    bottom: var(--footer-height);
    width: min(390px, calc(100vw - 34px));
    max-width: calc(100vw - 34px);
    min-height: 0;
    z-index: 1800;
    background: rgba(13,19,28,.98);
    backdrop-filter: blur(16px);
    box-shadow: 0 24px 70px rgba(0,0,0,.62);
    transition: transform .18s ease;
    will-change: transform;
  }

  aside.left-sidebar {
    left: 0;
    border-right: 1px solid var(--border-hi);
    transform: translateX(calc(-100% - 12px));
  }

  aside.right-sidebar {
    right: 0;
    border-left: 1px solid var(--border-hi);
    transform: translateX(calc(100% + 12px));
  }

  .app.tt-left-open aside.left-sidebar,
  .app.tt-right-open aside.right-sidebar {
    transform: translateX(0);
  }

  .left-tabs {
    min-height: 42px;
  }

  .left-tab {
    padding: 10px 5px;
    font-size: 10px;
  }

  .left-content,
  .right-content {
    padding: 10px;
    -webkit-overflow-scrolling: touch;
  }

  .tt-mobile-backdrop {
    position: fixed;
    inset: calc(var(--topbar-height) + var(--mobile-toolbar-height)) 0 var(--footer-height) 0;
    display: none;
    background: rgba(0,0,0,.42);
    backdrop-filter: blur(3px);
    z-index: 1500;
  }

  .app.tt-left-open .tt-mobile-backdrop,
  .app.tt-right-open .tt-mobile-backdrop,
  .app.tt-view-menu-open .tt-mobile-backdrop {
    display: block;
  }

  footer {
    min-height: var(--footer-height);
    padding: 0 8px;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 10px;
  }

  footer .left,
  footer .right {
    min-width: 0;
    gap: 8px;
  }

  footer .left {
    overflow: hidden;
  }

  footer .left > * {
    flex: 0 0 auto;
  }

  footer .left > *:nth-child(n+5),
  footer .sep:nth-of-type(n+2) {
    display: none !important;
  }

  footer .right {
    flex: 0 0 auto;
  }

  .footer-btn {
    padding: 3px 7px;
  }

  .settings-panel {
    top: calc(var(--topbar-height) + var(--mobile-toolbar-height));
    bottom: var(--footer-height);
    width: min(390px, calc(100vw - 34px));
  }

  .tt-density-title {
    font-size: 14px;
  }

  .tt-density-histogram {
    height: 96px;
  }

  .tt-density-fields {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .tt-preview-grid {
    grid-template-columns: 1fr;
  }

  .tt-preview-tile {
    min-height: 62px;
  }

  .tt-preview-tile canvas {
    height: 66px;
  }
}

@media (max-width: 560px) {
  :root {
    --topbar-height: 50px;
    --mobile-toolbar-height: 42px;
    --footer-height: 28px;
  }

  header {
    gap: 6px;
  }

  .brand {
    letter-spacing: .14em;
  }

  .brand::after {
    content: '';
  }

  .dataset-name {
    font-size: 12px;
    padding-left: 8px;
  }

  .toggle-btn {
    padding: 5px 7px;
    min-width: 36px;
    font-size: 9px;
    letter-spacing: .05em;
  }

  .tt-mobile-toolbar {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 5px;
    padding: 5px 6px;
  }

  .tt-mobile-drawer-button span:not(.tt-mobile-icon) {
    display: none;
  }

  .tt-mobile-icon {
    font-size: 15px;
  }

  .tt-mobile-view-button {
    padding: 0 8px;
  }

  .tt-mobile-view-menu {
    grid-template-columns: 1fr;
  }

  aside.left-sidebar,
  aside.right-sidebar,
  .settings-panel {
    width: min(92vw, 390px);
    max-width: 92vw;
  }

  footer .right a:not(:last-child),
  footer .right .sep,
  footer .left > *:nth-child(n+4) {
    display: none !important;
  }
}

/* ── Mobile Fix: Watermark sichtbar + Fullscreen-Buttons ausblenden ──────── */
@media (max-width: 1024px), (max-height: 640px) and (pointer: coarse) {
  /* Im bisherigen Mobile-CSS wurde das Watermark stark transparent gemacht.
     Auf dunklem UI wirkt es dadurch dunkelgrau/weggerutscht. */
  .watermark {
    right: 12px;
    top: 10px;
    z-index: 7;
    opacity: .9 !important;
    mix-blend-mode: normal;
    filter: none;
  }

  /* Fullscreen/Maximize-Buttons sind auf Mobile kontraproduktiv:
     sie liegen über der Touch-Bedienung und können die Workbench zerlegen. */
  .panel-maximize {
    display: none !important;
    pointer-events: none !important;
  }

  /* Der 3D-Localizer darf oben rechts bleiben, nachdem der Maximize-Button weg ist. */
  .localizer-toggle {
    top: 9px;
  }
}

@media (max-width: 520px) {
  .watermark {
    max-width: min(132px, 34vw);
    opacity: .88 !important;
  }
}

/* ── Measure action bar: Desktop + Mobile/Stift ─────────────────────────── */
.tt-measure-actionbar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-height, 34px) + 14px);
  transform: translate(-50%, 10px);
  z-index: 3200;
  display: none;
  max-width: min(720px, calc(100vw - 24px));
  pointer-events: none;
}

.tt-measure-actionbar.show {
  display: block;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.tt-measure-actionbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(130, 170, 210, .38);
  border-radius: 14px;
  background: rgba(15, 18, 24, .94);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(14px);
}

.tt-measure-actionbar-status {
  min-width: 180px;
  max-width: 360px;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-measure-actionbar-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tt-measure-action-btn {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(130, 170, 210, .32);
  border-radius: 10px;
  background: rgba(34, 42, 54, .95);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.tt-measure-action-btn:hover:not(:disabled) {
  background: rgba(49, 60, 76, .98);
  border-color: rgba(160, 200, 240, .55);
}

.tt-measure-action-btn.primary {
  border-color: rgba(108, 213, 255, .52);
  background: rgba(24, 93, 130, .95);
}

.tt-measure-action-btn.danger {
  min-width: 38px;
  padding-inline: 10px;
  border-color: rgba(255, 126, 126, .42);
  background: rgba(90, 35, 42, .92);
  font-size: 18px;
  line-height: 1;
}

.tt-measure-action-btn:disabled {
  opacity: .38;
  cursor: default;
}

.tt-measure-action-btn[hidden] {
  display: none !important;
}

@media (max-width: 1024px), (max-height: 640px) and (pointer: coarse) {
  .tt-measure-actionbar {
    bottom: calc(var(--footer-height, 28px) + 8px);
    width: calc(100vw - 14px);
    max-width: calc(100vw - 14px);
  }

  .tt-measure-actionbar-inner {
    gap: 7px;
    padding: 7px;
    border-radius: 13px;
  }

  .tt-measure-actionbar-status {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    font-size: 10px;
  }

  .tt-measure-actionbar-buttons {
    flex: 0 0 auto;
    gap: 5px;
  }

  .tt-measure-action-btn {
    min-height: 36px;
    padding: 7px 8px;
    border-radius: 10px;
    font-size: 10px;
  }

  .tt-measure-action-btn.danger {
    min-width: 36px;
    font-size: 18px;
  }
}

@media (max-width: 560px) {
  .tt-measure-actionbar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .tt-measure-actionbar-status {
    text-align: center;
    white-space: normal;
  }

  .tt-measure-actionbar-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 42px;
  }

  .tt-measure-action-btn[data-measure-action="close-poly"][hidden] {
    display: none !important;
  }

  .tt-measure-action-btn[data-measure-action="close-poly"]:not([hidden]) {
    grid-column: auto;
  }
}
