:root {
    --bg-color: #fdfcf8; /* Soft Paper White */
    --card-bg: rgba(255, 255, 255, 0.9);
    --accent-color: #1a1a1b; /* Ink Black */
    --accent-highlight: #ffd700; /* Marker Yellow */
    --accent-theme: #a5d8ff; /* Marker Blue */
    --text-primary: #1a1a1b;
    --text-secondary: #5a5a5c;
    --grid-border: #d1d5db;
    --glass-blur: blur(4px);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --newspaper-border: 2px solid #1a1a1b;
}

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

body {
    font-family: 'Lexend', sans-serif;
    background-color: var(--bg-color);
    background-image: url('paper-texture.png');
    background-blend-mode: multiply;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.background-glow {
    display: none; /* Removed for cleaner newspaper look */
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid #eee;
    border-bottom-color: var(--accent-color);
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    background: #fee2e2;
    color: #ef4444;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid #fca5a5;
    margin-top: 1rem;
}

.status-badge.online {
    background: #dcfce7;
    color: #22c55e;
    border-color: #86efac;
}

/* Newspaper Header */
.newspaper-header {
    text-align: center;
    padding: 2rem 1rem 1rem;
    border-bottom: 4px double var(--accent-color);
    margin-bottom: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.date-line {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.newspaper-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 4.5rem;
    font-weight: 900;
    letter-spacing: -3px;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.newspaper-header h1 span {
    font-style: italic;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.newspaper-header h1 span::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    height: 25px;
    background: var(--accent-highlight);
    z-index: -1;
    transform: rotate(-1deg);
    opacity: 0.8;
}

.sub-masthead {
    font-size: 1.1rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-top: 0.5rem;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 4rem;
    align-items: start;
}

/* Grid Styles */
.strands-grid {
    display: grid;
    grid-template-columns: repeat(6, 60px);
    grid-template-rows: repeat(8, 60px);
    gap: 10px;
    padding: 20px;
    background: white;
    border: 3px solid var(--accent-color);
    border-radius: 4px;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.05);
}

.cell {
    width: 60px;
    height: 60px;
    background: #fff;
    border: 1px solid var(--grid-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: text;
    transition: all 0.1s ease;
    outline: none;
}

.cell:focus {
    border-color: var(--accent-color);
    border-width: 2px;
    background: #f8fafc;
}

.cell:hover {
    background: #f1f5f9;
}

/* Controls */
.controls {
    margin-top: 2rem;
    display: flex;
    gap: 1.5rem;
}

.primary-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.secondary-btn {
    background: white;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 1rem 2.5rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
}

/* Results */
.results-container {
    background: white;
    padding: 2.5rem;
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.05);
    max-height: 700px;
    overflow-y: auto;
}

.results-container h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

.results-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.word-tag {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid var(--grid-border);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.word-tag:hover {
    background: #e5e7eb;
}

.word-tag.active-highlight {
    background: var(--accent-theme);
}

.word-tag.spangram {
    background: var(--accent-highlight);
    border-color: #d97706;
}

/* Ad Containers */
.ad-container {
    margin: 3rem auto;
    border: 1px solid var(--grid-border);
    background: white;
    padding: 15px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: fit-content;
}

.top-leaderboard {
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.bottom-banner {
    margin-top: 4rem;
}

.ad-placeholder {
    background: #f9fafb;
    border: 1px dashed var(--grid-border);
    color: #9ca3af;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-leaderboard .ad-placeholder { width: 728px; height: 90px; }
.sidebar-ad .ad-placeholder { width: 300px; height: 250px; }
.bottom-banner .ad-placeholder { width: 970px; height: 90px; }

/* Info Section */
.info-section {
    max-width: 1200px;
    margin: 6rem auto;
    border-top: 4px double var(--accent-color);
    padding-top: 4rem;
}

.info-section h2 {
    font-family: 'Playfair Display', serif;
    text-align: center;
    font-size: 3rem;
    margin-bottom: 3rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
}

.info-card {
    background: white;
    padding: 2.5rem;
    border: 1px solid var(--grid-border);
    border-radius: 4px;
    position: relative;
}

.info-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 5rem 1rem;
    background: #1a1a1b;
    color: #a1a1aa;
    margin-top: 6rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    margin: 0 1rem;
    font-weight: 600;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border: 2px solid var(--accent-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.cookie-banner.hidden { display: none; }

@media (max-width: 1100px) {
    .main-layout { grid-template-columns: 1fr; }
    .newspaper-header h1 { font-size: 3rem; }
}
