:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #020617;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent: #06b6d4;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --correct: #10b981;
    --wrong: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 850px;
    background-color: #0b0f19;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid #1e293b;
    overflow: hidden;
}

@media (min-width: 481px) {
    .app-container {
        border-radius: 16px;
        height: 92vh;
    }
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: calc(100% - 50px);
    padding: 30px 24px;
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

.brand-logo {
    font-size: 72px;
    margin-top: 40px;
    animation: pulse 2s infinite;
}

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

.app-title {
    font-size: 24pt;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.app-subtitle {
    font-size: 10.5pt;
    color: var(--text-muted);
    text-align: center;
    max-width: 300px;
    line-height: 1.5;
    margin-bottom: 40px;
}

.stats-badge {
    background-color: var(--bg-card);
    padding: 12px 24px;
    border-radius: 30px;
    border: 1px solid #334155;
    margin-bottom: 50px;
    font-size: 11pt;
}

.highlight-txt {
    color: var(--accent);
    font-weight: bold;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 12pt;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid #334155;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 9.5pt;
    cursor: pointer;
    text-decoration: underline;
}

.splash-nav {
    margin-top: auto;
    display: block;
    text-align: center;
}

.separator {
    color: #334155;
    margin: 0 8px;
}

.game-header {
    width: 100%;
    margin-bottom: 20px;
}

.score-box {
    float: right;
    font-size: 12pt;
    font-weight: bold;
    color: var(--accent);
}

.level-box {
    float: left;
    font-size: 12pt;
    font-weight: bold;
}

.timer-container {
    width: 100%;
    height: 6px;
    background-color: var(--bg-card);
    border-radius: 3px;
    margin-bottom: 40px;
    overflow: hidden;
}

#timer-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
    transition: width 0.1s linear;
}

.question-container {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
}

.question-hint {
    font-size: 11pt;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.sequence-box {
    background-color: var(--bg-input);
    border: 2px solid #1e293b;
    padding: 25px 15px;
    border-radius: 16px;
    font-size: 24pt;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 2px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.options-grid {
    width: 100%;
    margin-bottom: 20px;
}

.option-btn {
    width: 48%;
    display: inline-block;
    margin: 1%;
    background-color: var(--bg-card);
    border: 1px solid #334155;
    color: var(--text-main);
    padding: 18px 10px;
    border-radius: 12px;
    font-size: 16pt;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.option-btn:hover {
    border-color: var(--primary);
    background-color: #24324d;
}

.back-to-menu {
    margin-top: auto;
    padding: 12px;
    font-size: 10pt;
}

.document-screen {
    align-items: flex-start;
    text-align: right;
}

.document-content {
    background-color: var(--bg-card);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 15px;
    width: 100%;
    max-height: 480px;
    overflow-y: auto;
    margin-bottom: 20px;
    font-size: 10pt;
    color: #cbd5e1;
}

.document-content h3 {
    margin-top: 15px;
    border-bottom: 1px solid #334155;
    padding-bottom: 5px;
}

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

.contact-card {
    background-color: var(--bg-input);
    border: 1px solid #334155;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.email-link {
    font-family: monospace;
    font-size: 12pt;
    color: var(--accent) !important;
    font-weight: bold;
}

.web-link {
    font-family: monospace;
    font-size: 12pt;
    color: var(--primary) !important;
    font-weight: bold;
}

.app-footer {
    width: 100%;
    height: 50px;
    background-color: #060910;
    border-top: 1px solid #1e293b;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 10;
}

.app-footer p {
    margin: 0;
    font-size: 9pt;
    color: var(--text-muted);
}

.footer-brand {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}

.footer-brand:hover {
    text-decoration: underline;
}

.gameover-icon {
    font-size: 48pt;
    color: var(--wrong);
    margin-bottom: 20px;
}

.result-card {
    background-color: var(--bg-card);
    width: 100%;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid #334155;
}

.correct-flash {
    background-color: var(--correct) !important;
    border-color: var(--correct) !important;
    color: white !important;
}

.wrong-flash {
    background-color: var(--wrong) !important;
    border-color: var(--wrong) !important;
    color: white !important;
}

/* Achievements Screen */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.achievement-card {
    background-color: var(--bg-card);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.achievement-card.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.achievement-card.unlocked {
    opacity: 1;
    filter: none;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.achievement-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.achievement-title {
    font-size: 12pt;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 5px;
}

.achievement-desc {
    font-size: 9pt;
    color: var(--text-muted);
    line-height: 1.4;
}

.achievement-card.unlocked .achievement-title {
    color: var(--accent);
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.5s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 24px;
}

.toast-message {
    font-size: 11pt;
    font-weight: bold;
}

/* Game Mode Selection Screen */
.screen-title {
    font-size: 20pt;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 30px;
    text-align: center;
}

.modes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.mode-card {
    background-color: var(--bg-card);
    border: 2px solid #334155;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.mode-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.mode-name {
    font-size: 14pt;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 8px;
}

.mode-desc {
    font-size: 10pt;
    color: var(--text-muted);
    line-height: 1.5;
}

.mode-card:hover .mode-name {
    color: var(--accent);
}

/* Hide timer in Zen Mode */
.zen-mode .timer-container {
    display: none;
}

/* Lives System */
.lives-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 12pt;
}

.lives-label {
    color: var(--text-muted);
}

.lives-display {
    font-size: 18pt;
    letter-spacing: 5px;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.btn-hint {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
    font-size: 11pt;
    padding: 12px 20px;
}

.btn-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.btn-hint:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-share {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
    font-size: 11pt;
    padding: 12px 20px;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.option-btn.hidden {
    opacity: 0.2;
    pointer-events: none;
}

/* Confetti Particle Effect */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f00;
    animation: confetti-fall 1s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100px) translateX(var(--tx, 0px)) rotate(720deg);
        opacity: 0;
    }
}

/* Screen Shake Effect */
.screen-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Smooth Screen Transitions */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: calc(100% - 50px);
    padding: 30px 24px;
    overflow-y: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

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

.screen.slide-out {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}
