/* ==========================================================================
   SYNTAX TREE EDITOR - SWISS TYPOGRAPHIC STYLE
   Inspired by Josef Müller-Brockmann, Emil Ruder & International Style
   ========================================================================== */

:root {
  /* Swiss Typographic Style Palette (Harmonized with ipa-keyboard) */
  --bg-page: #ffffff;
  --bg-surface: #ffffff;
  --bg-subtle: #f4f4f5;
  --bg-header: #18181b;
  --text-header: #ffffff;
  --bg-empty: #fcfcfc;

  --border-strong: #000000;
  --border-mid: #27272a;
  --border-light: #d4d4d8;
  --border-subtle: #e4e4e7;

  --text-main: #09090b;
  --text-muted: #52525b;
  --text-dim: #71717a;

  --accent-red: #e11d48;
  --accent-red-hover: #be123c;
  --accent-red-light: rgba(225, 29, 72, 0.08);

  --font-main: "Noto Sans", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-sans: var(--font-main);
  --font-ui: var(--font-main);
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', monospace;

  /* Backward Compatibility Aliases */
  --swiss-red: var(--accent-red);
  --swiss-red-hover: var(--accent-red-hover);
  --swiss-red-light: var(--accent-red-light);
  --ink-900: var(--text-main);
  --ink-800: var(--border-mid);
  --ink-700: #3f3f46;
  --ink-600: #52525b;
  --ink-500: var(--text-muted);
  --ink-400: var(--text-dim);
  --ink-300: var(--border-light);
  --ink-200: var(--border-subtle);
  --ink-100: var(--bg-subtle);
  --ink-50:  #fafafa;
  --pure-white: var(--bg-page);

  --accent-blue: #0284c7;
  --accent-blue-light: rgba(2, 132, 199, 0.08);

  --header-height: 52px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
header.app-header {
  height: var(--header-height);
  background: var(--bg-page);
  border-bottom: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
  flex-shrink: 0;
  gap: 16px;
  overflow-x: auto;
}

.brand-section {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  gap: 28px;
}

.title-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.app-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text-main);
  margin: 0;
  white-space: nowrap;
}

.app-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.grammar-mode-group {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  padding-left: 24px;
  border-left: 1px solid var(--border-light);
}

.grammar-mode-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.grammar-mode-switch {
  display: inline-flex;
  align-items: center;
  height: 26px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  overflow: hidden;
  user-select: none;
}

.grammar-btn {
  background: #ffffff;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0 10px;
  height: 100%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s, color 0.1s;
  white-space: nowrap;
}

.grammar-btn:first-child {
  border-right: 1px solid var(--border-strong);
}

