/* Ge-Prime-Matrix — Dark UI */

:root {
  --bg: #0a0e14;
  --surface: #131920;
  --surface-2: #1a222d;
  --border: #2a3441;
  --text: #e8eef4;
  --muted: #8b9cb3;
  --accent: #6cb6ff;
  --accent-dim: #316dca;
  --green: #56d364;
  --orange: #f0883e;
  --red: #f85149;
  --tab-active: #1f6feb;
  --spectro-teal-rgb: 0, 150, 136;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

header {
  padding: 2rem 1.5rem 0;
  text-align: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.85rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.tagline {
  color: var(--muted);
  margin: 0.4rem 0 1.25rem;
  font-size: 0.95rem;
}

.formula-hero {
  display: inline-block;
  font-family: ui-monospace, monospace;
  color: var(--green);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0.35rem;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 1rem 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.tabs::-webkit-scrollbar {
  height: 6px;
}

.tabs::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  transition: all 0.15s ease;
  flex: 0 0 auto;
  white-space: nowrap;
}

.build-tag {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--green);
  color: #0a0e14;
  letter-spacing: 0.02em;
}

.tab-btn.tab-gpm {
  border-color: var(--green);
  color: var(--green);
}

.tab-btn.tab-gpm.active {
  background: var(--green);
  color: #0a0e14;
  border-color: var(--green);
}

.tab-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tab-btn.active {
  background: var(--tab-active);
  border-color: var(--tab-active);
  color: #fff;
}

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.tab-panel { display: none; animation: fadeIn 0.2s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.65rem;
  color: var(--accent);
}

.card h3 {
  font-size: 0.92rem;
  color: var(--green);
  margin: 1rem 0 0.4rem;
}

.card p, .card li { margin-bottom: 0.45rem; color: var(--text); }
.card ul, .card ol { padding-left: 1.2rem; }

.lead { color: var(--muted); font-size: 0.95rem; }

.tool-page-head {
  margin-bottom: 1rem;
}

.tool-page-head h2 {
  font-size: 1.05rem;
  margin-bottom: 0.65rem;
  color: var(--accent);
}

.tool-page-head .lead {
  margin-bottom: 0.65rem;
}

.tool-page-head .tab-guide {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.tool-help-details {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
}

.tool-help-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.tool-help-details-body {
  margin-top: 0.65rem;
  color: var(--muted);
}

.tool-help-details-body p {
  margin-bottom: 0.45rem;
}

.pair-mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.pair-mode-option {
  flex: 1 1 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--muted);
  border: 1px solid transparent;
}

.pair-mode-option:has(input:checked) {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.pair-help-panel.hidden {
  display: none;
}

.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.flow-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
}

.flow-arrow { color: var(--muted); }

.prime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.4rem;
}

.prime-grid span {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  text-align: center;
}

.tool-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-top: 1rem;
}

.tool-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1;
  min-width: 160px;
}

.tool-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-family: ui-monospace, monospace;
}

.tool-form select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
}

.tool-form input[type="file"] {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.45rem;
}

.tool-form input:focus,
.tool-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.tool-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  min-height: 5rem;
  width: 100%;
}

.tool-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.tool-form-stack {
  flex-direction: column;
  align-items: stretch;
}

