/* Base & Brand Variables */
:root {
    --brand-bg: #042B0B;
    --brand-cream: #F7EFE6;
    --brand-cream-muted: rgba(247, 239, 230, 0.75);
    --brand-cream-glass: rgba(247, 239, 230, 0.12);
    --brand-cream-border: rgba(247, 239, 230, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background-color: var(--brand-bg);
    color: var(--brand-cream);
    overflow-x: hidden;
    text-align: center;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Mobile Controller Layout */
.mobile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 16px 16px 24px;
    background-color: var(--brand-bg);
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Brand Header & Responsive Logo Scaling */
.brand-header {
    width: 100%;
    max-width: 440px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 8px 18px;
    margin-bottom: 4px;
    z-index: 10;
}

.brand-logo {
    display: block;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
    transition: transform 0.2s ease;
}

.opella-logo {
    width: clamp(90px, 28vw, 130px);
    max-height: 36px;
}

.campaign-logo {
    width: clamp(100px, 32vw, 140px);
    max-height: 52px;
}

/* Phase Containers */
.phase-container {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.35s ease forwards;
    margin: auto 0;
}

.phase-container.active {
    display: flex;
}

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

h1 {
    margin-bottom: 20px;
    font-size: clamp(1.6rem, 5.5vw, 2.1rem);
    font-weight: 800;
    color: var(--brand-cream);
    letter-spacing: 0.5px;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}

#team-subtitle {
    font-size: clamp(1.1rem, 3.8vw, 1.25rem);
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--brand-cream);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.gameplay-title {
    margin-bottom: 12px;
    font-size: clamp(1.5rem, 5vw, 1.9rem);
}

/* Selection Grids */
.color-grid,
.word-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
}

.color-btn {
    padding: clamp(18px, 5.5vw, 24px) 10px;
    font-size: clamp(1.1rem, 3.8vw, 1.25rem);
    font-weight: 800;
    letter-spacing: 1px;
    border-radius: 14px;
    border: 2px solid var(--brand-cream-border);
    color: var(--brand-cream);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.color-btn.span-full {
    grid-column: span 2;
}

.color-btn:active {
    transform: scale(0.96);
    filter: brightness(1.1);
}

/* 5 Team Colors Backgrounds (Green, White, Pink, Orange, Yellow) */
.bg-green { background-color: #263f26; color: #FFFFFF; }
.bg-white { background-color: #FFFFFF; color: #042B0B; text-shadow: none; border-color: rgba(4, 43, 11, 0.25); }
.bg-pink { background-color: #ff78d3; color: #FFFFFF; }
.bg-orange { background-color: #ea7f36; color: #FFFFFF; }
.bg-yellow { background-color: #fff450; color: #042B0B; text-shadow: none; border-color: rgba(4, 43, 11, 0.25); }

/* Light Theme Adjustments (for White & Yellow backgrounds) */
.mobile-container.theme-light h1,
.mobile-container.theme-light #team-subtitle,
.mobile-container.theme-light .gameplay-title {
    color: #042B0B;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

.mobile-container.theme-light .word-btn {
    background: rgba(4, 43, 11, 0.08);
    color: #042B0B;
    border: 2.5px solid #042B0B;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.mobile-container.theme-light .word-btn:active {
    background: rgba(4, 43, 11, 0.2);
}

.mobile-container.theme-light .carousel-card {
    background: rgba(255, 255, 255, 0.45);
    border: 4px solid #042B0B;
    color: #042B0B;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.mobile-container.theme-light .carousel-card:active {
    background: rgba(255, 255, 255, 0.75);
}

.success-overlay.theme-light .giant-letter {
    color: #042B0B;
    text-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Team Selection Buttons */
.word-btn {
    background: rgba(4, 43, 11, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--brand-cream);
    border: 2.5px solid var(--brand-cream);
    padding: clamp(20px, 6vw, 26px) 10px;
    font-size: clamp(1.2rem, 4.2vw, 1.4rem);
    border-radius: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.word-btn:active {
    transform: scale(0.96);
    background: rgba(247, 239, 230, 0.25);
}

/* Fullscreen Carousel */
.fullscreen-phase {
    justify-content: center;
    position: relative;
    max-width: 100vw;
    width: 100%;
}

.carousel-container.fullscreen {
    width: 100vw;
    height: 52vh;
    height: 52dvh;
    overflow: hidden;
    position: relative;
    margin-top: 10px;
}

.carousel.fullscreen {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding: 0 calc(50vw - 90px);
    height: 100%;
    align-items: center;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel-card {
    scroll-snap-align: center;
    flex: 0 0 180px;
    height: 270px;
    background: var(--brand-cream-glass);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 4px solid var(--brand-cream);
    color: var(--brand-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(6rem, 20vw, 7.5rem);
    font-weight: 900;
    border-radius: 24px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.carousel-card:active {
    transform: scale(0.95);
    background: rgba(247, 239, 230, 0.3);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #D90429;
    color: var(--brand-cream);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1.4rem;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.toast.show {
    opacity: 1;
}

/* Giant Letter Overlay */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--brand-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2000;
    cursor: pointer;
}

.success-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.giant-letter {
    font-size: min(26rem, 70vw);
    font-weight: 900;
    color: var(--brand-cream);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin-bottom: 20px;
    text-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}