.grammar-btn:hover:not(.active) {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.grammar-btn.active {
  background: var(--text-main);
  color: #ffffff;
  cursor: default;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.preset-group {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.preset-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.select-control {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  background-color: #ffffff;
  color: var(--text-main);
  border-radius: 0;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.1s ease;
}

.select-control:hover, .select-control:focus {
  border-color: var(--border-strong);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* スイス・スタイル言語スイッチャー (JA / EN セグメントコントロール) */
.lang-switch {
  display: inline-flex;
  align-items: center;
  height: 26px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
  margin-left: 4px;
}

.lang-btn {
  background: #ffffff;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 10px;
  height: 100%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s, color 0.1s;
}

.lang-btn:first-child {
  border-right: 1px solid var(--border-strong);
}

.lang-btn:hover:not(.active) {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.lang-btn.active {
  background: var(--text-main);
  color: #ffffff;
  cursor: default;
}

/* Buttons (Swiss Typographic Style with Instant Hover Invert) */
.btn {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  height: 26px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  background-color: #ffffff;
  color: var(--text-main);
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.1s, color 0.1s;
  user-select: none;
}

.btn:hover {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--border-strong);
}

.btn:active {
  background-color: #27272a;
  color: #ffffff;
}

.btn-primary {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.btn-primary:hover {
  background-color: #27272a;
  border-color: #27272a;
  color: #ffffff;
}

.btn-accent {
  background-color: var(--accent-red);
  color: #ffffff;
  border-color: var(--accent-red);
}

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

.btn-icon-only {
  padding: 7px;
}

.btn svg {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   MAIN WORKSPACE SPLIT
   -------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* LEFT: EDITOR PANEL */
.editor-panel {
  width: 380px;
  min-width: 300px;
  max-width: 550px;
  background: var(--bg-page);
  border-right: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  z-index: 10;
  position: relative;
}

.panel-header {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.panel-header-row.bottom-row {
  gap: 8px;
}

.mode-tabs-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-help-indicator {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  height: 26px;
  padding: 0 10px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  cursor: pointer;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.1s, color 0.1s;
}

.btn-help-indicator:hover {
  background: var(--text-main);
  color: #ffffff;
}

/* View mode tabs (インデント / 通常(1行) / 両方) */
.view-mode-tabs {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  gap: 0;
  height: 26px;
  overflow: hidden;
  user-select: none;
  flex: 1;
}

.view-tab {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  height: 100%;
  padding: 0 6px;
  background: #ffffff;
  border: none;
  border-radius: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
  white-space: nowrap;
  flex: 1;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.view-tab:not(:last-child) {
  border-right: 1px solid var(--border-strong);
}

.view-tab:hover:not(.active) {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.view-tab.active {
  background: var(--text-main);
  color: #ffffff;
  box-shadow: none;
  cursor: default;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-ghost-sm {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  cursor: pointer;
  height: 26px;
  padding: 0 10px;
  border-radius: 0;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.1s, color 0.1s;
}

.btn-ghost-sm:hover {
  background: var(--text-main);
  color: #ffffff;
}

.btn-ghost-sm:active {
  background: #27272a;
  color: #ffffff;
}

/* Sentence Yield Bar (文プレビュー) */
.sentence-bar {
  padding: 4px 12px;
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  overflow-x: auto;
}

.sentence-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-400);
  flex-shrink: 0;
}

.sentence-content {
  font-size: 11.5px;
  font-weight: 500;
  font-style: italic;
  color: var(--ink-900);
  font-family: var(--font-sans);
  user-select: text;
}

/* Quick Symbol Keyboard Bar */
.symbol-bar {
  padding: 6px 12px;
  background: var(--pure-white);
  border-bottom: var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.symbol-bar-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 100%;
  margin-bottom: 2px;
}

.quick-sym-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: 0;
  cursor: pointer;
  color: var(--ink-800);
  transition: all 0.12s ease;
}

.quick-sym-btn:hover {
  background: var(--ink-900);
  color: var(--pure-white);
  border-color: var(--ink-900);
}

/* Dual Editor Panes Container */
.editor-panes-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--pure-white);
}

.editor-subpane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--pure-white);
}

.subpane-header {
  padding: 3px 12px;
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subpane-title {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
}

.editor-subpane textarea {
  flex: 1;
  width: 100%;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-900);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  tab-size: 2;
  white-space: pre;
}

.editor-subpane textarea::placeholder {
  color: var(--ink-300);
}

/* Mode: Split (Both) */
.editor-panes-container.mode-split .pane-indented {
  flex: 1.1;
  border-bottom: 1px solid var(--ink-200);
}

.editor-panes-container.mode-split .pane-flat {
  flex: 0.9;
}

/* Mode: Indent only */
.editor-panes-container.mode-indent .pane-indented {
  flex: 1;
}

.editor-panes-container.mode-indent .pane-flat {
  display: none;
}

/* Mode: Flat only */
.editor-panes-container.mode-flat .pane-flat {
  flex: 1;
}

.editor-panes-container.mode-flat .pane-indented {
  display: none;
}

/* Error banner */
.error-banner {
  display: none;
  background: #FFF2F2;
  border-top: 1px solid #FFCDD2;
  color: #D32F2F;
  font-size: 11.5px;
  font-family: var(--font-mono);
  padding: 8px 14px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.error-banner.visible {
  display: block;
}



/* --------------------------------------------------------------------------
   RIGHT: PREVIEW & CANVAS
   -------------------------------------------------------------------------- */
.canvas-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--pure-white);
  background-image: 
    radial-gradient(circle, var(--ink-200) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  flex-direction: column;
}

.canvas-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tree-canvas-layer {
  position: absolute;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas Toolbar Overlay */
.canvas-floating-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  box-shadow: none;
  padding: 3px;
  gap: 4px;
  z-index: 15;
}

.zoom-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 8px;
  min-width: 48px;
  text-align: center;
}

/* Node Action Toolbar (when node selected) */
.node-action-toolbar {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #ffffff;
  border: 2px solid var(--border-strong);
  box-shadow: none;
  border-radius: 0;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 18;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.node-action-toolbar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.selected-node-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  color: var(--accent-red);
  background: var(--accent-red-light);
  border: 1px solid var(--accent-red);
  padding: 3px 7px;
  border-radius: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border-light);
}

.node-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.node-input-mode {
  gap: 8px;
}

.node-input-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.node-inline-input {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 4px 8px;
  min-width: 160px;
  max-width: 240px;
  height: 26px;
  outline: none;
  transition: border-color 0.1s ease;
}

.node-inline-input:focus {
  background: #ffffff;
  border-color: var(--border-strong);
  border-width: 2px;
  padding: 3px 7px;
  box-shadow: none;
}

.node-input-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-sm {
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  height: 26px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-main);
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
}

