:root {
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-tertiary: #2C2C2C;
    --text-primary: #FFFFFF;
    --text-secondary: #AAAAAA;
    --accent: #0070FF;
    --accent-hover: #0056C7;
    --border: #333333;
    --font-main: 'Outfit', sans-serif;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.main-header {
    height: 70px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    background-color: var(--bg-secondary);
}

.logo h1 {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.logo .year {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
}

.action-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}

.action-btn:hover {
    opacity: 0.8;
}

.mode-switch {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 4px;
}

.mode-switch button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mode-switch button.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Main Content */
#main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.view-section {
    width: 100%;
    height: 100%;
    display: flex;
}

/* Single View Layout */
#single-view {
    display: flex;
}

.controls-panel {
    width: 350px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    overflow-y: auto;
}

.preview-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, var(--bg-tertiary) 0%, var(--bg-primary) 100%);
}

/* Controls */
.team-selector-container select {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    margin-top: var(--spacing-sm);
    outline: none;
}

.control-group {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--radius);
    margin-bottom: var(--spacing-md);
}

.control-group h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.5px;
}

.toggle-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.toggle-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    border-color: var(--accent);
}

.toggle-btn.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.actions {
    margin-top: auto;
    display: flex;
    gap: var(--spacing-sm);
}

.actions button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
}

#randomize-btn,
#reset-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#export-btn {
    background: var(--accent);
    color: white;
}

/* Mannequin / Canvas */
/* Mannequin / Canvas */
.uniform-canvas {
    height: 80vh;
    aspect-ratio: 1 / 2;
    /* Approx ratio for a standing figure */
    position: relative;
    /* Add background to see container bounds */
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
}


.mannequin {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 20px;
    gap: 0;
    /* No space between components */
    overflow-y: auto;
}

.uniform-layer {
    position: relative;
    width: 80%;
    /* Adjusted width for vertical stack */
    height: auto;
    object-fit: contain;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin: 0;
    /* Align edges exactly */
}

/* Layer Order (Removed Z-index for vertical stack) */
.layer-pants {
    margin-bottom: -0.4cqw;
    /* Overlap with socks perfectly scales with container width! */
    z-index: 40;
    /* Ensure pants stay on top of socks if needed */
}

.layer-socks {
    transform: translateY(-1px);
    /* Nudge socks up by exactly 1 pixel */
    z-index: 30;
}

.layered-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.component-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cat-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.flip-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flip-buttons button {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.flip-buttons button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.index-label {
    font-size: 0.8rem;
    font-family: monospace;
    color: var(--text-primary);
    min-width: 40px;
    text-align: center;
}

.layer-pants {
    z-index: 20;
}

.layer-jersey {
    z-index: 30;
}

.layer-helmet {
    z-index: 40;
}

/* Matchup View Styles */
.matchup-container {
    display: flex;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
}

.side-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.right-panel {
    border-right: none;
    border-left: 1px solid var(--border);
}

.uniform-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    /* Pure white studio background */
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1);
    position: relative;
    padding: 0;
    overflow: hidden;
    container-type: inline-size;
    /* Scale based on width primarily */
}

.stage-inner {
    display: flex;
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 900px;
    aspect-ratio: 16 / 7;
    align-items: center;
    justify-content: center;
    position: relative;
}

.uniform-stage .mannequin-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.uniform-stage .mannequin {
    width: 100%;
    height: 100%;
    margin-top: -10cqh;
    /* Pull images higher */
    background: transparent;
}

.team-name {
    position: relative;
    z-index: 100;
    margin-top: 5cqw;
    /* Relative to stage width */
    font-size: 2.8cqw;
    /* Scale font with width */
    font-weight: 800;
    color: #333333;
    text-transform: uppercase;
    letter-spacing: 0.1cqw;
    pointer-events: none;
    text-align: center;
    width: 100%;
}

.team-type {
    position: relative;
    z-index: 100;
    font-size: 1.5cqw;
    font-weight: 500;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.15cqw;
    pointer-events: none;
    text-align: center;
    width: 100%;
    margin-top: 0.2cqw;
}

.side-panel h2 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.side-panel select {
    width: 100%;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
}