/* ============================================
   KucyKon Style — Steampunk Gundam Chronicles
   Mega Steampunk Anime Theme Stylesheet
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --brass: #c9a227;
    --brass-light: #e8d48b;
    --brass-dark: #8b6914;
    --copper: #b87333;
    --copper-light: #da8a57;
    --copper-dark: #7a4f20;
    --steam-orange: #ff6b35;
    --steam-red: #d63031;
    --steel: #7f8c8d;
    --steel-light: #95a5a6;
    --steel-dark: #4a5252;
    --dark-bg: #1a1410;
    --dark-bg-2: #231e18;
    --dark-bg-3: #2d2720;
    --text-primary: #f5e6c8;
    --text-secondary: #c9b896;
    --text-muted: #8a7d6b;
    --gallant-color: #ff4757;
    --flasch-color: #3742fa;
    --font-display: 'Cinzel', serif;
    --font-tech: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--brass) var(--dark-bg);
}

body {
    font-family: var(--font-body);
    background: var(--dark-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--dark-bg); }
::-webkit-scrollbar-thumb { background: var(--brass-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brass); }

/* --- Steam Particle Overlay --- */
#steam-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.steam-particle {
    position: absolute;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: steamRise linear infinite;
}

@keyframes steamRise {
    0% { transform: translateY(0) scale(1); opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { transform: translateY(-200px) scale(2); opacity: 0; }
}

/* --- Animated Gear Backgrounds --- */
.gear-bg {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 30%, rgba(201,162,39,0.03) 31%, rgba(201,162,39,0.03) 33%, transparent 34%);
    pointer-events: none;
    z-index: 0;
}

.gear-bg::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 30%; height: 30%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201,162,39,0.05) 0%, transparent 70%);
}

.gear-1 { width: 400px; height: 400px; top: -100px; right: -100px; animation: gearSpin 60s linear infinite; }
.gear-2 { width: 300px; height: 300px; bottom: -50px; left: -80px; animation: gearSpinReverse 45s linear infinite; }
.gear-3 { width: 250px; height: 250px; top: 40%; right: -60px; animation: gearSpin 50s linear infinite; }
.gear-4 { width: 350px; height: 350px; bottom: 20%; left: -100px; animation: gearSpinReverse 70s linear infinite; }

@keyframes gearSpin { to { transform: rotate(360deg); } }
@keyframes gearSpinReverse { to { transform: rotate(-360deg); } }

/* --- Navigation --- */
.steampunk-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 2rem;
    background: linear-gradient(180deg, rgba(26,20,16,0.98) 0%, rgba(26,20,16,0.9) 100%);
    border-bottom: 2px solid var(--brass-dark);
    backdrop-filter: blur(10px);
}

.steampunk-nav::before {
    content: '';
    position: absolute;
    bottom: -4px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--brass), transparent);
}

.nav-gear-left, .nav-gear-right {
    width: 40px; height: 40px;
    border: 3px solid var(--brass-dark);
    border-radius: 50%;
    animation: gearSpin 10s linear infinite;
}

.nav-gear-left::before, .nav-gear-right::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 12px; height: 12px;
    background: var(--brass-dark);
    border-radius: 50%;
}

.nav-gear-right { animation-direction: reverse; }

.nav-brand {
    text-align: center;
}

.brand-icon {
    font-size: 1.5rem;
    color: var(--brass);
    animation: gearSpin 8s linear infinite;
    display: inline-block;
}

.nav-brand h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--text-primary);
    letter-spacing: 3px;
}

.nav-brand .accent {
    color: var(--brass);
    text-shadow: 0 0 20px rgba(201,162,39,0.5);
}

.brand-subtitle {
    display: block;
    font-family: var(--font-tech);
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-family: var(--font-tech);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 1px;
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--brass);
    border-color: var(--brass-dark);
    background: rgba(201,162,39,0.1);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 50%;
    width: 0; height: 2px;
    background: var(--brass);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 80%;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(ellipse at center, var(--dark-bg-2) 0%, var(--dark-bg) 70%);
}

#three-canvas-hero {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

.steam-vent {
    position: absolute;
    width: 60px; height: 200px;
    bottom: -50px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.1));
    animation: steamVent 3s ease-in-out infinite;
}

.steam-vent.left { left: 10%; }
.steam-vent.right { right: 10%; animation-delay: 1.5s; }

