/* =========================================================
   STYLE - ESCAPE MATH
   Design premium : Coffre-Fort / Métallique / Digicode
========================================================= */

:root {
    --bg-dark: #111827;
    --vault-metal: #374151;
    --vault-light: #4b5563;
    --vault-dark: #1f2937;
    
    --neon-green: #10b981;
    --neon-red: #ef4444;
    --neon-yellow: #f59e0b;
    
    --text-main: #f3f4f6;
    --lcd-bg: #064e3b;
    --lcd-text: #34d399;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at center, #1f2937, #030712);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

/* Floating Back Button */
.btn-back {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-4px);
}

.app-container {
    width: 100%;
    max-width: 900px;
    margin: auto;
    position: relative;
}

.screen {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.screen.active {
    display: block;
}

/* Menu Screen */
.vault-panel {
    background: linear-gradient(135deg, var(--vault-light), var(--vault-dark));
    border: 4px solid #6b7280;
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 0 15px 30px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}
/* Rivets on vault door */
.vault-panel::before, .vault-panel::after {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    background: #9ca3af;
    border-radius: 50%;
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.5), 1px 1px 2px rgba(255,255,255,0.2);
}
.vault-panel::before { top: 20px; left: 20px; }
.vault-panel::after { top: 20px; right: 20px; }

.logo-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

h1 {
    font-family: 'Share Tech Mono', monospace;
    font-size: 3rem;
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(16,185,129,0.5);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: #9ca3af;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.instructions {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--neon-yellow);
}

.level-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn-level {
    background: linear-gradient(to bottom, #4b5563, #374151);
    border: 2px solid #6b7280;
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.2), 0 4px 6px rgba(0,0,0,0.4);
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn-level:hover {
    background: linear-gradient(to bottom, #6b7280, #4b5563);
    transform: translateY(-2px);
}
.btn-level:active {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

/* Game Screen */
.vault-interior {
    background: #1f2937;
    border: 4px solid #4b5563;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.vault-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #374151;
    padding-bottom: 1rem;
}

.vault-header h2 {
    font-family: 'Share Tech Mono', monospace;
    color: var(--neon-red);
    font-size: 1.5rem;
}

.escape-timer {
    font-family: 'Share Tech Mono', monospace;
    font-size: 2rem;
    color: var(--neon-red);
    background: #000;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 2px solid #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    text-shadow: 0 0 5px #ef4444;
}

.btn-quit {
    background: #374151;
    color: #9ca3af;
    border: 1px solid #4b5563;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Digicode Layout */
.safe-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 3rem;
    background: #111827;
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid #374151;
    box-shadow: inset 0 0 20px rgba(0,0,0,1);
}

.digicode-display {
    background: var(--lcd-bg);
    border: 3px solid #065f46;
    padding: 1rem 2rem;
    border-radius: 8px;
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
}

.digit-box {
    font-family: 'Share Tech Mono', monospace;
    font-size: 3.5rem;
    color: var(--lcd-text);
    text-shadow: 0 0 10px var(--lcd-text);
    width: 50px;
    text-align: center;
    border-bottom: 4px solid rgba(52, 211, 153, 0.2);
}

.digicode-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.keypad-btn {
    background: linear-gradient(to bottom, #d1d5db, #9ca3af);
    border: 2px solid #4b5563;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #111827;
    padding: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #4b5563;
    transition: all 0.1s;
}

.keypad-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #4b5563;
}

.keypad-btn.action.clear {
    color: #ef4444;
}
.keypad-btn.action.enter {
    color: #10b981;
}

.vault-msg {
    margin-top: 1.5rem;
    font-family: 'Share Tech Mono', monospace;
    color: var(--neon-yellow);
    font-size: 1.2rem;
    height: 1.5rem;
}
.vault-msg.error { color: var(--neon-red); }
.vault-msg.success { color: var(--neon-green); }

/* Missions Dashboard */
.missions-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.mission-card {
    background: #374151;
    border: 2px solid #4b5563;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    color: #f3f4f6;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.mission-card:hover {
    background: #4b5563;
    transform: translateY(-3px);
    border-color: #9ca3af;
}
.mission-card.completed {
    border-color: var(--neon-green);
    background: rgba(16, 185, 129, 0.1);
}

.mission-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}
.mission-title {
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}
.mission-desc {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}
.mission-status {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    background: #111827;
    padding: 0.3rem 0.8rem;
    border-radius: 99px;
    color: var(--neon-yellow);
}
.mission-card.completed .mission-status {
    color: var(--neon-green);
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(5px);
}
.modal.hidden { display: none; }

.modal-content {
    background: #1f2937;
    border: 2px solid #4b5563;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    animation: fadeIn 0.3s;
}

.modal-header {
    background: #111827;
    padding: 1.5rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #374151;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: #f3f4f6;
}

.btn-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 2rem;
    cursor: pointer;
}

.modal-body {
    padding: 2rem;
    text-align: center;
}

.modal-instruction {
    color: #9ca3af;
    margin-bottom: 1.5rem;
}

.problem-container {
    background: #111827;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    min-height: 100px;
    text-align: center;
}

.answer-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#mission-answer {
    background: #374151;
    border: 2px solid #4b5563;
    border-radius: 8px;
    color: #fff;
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    width: 120px;
    text-align: center;
    font-weight: bold;
}

.btn-verify {
    background: var(--neon-green);
    color: #064e3b;
    border: none;
    border-radius: 8px;
    padding: 0 1.5rem;
    font-weight: 800;
    cursor: pointer;
}

.mission-feedback {
    margin-top: 1rem;
    font-weight: bold;
    min-height: 1.5rem;
}
.mission-feedback.error { color: var(--neon-red); }
.mission-feedback.success { color: var(--neon-green); }

@keyframes pulse-attention {
    0% { transform: scale(1); box-shadow: 0 4px 6px rgba(0,0,0,0.3); border-color: #4b5563; }
    50% { transform: scale(1.03); box-shadow: 0 0 15px rgba(239, 68, 68, 0.6); border-color: #ef4444; }
    100% { transform: scale(1); box-shadow: 0 4px 6px rgba(0,0,0,0.3); border-color: #4b5563; }
}

.mission-card.attention {
    animation: pulse-attention 1.5s infinite;
}

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

/* Hall of Fame */
.hof-section {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--neon-blue);
    border-radius: 8px;
    padding: 1rem;
    width: 100%;
    max-width: 350px;
    text-align: center;
}

.hof-section h3 {
    font-family: 'Share Tech Mono', monospace;
    color: var(--neon-blue);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

#hof-input-area {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#player-name {
    flex-grow: 1;
    background: #000;
    border: 1px solid var(--neon-green);
    color: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.hof-list {
    list-style: none;
    padding: 0;
    text-align: left;
    margin-bottom: 1rem;
}

.hof-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(14, 165, 233, 0.2);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
}

.hof-list li:last-child {
    border-bottom: none;
}
.hof-name { color: #f3f4f6; }
.hof-score { color: var(--neon-green); font-weight: bold; }

@media (max-width: 600px) {
    .digit-box { font-size: 2.5rem; width: 40px; }
    .keypad-btn { padding: 0.8rem; font-size: 1.2rem; }
}

.footer-discreet {
    position: fixed;
    bottom: 5px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.25);
    pointer-events: none;
    z-index: 100;
}
