/* Basic Setup & Fonts */
:root {
    --font-title: 'Gabriela', serif;
    --font-body: 'Aptos', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --border-radius: 12px;
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-dark: 0 4px 15px rgba(0, 0, 0, 0.2);
    --transition-speed: 0.3s;
}

body {
    margin: 0;
    padding: 1rem;
    font-family: var(--font-body);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    line-height: 1.7;
}

/* Font Size Classes */
.font-small { font-size: 14px; }
.font-normal { font-size: 16px; }
.font-large { font-size: 18px; }
.font-xlarge { font-size: 20px; }
.font-xxlarge { font-size: 22px; }

/* --- THEMES --- */
/* Dark Themes */
.theme-dark-sky-blue { background-color: #0b2d4f; color: #e0f7fa; --primary: #38bdf8; --secondary: #0ea5e9; --accent: #7dd3fc; --text-main: #e0f7fa; --text-muted: #94a3b8; --bg-main: #0f3c66; --bg-alt: #1e4d78; --shadow-color: rgba(0,0,0,0.4); }
.theme-dark-charcoal { background-color: #1a1a1a; color: #f5f5f5; --primary: #777; --secondary: #555; --accent: #999; --text-main: #f5f5f5; --text-muted: #aaa; --bg-main: #2b2b2b; --bg-alt: #3c3c3c; --shadow-color: rgba(0,0,0,0.5); }
.theme-dark-midnight { background-color: #191970; color: #e6e6fa; --primary: #4169e1; --secondary: #0000cd; --accent: #87cefa; --text-main: #e6e6fa; --text-muted: #b0c4de; --bg-main: #2c2c8c; --bg-alt: #3d3da8; --shadow-color: rgba(0,0,0,0.4); }
.theme-dark-forest { background-color: #003300; color: #e8f5e9; --primary: #4caf50; --secondary: #388e3c; --accent: #81c784; --text-main: #e8f5e9; --text-muted: #a5d6a7; --bg-main: #004d00; --bg-alt: #006400; --shadow-color: rgba(0,0,0,0.4); }
.theme-dark-plum { background-color: #2e1a47; color: #f3e5f5; --primary: #ab47bc; --secondary: #8e24aa; --accent: #ce93d8; --text-main: #f3e5f5; --text-muted: #e1bee7; --bg-main: #3e275f; --bg-alt: #4a2f71; --shadow-color: rgba(0,0,0,0.4); }

/* Light Themes */
.theme-light-snow { background-color: #f9f9f9; color: #333; --primary: #4a90e2; --secondary: #357abd; --accent: #8ab4f8; --text-main: #333; --text-muted: #666; --bg-main: #ffffff; --bg-alt: #f0f0f0; --shadow-color: rgba(0,0,0,0.1); }
.theme-light-mint { background-color: #f0fff4; color: #005f4b; --primary: #20c997; --secondary: #17a2b8; --accent: #66d9b3; --text-main: #005f4b; --text-muted: #004d40; --bg-main: #ffffff; --bg-alt: #e6fcf5; --shadow-color: rgba(0,0,0,0.08); }
.theme-light-peach { background-color: #fff0e6; color: #7f2e00; --primary: #ff7f50; --secondary: #ff6347; --accent: #ffa07a; --text-main: #7f2e00; --text-muted: #a0522d; --bg-main: #ffffff; --bg-alt: #fff5ee; --shadow-color: rgba(0,0,0,0.08); }
.theme-light-lavender { background-color: #f3e8ff; color: #4a0072; --primary: #9c27b0; --secondary: #7b1fa2; --accent: #ba68c8; --text-main: #4a0072; --text-muted: #6a1b9a; --bg-main: #ffffff; --bg-alt: #f9f2ff; --shadow-color: rgba(0,0,0,0.08); }
.theme-light-lemon { background-color: #fffde7; color: #5f4300; --primary: #ffeb3b; --secondary: #fbc02d; --accent: #fff176; --text-main: #5f4300; --text-muted: #827717; --bg-main: #ffffff; --bg-alt: #fff9c4; --shadow-color: rgba(0,0,0,0.08); }

/* Header & Title */
header {
    text-align: center;
    margin: 2rem 0 3rem 0;
    position: relative;
}
#main-title {
    font-family: var(--font-title);
    font-size: 3em;
    color: var(--primary);
    text-shadow: 1px 1px 3px var(--shadow-color);
    margin-bottom: 0.25rem;
    cursor: pointer;
    display: inline-block;
}
header h2 {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.5em;
    color: var(--text-muted);
    margin-top: 0;
}
#settings-cog-container {
    display: inline-block;
    vertical-align: middle;
    margin-left: 15px;
    cursor: pointer;
}
.cog-icon {
    width: 36px;
    height: 36px;
    fill: var(--accent);
    transition: transform 0.5s ease-in-out;
}
.cog-icon:hover {
    transform: rotate(180deg);
}

/* Main Content */
main {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-main);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 30px var(--shadow-color);
}
article h3 {
    font-family: var(--font-title);
    color: var(--primary);
    font-size: 2em;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 0.5rem;
}
article h4 {
    color: var(--accent);
    font-size: 1.4em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}
blockquote {
    border-left: 4px solid var(--secondary);
    margin: 1.5em 10px;
    padding: 0.5em 20px;
    background-color: var(--bg-alt);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
}
blockquote p {
    margin: 0;
}
blockquote footer {
    text-align: right;
    font-weight: bold;
    margin-top: 0.5em;
    color: var(--accent);
}

/* Settings Panel */
.settings-panel, .settings-panel-hidden {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--secondary);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 10px 40px var(--shadow-color);
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.settings-panel-hidden {
    opacity: 0;
    visibility: hidden;
}
.settings-panel {
    opacity: 1;
    visibility: visible;
}
.settings-panel h3 {
    text-align: center;
    font-family: var(--font-title);
    color: var(--primary);
    margin-top: 0;
}
.settings-section h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--accent);
    border-bottom: 1px solid var(--text-muted);
    padding-bottom: 5px;
}
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Buttons */
.close-btn, .setting-btn {
    font-family: var(--font-body);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease, transform 0.1s ease;
    padding: 10px 15px;
}
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    padding: 0;
}
.close-btn:hover {
    color: var(--primary);
}
.setting-btn {
    background-color: var(--secondary);
    color: var(--text-main);
    flex-grow: 1;
}
.setting-btn:hover {
    background-color: var(--primary);
}
.setting-btn:active {
    transform: translateY(2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    main {
        padding: 1.5rem;
    }
    #main-title {
        font-size: 2.5em;
    }
    header h2 {
        font-size: 1.2em;
    }
}
@media (max-width: 480px) {
    main {
        padding: 1rem;
    }
    #main-title {
        font-size: 2em;
    }
    .cog-icon {
        width: 30px;
        height: 30px;
    }
}