/* Color Palette */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-terminal: #0d1117;
    --text-primary: #00ff41;
    --text-secondary: #00d9ff;
    --text-muted: #8b949e;
    --accent-red: #ff0055;
    --accent-yellow: #ffcc00;
    --border-color: #30363d;
    --shadow-glow: 0 0 20px rgba(0, 255, 65, 0.3);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', 'Consolas', monospace;
    background: var(--bg-primary);
    color: var(--text-muted);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Scanlines Effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    text-align: center;
    padding: 60px 0 30px;
}

.glitch {
    font-size: 4rem;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow:
        0 0 10px var(--text-primary),
        0 0 20px var(--text-primary),
        0 0 30px var(--text-primary);
    position: relative;
    animation: flicker 3s infinite;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        opacity: 1;
        text-shadow:
            0 0 10px var(--text-primary),
            0 0 20px var(--text-primary),
            0 0 30px var(--text-primary);
    }
    20%, 24%, 55% {
        opacity: 0.8;
        text-shadow: none;
    }
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-red);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--text-secondary);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(39px, 9999px, 94px, 0);
    }
    20% {
        clip: rect(76px, 9999px, 67px, 0);
    }
    40% {
        clip: rect(85px, 9999px, 23px, 0);
    }
    60% {
        clip: rect(43px, 9999px, 61px, 0);
    }
    80% {
        clip: rect(12px, 9999px, 98px, 0);
    }
    100% {
        clip: rect(71px, 9999px, 36px, 0);
    }
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 60px 0;
    align-items: center;
}

.terminal-window {
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-glow);
}

.terminal-header {
    background: var(--bg-secondary);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border-color);
}

