/* VOIDBOUND - Puzzle System Styles */

/* ============================================
   Puzzle Overlay
   ============================================ */
.puzzle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: puzzleFadeIn 0.3s ease-out;
}

@keyframes puzzleFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.puzzle-container {
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg,
        rgba(10, 30, 40, 0.95) 0%,
        rgba(5, 15, 25, 0.98) 100%);
    border: 2px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.3);
    padding: var(--space-lg);
}

/* ============================================
   Puzzle Header
   ============================================ */
.puzzle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(0, 240, 255, 0.3);
}

.puzzle-header h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
}

.puzzle-close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid var(--danger);
    border-radius: 4px;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.puzzle-close-btn:hover {
    background: var(--danger);
    color: white;
}

.puzzle-description {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

/* ============================================
   Puzzle Controls
   ============================================ */
.puzzle-controls {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    justify-content: center;
    flex-wrap: wrap;
}

.puzzle-btn {
    padding: var(--space-sm) var(--space-lg);
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-normal);
    font-family: var(--font-display);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.puzzle-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--primary);
    color: var(--text-bright);
}

.puzzle-btn.primary {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.puzzle-btn.primary:hover {
    background: var(--primary);
    color: var(--bg-dark);
}

.puzzle-btn.hint-btn {
    color: var(--warning);
    border-color: var(--warning);
}

.puzzle-btn.hint-btn:hover {
    background: rgba(255, 170, 0, 0.2);
}

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

/* ============================================
   Hints
   ============================================ */
.puzzle-hints {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid var(--warning);
    border-radius: 4px;
}

.hint-text {
    color: var(--warning);
    font-size: 0.9rem;
}

/* ============================================
   Results
   ============================================ */
.puzzle-result {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: 4px;
    text-align: center;
    animation: resultPop 0.3s ease-out;
}

@keyframes resultPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.puzzle-result.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.puzzle-result.success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.puzzle-result.failure {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.success-icon,
.failure-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

/* ============================================
   Hacking Puzzle (Wordle-style)
   ============================================ */
.hacking-display {
    display: flex;
    justify-content: center;
}

.hacking-terminal {
    background: rgba(0, 20, 0, 0.9);
    border: 1px solid #00ff00;
    border-radius: 4px;
    padding: var(--space-lg);
    min-width: 350px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px dashed rgba(0, 255, 0, 0.5);
}

.terminal-status {
    color: #00ff00;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.attempts-left {
    color: #00ff00;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.attempts-left.critical {
    color: #ff4444;
    animation: blink 0.5s infinite;
}

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

.terminal-grid {
    margin-bottom: var(--space-md);
}

.guess-row {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    justify-content: center;
}

.guess-cell {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    animation: cellReveal 0.3s ease-out;
}

@keyframes cellReveal {
    from {
        transform: rotateX(90deg);
    }
    to {
        transform: rotateX(0);
    }
}

.guess-cell.correct {
    background: #00aa00;
    border-color: #00ff00;
    color: white;
}

.guess-cell.present {
    background: #aa7700;
    border-color: #ffaa00;
    color: white;
}

.guess-cell.absent {
    background: #333;
    border-color: #555;
    color: #888;
}

.terminal-input {
    display: flex;
    gap: var(--space-sm);
}

.terminal-input input {
    flex: 1;
    background: rgba(0, 30, 0, 0.8);
    border: 1px solid #00ff00;
    border-radius: 4px;
    padding: var(--space-sm);
    color: #00ff00;
    font-family: var(--font-mono);
    font-size: 1rem;
    text-transform: uppercase;
}

.terminal-input input::placeholder {
    color: rgba(0, 255, 0, 0.5);
}

.hack-submit {
    padding: var(--space-sm) var(--space-md);
    background: #00aa00;
    border: none;
    border-radius: 4px;
    color: white;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hack-submit:hover {
    background: #00ff00;
    color: black;
}

.keyboard-hint {
    margin-top: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(0, 255, 0, 0.5);
    text-align: center;
}

/* ============================================
   Sequence Puzzle
   ============================================ */
.sequence-display {
    text-align: center;
}

.sequence-screen {
    background: rgba(0, 0, 30, 0.9);
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: inset 0 0 30px rgba(0, 240, 255, 0.1);
}

.sequence-label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: var(--space-md);
    letter-spacing: 2px;
}

.sequence-input {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    color: var(--text-bright);
    letter-spacing: 0.5rem;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.sequence-keypad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-sm);
    max-width: 300px;
    margin: 0 auto;
}

.keypad-btn {
    width: 50px;
    height: 50px;
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-bright);
    font-family: var(--font-display);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.keypad-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--primary);
    transform: scale(1.05);
}

.keypad-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Wire Puzzle
   ============================================ */
.wire-puzzle {
    text-align: center;
}

.wire-timer {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--warning);
    margin-bottom: var(--space-md);
}

.wire-timer.critical {
    color: var(--danger);
    animation: blink 0.5s infinite;
}

.wire-board {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: var(--space-xl);
    padding: var(--space-lg);
    background: rgba(20, 20, 30, 0.8);
    border-radius: 8px;
    position: relative;
    min-height: 300px;
}

.wire-sources,
.wire-targets {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: var(--space-md);
}

