/* BlogCore Pitch Game - Modern Minimalist Style */

:root {
    --white: #FFFFFF;
    --black: #000000;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #E5E5E5;
    --gray-300: #D4D4D4;
    --gray-400: #A3A3A3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --blue: #3B82F6;
    --blue-dark: #2563EB;
    --blue-light: #60A5FA;

    --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--gray-900);
    color: var(--black);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   GAME WRAPPER & CANVAS (Letterboxing)
   ========================================== */
#game-wrapper {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
}

#game-canvas {
    display: block;
    background: var(--white);
}

/* ==========================================
   SCREENS (Start, Level Complete, Final)
   ========================================== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    z-index: 100;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    overflow-y: auto;
}

/* Final screen - compact layout to avoid scrolling */
#final-screen {
    align-items: center;
    padding: 1rem 0;
}

#final-screen .final-content {
    margin: auto;
    padding: 1rem 2rem;
}

#final-screen .final-title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

#final-screen .ask-box {
    padding: 1.25rem;
    margin-bottom: 1rem;
}

#final-screen .ask-amount {
    font-size: 2.5rem;
}

#final-screen .funds-grid {
    margin-bottom: 1rem;
    gap: 0.75rem;
}

#final-screen .fund-item {
    padding: 0.75rem;
}

#final-screen .milestones {
    padding: 1rem;
    margin-bottom: 1rem;
}

#final-screen .milestones h3 {
    margin-bottom: 0.5rem;
}

#final-screen .final-actions {
    margin-bottom: 1rem;
}

#final-screen .contact-info {
    margin-bottom: 0.5rem;
}

#final-screen .final-note {
    margin-top: 0.5rem;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.02);
}

/* ==========================================
   START SCREEN
   ========================================== */
.start-content {
    text-align: center;
    padding: 2rem;
    max-width: 540px;
}

.logo-container {
    margin-bottom: 2.5rem;
}

.logo {
    height: 60px;
    width: auto;
}

.headline {
    font-size: 1.625rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.tagline {
    font-size: 1.125rem;
    color: var(--gray-500);
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn-primary, .btn-secondary {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 12px;
    font-family: var(--font-main);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--gray-800);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

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

.btn-secondary:hover {
    border-color: var(--black);
    background: var(--gray-100);
}

.btn-hint {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.6;
    margin-top: 0.25rem;
}

/* ==========================================
   CONTROLS HINT
   ========================================== */
.controls-hint {
    margin-top: 2rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.control-item {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.key {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--gray-700);
}

/* ==========================================
   UI OVERLAY (During Gameplay)
   ========================================== */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    z-index: 50;
    pointer-events: none;
}

#ui-overlay.hidden {
    opacity: 0;
}

.ui-top {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    justify-content: space-between;
}

/* Sound Toggle Button */
.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--gray-700);
    cursor: pointer;
    pointer-events: auto;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    margin-left: auto;
}

.sound-toggle:hover {
    background: var(--white);
    color: var(--black);
    transform: scale(1.05);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.sound-toggle.muted {
    color: var(--gray-400);
}

.sound-toggle.muted:hover {
    color: var(--gray-600);
}

.sound-toggle svg {
    pointer-events: none;
}

/* Demo Button */
.demo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--gray-700);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
}

.demo-btn:hover {
    background: var(--white);
    color: var(--black);
    transform: scale(1.05);
}

.demo-btn:active {
    transform: scale(0.95);
}

.demo-btn svg {
    pointer-events: none;
}

/* Video Modal */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal.hidden {
    display: none;
}

.video-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.video-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    z-index: 2001;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.video-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.video-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.level-indicator {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
}

.level-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
}

#level-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--blue);
}

.level-name {
    font-size: 0.875rem;
    color: var(--gray-700);
    font-weight: 500;
}

.progress-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-start;
}

.progress-percent {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-dark);
    letter-spacing: 0.5px;
    min-width: 36px;
}

.progress-bar {
    flex: 1;
    width: 200px;
    max-width: 200px;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 3px;
    transition: width var(--transition-normal);
    width: 0%;
}

/* ==========================================
   TOUCH CONTROLS
   ========================================== */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 60;
    pointer-events: none;
}

#touch-controls.hidden {
    display: none;
}

#touch-controls > div:first-child {
    display: flex;
    gap: 0.75rem;
}

.touch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--black);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.touch-btn:active {
    background: rgba(255, 255, 255, 1);
    transform: scale(0.95);
}

.touch-btn svg {
    pointer-events: none;
}

.touch-left, .touch-right {
    width: 56px;
    height: 56px;
}

.touch-jump {
    width: 72px;
    height: 72px;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: var(--black);
    color: var(--white);
}

.touch-jump:active {
    background: var(--gray-800);
}

/* Floor Branding (between controls) */
.floor-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    pointer-events: auto;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-decoration: none;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.floor-branding:hover {
    opacity: 0.8;
}

.floor-logo {
    height: 24px;
    width: auto;
}