.tool-form .full-width {
  flex: 1 1 100%;
  min-width: 100%;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.hint-muted {
  color: var(--muted);
  font-size: 0.8rem;
}

.tab-guide {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border-left: 3px solid var(--orange);
  border-radius: 0 10px 10px 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.tab-guide p {
  margin: 0;
  color: var(--text);
}

.norm-rules {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.norm-rule {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.norm-rule-highlight {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.norm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--orange);
  flex-shrink: 0;
}

.norm-rule p {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.norm-examples {
  margin: 0.65rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.55;
}

.norm-examples li + li {
  margin-top: 0.45rem;
}

.tool-guide {
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.85rem;
}

.tool-guide dt {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.tool-guide dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.norm-example {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem !important;
  color: var(--green) !important;
  margin-top: 0.4rem !important;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.norm-pair {
  display: block;
}

.norm-pair-warn code {
  color: var(--orange);
}

.norm-prime,
.norm-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.35rem;
}

.norm-prime {
  color: var(--green);
}

.norm-prime-hint {
  margin: -0.25rem 0 0.85rem;
}

.compare-eszett-tip {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.9rem;
}

.compare-result {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.compare-words {
  margin-bottom: 0;
}

.compare-word-box .summary-label {
  font-size: 1rem;
}

.compare-norm {
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--green);
}

.compare-si {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.compare-gcd-card,
.compare-lcm-card {
  padding: 1rem 1.15rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}

.compare-gcd-label {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compare-gcd-value {
  font-size: 1.35rem;
  color: var(--orange);
  margin: 0.35rem 0;
}

.compare-gcd-sim {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.compare-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.compare-match-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

.compare-union-letters {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
  text-align: left;
}

.gpm-search-query2.hidden {
  display: none;
}

.diff-rest-card {
  padding: 1rem 1.15rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.diff-formula {
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.diff-badges {
  margin: 0.65rem 0 0;
}

.diff-classify {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.diff-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.diff-badge-yes {
  background: rgba(255, 140, 0, 0.12);
  border-color: var(--orange);
  color: var(--orange);
}

.compare-letters p {
  margin: 0.35rem 0;
  font-size: 0.92rem;
}

.compare-letter-label {
  display: inline-block;
  min-width: 6.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.compare-notes {
  margin: 0;
  padding: 0.85rem 1rem 0.85rem 2rem;
  background: var(--surface-2);
  border-left: 3px solid var(--orange);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.compare-notes li + li {
  margin-top: 0.35rem;
}

.ikurve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.ikurve-side textarea {
  min-height: 6rem;
}

.ikurve-ingest-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ikurve-ingest-row label {
  flex: 1 1 12rem;
  min-width: 0;
}

.ikurve-ingest-input {
  width: 100%;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}

.ikurve-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.ikurve-matrix-root {
  margin-top: 1.25rem;
}

.ikurve-matrix-root.hidden {
  display: none;
}

.ikurve-matrix-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.geometric-matrix {
  user-select: text;
  white-space: pre-wrap;
  overflow: auto;
  min-height: 10rem;
  max-height: min(45vh, 22rem);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
}

.geometric-matrix ::selection {
  background: rgba(var(--spectro-teal-rgb), 0.15);
}

.ikurve-ingest-lock-banner {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(var(--spectro-teal-rgb), 0.08);
  margin-bottom: 0.75rem;
}

.ikurve-ingest-locked .ikurve-gpm-drop,
.ikurve-ingest-locked .ikurve-ingest-input,
.ikurve-ingest-locked .ikurve-ingest-row button:not(.ikurve-reset-btn) {
  pointer-events: none;
  opacity: 0.55;
}

.ikurve-ingest-locked input,
.ikurve-ingest-locked select,
.ikurve-ingest-locked button:not(.ikurve-reset-btn) {
  pointer-events: none;
}

.ikurve-ingest-locked .ikurve-ingest-row {
  opacity: 0.7;
}

.ikurve-spectro-legend {
  font-size: 0.78rem;
}

.ikurve-spectro-result {
  margin-top: 0.35rem;
  font-size: 0.88rem;
}

.ikurve-source-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.65rem 0 0.35rem;
  font-size: 0.9rem;
}

.ikurve-source-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.ikurve-source-toggle input:disabled + span,
.ikurve-source-toggle label:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.ikurve-gpm-drop {
  margin-top: 0.65rem;
  padding: 0.85rem 0.75rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: var(--surface);
}

.ikurve-gpm-drop.hidden {
  display: none;
}

.ikurve-gpm-drop.drag-over {
  border-color: var(--green);
  background: rgba(86, 211, 100, 0.06);
}

.ikurve-gpm-drop-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
}

.ikurve-gpm-drop-status {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.ikurve-gpm-drop-status.ready {
  color: var(--green);
}

.ikurve-gpm-shared-status {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.ikurve-charts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
  width: 100%;
}

.ikurve-chart-pair {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
}

.ikurve-chart-cell {
  display: flex;
  flex-direction: column;
  min-height: 7.25rem;
  width: 100%;
}

.ikurve-chart-cell .ikurve-sparkline {
  margin-top: auto;
  flex-shrink: 0;
}

.ikurve-charts-paired {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
  width: 100%;
}

.ikurve-atomic-metrics {
  margin-bottom: 1rem;
}

.ikurve-dtw-failed {
  margin: 0.35rem 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--warn-border, #c9a227);
  background: var(--warn-bg, rgba(201, 162, 39, 0.12));
  color: var(--text);
  font-size: 0.88rem;
}

.ikurve-chart-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.ikurve-sparkline {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 90px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ikurve-sparkline--extended {
  display: block;
  box-sizing: border-box;
  height: 90px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.ikurve-sparkline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ikurve-sparkline-scroll::-webkit-scrollbar {
  height: 6px;
}

.ikurve-sparkline-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.ikurve-sparkline-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.ikurve-sparkline-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.ikurve-sparkline-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

.ikurve-sparkline-scroll .ikurve-sparkline,
.ikurve-sparkline-scroll .ikurve-sparkline--extended {
  height: 90px;
}

.ikurve-scroll-hint {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.25rem;
}

.ikurve-chart-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}

.ikurve-chart-scale-btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: inherit;
  cursor: pointer;
}

.ikurve-chart-scale-btn.ikurve-chart-scale-active {
  border-color: var(--orange);
  background: rgba(255, 152, 0, 0.12);
}

.ikurve-line-a {
  color: var(--orange);
}

.ikurve-line-b {
  color: #6eb5ff;
}

.ikurve-metrics {
  margin: 1rem 0;
}

.ikurve-metric-card {
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ikurve-alert {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border-left: 3px solid var(--border);
  border-radius: 0 8px 8px 0;
}

.ikurve-alert-warn {
  border-left-color: var(--orange);
  background: rgba(255, 140, 0, 0.08);
}

.ikurve-flag {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 140, 0, 0.15);
  border: 1px solid var(--orange);
  color: var(--orange);
}

.ikurve-cell-twins-banner {
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
  border-radius: var(--radius, 8px);
  border: 1px solid rgba(180, 120, 0, 0.45);
  background: rgba(255, 193, 7, 0.12);
  color: inherit;
}

.ikurve-cell-twins-banner strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.ikurve-layer-head {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ikurve-metrics-word {
  margin-bottom: 0.5rem;
}

.ikurve-metrics-cell {
  margin-bottom: 1rem;
}

.ikurve-cell-charts {
  margin-top: 0.75rem;
}

.cell-geometry-block {
  margin-top: 0.5rem;
}

.cell-geometry-block .cell-skeleton,
.gpm-table .mono {
  font-family: var(--mono, ui-monospace, monospace);
}

.ikurve-signal-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
  align-items: stretch;
}

.ikurve-signal-segment {
  display: flex;
  flex-direction: column;
  min-height: 4.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.ikurve-signal-label {
  display: block;
  min-height: 2.5em;
  line-height: 1.25;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ikurve-signal-value {
  display: block;
  min-height: 1.35rem;
  font-weight: 700;
  margin: 0.15rem 0 0.35rem;
}

.ikurve-signal-bar {
  display: block;
  height: 4px;
  margin-top: auto;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.2);
  overflow: hidden;
}

.ikurve-signal-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.ikurve-score-high .ikurve-signal-bar span { background: var(--green, #2e7d32); }
.ikurve-score-mid .ikurve-signal-bar span { background: var(--orange, #e65100); }
.ikurve-score-low .ikurve-signal-bar span { background: rgba(127, 127, 127, 0.55); }

.ikurve-substance-twins-banner {
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
  border-radius: var(--radius, 8px);
  border: 1px solid rgba(0, 120, 140, 0.45);
  background: rgba(0, 188, 212, 0.1);
}

.ikurve-substance-twins-banner strong,
.ikurve-relation-twins-banner strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.ikurve-relation-twins-banner {
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
  border-radius: var(--radius, 8px);
  border: 1px solid rgba(80, 60, 160, 0.45);
  background: rgba(126, 87, 194, 0.1);
}

.ikurve-language-db-card,
.ikurve-relation-block {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--surface-2);
}

.ikurve-lang-db-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.ikurve-db-bar-wrap { margin-top: 0.35rem; }

.ikurve-db-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.2);
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.ikurve-db-bar span {
  display: block;
  height: 100%;
  background: var(--accent, #1976d2);
  border-radius: inherit;
}

.ikurve-interpret-bullets {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}

.ikurve-audit-mode-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0;
  max-width: 320px;
}

.ikurve-audit-mode-select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--surface-2);
}

.ikurve-plag-assessment {
  margin-bottom: 1rem;
}

.ikurve-plag-head {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.ikurve-geo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.ikurve-geo-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.ikurve-badge-offset {
  background: rgba(255, 193, 7, 0.15);
  border-color: rgba(255, 193, 7, 0.45);
  color: #b8860b;
}

.ikurve-badge-stretch {
  background: rgba(33, 150, 243, 0.12);
  border-color: rgba(33, 150, 243, 0.4);
  color: #1565c0;
}

.ikurve-badge-hybrid {
  background: rgba(156, 39, 176, 0.12);
  border-color: rgba(156, 39, 176, 0.4);
  color: #7b1fa2;
}

.ikurve-plag-score-bars {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.ikurve-plag-score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.75rem;
  align-items: center;
}

.ikurve-plag-score-row .ikurve-plag-score-label {
  min-height: 2.5em;
  line-height: 1.25;
}

.ikurve-plag-score-label {
  font-size: 0.85rem;
  color: var(--muted, #666);
}

.ikurve-plag-score-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ikurve-plag-score-bar {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  overflow: hidden;
}

.ikurve-plag-score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #1976d2);
}

.ikurve-plag-score-row.ikurve-score-high .ikurve-plag-score-bar span { background: #2e7d32; }
.ikurve-plag-score-row.ikurve-score-mid .ikurve-plag-score-bar span { background: #f9a825; }
.ikurve-plag-score-row.ikurve-score-low .ikurve-plag-score-bar span { background: #c62828; }

.ikurve-foreign-audit {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--surface-2);
}

.ikurve-foreign-audit h4 {
  margin: 0 0 0.65rem;
}

.ikurve-metrics-substance {
  margin-bottom: 0.75rem;
}

.ikurve-substance-charts {
  margin-top: 0.75rem;
}

@media (max-width: 900px) {
  .ikurve-signal-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ikurve-lang-db-grid { grid-template-columns: 1fr; }
}

.cipher-mode-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.cipher-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}

.cipher-mode-option {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.cipher-mode-option:has(input:checked) {
  border-color: var(--orange);
  box-shadow: 0 0 0 1px rgba(255, 140, 0, 0.25);
}

.cipher-mode-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.cipher-security {
  font-size: 0.78rem;
  color: var(--muted);
}

.cipher-security-low {
  color: #c97070;
}

.cipher-security-mid {
  color: #c9a030;
}

.cipher-security-high {
  color: #5cb85c;
}

.cipher-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.75rem 0;
}

.cipher-direction {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.cipher-security-preview {
  margin-bottom: 0.75rem;
}

.cipher-security-card {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  background: var(--surface-2);
}

.cipher-security-card.cipher-security-low {
  border-left: 3px solid #c97070;
}

.cipher-security-card.cipher-security-mid {
  border-left: 3px solid #c9a030;
}

.cipher-security-card.cipher-security-high {
  border-left: 3px solid #5cb85c;
}

.cipher-security-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.cipher-security-badge {
  font-weight: 700;
  text-transform: capitalize;
}

.cipher-security-score {
  font-size: 0.88rem;
  color: var(--muted);
}

.cipher-security-summary {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9rem;
}

.cipher-output {
  width: 100%;
  font-size: 0.82rem;
  word-break: break-all;
}

.cipher-warnings {
  margin-top: 0.5rem;
}

.cipher-hardcore-hint {
  margin-top: -0.35rem;
}

.meta-genome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}

.meta-genome-card {
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.meta-genome-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.meta-top-words {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

.meta-metrics {
  margin-top: 0.75rem;
}

.meta-plag-highlight {
  margin-bottom: 1rem;
}

.gpm-encrypt-fieldset {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.gpm-encrypt-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.92rem;
}

.gpm-encrypt-panel {
  margin-top: 0.85rem;
}

.gpm-encrypt-panel .gpm-cipher-modes {
  margin-bottom: 0.75rem;
}

.gpm-decrypt-panel {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--orange);
  border-radius: 8px;
  background: rgba(255, 140, 0, 0.06);
}

.gpm-decrypt-lead {
  margin: 0 0 0.65rem;
}

.gpm-encrypted-badge {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255, 140, 0, 0.12);
  border: 1px solid var(--orange);
  color: var(--orange);
}

.norm-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.88rem;
}

.norm-list li {
  padding: 0.3rem 0;
  color: var(--text);
}

.batch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.batch-meta strong { color: var(--text); }

.word-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.word-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}

.word-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  user-select: none;
}

.word-panel summary::-webkit-details-marker { display: none; }

.word-panel summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 0.75rem;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.word-panel[open] summary::before {
  transform: rotate(90deg);
}

.word-panel summary:hover {
  background: rgba(88, 166, 255, 0.06);
}

.word-index {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  min-width: 1.8rem;
}

.word-title {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 120px;
}

.word-brief {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.word-brief span {
  color: var(--green);
  margin-left: 0.35rem;
}

.word-panel-body {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
}

.word-panel-body .result-summary {
  margin-top: 0.65rem;
  margin-bottom: 0.5rem;
}

.panel-actions {
  margin-top: 0.65rem;
}

.btn {
  background: var(--accent-dim);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  white-space: nowrap;
}

.btn:hover { background: var(--accent); }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); background: var(--surface-2); color: var(--accent); }

.result {
  margin-top: 1.1rem;
  padding: 1rem 1.15rem;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.result.hidden { display: none; }

.step-list { list-style: none; padding: 0; margin-top: 0.75rem; }

.step-item {
  border-left: 3px solid var(--accent-dim);
  padding: 0.75rem 0 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
}

.step-item.decode { border-left-color: var(--orange); }

.step-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.step-detail {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.step-lines {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--green);
  line-height: 1.5;
}

.step-formula {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--accent);
  word-break: break-all;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.summary-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.summary-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.summary-value {
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  margin-top: 0.2rem;
  word-break: break-all;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.error { color: var(--red); }
.loading { color: var(--muted); }
.muted { color: var(--muted); font-size: 0.9rem; }
.tip-below-form { margin-top: 0.75rem; }

.stats { list-style: none; padding: 0; }
.stats li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

footer {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-meta {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  max-width: 100%;
  overflow-x: auto;
}

.footer-sep {
  opacity: 0.35;
  user-select: none;
}

.footer-build {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(86, 211, 100, 0.12);
  color: var(--green);
  border: 1px solid rgba(86, 211, 100, 0.25);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover { text-decoration: underline; }

/* .gpm Datei */
.gpm-anatomy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.gpm-segment {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.gpm-segment h3 {
  margin-top: 0;
  color: var(--green);
}

.gpm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}

.gpm-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.gpm-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gpm-stat-value {
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.gpm-stat-wide {
  grid-column: 1 / -1;
}

.gpm-stat-value-plain {
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}

.gpm-table-wrap {
  overflow: auto;
  max-height: 420px;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.gpm-table-wrap .gpm-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.gpm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.gpm-table th,
.gpm-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.gpm-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}

.gpm-table td.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

.gpm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Editor — IDE-ähnliches Panel (nur Darstellung) */
.editor-shell {
  --editor-bg: #0c1017;
  --editor-gutter: rgba(108, 182, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 12px 40px rgba(0, 0, 0, 0.35);
}

.editor-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(180deg, #1a222d 0%, #151b24 100%);
  border-bottom: 1px solid var(--border);
}

.editor-chrome-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.editor-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.85;
}

.editor-dot-red { background: #ff5f57; }
.editor-dot-yellow { background: #febc2e; }
.editor-dot-green { background: #28c840; }

.editor-chrome-title {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.editor-chrome-stats {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.72rem;
  color: var(--accent);
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(49, 109, 202, 0.12);
  border: 1px solid rgba(108, 182, 255, 0.15);
}

.editor-dropzone {
  position: relative;
  transition: background 0.18s ease;
}

.editor-dropzone.drag-over {
  background: rgba(86, 211, 100, 0.05);
}

.editor-dropzone.drag-over .code-editor {
  opacity: 0.35;
}

.code-editor {
  display: block;
  width: 100%;
  min-height: 22rem;
  max-height: min(70vh, 36rem);
  resize: vertical;
  font-family: "Cascadia Code", "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.65;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
  background:
    linear-gradient(90deg, var(--editor-gutter) 0, var(--editor-gutter) 3rem, transparent 3rem),
    var(--editor-bg);
  color: #dce6f2;
  border: none;
  border-radius: 0;
  padding: 1rem 1.15rem 1rem 3.35rem;
  caret-color: var(--green);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.code-editor::placeholder {
  color: #5c6b80;
  opacity: 1;
}

.code-editor:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(108, 182, 255, 0.35);
}

.code-editor::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.code-editor::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid var(--editor-bg);
}

.dropzone-hint {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--green);
  background: rgba(10, 14, 20, 0.82);
  backdrop-filter: blur(4px);
  pointer-events: none;
  border: 2px dashed rgba(86, 211, 100, 0.45);
  margin: 0.5rem;
  border-radius: 8px;
}

.dropzone-hint-icon {
  font-size: 1.75rem;
  line-height: 1;
  opacity: 0.9;
}

.editor-dropzone.drag-over .dropzone-hint {
  display: flex;
}

.editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.85rem;
  background: var(--editor-bg);
  border-top: 1px solid rgba(42, 52, 65, 0.8);
  border-bottom: 1px solid var(--border);
}

.editor-status-hint {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.85rem 0.95rem;
  background: var(--surface-2);
}

.editor-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.btn-editor-primary {
  min-width: 11rem;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.file-dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.35rem 1rem;
  min-height: 5.5rem;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  background: var(--surface);
  cursor: pointer;
}

.file-dropzone:hover {
  border-color: rgba(108, 182, 255, 0.35);
}

.file-dropzone.drag-over {
  border-color: var(--green);
  background: rgba(86, 211, 100, 0.06);
  box-shadow: 0 0 0 4px rgba(86, 211, 100, 0.08);
}

.file-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.file-dropzone-hint {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  pointer-events: none;
}

.file-dropzone-name {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  pointer-events: none;
}

.file-dropzone-name.hidden {
  display: none;
}

/* Rekonstruktion + Lossless */
.recon-block {
  margin: 1rem 0;
}

.recon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.recon-head h3 {
  margin: 0;
}

.recon-exact {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
  border: 1px solid rgba(86, 211, 100, 0.35);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.4rem;
}

.recon-text {
  margin-top: 0.5rem;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
}

.lossless-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  margin: 0.25rem 0;
}

.lossless-badge.ok {
  color: var(--green);
  background: rgba(86, 211, 100, 0.12);
  border: 1px solid rgba(86, 211, 100, 0.3);
}

.lossless-badge.warn {
  color: var(--orange);
  background: rgba(240, 136, 62, 0.12);
  border: 1px solid rgba(240, 136, 62, 0.3);
}

/* Speichervergleich (on-demand) */
.size-result {
  margin: 1rem 0 0.5rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(165deg, var(--surface) 0%, rgba(86, 160, 255, 0.04) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.size-result.hidden {
  display: none;
}

.size-compare {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.size-insight {
  border-radius: 12px;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  background: var(--bg);
}

.size-insight-win {
  border-color: rgba(86, 211, 100, 0.35);
  background: rgba(86, 211, 100, 0.07);
}

.size-insight-tie {
  border-color: rgba(86, 160, 255, 0.35);
  background: rgba(86, 160, 255, 0.07);
}

.size-insight-learn {
  border-color: rgba(240, 136, 62, 0.35);
  background: rgba(240, 136, 62, 0.07);
}

.size-insight-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.size-insight-headline {
  margin: 0 0 0.5rem;
  font-size: 1.12rem;
  line-height: 1.35;
}

.size-insight-baseline {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.size-insight-points {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text);
}

.size-category-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.size-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
}

.size-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
}

.size-card-gpm {
  border-color: rgba(86, 160, 255, 0.35);
  background: rgba(86, 160, 255, 0.05);
}

.size-card-highlight {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.size-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: start;
}

.size-card-icon {
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0.9;
}

.size-card-label {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}

.size-ext {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  font-family: ui-monospace, monospace;
}

.size-card-human {
  font-size: 1rem;
  margin-top: 0.15rem;
  color: var(--text);
}

.size-card-bytes {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.size-bar-track {
  height: 5px;
  margin: 0.55rem 0 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.size-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(86, 160, 255, 0.55), var(--accent));
}

.size-card-gpm .size-bar-fill {
  background: linear-gradient(90deg, rgba(86, 211, 100, 0.45), var(--green));
}

.size-card-formula {
  font-size: 0.76rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.size-card-note {
  font-size: 0.76rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.size-details {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  background: rgba(0, 0, 0, 0.12);
}

.size-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.size-calc {
  margin: 0.65rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--muted);
}

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .gpm-anatomy { grid-template-columns: 1fr; }
  .tabs { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.5rem; }
  .editor-chrome { flex-wrap: wrap; }
  .editor-chrome-stats { width: 100%; text-align: right; }
  .editor-toolbar { flex-direction: column; align-items: stretch; }
  .editor-toolbar-group { width: 100%; }
  .btn-editor-primary { width: 100%; }
  .code-editor { min-height: 16rem; max-height: 50vh; font-size: 0.88rem; }
}

/* v40 — Spektroskopie (Gesetz 3) */
.spectro-teal { background: rgba(0, 150, 136, 0.25); border-bottom: 2px solid #009688; }
.spectro-amber { background: rgba(255, 193, 7, 0.2); border-bottom: 2px solid #ffc107; }
.spectro-amber-struct { background: rgba(233, 30, 99, 0.15); border-bottom: 2px solid #e91e63; }

.spectro-crossfire {
  background: repeating-linear-gradient(
    -45deg,
    rgba(0, 150, 136, 0.25) 0px,
    rgba(0, 150, 136, 0.25) 6px,
    rgba(255, 193, 7, 0.2) 6px,
    rgba(255, 193, 7, 0.2) 12px
  );
  border-bottom: 2px dashed #ff9800;
  pointer-events: auto;
}

.editor-dropzone { position: relative; }
.geometric-viewport {
  position: absolute;
  inset: 0;
  pointer-events: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  z-index: 1;
  background: rgba(255, 255, 255, 0.92);
}
.geometric-viewport.hidden { display: none; }
.geo-line { min-height: 1.5em; }
.geo-cell.spectro-teal { background: rgba(0, 188, 212, 0.35); }
.geo-cell.spectro-amber { background: rgba(255, 193, 7, 0.35); }
.geo-cell.spectro-amber-struct { background: rgba(255, 152, 0, 0.35); }
.geo-cell.spectro-crossfire {
  background: linear-gradient(
    135deg,
    rgba(0, 188, 212, 0.35) 0%,
    rgba(255, 193, 7, 0.35) 100%
  );
  outline: 1px solid rgba(255, 87, 34, 0.6);
}
.code-editor.spectro-active { position: relative; z-index: 2; color: transparent; caret-color: var(--text, #111); }

.ikurve-zoom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.75rem 0;
}

/* v41 — I-Kurve Spektroskopie-Labor */
.ikurve-zone {
  margin-top: 0.75rem;
}

.ikurve-zone-body {
  padding-top: 0.5rem;
}

.ikurve-foreign-compact {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

.ikurve-layer-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.ikurve-layer-btn,
.ikurve-depth-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2, #f5f5f5);
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.ikurve-layer-btn:hover,
.ikurve-depth-btn:hover {
  background: var(--surface-3, #eee);
}

.ikurve-layer-btn.ikurve-layer-active,
.ikurve-depth-btn.ikurve-depth-active {
  background: var(--tab-active, var(--accent, #1565c0));
  border-color: var(--tab-active, var(--accent, #1565c0));
  color: #fff;
}

.ikurve-depth-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.ikurve-depth-pills.hidden {
  display: none;
}

.ikurve-charts-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
  width: 100%;
}

.ikurve-dtw-line {
  margin: 0.5rem 0 0;
}

.ikurve-sparkline-hint {
  font-size: 0.85rem;
  color: var(--text-muted, var(--muted, #666));
  margin-top: 0.25rem;
}

.ikurve-badge {
  margin: 0.65rem 0;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.ikurve-badge-purple {
  background: rgba(103, 58, 183, 0.12);
  border-color: rgba(103, 58, 183, 0.45);
}

.ikurve-badge-purple strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #5e35b1;
}

.ikurve-badge-red {
  background: rgba(244, 67, 54, 0.08);
  border: 1px solid rgba(244, 67, 54, 0.4);
  color: #ff5252;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.ikurve-badge-yellow {
  background: rgba(255, 193, 7, 0.08);
  border: 1px solid rgba(255, 193, 7, 0.45);
  color: #ffc107;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.ikurve-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.ikurve-zone-header-title {
  flex: 1 1 auto;
}

.ikurve-mini-sparkline-container {
  flex: 0 0 auto;
  min-width: 120px;
  max-width: 140px;
}

.ikurve-mini-sparkline {
  display: block;
  width: 120px;
  height: 28px;
}

.ikurve-cell-nested {
  margin: 0.75rem 0;
}

.ikurve-cell-nested > summary {
  cursor: pointer;
  list-style: none;
}

.ikurve-cell-nested > summary::-webkit-details-marker {
  display: none;
}

.ikurve-hierarchy-block { margin-top: 1.25rem; }
.ikurve-hierarchy-head { margin: 0.75rem 0 0.35rem; font-size: 0.95rem; }
.spectro-result-panel {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.88rem;
}
