/* Tech Chase Trainer Styles */

.tech-chase-page {
    max-width: 100%;
    padding: 1rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tech-chase-page .header.compact {
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    flex-shrink: 0;
}

.tech-chase-page .page-title {
    font-size: 1.25rem;
}

/* Game Layout - Stacked for wide display */
.game-layout {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-height: 0;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Game Panel */
.game-panel {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* HUD Bar */
.hud-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: rgba(22, 22, 22, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.stocks {
    display: flex;
    gap: 0.25rem;
}

.stock-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.stock-icon.lost {
    opacity: 0.15;
    filter: grayscale(1);
}

.score-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.score-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--lime);
}

/* Frame Display */
.frame-display {
    position: relative;
    background: #000;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 5;
}

.frame-display img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.overlay-message {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
}

.overlay-message.hidden {
    opacity: 0;
    pointer-events: none;
}

.message-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.4;
}

.result-correct {
    color: var(--lime);
    font-size: 1.25rem;
}

.result-wrong {
    color: #ff6b6b;
    font-size: 1.25rem;
}

.result-gameover {
    color: #ff6b6b;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Reaction Bar */
.reaction-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem;
    background: rgba(22, 22, 22, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.reaction-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.reaction-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--lime);
}

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-height: 0;
    justify-content: center;
}

/* Diamond Button Layout */
.tech-buttons.diamond {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        ". top ."
        "left . right"
        ". bottom .";
    gap: 0.4rem;
    max-width: 360px;
    margin: 0 auto;
}

.tech-buttons.diamond .tech-btn.top { grid-area: top; }
.tech-buttons.diamond .tech-btn.left { grid-area: left; }
.tech-buttons.diamond .tech-btn.right { grid-area: right; }
.tech-buttons.diamond .tech-btn.bottom { grid-area: bottom; }

.tech-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.6rem 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
    background: rgba(22, 22, 22, 0.95);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
    min-width: 90px;
    min-height: 50px;
}

.tech-btn:hover:not(:disabled) {
    border-color: var(--lime);
    background: rgba(209, 250, 80, 0.1);
}

.tech-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

.tech-btn.correct {
    border-color: var(--lime);
    background: rgba(209, 250, 80, 0.25);
    opacity: 1;
}

.tech-btn.incorrect {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.25);
    opacity: 1;
}

.key-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    background: var(--lime);
    color: #000;
    border-radius: 4px;
}

.btn-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* Start Button */
.start-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.75rem;
    background: var(--lime);
    color: #000;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
}

.start-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 0 25px var(--lime-glow);
}

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

/* Run Stats */
.run-stats {
    display: flex;
    gap: 0.5rem;
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
}

.mini-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem;
    background: rgba(22, 22, 22, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.mini-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.mini-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--lime);
}

/* Swipe Input - Hidden by default, shown on mobile */
.swipe-input {
    display: none;
}

.swipe-circle {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(22, 22, 22, 0.95);
    border: 3px solid var(--border-color);
    margin: 0 auto;
    touch-action: none;
    user-select: none;
}

.swipe-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    pointer-events: none;
}

.swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 50px;
    height: 50px;
    background: var(--lime);
    border-radius: 50%;
    opacity: 0.6;
    transition: transform 0.05s ease-out, opacity 0.1s ease;
    pointer-events: none;
}

.swipe-indicator.active {
    opacity: 1;
}

.swipe-label {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.1s ease;
    pointer-events: none;
}

