/* ═══════════════════════════════════════
   MIRAGE GENESIS : Le Dernier Message
   Cyberpunk Noir Aesthetic
   ═══════════════════════════════════════ */

:root {
    --bg-deep:    #0a0a14;
    --bg-dark:    #1a1a2e;
    --bg-panel:   #16213e;
    --cyan:       #00b4d8;
    --cyan-dim:   #00b4d844;
    --cyan-glow:  #00b4d866;
    --gold:       #e8b931;
    --gold-dim:   #e8b93144;
    --red:        #e63946;
    --green:      #4ade80;
    --white:      #e0e0e0;
    --gray:       #666680;
    --text:       #c8c8d8;
    --font-mono:  'Share Tech Mono', monospace;
    --font-title: 'Orbitron', sans-serif;
    --font-body:  'Inter', sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ── Scanlines overlay ── */
.scanlines {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
}

/* ═══════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════ */

.landing-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(ellipse at 30% 20%, rgba(0, 180, 216, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(232, 185, 49, 0.04) 0%, transparent 50%),
        var(--bg-deep);
}

.landing-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
}

.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    opacity: 1;
}

.screen.fade-out {
    opacity: 0;
}

/* Logo */
.logo-container {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-container h1 {
    font-family: var(--font-title);
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 900;
    color: var(--cyan);
    letter-spacing: 0.15em;
    text-shadow: 0 0 30px var(--cyan-glow), 0 0 60px var(--cyan-dim);
    margin-bottom: 0.8rem;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 3vw, 1.1rem);
    color: var(--gold);
    letter-spacing: 0.1em;
    opacity: 0.8;
}

/* Language choice */
.lang-choice {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.btn-lang {
    font-family: var(--font-mono);
    font-size: 1rem;
    padding: 0.8rem 2rem;
    background: transparent;
    color: var(--cyan);
    border: 1px solid var(--cyan-dim);
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
}

.btn-lang:hover {
    background: var(--cyan-dim);
    border-color: var(--cyan);
    box-shadow: 0 0 20px var(--cyan-dim);
}

.version-tag {
    position: fixed;
    bottom: 1rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gray);
    opacity: 0.5;
}

/* Name screen */
.name-container {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.prompt-text {
    font-family: var(--font-mono);
    color: var(--cyan);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.input-group {
    position: relative;
    margin-bottom: 2rem;
}

.cyber-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 180, 216, 0.05);
    border: none;
    border-bottom: 2px solid var(--cyan-dim);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    text-align: center;
    outline: none;
    transition: border-color 0.3s ease;
}

.cyber-input:focus {
    border-bottom-color: var(--cyan);
}

.cyber-input::placeholder {
    color: var(--gray);
    opacity: 0.5;
}

.name-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Buttons */
.btn-cyber {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 0.7rem 1.8rem;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: transparent;
    color: var(--cyan);
    border-color: var(--cyan);
}

.btn-primary:hover {
    background: var(--cyan);
    color: var(--bg-deep);
    box-shadow: 0 0 20px var(--cyan-dim);
}

.btn-secondary {
    background: transparent;
    color: var(--gray);
    border-color: var(--gray);
}

.btn-secondary:hover {
    color: var(--white);
    border-color: var(--white);
}

/* Intro */
.intro-container {
    max-width: 500px;
    width: 100%;
}

.intro-text {
    min-height: 300px;
}

.intro-line {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.6rem;
    line-height: 1.6;
}

.btn-start-game {
    margin-top: 2rem;
}

.fade-in {
    animation: fadeIn 1s ease forwards;
}

/* ═══════════════════════════════════════
   GAME PAGE
   ═══════════════════════════════════════ */

.game-body {
    display: flex;
    flex-direction: column;
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(0, 180, 216, 0.04) 0%, transparent 60%),
        var(--bg-deep);
}

/* Progress bar */
.progress-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1rem 0.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(to bottom, var(--bg-deep) 60%, transparent);
}

.progress-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
}

.progress-dot .dot-number {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--gray);
}

.progress-dot.completed {
    border-color: var(--cyan);
    background: var(--cyan-dim);
}

.progress-dot.completed .dot-number {
    color: var(--cyan);
}

.progress-dot.current {
    border-color: var(--gold);
    background: var(--gold-dim);
    box-shadow: 0 0 12px var(--gold-dim);
}

.progress-dot.current .dot-number {
    color: var(--gold);
    font-weight: bold;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    margin-top: 3rem;
}

.level-indicator {
    font-family: var(--font-title);
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 0.15em;
}

.btn-icon {
    background: none;
    border: 1px solid var(--gray);
    color: var(--gray);
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--cyan);
    border-color: var(--cyan);
}

/* Dropdown menu */
.dropdown-menu {
    position: fixed;
    top: 4.5rem;
    right: 1.5rem;
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    z-index: 200;
}

