/* --- Global Variables --- */
:root {
    /* Colors */
    --bg-color: #0f172a;
    --container-bg: #1e293b;
    --text-color: #e2e8f0;
    --heading-color: #f1f5f9;
    --subheading-color: #cbd5e1;
    --muted-color: #94a3b8;
    --border-color: #334155;

    /* Accents */
    --accent-primary: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-warning: #f59e0b;
    --accent-success: #22c55e;

    /* Code Blocks */
    --code-bg: #334155;
    --pre-bg: #020617;
    --btn-bg: #475569;
    --btn-hover: #64748b;

    /* Fonts */
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    --font-display: 'Ubuntu', sans-serif;
}

/* --- Global Styles (consistent theme) --- */
body {
    font-family: var(--font-main);
    line-height: 1.7;
    /* Default line height */
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

/* --- Content Container (consistent theme) --- */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem 3rem;
    background-color: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* --- Typography (consistent theme) --- */
/* h1 is defined per page */

/* Category Headings */
h3 {
    color: var(--subheading-color);
    font-size: 1.4rem;
    margin-top: 2em;
    margin-bottom: 1em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid var(--border-color);
    /* line-height inherits default */
}

p {
    margin-bottom: 1.2em;
}

/* Specific style for intro paragraph */
.intro-paragraph {
    text-align: left;
    /* Changed from center to left */
    margin-bottom: 2em;
    line-height: 1.5;
    /* Keep reduced line-height for intro P with <br> */
}


/* --- Links (Standard style) --- */
a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Link items styling */
ul.link-list {
    list-style-type: none;
    padding-left: 0;
}

.link-item {
    margin-bottom: 1.5em;
    font-size: 1.1em;
    /* line-height inherits default */
}

/* Style for emojis next to links */
.link-item .emoji {
    display: inline-block;
    margin-right: 0.6em;
    font-size: 1.2em;
    vertical-align: middle;
    width: 1.5em;
    text-align: center;
}

/* Span for Chinese text */
span[lang="zh"] {
    /* No specific styling needed now unless desired */
}

/* Removed the br + span rule */

/* --- Footer Styling (consistent theme) --- */
.footer {
    font-size: 0.9em;
    color: var(--muted-color);
    margin-top: 3rem;
    text-align: center;
    padding-bottom: 1rem;
    line-height: 1.5;
    /* Keep reduced line-height for footer with <br> */
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 1.5rem 1.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    .link-item {
        font-size: 1em;
    }
}

/* --- Maths Cache Page Specific Styles --- */
.maths-cache-page h1,
.maths-cache-page h2 {
    font-family: var(--font-display);
    color: var(--text-color);
}

.maths-cache-page p,
.maths-cache-page .app-info {
    font-size: 18px;
    color: var(--subheading-color);
}

.maths-cache-page .app-link {
    color: var(--bg-color);
    background-color: var(--accent-primary);
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.maths-cache-page .app-link:hover {
    background-color: var(--accent-hover);
}

.maths-cache-page .google-play-badge {
    height: auto;
    margin: 20px 0;
}

.maths-cache-page .language-section {
    margin-top: 10px;
}

.maths-cache-page .logo-align {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.maths-cache-page .logo {
    height: 50px;
}

/* --- Index Page Specific Styles --- */
.index-page h1 {
    color: var(--heading-color);
    font-size: 2.2rem;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.4;
    /* Keep reduced line-height for H1 with <br> */
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.3em;
    text-align: center;
}

/* --- Kuala Lumpur Sunrise Sunset Page Specific Styles --- */
.kuala-lumpur-sunrise-sunset-page h2 {
    color: var(--heading-color);
    font-size: 1.8rem;
    /* Matches H2 on FFmpeg page */
    margin-top: 1em;
    /* Adjusted top margin */
    margin-bottom: 1em;
    line-height: 1.3;
    border-bottom: 1px solid var(--border-color);
    /* Subtle line */
    padding-bottom: 0.3em;
    text-align: center;
    /* Center the heading */
}

.kuala-lumpur-sunrise-sunset-page h2 span {
    font-size: 1.1rem;
    /* Adjusted size relative to h2 */
    display: block;
    /* Make it appear on a new line */
    margin-top: 0.3em;
    font-weight: normal;
    /* Make sub-heading less bold */
    color: var(--subheading-color);
    /* Slightly lighter color for subheading */
}

.kuala-lumpur-sunrise-sunset-page .intro-text {
    text-align: left;
    /* Changed from center to left */
}

.kuala-lumpur-sunrise-sunset-page .back-link {
    display: block;
    /* Make it a block element */
    margin-bottom: 1.5rem;
    /* Space below the link */
    font-size: 0.9em;
}

.kuala-lumpur-sunrise-sunset-page img {
    max-width: 100%;
    height: auto;
    display: block;
    /* Allows margin auto centering */
    margin: 1.5em auto;
    /* Center images and add vertical space */
    border-radius: 4px;
    /* Optional: slightly rounded corners for images */
}

/* --- Maths Cheatsheets Page Specific Styles --- */
.maths-cheatsheets-page h1 {
    color: var(--heading-color);
    font-size: 2.2rem;
    margin-top: 1.5em;
    margin-bottom: 1em;
    line-height: 1.4;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.3em;
    text-align: center;
}

.maths-cheatsheets-page h2 {
    /* Section titles */
    color: var(--subheading-color);
    font-size: 1.8rem;
    margin-top: 2em;
    margin-bottom: 1em;
    /* Reduced margin below H2 */
    padding-bottom: 0.2em;
    border-bottom: 1px solid var(--border-color);
}

.maths-cheatsheets-page p {
    margin-bottom: 1.2em;
    text-align: justify;
}

.maths-cheatsheets-page .emphasis-note {
    background-color: var(--code-bg);
    /* Slate 700 */
    border-left: 3px solid var(--accent-warning);
    /* Amber */
    padding: 0.6em 1em;
    /* Reduced padding */
    margin: 1em 0 2em 0;
    /* Adjusted margin (more bottom margin before first item) */
    color: var(--text-color);
    border-radius: 4px;
    font-style: normal;
    text-align: justify;
    /* Match paragraph alignment */
    font-size: 1.05em;
    /* Slightly larger than normal p */
    line-height: 1.8;
}

.maths-cheatsheets-page .warning-note strong {
    /* You could add color here if desired, e.g., color: #c85000; */
    display: block;
    /* Make it block for margin control */
    margin: 1.5em 0;
    /* Ensure spacing */
}

.maths-cheatsheets-page .license-info {
    margin-top: 2.5em;
    margin-bottom: 1.5em;
    font-size: 0.95em;
    color: var(--muted-color);
    text-align: left;
}

.maths-cheatsheets-page .license-info img {
    height: 1.2em;
    vertical-align: middle;
    margin-right: 0.3em;
}

.maths-cheatsheets-page .file-link p {
    margin-top: 1.0em;
    margin-bottom: 2.0em;
    font-weight: bold;
}

.maths-cheatsheets-page .file-link .emoji {
    margin-right: 0.5em;
    font-size: 1.1em;
    vertical-align: middle;
}

.maths-cheatsheets-page .back-link {
    display: block;
    margin-bottom: 1.5rem;
    font-size: 0.9em;
}

/* --- Screen Recording FFmpeg Page Specific Styles --- */
.screen-recording-ffmpeg-page h1,
.screen-recording-ffmpeg-page h2,
.screen-recording-ffmpeg-page h3 {
    color: var(--heading-color);
    /* Slate 100 */
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.3;
    border-bottom: 1px solid var(--border-color);
    /* Subtle line under headings */
    padding-bottom: 0.3em;
}

.screen-recording-ffmpeg-page h1 {
    font-size: 2.2rem;
    border-bottom-width: 2px;
}

.screen-recording-ffmpeg-page h2 {
    font-size: 1.8rem;
}

.screen-recording-ffmpeg-page h3 {
    font-size: 1.4rem;
    border-bottom: none;
}

.screen-recording-ffmpeg-page strong {
    font-weight: 600;
}

.screen-recording-ffmpeg-page ol,
.screen-recording-ffmpeg-page ul {
    padding-left: 2em;
    margin-bottom: 1.2em;
}

.screen-recording-ffmpeg-page li {
    margin-bottom: 0.5em;
}

.screen-recording-ffmpeg-page li p {
    margin-bottom: 0.5em;
}

.screen-recording-ffmpeg-page ul ul {
    margin-top: 0.3em;
    margin-bottom: 0.8em;
}

.screen-recording-ffmpeg-page code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: var(--text-color);
}

.screen-recording-ffmpeg-page .code-block-wrapper {
    position: relative;
    margin-bottom: 1.5em;
    /* Space after code blocks */
}

.screen-recording-ffmpeg-page pre {
    background-color: var(--pre-bg);
    /* Slate 950 */
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 1em;
    padding-top: 2.5em;
    /* Make space for button */
    overflow-x: auto;
    line-height: 1.45;
    margin: 0;
    /* Remove margin from pre since wrapper handles it */
}

.screen-recording-ffmpeg-page pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.88em;
    color: inherit;
}

.screen-recording-ffmpeg-page .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--btn-bg);
    /* Slate 600 */
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    opacity: 0.7;
    /* Slightly visible */
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out;
    display: flex;
    /* Align icon and text */
    align-items: center;
}