.terminal-button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-button.red { background: #ff5f56; }
.terminal-button.yellow { background: #ffbd2e; }
.terminal-button.green { background: #27c93f; }

.terminal-title {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.terminal-body {
    padding: 20px;
    font-size: 0.95rem;
}

.prompt {
    color: var(--text-primary);
    font-weight: bold;
}

.output {
    color: var(--text-muted);
    margin-left: 20px;
}

.cursor {
    animation: blink 1s infinite;
}

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

.hero-content h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.hero-content p {
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.release-info {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 15px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
    border: 2px solid;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.btn-primary:hover {
    background: transparent;
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

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

.btn-secondary:hover {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

/* Features Section */
.features {
    padding: 80px 0;
    background: var(--bg-secondary);
    margin: 60px -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.features h2 {
    text-align: center;
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 50px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: var(--text-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.feature-card h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* Story Section */
.story {
    padding: 80px 0;
}

.story h2 {
    text-align: center;
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 40px;
}

.story-content {
    max-width: 800px;
    margin: 0 auto;
}

.story-content p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.story-content strong {
    color: var(--text-secondary);
}

.story-quote {
    background: var(--bg-terminal);
    border-left: 4px solid var(--text-primary);
    padding: 20px;
    margin: 40px 0;
    font-style: italic;
}

.story-quote p {
    margin-bottom: 10px;
}

.quote-source {
    color: var(--text-primary);
    text-align: right;
    font-size: 0.9rem;
}

/* Leaderboard Section */
.leaderboard-section {
    padding: 80px 0;
    background: var(--bg-secondary);
    margin: 60px -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.leaderboard-section h2 {
    text-align: center;
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.leaderboard-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.leaderboard-info-box {
    max-width: 800px;
    margin: 0 auto 30px;
    padding: 20px;
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
}

.leaderboard-info-box p {
    margin: 10px 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.leaderboard-info-box p:first-child {
    margin-top: 0;
}

.leaderboard-info-box p:last-child {
    margin-bottom: 0;
}

.leaderboard-info-box strong {
    color: var(--text-primary);
}

.dispute-notice {
    display: flex;
    align-items: center;
    color: var(--accent-cyan) !important;
    font-size: 0.9rem;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.dispute-notice svg {
    flex-shrink: 0;
    color: var(--accent-cyan);
}

.dispute-notice a {
    color: var(--accent-cyan);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.3s;
}

.dispute-notice a:hover {
    color: var(--accent-green);
}

.leaderboard-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.filter-btn {
    background: var(--bg-terminal);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 10px 25px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.leaderboard-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Mobile scroll hint */
.scroll-hint {
    display: none;
    text-align: center;
    padding: 8px;
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
}

/* Scroll hint gradient for mobile */
.leaderboard-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.3), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

@media (max-width: 768px) {
    .leaderboard-container::after {
        opacity: 1;
    }
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: var(--bg-primary);
}

.leaderboard-table th {
    padding: 15px;
    text-align: left;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}

.leaderboard-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table tbody tr:hover {
    background: rgba(0, 255, 65, 0.05);
}

.leaderboard-table .loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* Rank styling */
.leaderboard-table td:first-child {
    color: var(--text-primary);
    font-weight: bold;
}

/* Top 3 special styling */
.leaderboard-table tr:nth-child(1) td:first-child {
    color: #FFD700; /* Gold */
}

.leaderboard-table tr:nth-child(2) td:first-child {
    color: #C0C0C0; /* Silver */
}

.leaderboard-table tr:nth-child(3) td:first-child {
    color: #CD7F32; /* Bronze */
}

/* Score column styling */
.leaderboard-table .score-cell {
    color: var(--text-primary);
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* Hint count column styling */
.leaderboard-table .hint-cell {
    color: var(--accent-yellow);
    font-weight: 500;
    text-align: center;
    font-family: 'Courier New', monospace;
}

/* Playthrough badge styling */
.leaderboard-table .playthrough-badge {
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

/* Visual separator between playthroughs */
.leaderboard-table .playthrough-separator {
    border-top: 2px solid var(--accent-cyan);
}

.leaderboard-table .playthrough-separator td {
    padding-top: 20px;
}

/* How to Play Section */
.how-to-play {
    padding: 80px 0;
}

.how-to-play h2 {
    text-align: center;
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 50px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.step {
    text-align: center;
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 20px;
}

.step h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

/* Commands Section */
.commands {
    padding: 80px 0;
    background: var(--bg-secondary);
    margin: 60px -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.commands h2 {
    text-align: center;
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 50px;
}

.command-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.command-item {
    background: var(--bg-terminal);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    transition: all 0.3s;
}

.command-item:hover {
    border-color: var(--text-primary);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
}

.command-item code {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.command-item p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Footer */
footer {
    background: var(--bg-primary);
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
}

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

.footer-content p {
    margin-bottom: 15px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* Beta Download Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(5px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
}

.modal-content {
    background: var(--bg-terminal);
    border: 2px solid var(--text-primary);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(0, 255, 65, 0.4);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    background: var(--bg-secondary);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 30px;
}

.modal-body > p {
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
}

.password-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#beta-password {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 15px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#beta-password:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
}

#beta-password:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#unlock-btn {
    padding: 12px 25px;
    white-space: nowrap;
}

#unlock-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-message {
    color: var(--accent-red);
    text-align: center;
    min-height: 20px;
    font-size: 0.9rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.download-section {
    margin-top: 30px;
    transition: all 0.3s ease;
}

.download-section.hidden {
    display: none;
}

.success-message {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--text-primary);
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.success-message p {
    color: var(--text-primary);
    margin: 0;
    font-weight: bold;
}

.download-links {
    display: grid;
    gap: 15px;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px 20px;
    text-decoration: none;
    transition: all 0.3s;
}

.download-btn:hover {
    border-color: var(--text-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
    transform: translateX(5px);
}

.download-icon {
    font-size: 2rem;
}

.download-btn div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.download-btn strong {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.download-btn small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .glitch {
        font-size: 2.5rem;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .features h2,
    .story h2,
    .leaderboard-section h2,
    .how-to-play h2,
    .commands h2 {
        font-size: 2rem;
    }

    .leaderboard-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .leaderboard-table {
        font-size: 0.85rem;
        min-width: 650px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 5px;
        font-size: 0.85rem;
    }

    /* Hide date column on mobile to make room for hints */
    .leaderboard-table th:last-child,
    .leaderboard-table td:last-child {
        display: none;
    }

    /* Compress hint column on tablets */
    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        width: 60px;
        padding-left: 3px;
        padding-right: 3px;
    }

    .leaderboard-controls {
        gap: 10px;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .leaderboard-info-box {
        font-size: 0.9rem;
        padding: 15px;
    }

    .modal-content {
        width: 95%;
    }

    .modal-body {
        padding: 20px;
    }

    .password-input-container {
        flex-direction: column;
    }

    #unlock-btn {
        width: 100%;
    }
}

/* Extra small devices (phones in portrait, less than 480px) */
@media (max-width: 480px) {
    .leaderboard-table {
        font-size: 0.75rem;
        min-width: 550px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 3px;
        font-size: 0.75rem;
    }

    /* Further compress rank column */
    .leaderboard-table th:first-child,
    .leaderboard-table td:first-child {
        width: 35px;
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Compress hint column */
    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        width: 45px;
        padding-left: 2px;
        padding-right: 2px;
    }

    /* Compress playthrough column (now 6th column with hints added) */
    .leaderboard-table th:nth-child(6),
    .leaderboard-table td:nth-child(6) {
        width: 50px;
    }

    .leaderboard-section h2 {
        font-size: 1.6rem;
    }

    .leaderboard-subtitle {
        font-size: 0.95rem;
        padding: 0 10px;
    }

    .leaderboard-info-box {
        font-size: 0.85rem;
        padding: 12px;
    }

    .leaderboard-controls {
        padding: 0 10px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}
