/* Shared control panel used by the Matrix Rain page and the Dashboard hub.
   --accent is updated from script so the panel follows the active theme. */
.controls-panel {
    --accent: #39ff88;
    --link: #ffb347;
    --text: #e6f2ea;
    --muted: #93a79d;
    --line: rgba(255, 255, 255, 0.14);
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 12px 14px 14px;
    background: rgba(5, 9, 8, 0.9);
    border: 1px solid var(--accent);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65), 0 0 16px color-mix(in srgb, var(--accent) 22%, transparent);
    backdrop-filter: blur(8px);
    color: var(--text);
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 14px;
    animation: panelIn 0.4s ease-out;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.controls-title {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--muted);
}

.panel-body {
    margin-top: 12px;
}

.controls-panel.collapsed {
    width: auto;
}

.controls-panel.collapsed .panel-body {
    display: none;
}

/* Theme info */
.theme-info {
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

#theme-name {
    font-family: 'Orbitron', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.3;
}

#theme-counter {
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

/* Buttons */
.controls-panel button {
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.controls-panel button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.controls-panel button:focus-visible,
#speed-slider:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.controls-panel .panel-toggle {
    padding: 5px 10px;
    font-size: 10px;
}

.nav-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.controls-panel .nav-button {
    padding: 10px 8px;
    font-size: 12px;
    color: var(--accent);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.controls-panel .nav-button:hover {
    color: #050807;
    background: var(--accent);
}

.control-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.controls-panel .span-2 {
    grid-column: span 2;
}

.controls-panel .link-button {
    color: var(--link);
    border-color: color-mix(in srgb, var(--link) 55%, transparent);
}

.controls-panel .link-button:hover {
    color: #050807;
    background: var(--link);
    border-color: var(--link);
}

/* Speed control (Matrix Rain only) */
.speed-control {
    margin-bottom: 12px;
}

.field-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

#speed-display {
    color: var(--text);
    font-weight: 700;
}

.speed-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls-panel .icon-button {
    width: 32px;
    padding: 6px 0;
    font-size: 14px;
}

#speed-slider {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--line);
    accent-color: var(--accent);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

#speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #050807;
}

#speed-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #050807;
}

/* Keyboard hints */
.keyboard-hints {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

kbd {
    font-family: inherit;
    font-size: 11px;
    color: var(--text);
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    white-space: nowrap;
}

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

@media (max-width: 600px) {
    .controls-panel {
        right: 12px;
        bottom: 12px;
    }

    .keyboard-hints {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .controls-panel {
        animation: none;
    }
}