.btn-sm:hover {
  background: var(--text-main);
  color: #ffffff;
}

.btn-delete {
  color: var(--accent-red) !important;
  border-color: var(--accent-red) !important;
}

.btn-delete:hover {
  background: var(--accent-red) !important;
  color: #ffffff !important;
}

/* Bottom Settings Bar */
.canvas-bottom-bar {
  padding: 6px 16px;
  background: var(--bg-page);
  border-top: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 10;
}

.settings-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.setting-item label {
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.slider-control {
  width: 70px;
  accent-color: var(--border-strong);
}

.setting-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  min-width: 32px;
}

/* Radio buttons & toggle */
.radio-group {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  overflow: hidden;
}

.radio-group label {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: #ffffff;
  color: var(--text-muted);
  transition: background-color 0.1s, color 0.1s;
}

.radio-group input {
  display: none;
}

.radio-group input:checked + span {
  color: #ffffff;
  background: var(--text-main);
}

/* --------------------------------------------------------------------------
   SVG GRAPH STYLES
   -------------------------------------------------------------------------- */
.syntax-tree-svg {
  user-select: none;
}

.tree-node {
  cursor: pointer;
}

.tree-node .node-hitbox {
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.tree-node:hover .node-hitbox {
  fill: rgba(0, 0, 0, 0.05);
}

.tree-node.selected .node-hitbox {
  fill: var(--swiss-red-light) !important;
  stroke: var(--swiss-red) !important;
}

.tree-node.linking-source .node-hitbox {
  fill: var(--accent-blue-light) !important;
  stroke: var(--accent-blue) !important;
  stroke-dasharray: 3, 2;
}

.tree-branch {
  transition: stroke 0.15s ease;
}

.tree-triangle {
  transition: stroke 0.15s ease;
}

.movement-path {
  animation: dashMove 20s linear infinite;
}

@keyframes dashMove {
  to {
    stroke-dashoffset: -100;
  }
}

/* --------------------------------------------------------------------------
   MODAL DIALOG (LaTeX, Export, etc.)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 580px;
  max-width: 90vw;
  background: #ffffff;
  border: 2px solid var(--border-strong);
  box-shadow: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 12px 18px;
  border-bottom: 2px solid var(--border-strong);
  background: var(--bg-header);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #ffffff;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.1s;
}

.modal-close:hover {
  color: var(--accent-red);
}

.modal-tabs {
  display: flex;
  padding: 0 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
}

.tab-btn {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  transition: color 0.1s, border-bottom-color 0.1s;
}

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

.tab-btn.active {
  color: var(--text-main);
  border-bottom-color: var(--accent-red);
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}

.modal-textarea {
  width: 100%;
  height: 220px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: #ffffff;
  color: var(--text-main);
  resize: vertical;
  outline: none;
}

.modal-textarea:focus {
  border-width: 2px;
  padding: 11px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-subtle);
}

/* Help Modal Specific Styles (Swiss-Style, matching IPA Editor) */
.modal-box-lg {
  width: 640px;
  max-width: 92vw;
  max-height: 85vh;
}

.modal-help-body {
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-main);
  padding: 20px 24px;
  background: #ffffff;
}

.modal-help-body h3 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-main);
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
}

.modal-help-body h3:first-child {
  margin-top: 0;
}

.modal-help-body p {
  margin-bottom: 8px;
}

.modal-help-body ul {
  margin-left: 18px;
  margin-bottom: 14px;
}

.modal-help-body li {
  margin-bottom: 6px;
  font-size: 12.5px;
}

.modal-help-body kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: #f4f4f5;
  border: 1px solid var(--border-strong);
  border-radius: 0;
}

.modal-help-body code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: #f4f4f5;
  padding: 1px 5px;
  border: 1px solid var(--border-light);
  border-radius: 0;
  color: var(--text-main);
}

.modal-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  transition: background-color 0.1s, color 0.1s;
  margin-top: 4px;
}

.modal-link:hover {
  background: var(--text-main);
  color: #ffffff !important;
}

.modal-link-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   TOAST NOTIFICATION
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-main);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border-strong);
  box-shadow: none;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .node-action-toolbar {
    bottom: 84px;
  }
}

@media (max-width: 600px) {
  .app-main {
    flex-direction: column;
  }
  .editor-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 42%;
    border-right: none;
    border-bottom: var(--border-subtle);
  }
  .canvas-panel {
    height: 58%;
  }
}
