/* ==========================================================================
   Java 26 Tutorial - Design System & Stylesheet (estil.css)
   ========================================================================== */

@import url("../prismjs/prism.css");

:root {
    --bg-main: #0a0f1d;
    --bg-surface: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #273549;
    --bg-code: #030712;
    --bg-code-header: #0f172a;

    --border-subtle: #1e293b;
    --border-default: #334155;
    --border-focus: #38bdf8;

    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --text-heading: #ffffff;

    --accent-blue: #38bdf8;
    --accent-indigo: #6366f1;
    --accent-green: #10b981;
    --accent-emerald: #34d399;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #c084fc;
    --accent-yellow: #facc15;
    --accent-orange: #fb923c;

    --font-sans: 'Fira Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Rubik', var(--font-sans);
    --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --content-max-width: 960px;
    --nav-height: 64px;
}

/* Base Reset & Typography */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.68;
    padding: 0;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    font-weight: 700;
    line-height: 1.28;
    margin: 1.6em 0 0.6em 0;
    letter-spacing: -0.015em;
    scroll-margin-top: calc(var(--nav-height) + 1.5rem);
}

h1 { font-size: 2.35rem; }
h2 { font-size: 1.75rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.35em; }
h3 { font-size: 1.35rem; color: #cbd5e1; }
h4 { font-size: 1.15rem; color: var(--accent-blue); }

p {
    margin: 0.9em 0;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.15s ease, border-bottom-color 0.15s ease;
}

a:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

strong {
    color: var(--text-heading);
    font-weight: 600;
}

em {
    color: #f1f5f9;
}

ul, ol {
    margin: 1em 0 1.25em 1.75em;
    padding: 0;
}

li {
    margin: 0.4em 0;
}

hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 2.5em 0;
}

/* Layout Containers */
header {
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
    padding: 3rem 1.5rem 1.5rem 1.5rem;
}