.floor-tagline {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.02em;
    font-weight: 500;
    white-space: nowrap;
}

/* ==========================================
   LEVEL COMPLETE SCREEN
   ========================================== */
.level-content {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    animation: fadeInUp 0.5s ease;
}

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

.level-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.03em;
}

.level-body {
    text-align: left;
    margin-bottom: 2.5rem;
}

.level-body .stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.level-body .stat-item {
    background: var(--gray-100);
    padding: 1.25rem;
    border-radius: 12px;
    text-align: center;
}

.level-body .stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--blue);
    font-family: var(--font-mono);
}

.level-body .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.level-body p {
    color: var(--gray-700);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.level-body .highlight {
    color: var(--black);
    font-weight: 600;
}

.level-body .feature-list {
    list-style: none;
    margin: 1.5rem 0;
}

.level-body .feature-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.level-body .feature-list li:last-child {
    border-bottom: none;
}

.level-body .feature-icon {
    width: 32px;
    height: 32px;
    background: var(--black);
    color: var(--white);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* ==========================================
   FINAL SCREEN
   ========================================== */
.final-content {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    animation: fadeInUp 0.5s ease;
}

.final-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.03em;
}

.ask-box {
    background: var(--black);
    color: var(--white);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.ask-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ask-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

.ask-amount {
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--blue-light);
}

.ask-type {
    font-size: 1rem;
    opacity: 0.9;
}

.ask-cap {
    font-size: 0.875rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.funds-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.fund-item {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.fund-pct {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--blue);
    font-family: var(--font-mono);
}

.fund-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0.25rem 0;
}

.fund-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-600);
}

.milestones {
    background: var(--gray-100);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.milestones h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.milestone-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 0;
    font-family: var(--font-mono);
}

.milestone-from {
    color: var(--gray-600);
}

.milestone-arrow {
    color: var(--blue);
    font-weight: 700;
}

.milestone-to {
    color: var(--black);
    font-weight: 700;
}

.final-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.contact-info {
    margin-bottom: 1.5rem;
}

.contact-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.contact-email {
    color: var(--blue);
}

.contact-site {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.linkedin-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    background: var(--gray-100);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.linkedin-link:hover {
    background: var(--blue);
    color: var(--white);
}

.final-note {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-style: italic;
}

/* ==========================================
   COLLECTIBLE POPUP
   ========================================== */
.collectible-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 70;
    transition: all var(--transition-fast);
}

.collectible-popup.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.collectible-content {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.collectible-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collectible-icon svg {
    width: 24px;
    height: 24px;
}

.collectible-text {
    font-weight: 500;
    color: var(--black);
}

/* Problem popup (obstacles in level 1) - green theme when active */
.collectible-popup.problem-popup .collectible-content {
    background: #F0FDF4;
    border-left: 4px solid #22C55E;
}

.collectible-popup.problem-popup .collectible-text {
    color: #166534;
}

/* Collectible popup (levels 2-5) - blue theme when active */
.collectible-popup.collectible-active .collectible-content {
    background: #EFF6FF;
    border-left: 4px solid #3B82F6;
}

.collectible-popup.collectible-active .collectible-text {
    color: #1E40AF;
}

/* ==========================================
   PORTRAIT MODE OVERLAY
   ========================================== */
#portrait-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    text-align: center;
}

#portrait-overlay.visible {
    display: flex;
}

#portrait-overlay.dismissed {
    display: none !important;
}

.portrait-content {
    padding: 2rem;
    max-width: 300px;
}

.rotate-icon {
    margin-bottom: 1.5rem;
    color: var(--gray-400);
    animation: rotateHint 2s ease-in-out infinite;
}

@keyframes rotateHint {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(90deg);
    }
}

.portrait-content p {
    font-size: 1.125rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.portrait-hint {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* ==========================================
   MOBILE RESPONSIVENESS
   ========================================== */
@media (max-width: 768px) {
    .start-content {
        padding: 1.5rem;
    }

    .logo {
        height: 36px;
    }

    .tagline {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .controls-hint {
        display: none;
    }

    .btn-hint {
        display: none;
    }

    .level-indicator {
        padding: 0.5rem 1rem;
    }

    .level-name {
        display: none;
    }

    .progress-bar {
        max-width: 100px;
    }

    .level-title {
        font-size: 1.5rem;
    }

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

    .ask-amount {
        font-size: 2.25rem;
    }

    .funds-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .fund-item {
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left;
    }

    .fund-pct {
        font-size: 1.25rem;
        min-width: 50px;
    }
}

@media (max-width: 480px) {
    .ui-top {
        gap: 1rem;
    }

    #level-number {
        font-size: 1.25rem;
    }

    .level-content, .final-content {
        padding: 1.5rem;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Portrait mode detection */
@media (orientation: portrait) and (max-width: 768px) {
    #portrait-overlay:not(.dismissed) {
        display: flex;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.floating {
    animation: float 3s ease-in-out infinite;
}

/* Loading state */
.loading {
    opacity: 0.5;
    pointer-events: none;
}