@keyframes steamVent {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 0.7; transform: scaleY(1.2); }
}

.mega-title {
    font-family: var(--font-display);
    margin-bottom: 1rem;
}

.title-line {
    display: block;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 900;
    letter-spacing: 8px;
    text-transform: uppercase;
}

.title-top {
    color: var(--text-primary);
    text-shadow:
        0 0 40px rgba(201,162,39,0.5),
        0 0 80px rgba(201,162,39,0.3),
        0 4px 8px rgba(0,0,0,0.8);
    animation: titleGlow 4s ease-in-out infinite alternate;
}

.title-bottom {
    color: var(--brass);
    text-shadow:
        0 0 60px rgba(201,162,39,0.7),
        0 0 120px rgba(201,162,39,0.4),
        0 4px 8px rgba(0,0,0,0.8);
    animation: titleGlow 4s ease-in-out infinite alternate-reverse;
}

@keyframes titleGlow {
    from { filter: brightness(1); }
    to { filter: brightness(1.2); }
}

.hero-subtitle {
    font-family: var(--font-tech);
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    color: var(--text-secondary);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
}

.hero-cta-group {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Steampunk Buttons --- */
.steampunk-btn {
    font-family: var(--font-tech);
    padding: 0.9rem 2rem;
    border: 2px solid var(--brass-dark);
    background: linear-gradient(180deg, rgba(201,162,39,0.2) 0%, rgba(201,162,39,0.05) 100%);
    color: var(--brass-light);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.steampunk-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.steampunk-btn:hover::before {
    left: 100%;
}

.steampunk-btn:hover {
    border-color: var(--brass);
    background: linear-gradient(180deg, rgba(201,162,39,0.4) 0%, rgba(201,162,39,0.15) 100%);
    box-shadow: 0 0 30px rgba(201,162,39,0.3), inset 0 0 30px rgba(201,162,39,0.1);
    transform: translateY(-2px);
}

.btn-primary { color: var(--brass-light); }
.btn-secondary {
    border-color: var(--copper-dark);
    background: linear-gradient(180deg, rgba(184,115,51,0.2) 0%, rgba(184,115,51,0.05) 100%);
    color: var(--copper-light);
}

.btn-secondary:hover {
    border-color: var(--copper);
    background: linear-gradient(180deg, rgba(184,115,51,0.4) 0%, rgba(184,115,51,0.15) 100%);
    box-shadow: 0 0 30px rgba(184,115,51,0.3), inset 0 0 30px rgba(184,115,51,0.1);
}

.btn-gear { animation: gearSpin 6s linear infinite; display: inline-block; }
.btn-piston { animation: pistonMove 2s ease-in-out infinite; display: inline-block; }
.btn-steam { animation: steamPulse 3s ease-in-out infinite; display: inline-block; }

@keyframes pistonMove {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes steamPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- Hero Stats / Gauges --- */
.hero-stats {
    position: absolute;
    bottom: 2rem; left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3rem;
    z-index: 3;
}

.stat-gauge {
    text-align: center;
}

.gauge-ring svg {
    width: 100px; height: 100px;
    filter: drop-shadow(0 0 10px rgba(255,107,53,0.3));
}

.gauge-label {
    display: block;
    font-family: var(--font-tech);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: 0.5rem;
}

/* --- Section Titles --- */
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    text-align: center;
    color: var(--text-primary);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 3rem;
    position: relative;
}

.title-gear {
    display: inline-block;
    font-size: 2rem;
    color: var(--brass-dark);
    animation: gearSpin 8s linear infinite;
}

.title-gear.left { margin-right: 1rem; }
.title-gear.right { margin-left: 1rem; animation-direction: reverse; }

.steampunk-title::after {
    content: '';
    display: block;
    width: 200px; height: 3px;
    background: linear-gradient(90deg, transparent, var(--brass), transparent);
    margin: 1rem auto 0;
}

/* --- Characters Section --- */
.characters-section {
    position: relative;
    padding: 6rem 2rem;
    background: linear-gradient(180deg, var(--dark-bg) 0%, var(--dark-bg-2) 50%, var(--dark-bg) 100%);
}

.character-card {
    max-width: 900px;
    margin: 0 auto 4rem;
}

.card-frame {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(45,39,32,0.8) 0%, rgba(35,30,24,0.9) 100%);
    border: 2px solid var(--brass-dark);
    overflow: hidden;
}

.card-frame::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(201,162,39,0.05), transparent, rgba(201,162,39,0.05));
    animation: cardFrameSpin 20s linear infinite;
}

