/*!
 * fLcOnX Lab - CAS-Laskin (c) 2026 Marko Mononen. All rights reserved.
 * Proprietary and confidential. Unauthorized copying, reverse engineering,
 * or distribution is strictly prohibited under Finnish and international copyright law.
 */

:root {
  --editor-toolbar-bg: #f4f6f8;
  --editor-toolbar-border: #cfd8dc;
  --editor-btn-bg: #ffffff;
  --editor-btn-hover: #e3f2fd;
  --editor-btn-border: #b0bec5;
  --editor-blue: #005a9c;
  --editor-blue-light: #e8f1f8;
  --cas-accent: #0d7a5f;
  --cas-accent-light: #e6f6f2;
  --cas-accent-border: #76c8b2;
  --text-main: #1e293b;
  --text-muted: #546e7a;
  --bg-page: #eaeff2;
  --bg-surface: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Open Sans", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-page);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================================
   1. YLÄPALKKI (Erikoismerkit + Toimintopainikkeet)
   ========================================================================== */

.editor-top-header {
  background: var(--editor-toolbar-bg);
  border-bottom: 2px solid var(--editor-toolbar-border);
  box-shadow: var(--shadow-sm);
  z-index: 100;
  user-select: none;
}

/* Rivi 1: Erikoismerkit */
.special-chars-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 5px 12px;
  border-bottom: 1px solid #dce3e6;
  background: #fdfdfe;
}

.special-chars-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 8px;
  letter-spacing: 0.03em;
}

.char-btn {
  min-width: 28px;
  height: 27px;
  padding: 0 6px;
  background: var(--editor-btn-bg);
  border: 1px solid #d0d7de;
  border-radius: 3px;
  font-size: 14px;
  font-family: "Cambria Math", "Times New Roman", serif;
  color: #111;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s;
}

.char-btn:hover {
  background: var(--editor-btn-hover);
  border-color: var(--editor-blue);
}

.char-btn:active {
  background: #bbdefb;
}

.toggle-more-chars-btn {
  margin-left: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-family: inherit;
  background: #eef2f6;
  border: 1px solid var(--editor-btn-border);
  border-radius: 3px;
  cursor: pointer;
  color: var(--editor-blue);
  font-weight: 600;
}

.toggle-more-chars-btn:hover {
  background: var(--editor-btn-hover);
}

.extended-chars-row {
  display: none;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 12px 6px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #dce3e6;
}

.extended-chars-row.open {
  display: flex;
}

/* Rivi 2: Työkalupainikkeet (Kumoa, Lisää kaava, Lisää CAS-kaava, Vakiot, Näkymä) */
.main-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 12px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.editor-btn {
  height: 32px;
  padding: 0 11px;
  background: var(--editor-btn-bg);
  border: 1px solid var(--editor-btn-border);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.editor-btn:hover {
  background: var(--editor-btn-hover);
  border-color: var(--editor-blue);
}

.editor-btn.primary-formula {
  background: var(--editor-blue);
  color: #ffffff;
  border-color: #004578;
}

.editor-btn.primary-formula:hover {
  background: #004b82;
}

.editor-btn.cas-formula-btn {
  background: var(--cas-accent);
  color: #ffffff;
  border-color: #095c47;
}

.editor-btn.cas-formula-btn:hover {
  background: #09634c;
}

.btn-group-split {
  display: inline-flex;
  position: relative;
}

.btn-group-split > .editor-btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-group-split > .dropdown-trigger {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0 7px;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: #cfd8dc;
  margin: 0 2px;
}

/* Pudotusvalikot (Kaavavalikko, CAS-komentovalikko, Vakiot & Yksiköt) */
.dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 340px;
  max-width: 460px;
  max-height: 75vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #b0bec5;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 10px;
  z-index: 500;
}

.dropdown-panel.open {
  display: block;
}

.dropdown-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 8px 0 5px 0;
  padding-bottom: 3px;
  border-bottom: 1px solid #edf2f7;
}

.dropdown-section-title:first-child {
  margin-top: 0;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.formula-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.formula-menu-item:hover {
  background: var(--editor-btn-hover);
  border-color: var(--editor-blue);
}

.cas-cmd-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cas-cmd-item {
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--cas-accent);
  border-radius: 4px;
  background: #f9fdfb;
  cursor: pointer;
  transition: background 0.1s;
}

