/* Debug controls panel */
#controls-container {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(20, 20, 40, 0.7);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #4a4a8a;
    color: white;
    z-index: 200;
    pointer-events: auto;
    width: 280px;
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0s 0.5s;
    pointer-events: none; /* Prevent interaction when hidden */
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#controls-container h3 {
    margin: 0;
    text-align: center;
    font-size: 1.1em;
    color: #c58aff;
}

#character-editor-title {
    text-align: left;
}

#controls-container button,
#controls-container select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e8ecff;
    font-size: 10px;
    padding: 4px 7px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    width: auto;
}

#controls-container button:hover,
#controls-container select:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
}

#copy-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ddd;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.value-input {
    font-weight: bold;
    color: #eadaff;
    background-color: rgba(0,0,0,0.3);
    padding: 3px 8px;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1em;
    border: 1px solid rgba(255,255,255,0.1);
    width: 70px;
    text-align: right;
    -moz-appearance: textfield; /* Firefox */
}

.value-input:hover {
    cursor: ew-resize;
}

.value-input::-webkit-outer-spin-button,
.value-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0; /* Safari and Chrome */
}

label {
    font-size: 0.9em;
}

/* Accordion Styles */
details {
    border-bottom: 1px solid rgba(138, 138, 255, 0.2);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

details:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

summary {
    cursor: pointer;
    font-weight: bold;
    list-style: none; /* Remove default marker */
    padding: 5px 0;
    color: #b39ddb;
    font-size: 1em;
}

summary::-webkit-details-marker {
    display: none; /* Chrome */
}

summary::before {
    content: '+';
    margin-right: 10px;
    font-weight: bold;
}

details[open] > summary::before {
    content: '−';
}

details .control-group-content {
    padding-top: 10px;
}

/* Mobile controls container - visible inside pause menu */
#mobile-controls-container {
    display: none; 
    margin-top: 20px; 
    background-color: rgba(10, 10, 20, 0.5); 
    padding: 15px; 
    border-radius: 10px; 
    border-top: 1px solid #4a4a8a; 
    width: 90%; 
    max-width: 320px;
}

#mobile-controls-container details {
    margin-bottom: 15px;
}

#mobile-controls-container summary {
    color: #c58aff; 
    font-size: 1.1em;
}

#mobile-controls-container .control-item {
    margin-bottom: 20px;
}

#mobile-controls-container .control-item:last-child {
    margin-bottom: 0;
}

#mobile-controls-container .control-item[style*="flex-direction: column"] {
    margin-top: 15px;
}

#mobile-controls-container .control-item[style*="margin-top: 20px"] {
    margin-top: 20px;
}

#mobile-controls-container .control-item[style*="justify-content: flex-start"] {
    justify-content: flex-start;
}

#mobile-controls-container input[type="range"] {
    width: 100%;
}

#mobile-controls-container input[type="checkbox"] {
    margin-right: 10px; 
    width: 20px; 
    height: 20px;
}

#control-mode-toggle {
    background: rgba(255,255,255,0.1); 
    border: 1px solid #8a8aff; 
    color: white; 
    padding: 5px 10px; 
    border-radius: 5px; 
    cursor: pointer;
}

/* Detachment tuning expose panel */
#detachment-tuning-panel {
    position: fixed;
    left: 16px;
    top: 16px;
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(112, 166, 255, 0.35);
    background: rgba(6, 12, 24, 0.92);
    backdrop-filter: blur(8px);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
    z-index: 1600;
    color: #e7ecff;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(0);
}

#detachment-tuning-panel.hidden {
    transform: translateY(-8px);
}

.detachment-tuning-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.detachment-tuning-header h3 {
    margin: 0;
    color: #b9d9ff;
    font-size: 1rem;
    letter-spacing: 0.04em;
}

.detachment-tuning-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.06);
    color: #eef4ff;
    font-size: 0.8rem;
    cursor: pointer;
}

.detachment-tuning-hint {
    margin: 0 0 12px;
    font-size: 0.78rem;
    color: #95afd8;
}

.detachment-tuning-controls {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.detachment-tuning-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detachment-tuning-label {
    font-size: 0.76rem;
    color: #d6e5ff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detachment-tuning-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detachment-tuning-range {
    flex: 1;
}

.detachment-tuning-number {
    width: 86px;
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    color: #f2e8ff;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 4px 6px;
}

.detachment-tuning-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.detachment-tuning-actions button {
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
    color: #f0f4ff;
    padding: 5px 8px;
    font-size: 0.74rem;
    cursor: pointer;
}

.detachment-tuning-actions button:hover {
    background: rgba(255, 255, 255, 0.16);
}

#detachment-tuning-panel textarea {
    margin-top: 10px;
    width: 100%;
    min-height: 150px;
    max-height: 260px;
    resize: vertical;
    background: rgba(0, 0, 0, 0.36);
    color: #dff2ff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    line-height: 1.38;
    padding: 8px;
}

.detachment-tuning-status {
    margin-top: 7px;
    min-height: 1.1rem;
    font-size: 0.74rem;
    color: #a7b8d7;
}

.detachment-tuning-status[data-type="ok"] {
    color: #92f0c6;
}

.detachment-tuning-status[data-type="error"] {
    color: #ffadad;
}
