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

:root {
    --primary: #fff;
    --bg: #000;
    --gray: #666;
    --light-gray: #999;
}

body {
    background: var(--bg);
    color: var(--primary);
    font-family: 'Share Tech Mono', monospace;
    overflow-x: hidden;
    cursor: crosshair;
    line-height: 1.6;
}

/* CRT Screen Effect */
body::before {
    content: '';
    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;
}

/* Scanline animation */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    animation: scanline 8s linear infinite;
    pointer-events: none;
    z-index: 9998;
}

@keyframes scanline {
    0% { transform: translateY(-100vh); }
    100% { transform: translateY(100vh); }
}

/* Glitch animation */
@keyframes glitch {
    0%, 100% { transform: translate(0); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(-2px, -2px); }
}

.glitch {
    animation: glitch 0.3s infinite;
}

/* Flicker */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
    padding: 40px 20px;
    border: 2px solid var(--primary);
    position: relative;
    animation: flicker 3s infinite;
}

header::before {
    content: '⟨ SYSTEM ONLINE ⟩';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg);
    padding: 0 20px;
    font-size: 12px;
    letter-spacing: 2px;
}

h1 {
    font-family: 'VT323', monospace;
    font-size: 4rem;
    letter-spacing: 4px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: var(--light-gray);
}

.cursor {
    display: inline-block;
    width: 12px;
    height: 1.2rem;
    background: var(--primary);
    animation: blink 1s step-end infinite;
    margin-left: 5px;
    vertical-align: text-bottom;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Navigation */
nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 60px;
    flex-wrap: wrap;
}

nav a {
    color: var(--primary);
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid var(--primary);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

nav a::before {
    content: '> ';
    opacity: 0;
    transition: opacity 0.3s;
}

nav a:hover::before,
nav a.active::before {
    opacity: 1;
}

nav a:hover,
nav a.active {
    background: var(--primary);
    color: var(--bg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Terminal Window */
.terminal {
    background: var(--bg);
    border: 2px solid var(--primary);
    padding: 0;
    margin-bottom: 40px;
    position: relative;
}

.terminal-header {
    border-bottom: 1px solid var(--primary);
    padding: 10px 20px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.terminal-title {
    letter-spacing: 2px;
}

.terminal-buttons {
    display: flex;
    gap: 10px;
}

.terminal-button {
    width: 12px;
    height: 12px;
    border: 1px solid var(--primary);
    cursor: pointer;
    transition: all 0.3s;
}

.terminal-button:hover {
    background: var(--primary);
}

.terminal-content {
    padding: 30px;
}

/* Dream Archive Grid */
.dream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.dream-card {
    border: 1px solid var(--gray);
    padding: 20px;
    transition: all 0.3s;
    position: relative;
    cursor: pointer;
}

.dream-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.dream-id {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.dream-content {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: var(--light-gray);
}

.dream-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid var(--gray);
    color: var(--gray);
}

/* Stats Section */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 60px 0;
}

.stat-card {
    text-align: center;
    padding: 30px;
    border: 1px solid var(--gray);
}

.stat-number {
    font-family: 'VT323', monospace;
    font-size: 3rem;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 12px;
    color: var(--gray);
    letter-spacing: 2px;
}

/* Form Styles */
.form-group {
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 10px;
    letter-spacing: 1px;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
textarea,
select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--gray);
    color: var(--primary);
    padding: 15px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    transition: all 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

select {
    cursor: pointer;
}

input[type="checkbox"] {
    margin-right: 10px;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--gray);
    margin-top: 5px;
}

.hint {
    font-size: 12px;
    color: var(--gray);
    margin-top: 5px;
}

/* Buttons */
button,
.cta-button {
    background: var(--bg);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 15px 40px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 2px;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.cta-button:hover {
    background: var(--primary);
    color: var(--bg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

button:active,
.cta-button:active {
    transform: scale(0.98);
}

/* Loading State */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.active {
    display: block;
}

.loading-text {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    animation: flicker 1s infinite;
}

.loading-subtext {
    margin-top: 10px;
    font-size: 14px;
    color: var(--gray);
}

/* Success Message */
.success-message {
    display: none;
    text-align: center;
    padding: 40px;
}

.success-message.active {
    display: block;
}

.success-title {
    font-family: 'VT323', monospace;
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.dream-id-display {
    font-size: 1.5rem;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid var(--primary);
    display: inline-block;
}

/* About Page Styles */
.about-content {
    line-height: 1.8;
}

.about-content p {
    margin-bottom: 15px;
    color: var(--light-gray);
}

.section-title {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    margin: 40px 0 20px 0;
    color: var(--primary);
}

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

.faq-q {
    color: var(--primary);
    margin-top: 20px;
    margin-bottom: 5px;
}

.faq-a {
    color: var(--light-gray);
    margin-bottom: 15px;
    padding-left: 20px;
}

.text-link {
    color: var(--primary);
    text-decoration: underline;
}

.text-link:hover {
    text-decoration: none;
}

/* Submit Page Styles */
.instructions {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    margin-bottom: 30px;
    border-left: 3px solid var(--primary);
}

.example {
    font-style: italic;
    color: var(--gray);
    margin: 10px 0;
    padding-left: 20px;
    border-left: 2px solid var(--gray);
}

/* Archive Page Styles */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
}

.filter-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.filter-options input[type="radio"] {
    cursor: pointer;
}

.archive-stats {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid var(--gray);
}

.stat-inline {
    display: flex;
    gap: 10px;
}

.stat-value {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

/* Dream Detail Page */
.dream-detail {
    max-width: 800px;
    margin: 0 auto;
}

.dream-id-large {
    font-family: 'VT323', monospace;
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.dream-metadata {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 30px;
}

.dream-content-large {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 40px;
    color: var(--light-gray);
}

.dream-tags-section {
    margin-bottom: 40px;
}

.section-label {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.dream-tags-large {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.tag-large {
    font-size: 14px;
    padding: 8px 16px;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.dream-interpretation {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    margin-bottom: 40px;
    border-left: 3px solid var(--primary);
}

.dream-actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 40px;
}

.error-message {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    color: #ff4444;
    margin-bottom: 20px;
}

/* Welcome Section */
.welcome {
    margin-bottom: 60px;
}

.welcome .terminal-content {
    text-align: center;
}

.glitch-text {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 60px 20px;
    border-top: 1px solid var(--gray);
    margin-top: 80px;
    font-size: 12px;
    color: var(--gray);
    letter-spacing: 2px;
}

/* Matrix background */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.05;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg);
    border: 2px solid var(--primary);
    padding: 20px 30px;
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.5s;
}

.notification.show {
    transform: translateX(0);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border: 1px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    nav {
        flex-direction: column;
        gap: 15px;
    }

    .dream-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-options {
        flex-direction: column;
    }

    .archive-stats {
        flex-direction: column;
        gap: 10px;
    }

    .dream-actions {
        flex-direction: column;
    }

    .dream-actions .cta-button {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .terminal-content {
        padding: 20px;
    }
}