@keyframes cardFrameSpin { to { transform: rotate(360deg); } }

.frame-corner {
    position: absolute;
    width: 30px; height: 30px;
    border-color: var(--brass);
    z-index: 1;
}

.frame-corner.tl { top: -2px; left: -2px; border-top: 3px solid; border-left: 3px solid; }
.frame-corner.tr { top: -2px; right: -2px; border-top: 3px solid; border-right: 3px solid; }
.frame-corner.bl { bottom: -2px; left: -2px; border-bottom: 3px solid; border-left: 3px solid; }
.frame-corner.br { bottom: -2px; right: -2px; border-bottom: 3px solid; border-right: 3px solid; }

.character-visual {
    position: relative;
    z-index: 1;
}

.character-visual canvas {
    width: 100%; height: auto;
    border: 1px solid var(--brass-dark);
}

.steam-effect {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at bottom, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: steamEffect 4s ease-in-out infinite;
}

@keyframes steamEffect {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

.character-info {
    position: relative;
    z-index: 1;
}

.char-name {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 3px;
    margin-bottom: 0.3rem;
}

.gallant-fop .char-name { color: var(--gallant-color); text-shadow: 0 0 20px rgba(255,71,87,0.4); }
.flasch-hope .char-name { color: var(--flasch-color); text-shadow: 0 0 20px rgba(55,66,250,0.4); }

.char-title {
    font-family: var(--font-tech);
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: var(--brass);
    text-transform: uppercase;
    display: block;
    margin-bottom: 1rem;
}

.char-desc {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.char-stats .stat-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.stat-label {
    font-family: var(--font-tech);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    min-width: 90px;
}

.bar-track {
    flex: 1;
    height: 8px;
    background: rgba(201,162,39,0.15);
    border: 1px solid var(--brass-dark);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 1s ease-out;
}

.gallant-fop .bar-fill { background: linear-gradient(90deg, var(--gallant-color), #ff6b81); }
.flasch-hope .bar-fill { background: linear-gradient(90deg, var(--flasch-color), #5352ed); }

/* --- Duo Mode Banner --- */
.duo-mode-banner {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(255,71,87,0.1) 0%, rgba(55,66,250,0.1) 100%);
    border: 2px solid var(--brass-dark);
    position: relative;
}

.duo-mode-banner h3 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--text-primary);
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
}

.duo-mode-banner p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.duo-gear {
    position: absolute;
    top: -20px;
    width: 40px; height: 40px;
    border: 3px solid var(--brass-dark);
    border-radius: 50%;
    animation: gearSpin 8s linear infinite;
}

.duo-gear.left { left: -20px; }
.duo-gear.right { right: -20px; animation-direction: reverse; }

/* --- Modes Section --- */
.modes-section {
    position: relative;
    padding: 6rem 2rem;
    background: linear-gradient(180deg, var(--dark-bg) 0%, var(--dark-bg-3) 50%, var(--dark-bg) 100%);
}

.mode-switcher-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

/* --- Steampunk Toggles --- */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.steampunk-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding: 1rem 1.5rem;
    background: rgba(45,39,32,0.6);
    border: 1px solid var(--brass-dark);
    transition: all 0.3s ease;
}

.steampunk-toggle:hover {
    background: rgba(45,39,32,0.9);
    border-color: var(--brass);
}

.steampunk-toggle input[type="checkbox"] { display: none; }

.slider {
    position: relative;
    width: 56px; height: 28px;
    background: rgba(74,82,82,0.5);
    border: 2px solid var(--brass-dark);
    border-radius: 14px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.slider::before {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: var(--brass-dark);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.steampunk-toggle input:checked + .slider {
    background: rgba(201,162,39,0.3);
    border-color: var(--brass);
}

.steampunk-toggle input:checked + .slider::before {
    transform: translateX(28px);
    background: var(--brass);
    box-shadow: 0 0 15px rgba(201,162,39,0.5);
}

.toggle-label {
    font-family: var(--font-tech);
    font-size: 0.85rem;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.toggle-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* --- Mode Status Display --- */
.mode-status-display {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(26,20,16,0.8);
    border: 1px solid var(--brass-dark);
}

.mode-status-display h4 {
    font-family: var(--font-tech);
    color: var(--brass);
    letter-spacing: 3px;
    margin-bottom: 1rem;
}

.active-modes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 2rem;
    margin-bottom: 1rem;
}

.mode-tag {
    padding: 0.3rem 0.8rem;
    background: rgba(201,162,39,0.2);
    border: 1px solid var(--brass-dark);
    font-family: var(--font-tech);
    font-size: 0.7rem;
    color: var(--brass-light);
    letter-spacing: 1px;
    animation: modeTagAppear 0.3s ease-out;
}

@keyframes modeTagAppear {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.system-readout {
    display: flex;
    gap: 2rem;
    font-family: var(--font-tech);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.readout-item strong {
    color: var(--steam-orange);
}

/* --- Mode Preview 3D --- */
.mode-preview-3d {
    position: relative;
    border: 2px solid var(--brass-dark);
    background: rgba(26,20,16,0.5);
}

#three-canvas-modes {
    width: 100%; height: 400px;
    display: block;
}

.preview-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 1rem;
    background: linear-gradient(transparent, rgba(26,20,16,0.9));
    text-align: center;
}

#current-mode-label {
    font-family: var(--font-tech);
    color: var(--brass);
    letter-spacing: 3px;
    font-size: 0.85rem;
}

/* --- Machinery Section --- */
.machinery-section {
    position: relative;
    padding: 6rem 2rem;
    background: linear-gradient(180deg, var(--dark-bg) 0%, var(--dark-bg-2) 50%, var(--dark-bg) 100%);
}

.machinery-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
}

.machine-card {
    padding: 2rem;
    background: linear-gradient(135deg, rgba(45,39,32,0.6) 0%, rgba(35,30,24,0.8) 100%);
    border: 1px solid var(--brass-dark);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.machine-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(201,162,39,0.05), transparent);
    transition: left 0.8s ease;
}

.machine-card:hover::before { left: 150%; }

.machine-card:hover {
    border-color: var(--brass);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(201,162,39,0.15);
}

.machine-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.machine-card h3 {
    font-family: var(--font-display);
    color: var(--brass-light);
    letter-spacing: 2px;
    margin-bottom: 0.8rem;
}

.machine-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* --- Machine Animations --- */
.machine-gauge {
    position: relative;
    height: 80px;
}

.gauge-needle {
    position: absolute;
    bottom: 20px; left: 50%;
    width: 3px; height: 60px;
    background: var(--steam-orange);
    transform-origin: bottom center;
    animation: gaugeNeedleMove 4s ease-in-out infinite alternate;
}

@keyframes gaugeNeedleMove {
    from { transform: rotate(-30deg); }
    to { transform: rotate(30deg); }
}

.piston-animation {
    display: flex;
    gap: 1rem;
    justify-content: center;
    height: 80px;
    align-items: end;
}

.piston {
    width: 20px; height: 40px;
    background: linear-gradient(180deg, var(--brass), var(--brass-dark));
    border-radius: 3px;
    animation: pistonAnim 1s ease-in-out infinite;
}

.piston-1 { animation-delay: 0s; }
.piston-2 { animation-delay: 0.25s; }
.piston-3 { animation-delay: 0.5s; }
.piston-4 { animation-delay: 0.75s; }

@keyframes pistonAnim {
    0%, 100% { transform: translateY(0); height: 40px; }
    50% { transform: translateY(-20px); height: 60px; }
}

.gear-animation {
    display: flex;
    gap: -10px;
    justify-content: center;
    align-items: center;
    height: 80px;
}

.anim-gear {
    width: 50px; height: 50px;
    border: 4px solid var(--brass-dark);
    border-radius: 50%;
    position: relative;
}

.anim-gear::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 15px; height: 15px;
    background: var(--brass-dark);
    border-radius: 50%;
}

