/**
 * EPCVIP Tools Hub - GameBoy Style CSS
 */

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

body {
    background: #0f0f0f;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    overflow: hidden;
    padding: 20px;
}

/* GameBoy Frame - sized for larger canvas */
.gameboy-frame {
    background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
    padding: 20px;
    border-radius: 10px 10px 30px 30px;
    box-shadow:
        inset 2px 2px 4px rgba(255, 255, 255, 0.1),
        inset -2px -2px 4px rgba(0, 0, 0, 0.5),
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 0 0 3px #f0c000;
    max-width: 1300px;
}

.screen-frame {
    background: #0a0a0a;
    padding: 15px;
    border-radius: 5px;
    box-shadow: inset 2px 2px 8px rgba(0, 0, 0, 0.8);
    border: 2px solid #f0c000;
}

.screen-inner {
    background: #0f0f0f;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 1200px;
    max-width: 100%;
}

.title-bar {
    color: #f0c000;
    font-size: 10px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
}

/* Game Canvas - explicit size matches KaPlay internal resolution */
#gameCanvas {
    display: block;
    width: 1200px;
    height: 864px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid #2a2a2a;
    background: #58a028;
}

/* Dialog Box */
.dialog-box {
    background: #1a1a1a;
    border: 3px solid #f0c000;
    padding: 12px 16px;
    margin-top: 8px;
    min-height: 60px;
    width: 100%;
    max-width: 1200px;
    color: #f0c000;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    box-sizing: border-box;
    transition: opacity 0.2s ease;
}

.dialog-box::after {
    content: "\25BC";
    position: absolute;
    bottom: 4px;
    right: 8px;
    color: #f0c000;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding: 0 10px;
}

.dpad {
    width: 90px;
    height: 90px;
    position: relative;
}

.dpad-btn {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #1a1a1a;
    border: 2px solid #f0c000;
    cursor: pointer;
    color: #f0c000;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    box-shadow:
        inset 1px 1px 2px rgba(240, 192, 0, 0.2),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.dpad-btn:active {
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
    background: #2a2a0a;
}

.dpad-up { top: 0; left: 30px; }
.dpad-down { bottom: 0; left: 30px; }
.dpad-left { top: 30px; left: 0; }
.dpad-right { top: 30px; right: 0; }
.dpad-center {
    top: 30px;
    left: 30px;
    background: #0d0d0d;
    border-color: #3a3a00;
    cursor: default;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #f0c000;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    font-family: monospace;
    box-shadow:
        inset 1px 1px 2px rgba(240, 192, 0, 0.3),
        3px 3px 6px rgba(0, 0, 0, 0.5);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.action-btn:active {
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.btn-a {
    background: #f0c000;
    color: #0a0a0a;
}

.btn-b {
    background: #1a1a1a;
    color: #f0c000;
}

/* Brand */
.brand {
    color: #f0c000;
    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    margin-top: 15px;
    text-align: center;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

/* Instructions */
.instructions {
    color: #f0c000;
    font-size: 11px;
    text-align: center;
    margin-top: 20px;
    line-height: 1.6;
    opacity: 0.8;
}

.instructions kbd {
    background: #1a1a1a;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #f0c000;
    color: #f0c000;
}

/* Fallback link */
.fallback-link {
    margin-top: 15px;
}

.fallback-link a {
    color: #666;
    font-size: 11px;
    text-decoration: none;
}

.fallback-link a:hover {
    color: #f0c000;
}

/* Responsive - adjusted breakpoint for larger canvas */
@media (max-width: 1080px) {
    .gameboy-frame {
        padding: 15px;
        width: 100%;
        max-width: 600px;
    }

    .screen-inner {
        width: 100%;
    }

    .screen-frame {
        padding: 10px;
    }

    #gameCanvas {
        max-width: 100%;
    }

    .dialog-box {
        font-size: 12px;
        padding: 10px 12px;
        min-height: 50px;
        max-width: 100%;
    }

    .controls {
        margin-top: 15px;
    }

    .dpad {
        width: 80px;
        height: 80px;
    }

    .dpad-btn {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }

    .dpad-up { left: 27px; }
    .dpad-down { left: 27px; }
    .dpad-left { top: 27px; }
    .dpad-right { top: 27px; }
    .dpad-center { top: 27px; left: 27px; }

    .action-btn {
        width: 40px;
        height: 40px;
    }

    .brand {
        font-size: 16px;
    }

    .instructions {
        font-size: 10px;
    }
}

/* ============================================
   Auth Modal Styles
   ============================================ */

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.auth-modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.auth-modal-content {
    position: relative;
    background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
    padding: 40px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    border: 2px solid #f0c000;
    box-shadow:
        0 0 30px rgba(240, 192, 0, 0.2),
        0 20px 40px rgba(0, 0, 0, 0.5);
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-modal-header h2 {
    color: #f0c000;
    font-size: 1.5rem;
    margin-bottom: 8px;
    font-family: monospace;
}

.auth-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
}

.auth-form-group {
    margin-bottom: 16px;
}

.auth-form-group.hidden {
    display: none;
}

.auth-form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: monospace;
    background-color: #0a0a0a;
    border: 2px solid #333;
    border-radius: 6px;
    color: #fff;
    transition: border-color 0.2s ease;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #f0c000;
}

.auth-form-group input::placeholder {
    color: #666;
}

.auth-error {
    color: #ff4444;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 4px;
}

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

.auth-success {
    color: #44ff44;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(68, 255, 68, 0.1);
    border-radius: 4px;
}

.auth-success.hidden {
    display: none;
}

.auth-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.auth-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    font-family: monospace;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-btn-primary {
    background: #f0c000;
    color: #000;
}

.auth-btn-primary:hover {
    background: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 192, 0, 0.3);
}

.auth-btn-primary:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-btn-secondary {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}

.auth-btn-secondary:hover {
    background: #444;
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
    color: #888;
    font-size: 0.9rem;
}

.auth-toggle a {
    color: #f0c000;
    text-decoration: none;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* Loading state for button */
.auth-btn.loading {
    position: relative;
    color: transparent;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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