:root {
    --bg-color: #ffffff;
    --text-color: #111111;
    --accent-color: #000000;
    --secondary-color: #666666;
    --code-bg: #f4f4f4;
    --highlight-color: #ffe600; /* Bright Yellow */
    --font-stack: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0a0a0a;
        --text-color: #e0e0e0;
        --accent-color: #ffffff;
        --secondary-color: #a0a0a0;
        --code-bg: #1a1a1a;
        --highlight-color: #ffe600;
    }
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-stack);
    line-height: 1.6;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

a:hover {
    background-color: var(--highlight-color);
    color: #000000;
    text-decoration: none;
}

header {
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

nav a {
    margin-left: 1rem;
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

.subtitle {
    color: var(--secondary-color);
    font-size: 1.1rem;
    font-family: serif; /* Contrast for story summaries? */
    font-style: italic;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.5rem;
    background-color: var(--highlight-color); /* Yellow cursor */
    animation: blink 1s step-end infinite;
    vertical-align: middle;
    margin-left: 5px;
}

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

section {
    margin-bottom: 4rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 4px solid var(--highlight-color); /* Yellow border */
    padding-left: 1rem;
}

/* Grid & Cards for Story List */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    list-style: none;
}

.card {
    border: 1px solid var(--secondary-color);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 6px 6px 0 var(--accent-color);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    border: none;
    padding: 0;
    text-transform: none;
}

.card a {
    text-decoration: none;
}

.card p {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* Chapter List Styles */
.chapter-list {
    list-style: none;
}

.chapter-list li {
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed var(--secondary-color);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapter-list small {
    color: var(--secondary-color);
}

/* Buttons */
.btn {
    display: inline-block;
    text-decoration: none;
    color: var(--bg-color);
    background-color: var(--text-color);
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid var(--text-color);
    transition: all 0.2s;
    text-transform: uppercase;
    font-weight: bold;
}

.btn:hover {
    background-color: var(--highlight-color);
    color: #000;
    border-color: var(--highlight-color);
    box-shadow: 4px 4px 0 var(--accent-color);
}

.chapter-navigation {
    margin-bottom: 2rem;
}

footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--secondary-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-family: var(--font-stack);
}

/* --- E-Reader / Reading Mode Styles --- */

.reader-container {
    max-width: 68ch; /* Optimal reading width (approx 68 chars) */
    margin: 0 auto;
}

.reader-header {
    text-align: center;
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 2px dashed var(--secondary-color);
}

.reader-story-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: block;
}

.reader-chapter-title {
    font-size: 2.2rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

/* The Content Area */
.reader-content {
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: 5rem;
}

.reader-content p {
    margin-bottom: 1.5rem;
}

/* "Drop Cap" Effect for the first paragraph's first letter */
.reader-content p:first-of-type::first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    margin-right: 0.75rem;
    font-weight: 700;
    color: var(--highlight-color); 
    background: var(--text-color);
    padding: 0.1rem 0.3rem;
    margin-top: 0.2rem;
}

/* Navigation Footer */
.reader-footer {
    border-top: 2px dashed var(--secondary-color);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
}

.nav-group {
    display: flex;
    gap: 1rem;
}

.nav-link-card {
    display: inline-block;
    padding: 1rem;
    border: 1px solid var(--secondary-color);
    text-decoration: none;
    min-width: 140px;
    transition: all 0.2s;
}

.nav-link-card:hover {
    border-color: var(--highlight-color);
    background-color: var(--code-bg);
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 var(--secondary-color);
}

.nav-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin-bottom: 0.3rem;
}

.nav-title {
    display: block;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Progress Bar (Simple Visual) */
.progress-container {
    height: 4px;
    background: var(--code-bg);
    width: 100%;
    margin-top: 2rem;
    border-radius: 2px;
}
.progress-bar {
    height: 100%;
    background: var(--highlight-color);
    width: 0%; /* Dynamic if using JS, static for now */
}