.cas-cmd-item:hover {
  background: var(--cas-accent-light);
}

.cas-cmd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 12.5px;
  color: #0b5340;
}

.cas-cmd-syntax {
  font-family: "Consolas", monospace;
  font-size: 11.5px;
  color: #0f766e;
  background: #e6f4f1;
  padding: 1px 5px;
  border-radius: 3px;
}

.cas-cmd-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Luonnonvakiot & Yksiköt -valikko */
.constants-panel {
  min-width: 440px;
}

.constants-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.search-input {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
}

.insert-mode-toggle {
  display: flex;
  gap: 6px;
  font-size: 12px;
  align-items: center;
}

.constant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #edf2f7;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 4px;
}

.constant-item:hover {
  background: #f0f9ff;
  border-color: #93c5fd;
}

.constant-meta {
  display: flex;
  flex-direction: column;
}

.constant-name {
  font-size: 12.5px;
  font-weight: 600;
}

.constant-code {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

/* Näkymän valitsin & Moottorin tila */
.engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 99px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 600;
}

.engine-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

.engine-dot.ready {
  background: #10b981;
}

.view-switcher {
  display: inline-flex;
  background: #dfe5ea;
  padding: 2px;
  border-radius: 5px;
  border: 1px solid #c5cfd6;
}

.view-tab {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  border-radius: 4px;
  cursor: pointer;
}

.view-tab.active {
  background: #ffffff;
  color: var(--editor-blue);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   2. KAKSIPUOLINEN TYÖTILA: CAS-VASTAUSKENTTÄ & CAS-LASKIN
   ========================================================================== */

.workspace-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

.workspace-container.mode-answer-only {
  grid-template-columns: 1fr;
}

.workspace-container.mode-answer-only .calculator-pane {
  display: none;
}

.workspace-container.mode-calc-only {
  grid-template-columns: 1fr;
}

.workspace-container.mode-calc-only .answer-pane {
  display: none;
}

.pane-card {
  background: var(--bg-surface);
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.pane-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.pane-badge.standard {
  background: var(--editor-blue-light);
  color: var(--editor-blue);
}

.pane-badge.cas {
  background: var(--cas-accent-light);
  color: var(--cas-accent);
}

/* ==========================================================================
   3. VASTAUSKENTTÄ (Rich-Text & Kaavat)
   ========================================================================== */

.answer-editor-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.editor-answer-area {
  flex: 1;
  padding: 18px 22px;
  font-size: 16px;
  line-height: 1.65;
  color: #111827;
  overflow-y: auto;
  outline: none;
}

.editor-answer-area:focus {
  box-shadow: inset 0 0 0 2px rgba(0, 90, 156, 0.2);
}

/* Vastauskentän sisäiset kaavaelementit (Tavallinen kaava vs. CAS-kaava) */
.math-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 3px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  user-select: none;
  transition: all 0.12s;
}

/* Tavallinen kaava */
.math-chip.normal-formula {
  background: #f8fafc;
  border: 1px dashed #94a3b8;
}

.math-chip.normal-formula:hover,
.math-chip.normal-formula.selected {
  background: var(--editor-blue-light);
  border: 1px solid var(--editor-blue);
}

/* Aktiivinen CAS-kaava */
.math-chip.cas-formula {
  background: var(--cas-accent-light);
  border: 1.5px solid var(--cas-accent-border);
  position: relative;
}

.math-chip.cas-formula:hover,
.math-chip.cas-formula.selected {
  background: #d1fae5;
  border-color: var(--cas-accent);
  box-shadow: 0 0 0 2px rgba(13, 122, 95, 0.18);
}

.cas-chip-tag {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--cas-accent);
  color: #ffffff;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

/* Kaavaeditori-laatikko (Visuaalinen MathQuill + LaTeX + CAS-toiminnot) */
.formula-editor-dock {
  display: none;
  background: #f8fafc;
  border-top: 2px solid var(--editor-blue);
  padding: 10px 14px;
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.06);
}

.formula-editor-dock.open {
  display: block;
}

.formula-editor-dock.cas-mode {
  border-top-color: var(--cas-accent);
  background: #f4fbf9;
}