.anim-gear::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 4px;
    background: var(--brass-dark);
}

.gear-a { animation: gearSpin 3s linear infinite; }
.gear-b { animation: gearSpinReverse 2s linear infinite; margin-left: -15px; width: 60px; height: 60px; }
.gear-c { animation: gearSpin 4s linear infinite; margin-left: -15px; }

.steam-vent-animation {
    position: relative;
    height: 80px;
    display: flex;
    align-items: end;
    justify-content: center;
}

.vent-pipe {
    width: 30px; height: 60px;
    background: linear-gradient(90deg, var(--steel-dark), var(--steel));
    border-radius: 5px 5px 0 0;
}

.steam-cloud {
    position: absolute;
    width: 40px; height: 30px;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: steamCloudRise 2s ease-out infinite;
}

.steam-1 { top: -10px; left: -10px; animation-delay: 0s; }
.steam-2 { top: -30px; right: -15px; animation-delay: 0.7s; }
.steam-3 { top: -50px; left: 5px; animation-delay: 1.4s; }

@keyframes steamCloudRise {
    0% { transform: translateY(0) scale(0.5); opacity: 0.6; }
    100% { transform: translateY(-60px) scale(1.5); opacity: 0; }
}

.valve-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    gap: 1rem;
}

.valve-wheel {
    width: 60px; height: 60px;
    border: 4px solid var(--brass-dark);
    border-radius: 50%;
    animation: gearSpin 6s linear infinite;
    position: relative;
}

