/* ProxyGuessr - Styles */

/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Forest Green Theme */
    --primary-color: #364F36;
    --primary-dark: #2a3d2a;
    --primary-light: #4a6b4a;
    --secondary-color: #3d5a3d;
    --accent-color: #5a8a5a;
    --success-color: #4a6b4a;
    --warning-color: #d4a574;
    --error-color: #c0392b;
    
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --background: #FFFFFD;
    --surface: #ffffff;
    --border: #dce1e8;
    
    /* Typography */
    --font-primary: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
    
    /* Transitions */
    --transition: all 0.3s ease;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    color: var(--text-primary);
    background: var(--background);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* Header */
.header {
    background: linear-gradient(135deg, #364F36 0%, #4a6b4a 100%);
    color: white;
    padding: var(--spacing-lg) 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.branding {
    flex: 1;
}

.logo {
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: 0;
    letter-spacing: -0.02em;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.logo-text {
    color: white;
    text-shadow: 
        2px 2px 0 rgba(15, 51, 25, 0.8),
        -1px -1px 0 rgba(15, 51, 25, 0.3),
        1px -1px 0 rgba(15, 51, 25, 0.3),
        -1px 1px 0 rgba(15, 51, 25, 0.3),
        3px 3px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    margin: 0 -0.35em;
    position: relative;
    top: -1px;
}

.doc-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(2px 2px 0 rgba(15, 51, 25, 0.8))
            drop-shadow(-1px -1px 0 rgba(15, 51, 25, 0.3))
            drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.3));
    color: rgba(15, 51, 25, 0.9);
    transform: rotate(-5deg);
    animation: docBounce 3s ease-in-out infinite;
}

@keyframes docBounce {
    0%, 100% { transform: rotate(-5deg) translateY(0); }
    50% { transform: rotate(-3deg) translateY(-2px); }
}

.tagline {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.pennant-brand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: white;
    transition: var(--transition);
}

.pennant-brand:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.pennant-flag {
    width: 1.4rem;
    height: auto;
    filter: drop-shadow(0 0 2px white)
            drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
    vertical-align: middle;
}

.tagline strong {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: var(--spacing-sm);
}

.nav-tab {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-primary);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    min-height: 44px;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.nav-tab.active {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: var(--spacing-lg) 0;
}

.screen {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.hidden {
    display: none !important;
}

/* Start Screen */
.welcome-container {
    background: var(--surface);
    border-radius: 12px;
    padding: var(--spacing-xl) var(--spacing-xxl);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.username-section {
    margin: var(--spacing-lg) auto var(--spacing-md);
    max-width: 400px;
    text-align: left;
}

.username-section label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.username-section input {
    width: 100%;
    padding: var(--spacing-md);
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-primary);
    transition: var(--transition);
}

.username-section input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 77, 46, 0.1);
}

.username-hint {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: var(--spacing-xs);
}

.welcome-container h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
    text-shadow: 1px 1px 0 rgba(26, 77, 46, 0.2);
    letter-spacing: -0.02em;
}

.welcome-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.welcome-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0 -0.35em;
    position: relative;
    top: 0.1rem;
}

.welcome-logo-icon .doc-icon {
    width: 100%;
    height: 100%;
    color: var(--primary-color);
    filter: drop-shadow(1px 1px 0 rgba(26, 77, 46, 0.2));
}

.subtitle {
    font-size: 1.35rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.game-description {
    text-align: left;
    margin: var(--spacing-xl) auto 0;
    max-width: 600px;
}

.game-description p {
    margin-bottom: var(--spacing-md);
    font-size: 1.05rem;
    line-height: 1.5;
    text-align: center;
}

.scoring-info {
    background: var(--background);
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-top: var(--spacing-md);
    text-align: center;
}

.scoring-info h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-size: 1.25rem;
}

.scoring-info ul {
    list-style: none;
    display: inline-block;
    text-align: left;
}

.scoring-info li {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border);
}

.scoring-info li:last-child {
    border-bottom: none;
}

/* Feedback Box */
.feedback-box {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f2 100%);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: var(--spacing-lg);
    margin: var(--spacing-xl) auto 0;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(26, 77, 46, 0.15);
    transition: var(--transition);
}

.feedback-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 77, 46, 0.2);
}

.feedback-box h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
}