.dock-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.dock-mode-title {
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.dock-field-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dock-field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.mq-visual-container {
  background: #ffffff;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  min-height: 44px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  font-size: 18px;
}

.mq-visual-container:focus-within {
  border-color: var(--editor-blue);
  box-shadow: 0 0 0 2px rgba(0, 90, 156, 0.15);
}

.formula-editor-dock.cas-mode .mq-visual-container:focus-within {
  border-color: var(--cas-accent);
  box-shadow: 0 0 0 2px rgba(13, 122, 95, 0.18);
}

.mq-editable-field {
  border: none !important;
  box-shadow: none !important;
  width: 100%;
}

/* Yksikölle varattu oma tekstikenttä kaavan sisällä (\text{...}) */
.mq-editable-field .mq-text-mode {
  background: #e0f2fe;
  border: 1px solid #38bdf8;
  border-radius: 4px;
  padding: 0 5px;
  margin: 0 2px;
  color: #0369a1;
  font-family: "Open Sans", "Segoe UI", sans-serif;
  font-weight: 600;
  font-style: normal;
}

.raw-latex-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 13px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
}

.raw-latex-input:focus {
  outline: none;
  border-color: var(--editor-blue);
}

/* CAS-pikapainikkeet kaavaeditorissa */
.cas-quick-actions-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #d1fae5;
}

.formula-editor-dock.cas-mode .cas-quick-actions-bar {
  display: flex;
}

.cas-action-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--cas-accent-border);
  background: #ffffff;
  color: #095c47;
  cursor: pointer;
  transition: all 0.1s;
}

.cas-action-pill:hover {
  background: var(--cas-accent);
  color: #ffffff;
}

.cas-action-pill.primary {
  background: var(--cas-accent);
  color: #ffffff;
}

.cas-action-pill.primary:hover {
  background: #07523f;
}

/* ==========================================================================
   4. VARSINAINEN CAS-LASKIN (Oikea puoli: Laskurivit, Muuttujat, Kuvaaja)
   ========================================================================== */

.calc-subtabs {
  display: flex;
  gap: 4px;
}

.calc-subtab-btn {
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 4px;
  cursor: pointer;
  color: #334155;
}

.calc-subtab-btn.active {
  background: var(--cas-accent-light);
  border-color: var(--cas-accent);
  color: #095c47;
}

.calc-body-split {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calc-rows-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cas-row-card {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.cas-row-card.active {
  border-color: var(--cas-accent);
  box-shadow: 0 0 0 2px rgba(13, 122, 95, 0.14);
}

.cas-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cas-row-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--cas-accent);
  background: var(--cas-accent-light);
  padding: 3px 7px;
  border-radius: 4px;
  min-width: 32px;
  text-align: center;
}

.cas-row-input-wrap {
  flex: 1;
  min-height: 38px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  font-size: 16px;
  background: #fcfdfd;
}

.cas-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px dashed #e2e8f0;
}

.cas-row-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mini-btn {
  padding: 2px 7px;
  font-size: 11.5px;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  cursor: pointer;
  color: #1e293b;
}

.mini-btn:hover {
  background: var(--cas-accent-light);
  border-color: var(--cas-accent);
  color: #095c47;
}

.mini-btn.eval-exact {
  background: var(--cas-accent);
  color: #ffffff;
  border-color: #095c47;
}

.mini-btn.copy-to-answer {
  background: var(--editor-blue-light);
  color: var(--editor-blue);
  border-color: #93c5fd;
}

.mini-btn.copy-to-answer:hover {
  background: var(--editor-blue);
  color: #ffffff;
}

.cas-row-output {
  margin-top: 6px;
  padding: 7px 10px;
  background: #f8fafc;
  border-left: 3px solid var(--cas-accent);
  border-radius: 0 4px 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  overflow-x: auto;
}

.cas-row-engine-tag {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
  margin-left: 8px;
}

/* Jaettu Muuttujat & Funktiot + 2D-Kuvaajastudio -alapaneeli */
.calc-drawer-panel {
  border-top: 2px solid #cbd5e1;
  background: #f8fafc;
  height: 175px;
  min-height: 130px;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.calc-drawer-panel.graph-open {
  height: 58%;
  min-height: 350px;
}

.calc-body-split.graph-maximized #cas-rows-list {
  display: none;
}