.valve-wheel::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    background: var(--brass-dark);
    border-radius: 50%;
}

.valve-pipe {
    width: 80px; height: 12px;
    background: linear-gradient(90deg, var(--steel-dark), var(--steel));
    border-radius: 6px;
}

.armor-display {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    height: 80px;
    align-items: end;
}

.armor-plate {
    width: 40px;
    background: linear-gradient(180deg, var(--steel), var(--steel-dark));
    border: 2px solid var(--brass-dark);
    animation: armorShimmer 3s ease-in-out infinite;
}

.plate-1 { height: 50px; width: 35px; animation-delay: 0s; }
.plate-2 { height: 70px; width: 45px; animation-delay: 0.5s; }
.plate-3 { height: 55px; width: 38px; animation-delay: 1s; }

@keyframes armorShimmer {
    0%, 100% { border-color: var(--brass-dark); }
    50% { border-color: var(--brass); box-shadow: 0 0 15px rgba(201,162,39,0.3); }
}

/* --- Gallery Section --- */
.gallery-section {
    position: relative;
    padding: 6rem 2rem;
    background: linear-gradient(180deg, var(--dark-bg) 0%, var(--dark-bg-3) 50%, var(--dark-bg) 100%);
}

.gallery-container {
    max-width: 900px;
    margin: 0 auto;
    border: 2px solid var(--brass-dark);
    background: rgba(26,20,16,0.5);
}

#three-canvas-gallery {
    width: 100%; height: 500px;
    display: block;
}

.gallery-controls {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    justify-content: center;
    background: rgba(26,20,16,0.8);
}

.gallery-btn {
    font-family: var(--font-tech);
    padding: 0.7rem 1.5rem;
    border: 1px solid var(--brass-dark);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    letter-spacing: 2px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.gallery-btn:hover, .gallery-btn.active {
    border-color: var(--brass);
    color: var(--brass-light);
    background: rgba(201,162,39,0.15);
    box-shadow: 0 0 20px rgba(201,162,39,0.2);
}

/* --- Footer --- */
.steampunk-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    background: var(--dark-bg-2);
    border-top: 2px solid var(--brass-dark);
}

.footer-gear {
    width: 30px; height: 30px;
    border: 2px solid var(--brass-dark);
    border-radius: 50%;
    animation: gearSpin 10s linear infinite;
}

.footer-gear.right { animation-direction: reverse; }

.footer-content {
    text-align: center;
}

.footer-content p {
    font-family: var(--font-tech);
    color: var(--text-muted);
    letter-spacing: 2px;
    font-size: 0.75rem;
}