.swipe-label.up {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.swipe-label.down {
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.swipe-label.left {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.swipe-label.right {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.swipe-label.highlight {
    color: var(--lime);
    text-shadow: 0 0 10px var(--lime-glow);
}

.swipe-circle.correct {
    border-color: var(--lime);
    box-shadow: 0 0 20px rgba(209, 250, 80, 0.4);
}

.swipe-circle.incorrect {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.4);
}

.swipe-circle.correct .swipe-indicator {
    background: var(--lime);
}

.swipe-circle.incorrect .swipe-indicator {
    background: #ff6b6b;
}

/* Input Mode Toggle - Hidden on desktop */
.input-toggle {
    display: none;
}

/* Mobile input mode toggle */
@media (max-width: 700px) {
    .input-toggle {
        display: flex;
        gap: 0.25rem;
        background: rgba(22, 22, 22, 0.9);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.25rem;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .toggle-btn {
        flex: 1;
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.7rem;
        font-weight: 600;
        padding: 0.4rem 0.6rem;
        background: transparent;
        color: var(--text-muted);
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.15s ease;
    }
    
    .toggle-btn.active {
        background: var(--lime);
        color: #000;
    }
    
    .toggle-btn:not(.active):hover {
        color: var(--text-secondary);
    }
    
    /* Show/hide based on input mode */
    .controls-panel[data-input-mode="flick"] .tech-buttons.diamond {
        display: none;
    }
    
    .controls-panel[data-input-mode="flick"] .swipe-input {
        display: block;
    }
    
    .controls-panel[data-input-mode="buttons"] .tech-buttons.diamond {
        display: grid;
    }
    
    .controls-panel[data-input-mode="buttons"] .swipe-input {
        display: none;
    }
    
    /* Button mode mobile styles */
    .controls-panel[data-input-mode="buttons"] .tech-btn {
        padding: 0.9rem 1rem;
        min-width: 100px;
        min-height: 58px;
        border-radius: 12px;
    }
    
    .controls-panel[data-input-mode="buttons"] .btn-label {
        font-size: 0.9rem;
        font-weight: 700;
    }
    
    .controls-panel[data-input-mode="buttons"] .key-hint {
        display: none;
    }
}

/* Mobile Layout */
@media (max-width: 700px) {
    html, body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    .tech-chase-page {
        padding: 0.4rem;
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }
    
    .tech-chase-page .header.compact {
        margin-bottom: 0.3rem;
        padding: 0.35rem 0.6rem;
    }
    
    .tech-chase-page .page-title {
        font-size: 0.95rem;
    }
    
    .game-layout {
        gap: 0.35rem;
    }
    
    .game-panel {
        gap: 0.25rem;
    }
    
    .hud-bar {
        padding: 0.3rem 0.5rem;
    }
    
    .stock-icon {
        width: 20px;
        height: 20px;
    }
    
    .score-value {
        font-size: 1rem;
    }
    
    .reaction-bar {
        padding: 0.25rem;
    }
    
    .controls-panel {
        gap: 0.4rem;
    }
    
    /* Input methods controlled by data-input-mode attribute */
    .tech-buttons.diamond {
        max-width: 100%;
        gap: 0.35rem;
    }
    
    .start-btn {
        padding: 0.7rem;
        font-size: 0.85rem;
        max-width: 100%;
    }
    
    .run-stats {
        gap: 0.35rem;
        max-width: 100%;
    }
    
    .mini-stat {
        padding: 0.35rem;
    }
}

/* Very small height screens */
@media (max-height: 620px) {
    .tech-chase-page .header.compact {
        display: none;
    }
    
    .reaction-bar {
        display: none;
    }
    
    .run-stats {
        display: none;
    }
    
    .controls-panel {
        gap: 0.3rem;
    }
    
    .swipe-circle {
        width: 150px;
        height: 150px;
    }
    
    .swipe-indicator {
        width: 42px;
        height: 42px;
    }
    
    .controls-panel[data-input-mode="buttons"] .tech-btn {
        min-height: 50px;
        min-width: 90px;
        padding: 0.6rem 0.8rem;
    }
    
    .start-btn {
        padding: 0.65rem;
    }
}

/* Larger phones - bigger controls */
@media (min-width: 380px) and (max-width: 700px) and (min-height: 650px) {
    .swipe-circle {
        width: 200px;
        height: 200px;
    }
    
    .swipe-indicator {
        width: 55px;
        height: 55px;
    }
    
    .swipe-label {
        font-size: 0.7rem;
    }
    
    .controls-panel[data-input-mode="buttons"] .tech-btn {
        min-width: 110px;
        min-height: 65px;
        padding: 1rem 1.2rem;
    }
    
    .controls-panel[data-input-mode="buttons"] .btn-label {
        font-size: 0.95rem;
    }
}

/* Landscape mobile */
@media (max-height: 450px) and (orientation: landscape) {
    .game-layout {
        flex-direction: row;
        gap: 0.5rem;
        max-width: 100%;
    }
    
    .game-panel {
        flex: 1;
        min-width: 0;
    }
    
    .frame-display {
        flex: 1;
    }
    
    .controls-panel {
        width: 200px;
        flex-shrink: 0;
        justify-content: center;
    }
    
    .hud-bar, .reaction-bar {
        display: none;
    }
    
    /* Landscape swipe input sizing */
    .swipe-circle {
        width: 140px;
        height: 140px;
    }
    
    .swipe-indicator {
        width: 40px;
        height: 40px;
    }
    
    .swipe-label {
        font-size: 0.55rem;
    }
    
    .swipe-label.up {
        top: 8px;
    }
    
    .swipe-label.down {
        bottom: 8px;
    }
    
    .swipe-label.left {
        left: 6px;
    }
    
    .swipe-label.right {
        right: 6px;
    }
    
    /* Landscape button sizing */
    .controls-panel[data-input-mode="buttons"] .tech-btn {
        min-height: 44px;
        min-width: 65px;
        padding: 0.5rem;
    }
    
    .start-btn {
        max-width: 100%;
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .run-stats {
        display: none;
    }
    
    .input-toggle {
        max-width: 150px;
    }
    
    .toggle-btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.6rem;
    }
}
