* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

#plot-2d-container,
#plot-3d-container {
    position: fixed;
    inset: 0;
}

#plot-2d-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

#plot-2d-canvas.dragging {
    cursor: grabbing;
}

#plot-3d-container canvas {
    display: block;
}

.hidden {
    display: none !important;
}

#back-link, #hint {
    position: fixed;
    left: 18px;
    z-index: 10;
    margin: 0;
    color: #39d6ff;
    font-size: 0.8rem;
}

#back-link {
    top: 14px;
}

#back-link a {
    color: #39d6ff;
    text-decoration: none;
}

#back-link a:hover {
    text-decoration: underline;
}

#hint {
    bottom: 14px;
    opacity: 0.7;
}

#side-panel {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 280px;
    max-width: calc(100vw - 36px);
    max-height: calc(100vh - 28px);
    padding: 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(57, 214, 255, 0.3);
    border-radius: 4px;
    overflow-y: auto;
    color: #39d6ff;
    font-size: 0.75rem;
}

#mode-toggle {
    display: flex;
    gap: 6px;
}

.mode-button {
    flex: 1;
    padding: 6px 0;
    background: transparent;
    color: #39d6ff;
    border: 1px solid rgba(57, 214, 255, 0.4);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.mode-button.active {
    background: rgba(57, 214, 255, 0.2);
}

#equation-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.equation-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.equation-row .color-swatch {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
}

.equation-row .equation-input {
    flex: 1;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(57, 214, 255, 0.3);
    color: #39d6ff;
    font-family: inherit;
    font-size: 0.75rem;
    padding: 4px 6px;
    border-radius: 3px;
}

.equation-row .equation-input:focus {
    outline: none;
    border-color: #39d6ff;
}

.equation-row .visibility-toggle {
    accent-color: #39d6ff;
}

.equation-row .delete-equation {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.equation-row .delete-equation:hover {
    color: #ff5555;
}

.equation-error {
    flex-basis: 100%;
    color: #ff8080;
    font-size: 0.68rem;
    opacity: 0.9;
}

#panel-actions {
    display: flex;
    gap: 6px;
}

#panel-actions button {
    flex: 1;
    padding: 6px 0;
    background: transparent;
    color: #39d6ff;
    border: 1px solid rgba(57, 214, 255, 0.4);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}

#panel-actions button:hover,
.mode-button:hover {
    background: rgba(57, 214, 255, 0.12);
}

#examples-toggle {
    width: 100%;
    padding: 6px 0;
    background: transparent;
    color: #39d6ff;
    border: 1px solid rgba(57, 214, 255, 0.4);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}

#examples-toggle:hover {
    background: rgba(57, 214, 255, 0.12);
}

#examples-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    max-height: 180px;
    overflow-y: auto;
}

#examples-list button {
    text-align: left;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #39d6ff;
    border: 1px solid rgba(57, 214, 255, 0.2);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
}

#examples-list button:hover {
    background: rgba(57, 214, 255, 0.15);
}