/* --- Scroll to Top Button --- */
.steampunk-scroll-btn {
    position: fixed;
    bottom: 2rem; right: 2rem;
    width: 50px; height: 50px;
    border: 2px solid var(--brass-dark);
    background: rgba(45,39,32,0.9);
    color: var(--brass);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.steampunk-scroll-btn:hover {
    border-color: var(--brass);
    box-shadow: 0 0 20px rgba(201,162,39,0.3);
    transform: translateY(-3px);
}

.steampunk-scroll-btn.visible { display: flex; }

/* --- Overdrive Mode Effects --- */
body.overdrive-active {
    animation: overdrivePulse 0.5s ease-in-out infinite alternate;
}

@keyframes overdrivePulse {
    from { filter: brightness(1); }
    to { filter: brightness(1.1) saturate(1.2); }
}

body.overdrive-active .steampunk-nav {
    border-bottom-color: var(--steam-red);
}

body.overdrive-active .mega-title .title-top,
body.overdrive-active .mega-title .title-bottom {
    animation: overdriveTitle 0.3s ease-in-out infinite alternate;
}

@keyframes overdriveTitle {
    from { text-shadow: 0 0 40px rgba(255,107,53,0.8), 0 0 80px rgba(255,107,53,0.5); }
    to { text-shadow: 0 0 60px rgba(214,48,49,0.9), 0 0 120px rgba(214,48,49,0.6); }
}

/* --- Duo Mode Active Effects --- */
body.duo-active .character-card {
    border-color: var(--brass) !important;
    box-shadow: 0 0 40px rgba(201,162,39,0.3);
}

body.duo-active .duo-mode-banner {
    background: linear-gradient(135deg, rgba(255,71,87,0.3) 0%, rgba(55,66,250,0.3) 100%);
    border-color: var(--brass);
}

/* ============================================
   MOBILE RESPONSIVE DESIGN
   ============================================ */

/* --- Hamburger Menu (Mobile) --- */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid var(--brass-dark);
    cursor: pointer;
    z-index: 1100;
    padding: 6px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--brass);
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* --- Tablet Breakpoint (900px and below) --- */
@media (max-width: 900px) {
    /* Navigation */
    .mobile-menu-btn { display: flex; }

    .nav-gear-left, .nav-gear-right { display: none; }

    .steampunk-nav {
        padding: 0.6rem 1rem;
    }

    .nav-brand h1 { font-size: 1.2rem; }
    .brand-subtitle { font-size: 0.5rem; letter-spacing: 2px; }

    .nav-links {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(26,20,16,0.98);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease;
    }

    .nav-links.open {
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        font-size: 1.2rem;
        padding: 0.8rem 2rem;
        letter-spacing: 3px;
    }

    /* Hero */
    .hero-stats { gap: 1.5rem; }
    .gauge-ring svg { width: 70px; height: 70px; }

    /* Characters */
    .card-frame { grid-template-columns: 1fr; }

    .character-visual canvas {
        max-width: 300px;
        margin: 0 auto;
        display: block;
    }

    /* Modes */
    .mode-switcher-container { grid-template-columns: 1fr; }

    #three-canvas-modes { height: 280px; }

    /* Machinery */
    .machinery-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    /* Gallery */
    #three-canvas-gallery { height: 350px; }
}

