  /* ===================== Container ===================== */

  .ks-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 90vw;
    max-width: 880px;
    margin: 16px auto 10px;
    padding: 16px 20px 0;
    position: relative;
    overflow: hidden;
  }

  /* ===================== Hauptbereich: Sidebar + Canvas ===================== */

  .ks-main {
    display: flex;
    gap: 16px;
  }

  .ks-sidebar {
    width: 170px;
    flex-shrink: 0;
    padding-top: 2px;
  }

  /* --- f(x)-Toggle im Sidebar --- */

  .ks-graph-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 8px;
  }

  .ks-graph-toggle .set-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
    flex-shrink: 0;
  }

  .ks-graph-toggle .set-i {
    font-size: 0;
    width: 8px;
    height: 2px;
    background: #ccc;
    border-radius: 1px;
    display: block;
    transition: transform 0.3s, background 0.2s;
    transform: rotate(0deg);
  }

  .ks-graph-toggle.on .set-circle { border-color: #999; }
  .ks-graph-toggle.on .set-i { background: #999; transform: rotate(90deg); }
  .ks-graph-toggle:hover .set-circle { border-color: #666; }
  .ks-graph-toggle:hover .set-i { background: #666; }

  .graph-toggle-label {
    font-family: serif;
    font-style: italic;
    font-size: 14px;
    color: #bbb;
    transition: color 0.2s;
  }

  .ks-graph-toggle.on .graph-toggle-label { color: #555; }
  .ks-graph-toggle:hover .graph-toggle-label { color: #666; }

  .ks-graph-panel {
    display: none;
  }

  .ks-graph-panel.visible {
    display: block;
  }

  .ks-canvas-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
  }

  #koordinatensystem {
    width: 100% !important;
    border: 0;
    box-shadow: none !important;
    background: #fff;
    position: relative;
  }

  @media (max-width: 700px) {
    .ks-main {
      flex-direction: column;
    }
    .ks-sidebar {
      width: 100%;
      order: 2;
    }
    .ks-canvas-wrap {
      order: 1;
    }
    .ks-container {
      max-width: none;
    }
    #ks-toolbar.top-toolbar {
      flex-wrap: wrap !important;
      gap: 4px 6px;
      padding-right: 50px !important;
      width: 100% !important;
      box-sizing: border-box !important;
    }
    .ks-set-toggles {
      top: 14px;
      right: 12px;
    }
  }

  /* ===================== Werkzeugleiste ===================== */

  #ks-toolbar.top-toolbar {
    display: flex;
    gap: 6px;
    margin: 0 0 8px 0 !important;
    padding: 0;
    justify-content: flex-start !important;
    flex-wrap: wrap;
    max-width: none !important;
    align-items: center;
  }

  #ks-toolbar button.tool-icon {
    all: unset;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 0 4px;
    width: 36px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: grayscale(1);
    opacity: 0.3;
    transition: opacity 0.2s, filter 0.2s;
    line-height: 1;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    min-width: 36px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }

  #ks-toolbar button.tool-icon:hover {
    opacity: 0.7;
    filter: grayscale(0.5);
  }

  #ks-toolbar button.tool-icon.active {
    opacity: 0.7;
    filter: grayscale(0);
  }

  #ks-toolbar .ks-point-btn {
    color: #ff8800;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
  }

  .ks-point-sup {
    font-size: 8px;
    letter-spacing: -0.3px;
    color: inherit;
    font-family: sans-serif;
    font-style: normal;
    position: relative;
    top: -5px;
    margin-left: -1px;
  }

  #ks-toolbar button.tool-icon-text {
    filter: none;
    font-size: 12px;
    font-style: italic;
    font-family: serif;
    letter-spacing: -0.5px;
  }

  #ks-toolbar button.tool-icon-text:hover {
    filter: none;
  }

  #ks-toolbar button.tool-icon-text.active {
    filter: none;
    opacity: 0.7;
  }

  /* ===================== Zeichenwerkzeug-Dropdown ===================== */

  .tool-dropdown {
    position: relative;
    display: inline-flex;
    align-items: stretch;
  }

  .tool-has-dropdown {
    position: relative !important;
  }

  .ks-tool-corner {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 8px 8px;
    border-color: transparent transparent #aaa transparent;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
  }

  .tool-has-dropdown.active .ks-tool-corner {
    border-bottom-color: #666;
    opacity: 1;
  }

  .ks-tool-corner:hover {
    opacity: 1;
    border-bottom-color: #666;
  }

  .ks-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
    padding: 4px 0;
    min-width: 110px;
  }

  .ks-dropdown-menu.open {
    display: block;
  }

  .ks-dropdown-menu button {
    all: unset;
    display: flex;
    align-items: center;
    gap: 6px;
    width: calc(100% - 20px);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    color: #555;
    border-radius: 0;
  }

  .ks-dropdown-menu button:hover {
    background: #f0f0f0;
  }

  .ks-dropdown-menu button.selected {
    font-weight: 600;
    color: #333;
  }

  /* ===================== Farbauswahl ===================== */

  .ks-color-indicator {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.2);
    box-sizing: border-box;
  }

  #ks-toolbar button.tool-icon#ksColorBtn {
    opacity: 0.8 !important;
    filter: none !important;
  }

  .color-dropdown-grid {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    justify-content: center;
  }

  .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
    box-sizing: content-box;
    flex-shrink: 0;
  }

  .color-dot.active {
    border-color: rgba(0, 0, 0, 0.35);
    transform: scale(1.15);
  }

  .color-dot:hover {
    transform: scale(1.2);
  }

  /* ===================== Sidebar: Gleichungseingabe ===================== */

  .ks-graph-input {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
  }

  .ks-graph-input .graph-label {
    font-style: italic;
    font-family: serif;
    color: #999;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .ks-graph-input input {
    flex: 1;
    font-size: 13px;
    padding: 4px 6px;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    outline: none;
    font-family: monospace;
    min-width: 0;
    transition: border-color 0.2s;
  }

  .ks-graph-input input::placeholder {
    color: #ddd;
  }

  .ks-graph-input input:focus {
    border-color: #888;
  }

  .ks-graph-input button {
    all: unset;
    cursor: pointer;
    font-size: 14px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ccc;
    border: 1.5px solid #ccc;
    line-height: 1;
    padding-bottom: 1px;
    flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s;
  }

  .ks-graph-input button:hover {
    color: #333;
    border-color: #888;
  }

  /* ===================== Sidebar: Graphenliste ===================== */

  .ks-graph-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .graph-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-family: monospace;
    line-height: 1.3;
  }

  .graph-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
  }

  .graph-color-dot:hover {
    transform: scale(1.3);
  }

  .graph-eq {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #444;
  }

  .graph-remove {
    cursor: pointer;
    opacity: 0.3;
    font-size: 12px;
    flex-shrink: 0;
    transition: opacity 0.2s;
    line-height: 1;
    filter: grayscale(1);
  }

  .graph-remove:hover {
    opacity: 1;
  }

  /* ===================== Zahlenmengen-Toggles ===================== */

  .ks-set-toggles {
    position: absolute;
    top: 18px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
  }

  .ks-set-toggles .set-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
  }

  .ks-set-toggles .set-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
    flex-shrink: 0;
  }

  .ks-set-toggles .set-circle .set-i {
    font-size: 0;
    width: 8px;
    height: 2px;
    background: #ccc;
    border-radius: 1px;
    display: block;
    transition: transform 0.3s, background 0.2s;
    transform: rotate(0deg);
  }

  .ks-set-toggles .set-toggle.on .set-circle { border-color: #999; }
  .ks-set-toggles .set-toggle.on .set-i { background: #999; transform: rotate(90deg); }
  .ks-set-toggles .set-toggle:hover .set-circle { border-color: #666; }
  .ks-set-toggles .set-toggle:hover .set-i { background: #666; }

  .ks-set-toggles .set-label {
    font-family: serif;
    font-size: 15px;
    font-weight: bold;
    color: #bbb;
    transition: color 0.2s;
  }

  .ks-set-toggles .set-label sub { font-size: 0.65em; vertical-align: baseline; position: relative; top: 0.3em; }
  .ks-set-toggles .set-label sup { font-size: 0.65em; vertical-align: baseline; position: relative; top: -0.4em; }
  .ks-set-toggles .set-toggle.on .set-label { color: #555; }
  .ks-set-toggles .set-toggle:hover .set-label { color: #666; }

  /* ===================== Beschriftungs-Umschalter ===================== */

  .ks-label-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0 10px;
    cursor: pointer;
    user-select: none;
  }

  .ks-label-switch .label-switch-text {
    font-size: 13px;
    font-weight: 500;
    color: #ccc;
    letter-spacing: 0.5px;
  }

  .ks-label-switch .label-switch-track {
    width: 32px;
    height: 14px;
    border-radius: 7px;
    background: transparent;
    border: 1.5px solid #ccc;
    position: relative;
    transition: border-color 0.2s;
  }

  .ks-label-switch .label-switch-thumb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid #ccc;
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    transition: left 0.25s, border-color 0.2s;
  }

  .ks-label-switch.numbers .label-switch-thumb {
    left: 19px;
  }