header h1 {
    margin-top: 0.2em;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.abstract {
    background: rgba(30, 41, 59, 0.45);
    border-left: 4px solid var(--accent-blue);
    padding: 1.25em 1.5em;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1.75em 0;
    box-shadow: var(--shadow-sm);
}

.abstract p {
    margin: 0.4em 0;
    font-size: 1.05rem;
    color: #cbd5e1;
}

.abstract .check {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    margin: 0.4em 0;
    color: #cbd5e1;
    font-size: 0.98rem;
}

.abstract .check::before {
    content: "✓";
    color: var(--accent-green);
    font-weight: 800;
}

section {
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
    padding: 0 1.5rem 3rem 1.5rem;
    flex: 1 0 auto;
}

footer {
    border-top: 1px solid var(--border-subtle);
    background: #060913;
    padding: 2.5rem 1.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    text-align: center;
    margin-top: auto;
}

footer a {
    color: var(--text-muted);
}

footer a:hover {
    color: var(--text-heading);
}

/* Top Navigation Bar */
nav:not(.sidenav) {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: rgba(10, 15, 29, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(51, 65, 85, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

nav:not(.sidenav).hide {
    transform: translateY(-100%);
}

.hamb-open {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.hamb-open:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

.hamb-open::before,
.hamb-open::after {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-main);
    border-radius: 1px;
}

.hamb-open div {
    width: 20px;
    height: 2px;
    background: var(--text-main);
    border-radius: 1px;
}

/* Sidenav (Table of Contents Drawer) */
nav.sidenav {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: #090e1a;
    border-right: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

nav.sidenav.open {
    transform: translateX(0);
}

.hamb-close {
    align-self: flex-end;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    transition: background 0.15s ease;
}

.hamb-close::before {
    content: '✕';
}

.hamb-close:hover {
    background: var(--bg-card-hover);
    color: #ffffff;
}

nav.sidenav a {
    display: block;
    padding: 0.55rem 0.85rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    margin-bottom: 0.25rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

nav.sidenav a:hover {
    color: var(--text-heading);
    background: rgba(30, 41, 59, 0.6);
    border-left-color: var(--border-default);
}

nav.sidenav a.active {
    color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.1);
    border-left-color: var(--accent-blue);
    font-weight: 600;
}

nav.sidenav a.sidenav1 {
    font-weight: 600;
    margin-top: 0.5rem;
}

nav.sidenav a.sidenav2 {
    padding-left: 1.6rem;
    font-size: 0.86rem;
    color: var(--text-dim);
}

/* Callout Info Boxes & Exercises */
.work, work, .warn, warn, .info, info, .optional, optional, .tldr, tldr, 
.observe, observe, .quizz, quizz, .challenge, challenge, .project, project {
    display: block;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 1.5em;
    margin: 0 0 2.5em 0;
    box-shadow: var(--shadow-sm);
}

.work-header, .warn-header, .info-header, .observe-header, .challenge-header, 
.tldr-header, .optional-header, .project-header, .quizz-header {
    display: flex;
    align-items: center;
    gap: 0.75em;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 0.6em 1.25em;
    margin-top: 2em;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.work-header + :is(.work, work),
.warn-header + :is(.warn, warn),
.info-header + :is(.info, info),
.observe-header + :is(.observe, observe),
.challenge-header + :is(.challenge, challenge),
.tldr-header + :is(.tldr, tldr),
.optional-header + :is(.optional, optional),
.project-header + :is(.project, project),
.quizz-header + :is(.quizz, quizz) {
    margin-top: 0 !important;
}

:is(.work, work, .warn, warn, .info, info, .optional, optional, .tldr, tldr, 
.observe, observe, .quizz, quizz, .challenge, challenge, .project, project) > :first-child {
    margin-top: 0;
}

/* Info (Blue) */
.info, info {
    background-color: rgba(14, 116, 144, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-top: none;
}
.info-header {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
    color: #ffffff;
}
.info-header::before { content: 'ℹ'; font-size: 1.1em; }

/* Warn (Amber) */
.warn, warn {
    background-color: rgba(180, 83, 9, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-top: none;
}
.warn-header {
    background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
    color: #ffffff;
}
.warn-header::before { content: '⚠'; font-size: 1.1em; }

/* Work / Exercise (Green) */
.work, work {
    background-color: rgba(6, 95, 70, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-top: none;
}
.work-header {
    background: linear-gradient(135deg, #065f46 0%, #059669 100%);
    color: #ffffff;
}
.work-header::before { content: '🛠'; font-size: 1.1em; }

/* Challenge (Indigo/Purple) */
.challenge, challenge {
    background-color: rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-top: none;
}
.challenge-header {
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
    color: #ffffff;
}
.challenge-header::before { content: '🎯'; font-size: 1.1em; }

/* Observe (Purple) */
.observe, observe {
    background-color: rgba(126, 34, 206, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-top: none;
}
.observe-header {
    background: linear-gradient(135deg, #6b21a8 0%, #9333ea 100%);
    color: #ffffff;
}
.observe-header::before { content: '👁'; font-size: 1.1em; }

/* TLDR (Slate) */
.tldr, tldr {
    background-color: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-default);
    border-top: none;
}
.tldr-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #ffffff;
}
.tldr-header::before { content: '⚡'; font-size: 1.1em; }

/* Cards & Curriculum Grid */
.curriculum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.ra-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.ra-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md);
}

.ra-card h3 {
    margin-top: 0;
    font-size: 1.25rem;
    color: #ffffff;
}

.ra-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3em 0.75em;
    border-radius: 9999px;
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.3);
    margin-bottom: 0.85rem;
}

.ra-actions {
    margin-top: auto;
    padding-top: 1.25rem;
    display: flex;
    gap: 0.75rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6em 1.2em;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid #38bdf8;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6em 1.2em;
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    color: #ffffff;
    text-decoration: none;
}

.ex-link-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #94a3b8;
    background: #1e293b;
    padding: 0.3em 0.7em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    vertical-align: middle;
}

.ex-link-pill:hover {
    color: #ffffff;
    border-color: var(--accent-green);
    background: #064e3b;
    text-decoration: none;
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.exercise-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Code Styling, Syntax Highlighting & Copy Buttons
   ========================================================================== */

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
}

/* Inline Code Elements */
:not(pre) > code, code.w, code.m {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-default);
    color: #f1f5f9;
    padding: 0.15em 0.45em;
    border-radius: 4px;
    font-family: var(--font-mono);
    word-break: break-word;
}

/* Code Blocks Container */
sc, .sc, pre {
    position: relative;
    display: block;
    margin: 1.5em 0;
    border-radius: var(--radius-md);
    background-color: var(--bg-code) !important;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm);
}

/* Reset inner pre and code-toolbar inside code containers so there is never a double border or nested margin */
:is(sc, .sc) pre,
:is(sc, .sc) div.code-toolbar {
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

:is(shell, .shell, mem, .mem) pre,
:is(shell, .shell, mem, .mem) div.code-toolbar {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

/* Hide Prism default toolbar buttons */
div.code-toolbar > .toolbar,
.copy-to-clipboard-button {
    display: none !important;
}

/* Inline span.sc */
span.sc {
    display: inline !important;
    margin: 0 !important;
    background: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: 4px !important;
    padding: 0.15em 0.45em !important;
    box-shadow: none !important;
}

pre {
    padding: 1.25em !important;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.6;
}

pre > code {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    font-size: 1em;
    color: #e2e8f0;
}

/* ==========================================================================
   PRISM.JS VIBRANT SYNTAX TOKEN COLORS (DARK THEME)
   ========================================================================== */

code[class*="language-"],
pre[class*="language-"] {
    color: #e2e8f0;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.6;
    tab-size: 4;
    hyphens: none;
}

/* Comments */
.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata,
span.comment,
.comment {
    color: #64748b !important;
    font-style: italic !important;
}

/* Punctuation */
.token.punctuation {
    color: #94a3b8 !important;
}

/* Keywords & Control Flow */
.token.keyword,
.token.atrule {
    color: #c084fc !important; /* Vivid Purple */
    font-weight: 600 !important;
}

/* Strings & Characters */
.token.string,
.token.char,
.token.attr-value,
.token.triple-quoted-string,
span.string,
.string {
    color: #4ade80 !important; /* Vivid Emerald Green */
}

/* Numbers & Booleans */
.token.number,
.token.boolean {
    color: #fb923c !important; /* Vivid Amber/Orange */
    font-weight: 500;
}

/* Functions & Methods */
.token.function,
.token.function-name {
    color: #60a5fa !important; /* Bright Electric Blue */
    font-weight: 600;
}

/* Classes, Records, Interfaces & Types */
.token.class-name,
.token.constant,
.token.builtin {
    color: #facc15 !important; /* Vivid Gold/Yellow */
    font-weight: 600;
}

/* Operators */
.token.operator,
.token.entity,
.token.url {
    color: #38bdf8 !important; /* Bright Cyan */
}

/* HTML/XML tags and attributes */
.token.tag,
.token.attr-name,
.token.deleted {
    color: #f87171 !important; /* Coral Red */
}

.token.inserted {
    color: #34d399 !important;
}

/* Variables & Regex */
.token.variable,
.token.regex,
.token.property,
.token.symbol {
    color: #fbbf24 !important; /* Warm Gold */
}

.token.important,
.token.bold {
    font-weight: 700;
}

.token.italic {
    font-style: italic;
}

.token.namespace {
    opacity: 0.75;
}

/* Copy Code Button */
.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid var(--border-default);
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

sc:hover .copy-code-btn,
.sc:hover .copy-code-btn,
pre:hover .copy-code-btn,
shell:hover .copy-code-btn,
.shell:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: var(--bg-card-hover);
    color: #ffffff;
    border-color: var(--accent-blue);
}

.copy-code-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-green);
    color: #34d399;
}

/* Prism Line Highlight Plugin Overrides */
.line-highlight {
    background: linear-gradient(to right, rgba(56, 189, 248, 0.18) 70%, rgba(56, 189, 248, 0)) !important;
    border-left: 3px solid var(--accent-blue) !important;
    margin-top: 1.25em !important;
}

/* Block & Inline Highlighting */
.h, span.h {
    background: rgba(56, 189, 248, 0.25) !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
    border-radius: 4px;
    padding: 1px 4px;
    font-weight: 700;
    color: #38bdf8 !important;
}

lin, .lin, span.lin {
    display: inline-block;
    width: 100%;
    background: rgba(56, 189, 248, 0.12);
    border-left: 3px solid var(--accent-blue);
    padding-left: 0.5em;
    margin-left: -0.5em;
}

blk, .blk, span.blk {
    display: inline-block;
    width: 100%;
    background: rgba(245, 158, 11, 0.15);
    border-left: 3px solid var(--accent-yellow);
    padding-left: 0.5em;
    margin-left: -0.5em;
}

/* Diff tags */
add, .add {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-radius: 3px;
    padding: 1px 3px;
}

rem, .rem {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-radius: 3px;
    padding: 1px 3px;
}

hig, .hig {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    border-radius: 3px;
    padding: 1px 3px;
}

low, .low {
    opacity: 0.45;
}

/* Shell & Memory Output */
shell, .shell, mem, .mem {
    position: relative;
    display: block;
    margin: 1.5em 0;
    border-radius: var(--radius-md);
    background-color: #020617;
    border: 1px solid var(--border-default);
    padding: 1.25em;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    overflow-x: auto;
}

shell, .shell {
    color: #4ade80;
    color: #e2e8f0;
    border-left: 4px solid #22c55e;
}

:is(shell, .shell) pre code {
    color: inherit !important;
}

/* IntelliJ IDEA console user input (stdin): bright green */
shell :is(.in, .input, .stdin, .user-input),
.shell :is(.in, .input, .stdin, .user-input) {
    color: #4ade80 !important;
    font-weight: 600;
}

mem, .mem {
    color: #38bdf8;
    border-left: 4px solid var(--accent-blue);
}



/* ==========================================================================
   Interactive Quizzes
   ========================================================================== */

quizz, .quizz {
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin: 0 0 2.5em 0;
    padding: 1.5em;
}

.quizz-header {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: #ffffff;
    margin-top: 2em;
}
.quizz-header::before { content: '❓'; font-size: 1.1em; }

:is(quizz, .quizz) :is(question, .question) {
    display: block;
    padding: 1.5em 0;
}

:is(quizz, .quizz) :is(question, .question) + :is(question, .question) {
    border-top: 1px solid var(--border-default);
}

:is(question, .question) :is(statement, .statement) {
    display: block;
    font-weight: 600;
    color: #f8fafc;
    font-size: 1.05rem;
    margin-bottom: 1em;
}

:is(question, .question) :is(o, .o) {
    display: flex;
    align-items: center;
    gap: 0.75em;
    padding: 0.65em 0.9em;
    margin: 0.5em 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    transition: all 0.15s ease;
    cursor: pointer;
}

:is(question, .question) :is(o, .o):hover {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.4);
}

:is(question, .question) input[type=radio], 
:is(question, .question) input[type=checkbox] {
    accent-color: var(--accent-orange);
    width: 1.15em;
    height: 1.15em;
    cursor: pointer;
}

:is(question, .question) label {
    flex: 1;
    cursor: pointer;
    font-size: 0.95rem;
}

.right, :is(question, .question) :is(o, .o).right {
    background-color: rgba(16, 185, 129, 0.2) !important;
    border-color: var(--accent-green) !important;
    color: #34d399 !important;
}

:is(question, .question) :is(o, .o).right::after {
    content: '✓';
    color: var(--accent-green);
    font-weight: 900;
    margin-left: auto;
}

.wrong, :is(question, .question) :is(o, .o).wrong {
    background-color: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--accent-red) !important;
    color: #f87171 !important;
}