/* --- Mobile Breakpoint (600px and below) --- */
@media (max-width: 600px) {
    /* Navigation */
    .steampunk-nav { padding: 0.5rem 0.8rem; }
    .nav-brand h1 { font-size: 1rem; letter-spacing: 2px; }
    .brand-subtitle { display: none; }

    /* Hero Section */
    .hero-section { min-height: 90vh; padding-top: 60px; }

    .mega-title { margin-bottom: 0.5rem; }

    .title-line {
        font-size: clamp(2.2rem, 10vw, 3.5rem);
        letter-spacing: 4px;
    }

    .hero-subtitle {
        font-size: 0.75rem;
        letter-spacing: 3px;
        margin-bottom: 1.5rem;
    }

    .hero-cta-group {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .steampunk-btn {
        width: 90%;
        max-width: 320px;
        justify-content: center;
        padding: 0.8rem 1.5rem;
        font-size: 0.8rem;
    }

    /* Hero Stats */
    .hero-stats {
        position: relative;
        bottom: auto; left: auto;
        transform: none;
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
        margin-top: 2rem;
        padding-bottom: 1rem;
    }

    .gauge-ring svg { width: 60px; height: 60px; }
    .gauge-label { font-size: 0.55rem; letter-spacing: 1px; }

    /* Steam Vents */
    .steam-vent { display: none; }

    /* Section Titles */
    .section-title {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
        margin-bottom: 2rem;
        letter-spacing: 3px;
    }

    .title-gear { font-size: 1.4rem; }
    .steampunk-title::after { width: 120px; height: 2px; }

    /* Characters */
    .characters-section { padding: 4rem 1rem; }

    .card-frame {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }

    .char-name { font-size: 1.5rem; letter-spacing: 2px; }
    .char-title { font-size: 0.65rem; letter-spacing: 2px; }
    .char-desc { font-size: 0.95rem; line-height: 1.5; }

    .stat-label { min-width: 70px; font-size: 0.65rem; }
    .bar-track { height: 6px; }

    /* Duo Mode */
    .duo-mode-banner { padding: 2rem 1rem; }
    .duo-mode-banner h3 { font-size: 1.3rem; letter-spacing: 2px; }
    .duo-gear { display: none; }

    /* Modes Section */
    .modes-section { padding: 4rem 1rem; }

    .steampunk-toggle {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

    .slider { width: 52px; height: 26px; border-radius: 13px; }
    .slider::before { width: 18px; height: 18px; }
    .steampunk-toggle input:checked + .slider::before { transform: translateX(26px); }

    .toggle-label { font-size: 0.9rem; }
    .toggle-desc { font-size: 0.7rem; margin-top: 0; }

    /* Mode Status */
    .mode-status-display { padding: 1rem; }
    .system-readout { flex-direction: column; gap: 0.5rem; }
    .readout-item { font-size: 0.65rem; }

    #three-canvas-modes { height: 220px; }

    /* Machinery */
    .machinery-section { padding: 4rem 1rem; }

    .machinery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .machine-card { padding: 1.5rem; }
    .machine-icon { font-size: 2rem; }
    .machine-card h3 { font-size: 1.1rem; letter-spacing: 1px; }
    .machine-card p { font-size: 0.85rem; line-height: 1.4; margin-bottom: 1rem; }

    /* Gallery */
    .gallery-section { padding: 4rem 1rem; }
    #three-canvas-gallery { height: 260px; }

    .gallery-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 1rem;
    }

    .gallery-btn {
        padding: 0.5rem 1rem;
        font-size: 0.7rem;
        letter-spacing: 1px;
    }

    /* Footer */
    .steampunk-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .footer-gear { display: none; }
    .footer-content p { font-size: 0.65rem; letter-spacing: 1px; }

    /* Scroll to Top */
    .steampunk-scroll-btn {
        bottom: 1rem; right: 1rem;
        width: 42px; height: 42px;
        font-size: 1.2rem;
    }

    /* Gear Backgrounds - smaller on mobile */
    .gear-1 { width: 200px; height: 200px; top: -50px; right: -50px; }
    .gear-2 { width: 150px; height: 150px; bottom: -30px; left: -40px; }
    .gear-3 { display: none; }
    .gear-4 { display: none; }

    /* Loading Screen */
    .loading-gear { width: 60px; height: 60px; border-width: 4px; }
    .loading-text { font-size: 0.7rem; letter-spacing: 2px; }
}

/* --- Small Mobile (380px and below) --- */
@media (max-width: 380px) {
    .title-line { font-size: clamp(1.8rem, 12vw, 2.5rem); letter-spacing: 2px; }
    .hero-stats { gap: 0.6rem; }
    .gauge-ring svg { width: 50px; height: 50px; }
    .steampunk-btn { padding: 0.7rem 1rem; font-size: 0.7rem; }
    .card-frame { padding: 1rem 0.8rem; }
}

/* --- Landscape Mobile --- */
@media (max-width: 900px) and (orientation: landscape) {
    .hero-section { min-height: auto; padding-top: 80px; padding-bottom: 2rem; }
    .title-line { font-size: clamp(1.8rem, 6vw, 3rem); letter-spacing: 4px; }
    .hero-stats { position: relative; bottom: auto; left: auto; transform: none; flex-direction: row; justify-content: center; margin-top: 1rem; }
}

/* --- Touch-friendly enhancements --- */
@media (hover: none) and (pointer: coarse) {
    .steampunk-toggle { min-height: 60px; padding: 1.2rem; }
    .slider { width: 58px; height: 30px; border-radius: 15px; }
    .slider::before { width: 22px; height: 22px; }
    .steampunk-toggle input:checked + .slider::before { transform: translateX(28px); }
    .nav-links a { padding: 1rem 1.5rem; min-height: 48px; display: flex; align-items: center; }
}

/* --- Loading Animation --- */
.loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--dark-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-gear {
    width: 80px; height: 80px;
    border: 6px solid var(--brass-dark);
    border-radius: 50%;
    animation: gearSpin 2s linear infinite;
    position: relative;
}

.loading-gear::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 30px; height: 30px;
    background: var(--brass-dark);
    border-radius: 50%;
}

.loading-text {
    position: absolute;
    bottom: 40%;
    font-family: var(--font-tech);
    color: var(--brass);
    letter-spacing: 4px;
    font-size: 0.8rem;
}