.feedback-box p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-size: 1rem;
}

.feedback-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.btn-small {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-block;
}

.feedback-box .btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.feedback-box .btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Buttons */
.btn {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-primary);
    outline: none;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 77, 46, 0.3);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-large {
    padding: var(--spacing-lg) var(--spacing-xxl);
    font-size: 1.25rem;
    margin: var(--spacing-md);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Score Panel */
.score-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--surface);
    padding: var(--spacing-md);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

.score-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.score-label {
    display: block;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.timer-item {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    padding: var(--spacing-md);
    border-radius: 8px;
}

.timer-item .score-label {
    color: rgba(255, 255, 255, 0.9);
}

.timer-value {
    color: white !important;
    font-size: 2.5rem !important;
}

.timer-warning {
    animation: timerPulse 1s ease-in-out infinite;
    color: #f39c12 !important;
}

.timer-critical {
    animation: timerPulse 0.5s ease-in-out infinite;
    color: #e74c3c !important;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Game Layout - Side by Side */
#gameScreen .screen {
    max-width: 1800px;
    padding: 0 var(--spacing-xl);
}

.game-layout {
    display: grid;
    grid-template-columns: 42% 58%;
    gap: calc(var(--spacing-lg) * 1.5);
    align-items: start;
    max-width: 100%;
}

.game-left {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 100%;
    overflow: hidden;
}

.game-right {
    position: sticky;
    top: calc(80px + var(--spacing-lg));
    max-width: 100%;
    overflow: hidden;
}

/* Proxy Display */
.proxy-container {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.proxy-display {
    background: var(--surface);
    border-radius: 8px;
    padding: var(--spacing-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 100px);
    min-height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
}

#proxyCanvas {
    width: 100%;
    height: auto;
    min-height: 580px;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    object-fit: contain;
    filter: contrast(1.1);
}

/* Mobile canvas optimization - added after base styles */
@media (max-width: 1024px) {
    #proxyCanvas {
        min-height: unset !important;
        max-height: 52vh !important;
        width: auto !important;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    #proxyCanvas {
        max-height: 48vh !important;
    }
}

@media (max-width: 480px) {
    #proxyCanvas {
        max-height: 43vh !important;
    }
}

/* Input Section - Multiple Choice */
.input-section {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

.input-section h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-size: 1.3rem;
    text-align: center;
}

.choice-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    width: 100%;
    box-sizing: border-box;
}

.choice-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1.05rem;
    font-weight: 600;
    background: var(--background);
    color: var(--text-primary);
    border: 3px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-primary);
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(74, 107, 74, 0.2);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.5;
    box-sizing: border-box;
}

/* Only apply hover effects on devices that support hover (not touch devices) */
@media (hover: hover) and (pointer: fine) {
    .choice-btn:hover:not(:disabled) {
        background: var(--primary-light);
        color: white;
        border-color: var(--primary-color);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(26, 77, 46, 0.2);
    }
}

.choice-btn:active:not(:disabled) {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(26, 77, 46, 0.2);
}

/* Prevent focus ring from appearing on touch devices */
@media (hover: none) {
    .choice-btn:focus {
        outline: none;
    }
}

.choice-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.choice-btn.correct {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
    animation: successPulse 0.5s ease;
}

.choice-btn.incorrect {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
    animation: shake 0.5s ease;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Feedback Overlay */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

.feedback-overlay-content {
    background: var(--surface);
    padding: var(--spacing-xxl);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.feedback-container {
    margin-bottom: var(--spacing-xl);
}

.feedback-message {
    padding: var(--spacing-xl);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-message.correct {
    background: linear-gradient(135deg, #4a6b4a 0%, #5a8a5a 100%);
    color: white;
}

.feedback-message.partial {
    background: linear-gradient(135deg, #d4a574 0%, #e0b886 100%);
    color: white;
}

.feedback-message.incorrect {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
}

.feedback-message h3 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-lg);
    font-weight: 700;
}

.feedback-message p {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.sector-info, .industry-info {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: var(--spacing-sm);
}

.feedback-overlay-content .btn {
    font-size: 1.1rem;
    padding: var(--spacing-lg) var(--spacing-xxl);
    min-width: 200px;
}

#nextBtn {
    display: block;
}

#nextBtn.hidden {
    display: none;
}

.game-over {
    text-align: center;
}

.game-over h2 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: var(--spacing-lg);
}

.game-over p {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
}

.final-score-big {
    font-size: 3rem !important;
    font-weight: 700 !important;
    color: var(--primary-color) !important;
    margin: var(--spacing-lg) 0 !important;
}

.leaderboard-saved {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem !important;
    margin: var(--spacing-lg) 0 !important;
}

/* Nickname Input Section in Game Over */
.nickname-input-section {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f2 100%);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.nickname-prompt {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.15rem !important;
    margin-bottom: var(--spacing-md) !important;
}

.nickname-input-field {
    width: 100%;
    padding: var(--spacing-md);
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-primary);
    transition: var(--transition);
    margin-bottom: var(--spacing-md);
    box-sizing: border-box;
}