:is(question, .question) :is(o, .o).wrong::after {
    content: '✕';
    color: var(--accent-red);
    font-weight: 900;
    margin-left: auto;
}

:is(question, .question) :is(o, .o).was-correct {
    border: 2px dashed var(--accent-green) !important;
    background-color: rgba(16, 185, 129, 0.08) !important;
}

:is(question, .question) :is(o, .o).was-correct::after {
    content: '(correcta)';
    color: var(--accent-green);
    font-size: 0.8rem;
    margin-left: auto;
}

/* Match Questions */
.match-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25em;
    margin: 1.25em 0;
}

@media(max-width: 640px) {
    .match-container {
        grid-template-columns: 1fr;
    }
}

:is(question, .question) .left,
:is(question, .question) .right {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

:is(question, .question) .left .o,
:is(question, .question) .left o {
    background: #0f172a;
    border: 1px solid var(--border-default);
    color: var(--text-heading);
    cursor: default;
    user-select: none;
    font-weight: 600;
}

:is(question, .question) .right .o,
:is(question, .question) .right o {
    background: #1e293b;
    border: 1px dashed var(--accent-blue);
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
}

:is(question, .question) .right .o:active {
    cursor: grabbing;
}

:is(question, .question) .right .o.dragging {
    opacity: 0.4;
    border-style: solid;
}

:is(question, .question) .right .o.highlight {
    background: rgba(56, 189, 248, 0.25) !important;
    border-color: #38bdf8 !important;
    transform: scale(1.02);
}

:is(question, .question) .right .o.selected-swap {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: var(--accent-yellow) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

/* Order / Parsons Questions */
.order-container {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    margin: 1.25em 0;
    padding: 0.85em;
    background: #0b1120;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}

:is(question, .question) .order-container :is(o, .o) {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 0.7em 1em;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    cursor: grab;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

:is(question, .question) .order-container :is(o, .o):hover {
    border-color: var(--accent-blue);
    background: #273549;
}

:is(question, .question) .order-container :is(o, .o):active {
    cursor: grabbing;
}

:is(question, .question) .order-container :is(o, .o).dragging {
    opacity: 0.35;
    border: 1px dashed var(--accent-blue);
    background: rgba(56, 189, 248, 0.1);
}

:is(question, .question) .order-container :is(o, .o).drag-over-top {
    border-top: 3px solid #38bdf8 !important;
    transform: translateY(2px);
}

:is(question, .question) .order-container :is(o, .o).drag-over-bottom {
    border-bottom: 3px solid #38bdf8 !important;
    transform: translateY(-2px);
}

:is(question, .question) .order-container :is(o, .o).selected-swap {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: var(--accent-yellow) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

:is(question, .question) .order-handle {
    color: var(--text-muted);
    font-size: 1.15rem;
    line-height: 1;
    cursor: grab;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    user-select: none;
}

:is(question, .question) .order-container :is(o, .o):hover .order-handle {
    opacity: 1;
    color: var(--accent-blue);
}

:is(question, .question) .order-content {
    flex-grow: 1;
    font-family: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

:is(question, .question) .order-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5em;
    margin-bottom: 0.25em;
    font-style: italic;
}

/* Text Input Questions */
.quiz-text-input {
    background: #030712;
    border: 1px solid var(--border-default);
    color: #ffffff;
    padding: 0.6em 1em;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-mono);
    width: 100%;
    max-width: 340px;
    margin: 0.75em 0;
    transition: all 0.15s ease;
}

:is(question, .question) table .quiz-text-input {
    max-width: 100%;
    margin: 0;
    padding: 0.3em 0.5em;
    text-align: center;
}

.quiz-text-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.quiz-text-input.right {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: var(--accent-green) !important;
    color: #34d399 !important;
}

.quiz-text-input.wrong {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: var(--accent-red) !important;
    color: #f87171 !important;
}

/* Action Buttons & Feedback */
.quiz-actions {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-top: 1em;
}

:is(question, .question) button.check,
:is(question, .question) button.retry {
    padding: 0.5em 1.25em;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

:is(question, .question) button.check {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: 1px solid #38bdf8;
}

:is(question, .question) button.check:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

:is(question, .question) button.retry {
    background: #1e293b;
    color: var(--text-main);
    border: 1px solid var(--border-default);
}

:is(question, .question) button.retry:hover {
    background: var(--bg-card-hover);
    color: #ffffff;
    border-color: var(--accent-blue);
}

.quiz-feedback {
    margin-top: 1em;
    padding: 0.85em 1.2em;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 500;
}

.quiz-feedback.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--accent-green);
    color: #34d399;
}

.quiz-feedback.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-red);
    color: #f87171;
}

.quiz-feedback.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--accent-yellow);
    color: #fbbf24;
}

/* ==========================================================================
   Mermaid Diagrams
   ========================================================================== */

.mermaid, pre.mermaid, div.mermaid, mermaid {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0b1329;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin: 2em 0;
    padding: 1.5em;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.mermaid svg {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Static Tables
   ========================================================================== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
    text-align: left;
    margin: 1.5em 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

thead {
    background-color: #0b1329;
    border-bottom: 2px solid var(--border-default);
}

th {
    padding: 0.85em 1em;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.03em;
}

td {
    padding: 0.75em 1em;
    border-bottom: 1px solid var(--border-subtle);
    color: #cbd5e1;
    vertical-align: middle;
}

tbody tr {
    transition: background-color 0.12s ease;
}

tbody tr:nth-child(even) {
    background-color: rgba(30, 41, 59, 0.35);
}

tbody tr:hover {
    background-color: rgba(56, 189, 248, 0.08);
}


/* ==========================================================================
   Responsive Utilities
   ========================================================================== */

@media(max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    header {
        padding: 2rem 1rem 1rem 1rem;
    }
    
    section {
        padding: 0 1rem 2rem 1rem;
    }
    
    .curriculum-grid {
        grid-template-columns: 1fr;
    }
}