.calc-body-split.graph-maximized .calc-drawer-panel {
  flex: 1;
  height: 100% !important;
  max-height: 100% !important;
  border-top: none;
}

.calc-drawer-panel.hidden {
  display: none;
}

/* Raahattava korkeudenjakaja */
.calc-drawer-resizer {
  height: 9px;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}

.calc-drawer-resizer:hover {
  background: #bae6fd;
}

.resizer-grip {
  width: 42px;
  height: 3px;
  border-radius: 99px;
  background: #64748b;
}

.vars-memory-container {
  padding: 10px 14px;
  overflow-y: auto;
  flex: 1;
}

.vars-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.var-badge-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: #ffffff;
  border: 1px solid #93c5fd;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
}

.var-badge-card:hover {
  background: #eff6ff;
}

.var-delete-btn {
  border: none;
  background: transparent;
  color: #ef4444;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
}

/* 2D-Kuvaajastudio */
.graph-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.graph-expr-input {
  flex: 1;
  min-width: 150px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: "Consolas", monospace;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

.graph-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}

.graph-functions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.graph-func-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-family: "Consolas", monospace;
  font-weight: 600;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  cursor: pointer;
}

.graph-func-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.graph-toggles {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
}

.graph-chk-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.graph-canvas-wrapper {
  flex: 1;
  position: relative;
  min-height: 210px;
  display: flex;
  flex-direction: column;
}

#cas-graph-canvas {
  width: 100%;
  flex: 1;
  height: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: crosshair;
  display: block;
}

.graph-hover-hud {
  position: absolute;
  top: 8px;
  left: 10px;
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-family: "Consolas", monospace;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.graph-special-points-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  max-height: 54px;
  overflow-y: auto;
  font-size: 11.5px;
}

.special-pt-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  font-family: "Consolas", monospace;
  font-size: 11px;
  cursor: pointer;
}

.special-pt-pill:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
}

/* ==========================================================================
   5. ALAREUNAN VIRTUAALINÄPPÄIMISTÖ (CAS-funktiot & Matematiikka)
   ========================================================================== */

.virtual-keypad-drawer {
  display: none;
  background: #e2e8f0;
  border-top: 2px solid #94a3b8;
  padding: 8px 14px;
  z-index: 90;
}

.virtual-keypad-drawer.open {
  display: block;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  max-width: 1100px;
  margin: 0 auto;
}

.key-btn {
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-btn:hover {
  background: var(--editor-btn-hover);
  border-color: var(--editor-blue);
}

.key-btn.cas-key {
  background: var(--cas-accent-light);
  color: #095c47;
  border-color: var(--cas-accent-border);
}

.key-btn.cas-key:hover {
  background: var(--cas-accent);
  color: #ffffff;
}

/* ==========================================================================
   6. fLcOnX Lab -BRÄNDÄYS (Vasen yläkulma) & SUOJAUSTYYLIT
   ========================================================================== */

img,
svg {
  -webkit-user-drag: none;
  user-drag: none;
}

.flconx-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 10px;
  margin-right: 4px;
  border-right: 1px solid #cfd8dc;
  user-select: none;
  text-decoration: none;
}

.flconx-accent-bar {
  width: 5px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, #38bdf8 0%, #3b82f6 52%, #4f46e5 100%);
  box-shadow: 0 1px 6px rgba(14, 165, 233, 0.35);
  flex-shrink: 0;
}

.flconx-brand-text-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}

.flconx-brand-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flconx-wordmark {
  font-family: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 900;
  font-size: 15.5px;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.flconx-wordmark-x {
  color: #0284c7;
}

.flconx-suite-pill {
  font-family: "Consolas", "JetBrains Mono", monospace;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.28);
}

.flconx-subline {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-top: 2px;
}

.flconx-legal-btn {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.flconx-legal-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Käyttöoikeus- ja lisenssi-ikkuna */
.flconx-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.flconx-modal-backdrop.open {
  display: flex;
}

.flconx-modal-card {
  width: 100%;
  max-width: 620px;
  max-height: 82vh;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flconx-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #1e293b;
  background: #090d16;
}

.flconx-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.6;
  color: #cbd5e1;
}

.flconx-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid #1e293b;
  background: #090d16;
  font-size: 11px;
  color: #64748b;
}

