/* --- Login Overlay --- */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    /* Must be higher than video (500) */
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box,
#creation-box,
#selection-box,
#register-box,
#deletion-box {
    width: 400px;
    padding: 30px;
    text-align: center;
    border: 2px solid var(--phosphor-primary);
    box-shadow: 0 0 20px rgba(255, 183, 0, 0.2);
    background-color: #000;
}

#creation-box,
#selection-box {
    display: flex;
    flex-direction: column;
    /* Override width for creation/selection */
    width: 1000px !important;
    max-width: 95vw;
    /* Auto height, no internal scrollbars */
}

.login-box h2 {
    color: var(--phosphor-primary);
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#login-message,
#register-message {
    margin-bottom: 20px;
    color: #ccc;
    min-height: 1.2em;
    /* Prevent jump */
}

.login-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.login-buttons button {
    flex: 1;
    padding: 10px;
    font-size: 1em;
    background: #221a00;
    border: 1px solid var(--phosphor-primary);
    color: var(--phosphor-primary);
}

.login-buttons button:hover {
    background: var(--phosphor-primary);
    color: #000;
}

.error-text {
    color: #ff3333 !important;
}

/* --- Creation Wizard --- */
#creation-options {
    margin-bottom: 20px;
    text-align: left;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    padding: 10px 0;
}

.option-group {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.option-group label {
    color: var(--phosphor-secondary);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.radio-group input {
    margin: 0;
}

.radio-group label {
    margin-left: 10px;
    color: #ccc;
    cursor: pointer;
}

select {
    background: #000;
    color: var(--phosphor-primary);
    border: 1px solid var(--border-color);
    padding: 5px;
}

/* --- Attribute Wizard --- */
#attribute-selection {
    width: 600px;
}

#points-remaining {
    font-size: 1.5em;
    /* Larger */
    text-align: center;
    margin-bottom: 25px;
    /* More space */
    font-weight: bold;
    color: #2e7d32;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.attribute-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding: 10px 15px;
    background: transparent;
    /* Cleaner look */
    border-bottom: 1px solid rgba(255, 183, 0, 0.2);
    min-height: 80px;
}

.stat-icon {
    width: 64px;
    height: 64px;
    margin-right: 20px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

.stat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Center align text */
    text-align: center;
}

.stat-header {
    font-size: 1.2em;
    margin-bottom: 5px;
}

.stat-name {
    color: var(--phosphor-primary);
    font-weight: bold;
    text-transform: uppercase;
}

.stat-value {
    color: #fff;
    font-weight: bold;
    margin: 0 5px;
}

.stat-cost {
    font-size: 0.8em;
    color: #888;
    font-weight: normal;
}

.stat-desc {
    font-size: 0.9em;
    color: #aaa;
    font-style: italic;
    font-family: serif;
    /* Elegant feel */
}

.stat-controls {
    display: flex;
    gap: 10px;
    margin-left: 20px;
}

.stat-controls button {
    width: 30px;
    height: 30px;
    padding: 0;
    line-height: 28px;
    text-align: center;
    background: #e0e0e0;
    color: #000;
    border: none;
    font-weight: bold;
    border-radius: 2px;
}

.stat-controls button:hover {
    background: #fff;
    box-shadow: 0 0 5px #fff;
}

/* --- Character Creation Wizard --- */

/* Tabs */
.creation-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--phosphor-secondary);
}

.creation-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    color: var(--phosphor-secondary);
    border-bottom: 2px solid transparent;
}

.creation-tab.active {
    color: var(--phosphor-primary);
    border-bottom: 2px solid var(--phosphor-primary);
    font-weight: bold;
}

.creation-tab:hover {
    color: #fff;
}

/* Panes */
.creation-pane {
    display: none;
    min-height: 550px;
}

.creation-pane.active {
    display: block;
}

/* Account Pane */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
}

/* Race Pane - Drill Down Redesign */
.race-view-container {
    position: relative;
    min-height: 400px;
    /* Adjust as needed */
    margin-bottom: 20px;
}

.race-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.race-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Marquee Styles */
.marquee-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}

.marquee-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: auto;
    /* Allow growth */
}

.marquee-image {
    background-color: #111;
    background-size: cover;
    background-position: center;
    border: 2px solid var(--phosphor-secondary);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border-radius: 4px;
}

#race-marquee-image {
    width: 700px;
    height: 333px;
    /* 2.1:1 Ratio for 2100x1000 */
}

#subrace-marquee-image {
    width: 700px;
    height: 366px;
    /* ~1.9:1 Ratio for 2100x1100 */
}