.nickname-input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 77, 46, 0.1);
}

.btn-save-score {
    width: 100%;
    margin: 0 !important;
    padding: var(--spacing-md) var(--spacing-lg) !important;
}

.nickname-skip {
    margin-top: var(--spacing-sm) !important;
    font-size: 0.95rem !important;
    color: var(--text-secondary) !important;
}

.nickname-skip a {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}

.nickname-skip a:hover {
    opacity: 0.8;
}

.game-over-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
    align-items: center;
}

.game-over-actions .btn {
    min-width: 250px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.btn-pennant {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    font-weight: 700;
    position: relative;
    overflow: hidden;
}

.btn-pennant:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 77, 46, 0.3);
}

.btn-pennant::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-pennant:hover::after {
    width: 300px;
    height: 300px;
}

.pennant-flag-small {
    width: 1.2em;
    height: 1.2em;
    display: inline-block;
}

.pennant-flag-inline {
    width: 1.4em;
    height: 1.4em;
    display: inline-block;
    vertical-align: middle;
    margin: 0 0.3em;
    position: relative;
    top: -0.05em;
}

@media (max-width: 768px) {
    .game-over-actions .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: var(--spacing-lg);
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    padding: var(--spacing-xxl);
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-xl);
    font-size: 2rem;
}

.instructions section {
    margin-bottom: var(--spacing-xl);
}

.instructions h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-size: 1.25rem;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: var(--spacing-sm) 0;
    padding-left: var(--spacing-lg);
    position: relative;
}

.instructions li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.instructions p {
    margin-bottom: var(--spacing-md);
}

/* Tier List in Instructions */
.instructions .tier-list li {
    display: flex;
    align-items: center;
    padding-left: 0;
    gap: var(--spacing-sm);
}

.instructions .tier-list li:before {
    content: none;
}

.tier-icon-small {
    width: 1.5em;
    height: 1.5em;
    flex-shrink: 0;
    vertical-align: middle;
    display: inline-block;
}