.wire-node {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.wire-node.source {
    background: var(--wire-color);
    border: 3px solid rgba(255, 255, 255, 0.5);
}

.wire-node.source:hover,
.wire-node.source.selected {
    transform: scale(1.1);
    box-shadow: 0 0 20px currentColor;
}

.wire-node.target {
    background: rgba(50, 50, 60, 0.8);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.wire-node.target:hover {
    border-color: var(--primary);
    transform: scale(1.1);
}

.node-label {
    font-family: var(--font-display);
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.wire-connections {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* ============================================
   Pattern Puzzle
   ============================================ */
.pattern-puzzle {
    text-align: center;
}

.pattern-display {
    padding: var(--space-lg);
    background: rgba(20, 20, 30, 0.8);
    border-radius: 8px;
}

.pattern-label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: var(--space-md);
    letter-spacing: 2px;
}

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-size), 50px);
    gap: 4px;
    justify-content: center;
}

.pattern-cell {
    width: 50px;
    height: 50px;
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pattern-cell:hover {
    border-color: var(--primary);
}

.pattern-cell.active {
    background: var(--primary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

/* ============================================
   Frequency Puzzle
   ============================================ */
.frequency-puzzle {
    text-align: center;
}

.freq-display {
    background: rgba(0, 10, 20, 0.9);
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.freq-label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--primary);
    letter-spacing: 2px;
}

.freq-value {
    font-family: var(--font-mono);
    font-size: 3rem;
    color: var(--text-bright);
    margin: var(--space-md) 0;
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.freq-meter {
    position: relative;
    height: 20px;
    background: rgba(30, 30, 40, 0.8);
    border-radius: 10px;
    overflow: visible;
}

.freq-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 10px;
    transition: width 0.1s ease;
}

.freq-target {
    position: absolute;
    top: -5px;
    width: 4px;
    height: 30px;
    background: var(--success);
    transform: translateX(-50%);
    box-shadow: 0 0 10px var(--success);
}

.freq-tuner {
    padding: var(--space-md) 0;
}

.freq-tuner input {
    width: 100%;
    accent-color: var(--primary);
}

.freq-static {
    height: 60px;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 2px,
        rgba(255, 255, 255, 0.03) 4px
    );
    border-radius: 4px;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

.static-noise {
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect fill="white" opacity="0.1"/></svg>');
    animation: noise 0.2s steps(5) infinite;
}

@keyframes noise {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-5%, -5%); }
    50% { transform: translate(5%, 5%); }
    75% { transform: translate(-5%, 5%); }
}

/* ============================================
   Cipher Puzzle
   ============================================ */
.cipher-puzzle {
    text-align: center;
}

.cipher-display {
    background: rgba(20, 20, 30, 0.8);
    border-radius: 8px;
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.cipher-label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: var(--space-sm);
    letter-spacing: 2px;
}

.cipher-encrypted {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--warning);
    letter-spacing: 4px;
}

.cipher-input-container {
    margin-bottom: var(--space-lg);
}

.cipher-input-container label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: var(--space-sm);
}

.cipher-input-container input {
    width: 100%;
    padding: var(--space-md);
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
}

.cipher-input-container input::placeholder {
    color: var(--text-dim);
}

.cipher-alphabet {
    background: rgba(20, 20, 30, 0.8);
    border-radius: 4px;
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
}

.alphabet-row {
    display: flex;
    justify-content: center;
    gap: 2px;
    padding: var(--space-xs) 0;
}

.alphabet-row span {
    width: 18px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.alphabet-row.original span {
    color: var(--text-dim);
}

.alphabet-row.shifted span {
    color: var(--primary);
}

.cipher-shift-control {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    justify-content: center;
}

.cipher-shift-control label {
    font-family: var(--font-mono);
    color: var(--text-dim);
}

.cipher-shift-control input {
    width: 200px;
    accent-color: var(--primary);
}

/* ============================================
   Simon Says Puzzle
   ============================================ */
.simon-puzzle {
    text-align: center;
}

.simon-status {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: var(--space-lg);
}

.simon-board {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    max-width: 300px;
    margin: 0 auto;
}

.simon-btn {
    width: 120px;
    height: 120px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.simon-btn:hover {
    transform: scale(1.05);
}

.simon-btn.lit {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 30px currentColor;
}

.simon-btn.red {
    background: #cc0000;
    box-shadow: inset 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.simon-btn.red.lit {
    background: #ff4444;
}

.simon-btn.blue {
    background: #0044cc;
    box-shadow: inset 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.simon-btn.blue.lit {
    background: #4488ff;
}

.simon-btn.green {
    background: #00aa00;
    box-shadow: inset 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.simon-btn.green.lit {
    background: #44ff44;
}

.simon-btn.yellow {
    background: #ccaa00;
    box-shadow: inset 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.simon-btn.yellow.lit {
    background: #ffdd44;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 600px) {
    .puzzle-container {
        padding: var(--space-md);
        max-height: 100vh;
        border-radius: 0;
    }

    .hacking-terminal {
        min-width: 100%;
    }

    .guess-cell {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .sequence-keypad {
        grid-template-columns: repeat(5, 1fr);
    }

    .keypad-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .pattern-grid {
        grid-template-columns: repeat(var(--grid-size), 40px);
    }

    .pattern-cell {
        width: 40px;
        height: 40px;
    }

    .simon-btn {
        width: 80px;
        height: 80px;
    }

    .wire-node {
        width: 40px;
        height: 40px;
    }

    .alphabet-row span {
        width: 12px;
        font-size: 0.6rem;
    }
}