.race-view-header-row {
    display: flex;
    justify-content: flex-start;
    /* Force left alignment of contents */
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    position: relative;
    min-height: 40px;
}

.race-view-header-row h3 {
    width: 100%;
    text-align: center;
    position: absolute;
    left: 0;
    pointer-events: none;
    /* Let clicks pass through to buttons */
}

.btn-back {
    background: transparent !important;
    border: 1px solid var(--phosphor-secondary) !important;
    color: var(--phosphor-secondary) !important;
    padding: 5px 15px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
    z-index: 10;
    /* Ensure clickable over absolute title */
}

.btn-back:hover {
    border-color: var(--phosphor-primary) !important;
    color: var(--phosphor-primary) !important;
    background: rgba(255, 183, 0, 0.1) !important;
}

.marquee-label {
    font-size: 1.5em;
    color: var(--phosphor-primary);
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 183, 0, 0.3);
    letter-spacing: 2px;
}

.marquee-btn {
    background: transparent;
    border: none;
    color: var(--phosphor-secondary);
    font-size: 4em;
    cursor: pointer;
    padding: 0 10px;
    transition: all 0.2s;
    line-height: 1;
    opacity: 0.7;
}

.marquee-btn:hover {
    color: var(--phosphor-primary);
    transform: scale(1.1);
    opacity: 1;
    text-shadow: 0 0 15px var(--phosphor-primary);
}

.btn-select-marquee {
    padding: 10px 30px;
    font-size: 1.1em;
    background: rgba(255, 183, 0, 0.1);
    border: 1px solid var(--phosphor-primary);
    color: var(--phosphor-primary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.btn-select-marquee:hover {
    background: var(--phosphor-primary);
    color: #000;
    box-shadow: 0 0 15px var(--phosphor-primary);
}

.race-desc-box {
    border: 1px solid #333;
    padding: 15px;
    color: #ccc;
    font-style: italic;
    text-align: center;
    /* Center text for marquee feel */
    min-height: 60px;
    background: rgba(0, 0, 0, 0.3);
    margin-top: 10px;
    font-size: 1.1em;
}

/* Stats Pane */
.points-header {
    font-size: 1.2em;
    color: #2e7d32;
    margin-bottom: 10px;
}

.stats-scroll {
    max-height: none;
    padding-right: 5px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    margin-bottom: 5px;
}

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

.stat-controls button {
    width: 25px;
    height: 25px;
    line-height: 20px;
    padding: 0;
    font-weight: bold;
    cursor: pointer;
}

.stat-controls button:disabled {
    background: #444;
    color: #666;
    cursor: not-allowed;
    border: 1px solid #333;
    box-shadow: none;
}

/* Portrait Pane */
.portrait-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.portrait-option {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.7;
}

.portrait-option:hover {
    opacity: 1;
    border-color: #aaa;
}

.portrait-option.selected {
    opacity: 1;
    border-color: var(--phosphor-primary);
    box-shadow: 0 0 10px var(--phosphor-primary);
}

/* Footer */
.creation-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.creation-footer button {
    flex: 1;
    padding: 10px;
}

.btn-green {
    border-color: #2e7d32 !important;
    background-color: #2e7d32 !important;
    color: #e0e0e0 !important;
}

.btn-green:hover {
    background-color: #388e3c !important;
    color: #fff !important;
}

.btn-red {
    border-color: #c62828 !important;
    background-color: #c62828 !important;
    color: #fff !important;
}

.btn-red:hover {
    background-color: #d32f2f !important;
}

.text-error {
    color: #ff3333 !important;
}

/* --- Character Selection --- */
.character-list-wrapper {
    margin: 20px 0;
    border: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
}

.character-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    border: 1px solid #444;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.character-card:hover {
    border-color: var(--phosphor-primary);
    background: rgba(255, 183, 0, 0.1);
}

.char-portrait-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid #555;
    background: #111;
}

.char-info {
    flex: 1;
    text-align: left;
}

.char-name {
    color: var(--phosphor-primary);
    font-weight: bold;
    font-size: 1.3em;
    display: block;
}

.char-meta {
    color: #aaa;
    font-size: 0.95em;
}

.char-actions {
    display: flex;
    gap: 10px;
}

.btn-select,
.btn-delete {
    padding: 8px 15px;
    cursor: pointer;
    font-weight: bold;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-select {
    background: #2e7d32;
    color: #fff;
}

.btn-select:hover {
    background: #388e3c;
}

.btn-delete {
    background: #b71c1c;
    color: #fff;
}

.btn-delete:hover {
    background: #c62828;
}

.no-chars {
    color: #888;
    font-style: italic;
    padding: 20px;
}

.selection-buttons {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.selection-buttons button {
    flex: 1;
}