.screen-recording-ffmpeg-page .code-block-wrapper:hover .copy-btn {
    opacity: 1;
    /* Fully visible on hover */
}

.screen-recording-ffmpeg-page .copy-btn:hover {
    background-color: var(--btn-hover);
    /* Slate 500 on hover */
}

.screen-recording-ffmpeg-page .copy-btn svg {
    width: 1em;
    /* Size icon relative to font size */
    height: 1em;
    margin-right: 0.4em;
    fill: currentColor;
    /* Use button text color for icon */
}

.screen-recording-ffmpeg-page .copy-btn.copied {
    background-color: var(--accent-success);
    /* Green when copied */
}

.screen-recording-ffmpeg-page .copy-btn.copied svg {
    display: none;
    /* Hide copy icon when showing 'Copied!' */
}

.screen-recording-ffmpeg-page .note {
    font-style: italic;
    color: var(--muted-color);
    margin-left: 1em;
    border-left: 3px solid var(--btn-bg);
    padding-left: 1em;
    margin-top: 0.5em;
    /* Add space above note if needed */
    margin-bottom: 1em;
}

/* --- Maths Cache Privacy Simple Page Specific Styles --- */
.mathscache-privacy-simple-page body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.mathscache-privacy-simple-page .container {
    width: 80%;
    margin: auto;
    overflow: hidden;
    padding: 0 20px 20px 20px;
    background: var(--container-bg);
    margin-top: 30px;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
}

.mathscache-privacy-simple-page h1,
.mathscache-privacy-simple-page h2,
.mathscache-privacy-simple-page h3,
.mathscache-privacy-simple-page h4 {
    color: var(--heading-color);
}

.mathscache-privacy-simple-page a {
    color: var(--accent-primary);
}

.mathscache-privacy-simple-page .language-separator {
    margin: 30px 0;
    border-bottom: 1px solid var(--border-color);
}

/* --- Maths Cache Privacy Page Specific Styles --- */
.mathscache-privacy-page body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.mathscache-privacy-page .container {
    width: 80%;
    margin: auto;
    overflow: hidden;
    padding: 0 20px 20px 20px;
    background: var(--container-bg);
    margin-top: 30px;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
}

.mathscache-privacy-page h1,
.mathscache-privacy-page h2 {
    color: var(--heading-color);
}

.mathscache-privacy-page p {
    margin: 15px 0;
}

.mathscache-privacy-page a {
    color: var(--accent-primary);
}

.mathscache-privacy-page .language-separator {
    margin: 30px 0;
    border-bottom: 1px solid var(--border-color);
}