.dropdown-menu.open {
    display: flex;
}

.dropdown-menu button {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--gray);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.dropdown-menu button:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* Game container */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1.5rem 1.5rem;
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    gap: 1rem;
}

/* Terminal / Narrative zone */
.narrative-zone {
    background: var(--bg-dark);
    border: 1px solid var(--cyan-dim);
    border-radius: 4px;
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--cyan-dim);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.terminal-dot.red { background: var(--red); opacity: 0.7; }
.terminal-dot.yellow { background: var(--gold); opacity: 0.7; }
.terminal-dot.green { background: var(--green); opacity: 0.7; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gray);
    margin-left: 8px;
}

.terminal-body {
    padding: 1rem 1.2rem;
    min-height: 120px;
    max-height: 250px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
}

.terminal-body::-webkit-scrollbar {
    width: 4px;
}
.terminal-body::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
.terminal-body::-webkit-scrollbar-thumb {
    background: var(--cyan-dim);
}

/* Puzzle zone */
.puzzle-zone {
    background: var(--bg-dark);
    border: 1px solid var(--cyan-dim);
    border-radius: 4px;
    padding: 1.2rem;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.puzzle-zone .cipher-text {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--gold);
    text-align: center;
    word-break: break-all;
    line-height: 1.8;
    letter-spacing: 0.1em;
    padding: 1rem;
    background: rgba(232, 185, 49, 0.05);
    border: 1px dashed var(--gold-dim);
    width: 100%;
}

.puzzle-zone .puzzle-image {
    max-width: 100%;
    max-height: 300px;
    border: 1px solid var(--cyan-dim);
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.puzzle-zone .puzzle-image:hover {
    transform: scale(1.02);
}

/* Drag & drop puzzle */
.puzzle-zone .fragments-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.puzzle-zone .fragment {
    padding: 0.8rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--gray);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text);
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.puzzle-zone .fragment:hover {
    border-color: var(--cyan);
}

.puzzle-zone .fragment.dragging {
    opacity: 0.5;
    border-color: var(--gold);
}

.puzzle-zone .fragment.correct {
    border-color: var(--green);
    background: rgba(74, 222, 128, 0.1);
}

/* Answer zone */
.answer-zone {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.answer-input-group {
    display: flex;
    gap: 0.5rem;
}

.answer-input {
    flex: 1;
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    background: var(--bg-dark);
    border: 1px solid var(--cyan-dim);
    border-bottom: 2px solid var(--cyan-dim);
    border-radius: 2px;
}

.answer-input:focus {
    border-color: var(--cyan);
    background: rgba(0, 180, 216, 0.05);
}

.btn-submit {
    padding: 0.7rem 1.5rem;
    white-space: nowrap;
}

.answer-feedback {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    min-height: 1.2rem;
    padding: 0 0.2rem;
}

.answer-feedback.success {
    color: var(--green);
}

.answer-feedback.error {
    color: var(--red);
}

/* Hint zone */
.hint-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
}

.btn-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-hint:hover {
    border-color: var(--gold);
    box-shadow: 0 0 12px var(--gold-dim);
}

.btn-hint:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.hint-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    font-size: 0.7rem;
    font-weight: bold;
}

.hint-timer {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--gray);
}

.hint-content {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(232, 185, 49, 0.06);
    border-left: 3px solid var(--gold);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--gold);
    line-height: 1.6;
    opacity: 0.9;
}

/* ═══════════════════════════════════════
   END SCREEN
   ═══════════════════════════════════════ */

.end-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.end-container {
    text-align: center;
    max-width: 500px;
}

.connection-lost {
    font-family: var(--font-title);
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: var(--red);
    letter-spacing: 0.2em;
    margin-bottom: 2rem;
    text-shadow: 0 0 30px rgba(230, 57, 70, 0.4);
}

.end-message {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.8;
    margin-bottom: 2rem;
    white-space: pre-wrap;
}

.badge-display {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px solid var(--gold-dim);
    background: rgba(232, 185, 49, 0.04);
}

.badge-name {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--gold);
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.badge-message {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.7;
    font-style: italic;
}

.end-teaser {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--cyan);
    margin-bottom: 1rem;
}

.end-cta {
    margin-top: 2rem;
}

/* ── Transition overlay ── */
.transition-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 600px) {
    .game-container {
        padding: 0.5rem 1rem 1rem;
    }
    
    .terminal-body {
        font-size: 0.78rem;
        max-height: 180px;
    }
    
    .answer-input-group {
        flex-direction: column;
    }
    
    .btn-submit {
        width: 100%;
    }
    
    .progress-dot {
        width: 24px;
        height: 24px;
    }
    
    .progress-dot .dot-number {
        font-size: 0.55rem;
    }
}