/* Floating CTA Box */
.floating-cta {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(26, 77, 46, 0.4);
    z-index: 1000;
    animation: slideInRight 0.5s ease-out;
    border: 2px solid var(--primary-light);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(400px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.floating-cta.hidden {
    display: none;
}

.close-cta {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    opacity: 0.7;
}

.close-cta:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.floating-cta-text {
    margin-bottom: var(--spacing-md);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
}

.btn-cta {
    width: 100%;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    background: white;
    color: var(--primary-color);
    border: 2px solid white;
    font-weight: 700;
    padding: var(--spacing-md);
}

.btn-cta:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pennant-flag-cta {
    width: 1.3rem;
    height: auto;
    vertical-align: middle;
    margin-right: 0.3rem;
}

@media (max-width: 768px) {
    .floating-cta {
        width: calc(100% - 40px);
        bottom: 10px;
        right: 10px;
        left: 10px;
        padding: var(--spacing-md);
    }
    
    .floating-cta-text {
        font-size: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .floating-cta {
        width: calc(100% - 20px);
        bottom: 10px;
        right: 10px;
        left: 10px;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .floating-cta-text {
        font-size: 0.85rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .btn-cta {
        font-size: 0.9rem;
        padding: var(--spacing-sm);
    }
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-xl) 0;
    text-align: center;
    margin-top: auto;
}

.footer p {
    margin-bottom: var(--spacing-xs);
}

.footer-note {
    font-size: 1.1rem;
    opacity: 0.85;
}

.footer-link {
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    transition: var(--transition);
}

.footer-link:hover {
    border-bottom-color: white;
    opacity: 0.9;
}

.pennant-flag-footer {
    width: 1.1rem;
    height: auto;
    vertical-align: middle;
    margin-right: 0.2rem;
    filter: brightness(0) invert(1);
}

/* AI Summary Section */
.ai-summary-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-summary-title {
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: var(--spacing-lg);
    color: white;
    opacity: 0.9;
}

.ai-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
}

.ai-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0.8;
}

.ai-logo-link:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.ai-logo {
    width: 32px;
    height: 32px;
    fill: white;
    stroke: white;
}

/* Leaderboard */
.leaderboard-container {
    background: var(--surface);
    border-radius: 12px;
    padding: var(--spacing-xxl);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.leaderboard-container h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    text-align: center;
    text-shadow: 1px 1px 0 rgba(26, 77, 46, 0.2);
    letter-spacing: -0.02em;
}

.leaderboard-title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
}

/* Pac-Man Procession Animation */
.pacman-procession {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 80px;
    margin: var(--spacing-lg) auto;
    overflow: hidden;
}

.pacman-with-crown {
    position: absolute;
    width: 48px;
    height: 60px;
    top: 50%;
    transform: translateY(-50%);
    animation: pacmanMove 6s linear infinite;
}

.pacman-with-crown svg {
    width: 100%;
    height: 100%;
}

.gold-leader {
    animation-delay: 0s;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    z-index: 10;
}

.silver-second {
    animation-delay: 0.8s;
    filter: drop-shadow(0 0 10px rgba(192, 192, 192, 0.6));
    z-index: 9;
}

.bronze-third {
    animation-delay: 1.6s;
    filter: drop-shadow(0 0 10px rgba(205, 127, 50, 0.6));
    z-index: 8;
}

@keyframes pacmanMove {
    0% { left: -50px; }
    100% { left: 100%; }
}

/* Pac-Man mouth chomping animation */
.pacman-mouth {
    animation: chomp 0.15s linear infinite;
    transform-origin: 20px 20px;
}

@keyframes chomp {
    0%, 100% {
        d: path("M20,20 L38,8 L38,32 Z");
    }
    50% {
        d: path("M20,20 L38,18 L38,22 Z");
    }
}

/* Skill Tiers */
.leaderboard-filters {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin: var(--spacing-xl) 0;
}

.filter-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
    background: var(--background);
    color: var(--text-secondary);
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-primary);
}

.filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.leaderboard-list {
    margin: var(--spacing-xl) 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px 140px;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-header .rank-col,
.leaderboard-header .name-col,
.leaderboard-header .score-col,
.leaderboard-header .date-col {
    color: white !important;
}

.leaderboard-entries {
    max-height: 500px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 80px 1fr 120px 140px;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.leaderboard-entry:hover {
    background: rgba(0, 255, 65, 0.08);
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-entry.current-user {
    background: rgba(0, 255, 65, 0.12);
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
}

.rank-col {
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
}

.name-col {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.score-col {
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
}

.date-col {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
}

.rank-medal {
    font-size: 1.2rem;
    margin-right: var(--spacing-xs);
}

.empty-leaderboard {
    text-align: center;
    padding: var(--spacing-xxl);
    color: var(--text-secondary);
}

.empty-leaderboard p {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-lg);
}

/* Leaderboard Stats */
.leaderboard-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: var(--background);
    padding: var(--spacing-lg);
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--border);
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    display: block;
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Time's Up Overlay */
.times-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.times-up-content {
    background: var(--surface);
    padding: var(--spacing-xxl);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.times-up-content h2 {
    font-size: 3rem;
    color: var(--error-color);
    margin-bottom: var(--spacing-lg);
}

.times-up-content p {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Floating Icons */
.floating-icon {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    pointer-events: none;
    animation: floatUp 2.2s ease-out forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.floating-icon .icon-graphic {
    width: 150px;
    height: 150px;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
}

.floating-icon .floating-text {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.floating-icon.correct .floating-text {
    color: #4a6b4a;
}

.floating-icon.incorrect .floating-text {
    color: #c0392b;
}

.floating-icon .floating-company {
    font-size: 24px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    text-align: center;
    color: #333;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.8);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .game-right {
        position: relative;
        top: 0;
        order: -1;
    }

    .proxy-display {
        min-height: 250px;
        max-height: 55vh;
        padding: var(--spacing-sm);
        display: flex;
        align-items: center;
        justify-content: center;
    }


    .game-left {
        padding: 0 var(--spacing-md);
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .main-content {
        padding: var(--spacing-md) 0;
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    .feedback-overlay-content {
        padding: var(--spacing-lg);
        width: 95%;
        max-width: 100%;
    }

    .feedback-message h3 {
        font-size: 1.75rem;
    }

    .feedback-message p {
        font-size: 1.05rem;
    }

    .feedback-overlay-content .btn {
        width: 100%;
        font-size: 1.1rem;
        padding: var(--spacing-lg);
        min-height: 50px;
    }

    .feedback-box {
        padding: var(--spacing-lg);
        margin: var(--spacing-lg) 0;
    }

    .feedback-actions {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .feedback-box .btn-small {
        width: 100%;
        min-height: 48px;
        padding: var(--spacing-md);
    }

    .logo {
        font-size: 1.75rem;
    }

    .logo-icon {
        width: 1.5rem;
        height: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    .nav-tabs {
        width: 100%;
        justify-content: center;
        gap: var(--spacing-sm);
    }

    .nav-tab {
        flex: 1;
        padding: var(--spacing-md);
        font-size: 1.05rem;
        min-height: 48px;
    }

    .leaderboard-header,
    .leaderboard-entry {
        grid-template-columns: 60px 1fr 100px;
        font-size: 1rem;
        padding: var(--spacing-md);
    }

    .date-col {
        display: none;
    }

    .leaderboard-stats {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .stat-card {
        padding: var(--spacing-lg);
    }

    .choice-buttons {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .choice-btn {
        min-height: 60px;
        font-size: 1.1rem;
        padding: var(--spacing-lg);
        border-width: 2px;
        touch-action: manipulation;
    }

    .welcome-container {
        padding: var(--spacing-lg);
        margin: var(--spacing-md);
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .welcome-container h2 {
        font-size: 1.85rem;
        max-width: 100%;
    }

    .subtitle {
        font-size: 1.25rem;
        margin-bottom: var(--spacing-xl);
    }

    .username-section {
        margin: var(--spacing-xl) 0;
    }

    .username-section label {
        font-size: 1.05rem;
        margin-bottom: var(--spacing-sm);
    }

    .username-section input {
        font-size: 1.1rem;
        padding: var(--spacing-lg);
        min-height: 50px;
    }

    .input-group {
        flex-direction: column;
    }

    .score-panel {
        flex-direction: row;
        justify-content: space-around;
        padding: var(--spacing-lg);
        gap: var(--spacing-sm);
    }

    .score-item {
        flex: 1;
        min-width: 0;
    }

    .score-label {
        font-size: 0.9rem;
    }

    .score-value {
        font-size: 1.75rem;
    }

    .proxy-display {
        padding: var(--spacing-xs);
        min-height: 200px;
        max-height: 50vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }


    .input-section h3 {
        font-size: 1.25rem;
        margin-bottom: var(--spacing-md);
    }

    .modal-content {
        padding: var(--spacing-xl);
        width: 95%;
        max-height: 85vh;
        overflow-y: auto;
    }

    .modal-content h2 {
        font-size: 1.75rem;
        margin-bottom: var(--spacing-lg);
    }

    .modal-content h3 {
        font-size: 1.35rem;
    }

    .modal-content p,
    .modal-content li {
        font-size: 1.05rem;
    }

    .btn {
        min-height: 48px;
        font-size: 1.1rem;
    }

    .btn-large {
        padding: var(--spacing-lg);
        font-size: 1.2rem;
        min-height: 56px;
        width: 100%;
        max-width: 400px;
        margin: var(--spacing-sm) auto;
    }

    .btn-secondary {
        min-height: 48px;
    }

    .floating-cta {
        width: calc(100% - 20px);
        left: 10px;
        bottom: 10px;
        padding: var(--spacing-md);
    }

    .floating-cta-text {
        font-size: 1rem;
    }

    .leaderboard-title {
        font-size: 2rem;
    }

    .filter-btn {
        padding: var(--spacing-md);
        min-height: 44px;
        flex: 1;
    }

    .nickname-input-section {
        padding: var(--spacing-md);
        max-width: 100%;
    }

    .nickname-input-field {
        font-size: 1.1rem;
        padding: var(--spacing-lg);
        min-height: 50px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--spacing-md) 0;
    }

    .welcome-container {
        padding: var(--spacing-md);
        margin: var(--spacing-sm);
        max-width: 100%;
    }

    .welcome-container h2 {
        font-size: 1.6rem;
        max-width: 100%;
    }

    .subtitle {
        font-size: 1.15rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .score-panel {
        flex-wrap: wrap;
        padding: var(--spacing-md);
    }

    .score-item {
        min-width: 33%;
    }

    .score-value {
        font-size: 1.5rem;
    }

    .score-label {
        font-size: 0.85rem;
    }

    .choice-btn {
        min-height: 56px;
        font-size: 1.05rem;
        padding: var(--spacing-md);
    }

    .proxy-display {
        padding: var(--spacing-xs);
        min-height: 180px;
        max-height: 45vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #proxyCanvas {
        max-height: 43vh !important;
        width: auto !important;
        height: auto !important;
    }

    .game-layout {
        gap: var(--spacing-sm);
    }

    .score-panel {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }

    .input-section h3 {
        font-size: 1rem;
        margin-bottom: var(--spacing-sm);
    }

    .btn-large {
        font-size: 1.15rem;
        padding: var(--spacing-md) var(--spacing-lg);
        min-height: 52px;
    }

    .floating-icon .icon-graphic {
        width: 80px;
        height: 80px;
    }

    .floating-icon .floating-text {
        font-size: 20px;
    }

    .floating-icon .floating-company {
        font-size: 16px;
        padding: 6px 12px;
    }

    .modal-content {
        padding: var(--spacing-lg);
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .leaderboard-title {
        font-size: 1.75rem;
    }
}

/* ============================================================
   PASSWORD PROTECTION GATE
   ============================================================ */

/* Password Gate Overlay */
.password-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #364F36 0%, #4a6b4a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.password-gate-content {
    background: white;
    padding: var(--spacing-xxl);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 450px;
    width: 90%;
    animation: slideUp 0.4s ease;
}

.password-gate-logo {
    margin-bottom: var(--spacing-xl);
    max-width: 100%;
    overflow: hidden;
}

.password-gate-logo .logo {
    color: var(--primary-color);
    font-size: 2.5rem;
    display: inline-flex;
    align-items: center;
    margin: 0;
    max-width: 100%;
    flex-shrink: 1;
}

.password-gate-content h2 {
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: var(--spacing-sm);
}

.password-gate-content > p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.password-input {
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-primary);
    transition: var(--transition);
    text-align: center;
    letter-spacing: 0.1em;
}

.password-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(54, 79, 54, 0.1);
}

.password-error {
    background: #fee;
    color: var(--error-color);
    padding: var(--spacing-sm);
    border-radius: 6px;
    font-size: 0.9rem;
    animation: shake 0.4s ease;
}

.password-error.hidden {
    display: none;
}

.password-hint {
    margin-top: var(--spacing-lg);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.main-content-wrapper.hidden {
    display: none;
}

/* Password Gate Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .password-gate-content {
        padding: var(--spacing-xl);
    }

    .password-gate-logo .logo {
        font-size: 2rem;
        max-width: 100%;
        letter-spacing: -0.03em;
    }

    .password-gate-content h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .password-gate-logo .logo {
        font-size: 1.5rem;
        letter-spacing: -0.04em;
    }

    .password-gate-content h2 {
        font-size: 1rem;
    }
}

@media (max-width: 390px) {
    .password-gate-logo .logo {
        font-size: 1.3rem;
        letter-spacing: -0.05em;
    }

    .password-gate-content h2 {
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .password-gate-logo .logo {
        font-size: 1.2rem;
        letter-spacing: -0.05em;
    }

    .password-gate-content h2 {
        font-size: 0.85rem;
    }
}

/* AI Summary Section - Responsive */
@media (max-width: 768px) {
    .ai-summary-title {
        font-size: 0.95rem;
    }

    .ai-logos {
        gap: var(--spacing-lg);
    }

    .ai-logo {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .ai-summary-title {
        font-size: 0.85rem;
    }

    .ai-logos {
        gap: var(--spacing-md);
    }

    .ai-logo {
        width: 24px;
        height: 24px;
    }
}


