@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

/* ============================================================
   getlearning — Design System กลาง
   ฟอนต์: Prompt (Thai-friendly, อ่านง่าย)
   ธีม: Dark Navy + Electric Teal + Purple
   ============================================================ */

:root {
    /* สีพื้นหลัง */
    --bg-color:       #0b0f19;
    --surface-color:  #111827;
    --surface-hover:  #1f2937;
    --card-bg:        rgba(17, 24, 39, 0.8);

    /* สีขอบ */
    --border-color:   rgba(255, 255, 255, 0.08);

    /* สีหลัก */
    --primary:        #2dd4bf;
    --primary-rgb:    45, 212, 191;
    --secondary:      #c084fc;
    --secondary-rgb:  192, 132, 252;
    --accent:         #38bdf8;

    /* สีข้อความ */
    --text-primary:   #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted:     #6b7280;
    --text-main:      #f8fafc; /* alias สำหรับ control panel */

    /* สีสถานะ */
    --success:  #10b981;
    --danger:   #ef4444;
    --warning:  #f59e0b;

    /* ฟอนต์ */
    --font-family: 'Prompt', 'Leelawadee UI', 'Tahoma', 'Segoe UI', sans-serif;
    --font-mono:   'Fira Code', 'Courier New', monospace;
    --font-sans:   'Prompt', sans-serif; /* alias */

    /* มุมโค้ง */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* เงา */
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.5);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -1px rgba(0,0,0,0.3);

    /* Transition */
    --transition: all 0.2s ease-in-out;

    /* ตัวแปรเพิ่มเติม (network.html / control-panel) */
    --panel-gradient-end: #111827;
    --option-btn-bg:      #1f2937;
    --btn-primary-text:   #0b0f19;
    --header-bg:          rgba(11, 15, 25, 0.9);
    --svg-bg:             #111827;

    /* สีองค์ประกอบอื่นๆ สำหรับธีม */
    --mobile-nav-bg:      rgba(11, 15, 25, 0.98);
    --breadcrumb-bg:      rgba(11, 15, 25, 0.6);
    --pre-bg:             rgba(17, 24, 39, 0.95);
    --pre-color:          #e2e8f0;
    --exercise-card-bg:   linear-gradient(145deg, #1e293b, #0f172a);
    --mode-selector-bg:   rgba(0, 0, 0, 0.3);
    --code-bg:            rgba(30, 41, 59, 0.9);
    --code-color:         var(--accent);
}

[data-theme="light"] {
    /* สีพื้นหลัง */
    --bg-color:       #f8fafc;
    --surface-color:  #ffffff;
    --surface-hover:  #f1f5f9;
    --card-bg:        rgba(255, 255, 255, 0.85);

    /* สีขอบ */
    --border-color:   rgba(0, 0, 0, 0.08);

    /* สีหลัก */
    --primary:        #0d9488; /* Teal 600 */
    --primary-rgb:    13, 148, 136;
    --secondary:      #7c3aed; /* Violet 600 */
    --secondary-rgb:  124, 58, 237;
    --accent:         #0284c7; /* Sky 600 */

    /* สีข้อความ */
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #64748b;
    --text-main:      #0f172a;

    /* เงา */
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);

    /* ตัวแปรเพิ่มเติม */
    --panel-gradient-end: #f1f5f9;
    --option-btn-bg:      #f1f5f9;
    --btn-primary-text:   #ffffff;
    --header-bg:          rgba(248, 250, 252, 0.9);
    --svg-bg:             #ffffff;

    /* สีองค์ประกอบอื่นๆ สำหรับธีม */
    --mobile-nav-bg:      rgba(248, 250, 252, 0.98);
    --breadcrumb-bg:      rgba(248, 250, 252, 0.7);
    --pre-bg:             #f1f5f9;
    --pre-color:          #0f172a;
    --exercise-card-bg:   linear-gradient(145deg, #ffffff, #f1f5f9);
    --mode-selector-bg:   rgba(0, 0, 0, 0.05);
    --code-bg:            #e2e8f0; /* Slate 200 - soft background contrast */
    --code-color:         #0f172a; /* Slate 900 - dark text */
}

[data-theme="light"] body {
    background-image:
        radial-gradient(circle at 15% 50%, rgba(13, 148, 136, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.6;
    /* Ambient background glow */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(45, 212, 191, 0.07) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(192, 132, 252, 0.07) 0%, transparent 50%);
    background-attachment: fixed;
}

/* ============================================================
   Navigation Bar
   ============================================================ */
.gl-nav {
    font-family: var(--font-family) !important;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.75rem 1.5rem;
}

.gl-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.gl-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}

.gl-nav-brand svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.gl-nav-brand span {
    font-family: var(--font-family) !important;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

@media (max-width: 480px) {
    .gl-nav-brand span {
        font-size: 1.1rem;
    }
}

.gl-nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.gl-nav-links a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.gl-nav-links a:hover {
    background: rgba(45, 212, 191, 0.08);
    color: var(--primary);
}

.gl-nav-links a.active {
    background: rgba(45, 212, 191, 0.12);
    color: var(--primary);
    font-weight: 600;
}

.gl-nav-links a svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Hamburger (mobile) */
.gl-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.gl-nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

@media (max-width: 768px) {
    .gl-nav { padding: 0.6rem 1rem; }
    .gl-nav-toggle { display: flex; }

    /* Hamburger → X animation */
    .gl-nav-toggle.open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .gl-nav-toggle.open span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .gl-nav-toggle.open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .gl-nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 999;
        background: var(--mobile-nav-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 0.75rem 1rem 1rem;
        gap: 0.25rem;
        box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    }
    .gl-nav-links.open { display: flex; }
    .gl-nav-links a {
        width: 100%;
        padding: 0.7rem 0.85rem;
        font-size: 0.92rem;
    }
}

/* ============================================================
   Footer
   ============================================================ */
.gl-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.25rem;
    text-align: center;
    margin-top: auto;
    background: rgba(10, 15, 29, 0.8);
}

.gl-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.gl-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 2.25rem; color: var(--text-primary); }
h2 { font-size: 1.5rem;  color: var(--accent); }
h3 { font-size: 1.15rem; color: var(--text-primary); }

p { color: var(--text-secondary); line-height: 1.7; }

a { color: var(--primary); }

/* ── Mobile typography scale ── */
@media (max-width: 480px) {
    h1 { font-size: 1.55rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1rem; }
    p  { font-size: 0.93rem; }
}
@media (min-width: 481px) and (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.35rem; }
}

/* ============================================================
   Shared Layout
   ============================================================ */
.gl-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem;
}

@media (max-width: 480px) {
    .gl-container { padding: 1rem 0.75rem; }
}
@media (min-width: 481px) and (max-width: 768px) {
    .gl-container { padding: 1.5rem 1rem; }
}

.gl-page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2.5rem 2rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    animation: fadeOnly 0.7s ease-out;
}

.gl-page-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(45, 212, 191, 0.3);
    /* ป้องกันคำภาษาไทยล้นกรอบ */
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.gl-page-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    overflow-wrap: break-word;
}

@media (max-width: 480px) {
    .gl-page-header {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
        border-radius: var(--radius-md);
    }
    .gl-page-header h1 {
        font-size: 1.45rem;
        line-height: 1.4;
    }
    .gl-page-header p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
}
@media (min-width: 481px) and (max-width: 768px) {
    .gl-page-header {
        padding: 1.75rem 1.25rem;
        margin-bottom: 2rem;
    }
    .gl-page-header h1 { font-size: 1.75rem; }
    .gl-page-header p  { font-size: 0.92rem; }
}

/* ============================================================
   Cards & Sections (บทเรียน)
   ============================================================ */
.section {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.7s ease-out both;
}

.section:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}

@media (max-width: 480px) {
    .section {
        padding: 1rem 0.9rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-sm);
    }
    .section:hover { transform: none; } /* ปิด hover lift บนมือถือ */
}
@media (min-width: 481px) and (max-width: 768px) {
    .section { padding: 1.25rem; }
}

.section:nth-child(2) { animation-delay: 0.05s; }
.section:nth-child(3) { animation-delay: 0.1s; }
.section:nth-child(4) { animation-delay: 0.15s; }
.section:nth-child(5) { animation-delay: 0.2s; }
.section:nth-child(6) { animation-delay: 0.25s; }
.section:nth-child(7) { animation-delay: 0.3s; }

.section h2 {
    color: var(--accent);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.section h3 {
    color: var(--text-primary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ============================================================
   Code Blocks
   ============================================================ */
code {
    background: var(--code-bg);
    color: var(--code-color);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.88em;
    border: 1px solid var(--border-color);
    /* ป้องกัน inline code ล้นขอบหน้าจอ */
    word-break: break-all;
    white-space: pre-wrap;
}

pre {
    background: var(--pre-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin: 0.75rem 0;
    /* สำคัญ: ป้องกัน pre ล้นออก container */
    max-width: 100%;
    white-space: pre;
}

pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: var(--pre-color);
    font-size: 0.9rem;
    word-break: normal;
    white-space: pre;
}

@media (max-width: 480px) {
    code { font-size: 0.8em; }
    pre  { padding: 0.75rem; font-size: 0.82rem; }
}

/* ============================================================
   Alert / Warning boxes
   ============================================================ */
.warning-box, .warning {
    color: var(--danger);
    font-weight: 500;
    background: rgba(239, 68, 68, 0.08);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
    margin: 0.75rem 0;
    font-size: 0.92rem;
}

.highlight { color: var(--success); font-weight: 600; }

/* ============================================================
   Exercise Cards
   ============================================================ */
.exercise-card {
    background: var(--exercise-card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.exercise-card:hover { transform: scale(1.01); }

@media (max-width: 480px) {
    .exercise-card {
        padding: 1rem 0.9rem;
        margin-bottom: 1rem;
    }
    .exercise-card:hover { transform: none; }
}

.exercise-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.exercise-card h3 { color: var(--text-primary); margin-bottom: 0.5rem; }

ul, ol { padding-left: 1.25rem; }
li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    /* ป้องกันข้อความ li ล้น */
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (max-width: 480px) {
    ul, ol { padding-left: 1rem; }
    li { font-size: 0.9rem; margin-bottom: 0.4rem; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    border: 1px solid var(--border-color);
    background: var(--option-btn-bg);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem 1rem;
}

.btn:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: rgba(var(--primary-rgb), 0.3);
    color: var(--primary);
    transform: translateY(-2px);
}

.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    padding: 0;
}

.btn-icon svg { width: 17px; height: 17px; }

.btn-primary {
    background: var(--primary);
    color: var(--btn-primary-text);
    border: none;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    flex: 1;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-2px); }

/* ============================================================
   network.html — Details Panel, Progress, Categories
   ============================================================ */
.gl-network-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: relative;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo svg { width: 30px; height: 30px; color: var(--primary); }

.logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.mode-selector {
    display: flex;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: 30px;
}

.mode-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 20px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.mode-btn.active {
    background: var(--primary);
    color: var(--btn-primary-text);
    font-weight: 600;
}

.mode-btn svg { width: 14px; height: 14px; }

main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.intro-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.intro-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 0;
}

.intro-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1.6fr 1fr; }
}

.categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.category-btn {
    border: 1px solid var(--border-color);
    background: var(--option-btn-bg);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 20px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-btn:hover {
    background: var(--surface-hover);
    color: var(--primary);
    border-color: var(--primary);
}

.category-btn.active {
    background: var(--primary);
    color: var(--btn-primary-text);
    border-color: var(--primary);
    font-weight: 600;
}

.diagram-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.diagram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.diagram-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.diagram-title svg { width: 18px; height: 18px; color: var(--primary); }

.svg-wrapper {
    width: 100%;
    height: auto;
    max-height: 520px;
    background: var(--svg-bg);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.svg-wrapper svg { width: 100%; height: 100%; max-height: 500px; }

.svg-node { cursor: pointer; pointer-events: all; }
.svg-node .node-bg {
    fill: transparent;
    stroke: transparent;
    stroke-width: 2;
    transition: var(--transition);
}
.svg-node:hover .node-bg {
    stroke: var(--primary);
    fill: rgba(var(--primary-rgb), 0.06);
}
.svg-node.active .node-bg {
    stroke: var(--secondary);
    fill: rgba(var(--secondary-rgb), 0.12);
    stroke-width: 2.5;
}
.svg-node.quiz-correct .node-bg {
    stroke: var(--success) !important;
    fill: rgba(16,185,129,0.2) !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 12px rgba(16,185,129,0.7)) !important;
}
.svg-node.quiz-incorrect .node-bg {
    stroke: var(--danger) !important;
    fill: rgba(239,68,68,0.2) !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 12px rgba(239,68,68,0.7)) !important;
}
.svg-node text {
    fill: var(--text-primary);
    font-family: var(--font-family);
    font-size: 11px;
    font-weight: 500;
    pointer-events: none;
    user-select: none;
    transition: var(--transition);
}
.svg-node:hover text, .svg-node.active text { fill: #fff; }
.svg-node.active text { font-weight: 700; }

.svg-link {
    stroke: var(--text-muted);
    stroke-width: 1.5;
    transition: var(--transition);
}
.svg-link.active { stroke: var(--primary); stroke-width: 2.5; }

.details-panel {
    background: linear-gradient(145deg, var(--surface-color), var(--panel-gradient-end));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 520px;
    box-shadow: var(--shadow-md);
    position: relative; /* ensure relative positioning for absolute children overlays */
    touch-action: pan-y; /* prevent default horizontal action to allow swipe gestures */
}

/* Card Touch-Navigation Overlays */
.card-nav-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.15;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 10;
    color: var(--text-secondary);
}

.card-nav-overlay:hover {
    opacity: 0.9;
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--primary);
}

.card-nav-overlay.prev {
    left: 0;
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}

.card-nav-overlay.next {
    right: 0;
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.card-nav-overlay svg {
    width: 24px;
    height: 24px;
    transition: transform 0.2s ease;
}

.card-nav-overlay.prev:hover svg {
    transform: translateX(-4px);
}

.card-nav-overlay.next:hover svg {
    transform: translateX(4px);
}

@media (max-width: 768px) {
    .card-nav-overlay {
        width: 40px;
        opacity: 0.35; /* more visible on mobile since no hover state */
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.panel-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.panel-header-title svg { width: 16px; height: 16px; }

.panel-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-hardware {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
}

.badge-protocol {
    background: rgba(var(--secondary-rgb), 0.08);
    color: var(--secondary);
    border: 1px solid rgba(var(--secondary-rgb), 0.15);
}

.badge-troubleshooting {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.device-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.device-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: -8px;
}

.device-explanation {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: rgba(0,0,0,0.15);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.detail-section {
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
}

.detail-section.tech-tip {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.section-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-label svg { width: 14px; height: 14px; }
.tech-tip .section-label { color: var(--warning); }

.section-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

/* Quiz */
.quiz-section {
    display: none;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
    align-items: start;
}

@media (min-width: 1024px) {
    .quiz-section { grid-template-columns: 1.6fr 1fr; }
}

.quiz-container {
    background: linear-gradient(145deg, var(--surface-color), var(--panel-gradient-end));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 520px;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.quiz-score-badge {
    background: rgba(16,185,129,0.1);
    color: var(--success);
    border: 1px solid rgba(16,185,129,0.2);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
}

.quiz-question-box { margin-bottom: 0.5rem; }

.quiz-question-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.8px;
}

.quiz-question-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.quiz-options { display: grid; grid-template-columns: 1fr; gap: 10px; }

.option-btn {
    background: var(--option-btn-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.option-btn:hover:not(.disabled) {
    border-color: rgba(var(--primary-rgb), 0.4);
    background: rgba(var(--primary-rgb), 0.08);
    transform: translateY(-2px);
}

.option-marker {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: var(--transition);
}

.option-btn:hover:not(.disabled) .option-marker {
    border-color: var(--primary);
    color: var(--primary);
}

.option-btn.correct {
    border-color: var(--success);
    background: rgba(16,185,129,0.1);
    color: var(--text-primary);
    font-weight: 600;
}

.option-btn.correct .option-marker {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.option-btn.incorrect {
    border-color: var(--danger);
    background: rgba(239,68,68,0.1);
    color: var(--text-primary);
}

.option-btn.incorrect .option-marker {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.option-btn.disabled { cursor: not-allowed; opacity: 0.6; }

.quiz-feedback {
    min-height: 50px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    display: none;
    align-items: flex-start;
    gap: 8px;
}

.quiz-feedback.show { display: flex; animation: fadeIn 0.3s ease-out; }
.quiz-feedback.correct-bg { background: rgba(16,185,129,0.05); border: 1px solid rgba(16,185,129,0.1); }
.quiz-feedback.incorrect-bg { background: rgba(239,68,68,0.05); border: 1px solid rgba(239,68,68,0.1); }

.feedback-icon { flex-shrink: 0; margin-top: 2px; }
.feedback-icon svg { width: 18px; height: 18px; }

.feedback-text h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.feedback-text p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.quiz-result-view {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: linear-gradient(145deg, var(--surface-color), var(--panel-gradient-end));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.4s ease-out;
}

.result-icon {
    width: 80px; height: 80px;
    background: rgba(var(--primary-rgb), 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    color: var(--primary);
    margin-bottom: 1.25rem;
}

.result-icon svg { width: 40px; height: 40px; }
.result-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text-primary); }
.result-score { font-size: 2.75rem; font-weight: 700; color: var(--primary); margin: 0.75rem 0; }
.result-text { color: var(--text-secondary); max-width: 420px; font-size: 0.9rem; line-height: 1.6; margin-bottom: 2rem; }

/* ============================================================
   Footer (network.html legacy)
   ============================================================ */
footer {
    border-top: 1px solid var(--border-color);
    padding: 1.25rem;
    text-align: center;
    margin-top: auto;
    background: rgba(10, 15, 29, 0.8);
}

footer p { font-size: 0.8rem; color: var(--text-muted); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOnly {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60%  { transform: translateX(-4px); }
    40%, 80%  { transform: translateX(4px); }
}

@keyframes pulse {
    0%   { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.25); opacity: 1; }
}

@keyframes pulseSuccessAnim {
    0%   { box-shadow: 0 0 0 0   rgba(16,185,129,0.4); }
    100% { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
}

@keyframes pulseDangerAnim {
    0%   { box-shadow: 0 0 0 0   rgba(239,68,68,0.4); }
    100% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
}

.shake { animation: shake 0.4s ease-in-out; }
.pulse-success { animation: pulseSuccessAnim 0.5s ease-out; }
.pulse-danger  { animation: pulseDangerAnim  0.5s ease-out; }

/* ============================================================
   Breadcrumb Navigation
   ============================================================ */
.gl-breadcrumb {
    font-family: var(--font-family) !important;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--breadcrumb-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: sticky;
    top: 53px;
    z-index: 90;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .gl-breadcrumb {
        top: 48px;
    }
}

.gl-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.gl-breadcrumb a:hover {
    color: var(--primary);
}

.gl-breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.gl-breadcrumb-current {
    color: var(--primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   Scroll-to-Top Button
   ============================================================ */
.gl-scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(45, 212, 191, 0.15);
    border: 1px solid rgba(45, 212, 191, 0.3);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
    pointer-events: none;
    z-index: 500;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gl-scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.gl-scroll-top:hover {
    background: rgba(45, 212, 191, 0.25);
    border-color: rgba(45, 212, 191, 0.6);
    transform: translateY(-3px);
}

.gl-scroll-top svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 480px) {
    .gl-scroll-top {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 40px;
        height: 40px;
    }
}

/* ============================================================
   Enhanced Footer
   ============================================================ */
.gl-footer-enhanced {
    font-family: var(--font-family) !important;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    margin-top: auto;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.gl-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

.gl-footer-brand-name {
    font-family: var(--font-family) !important;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.gl-footer-brand-name svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

.gl-footer-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.gl-footer-col-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
    margin-bottom: 0.9rem;
}

.gl-footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gl-footer-links a {
    font-size: 0.88rem;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s ease;
}

.gl-footer-links a:hover {
    color: var(--primary);
}

.gl-footer-links a svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: 0.6;
}

.gl-footer-divider {
    max-width: 1100px;
    margin: 0 auto;
    padding-top: 0;
    border-top: none;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
}

.gl-footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
    width: 100%;
}

.gl-footer-copy strong {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .gl-footer-enhanced { padding: 1rem 1.25rem; }
    .gl-footer-inner {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
    .gl-footer-divider {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================================
   Enhanced Navigation - scroll glow
   ============================================================ */
.gl-nav.scrolled {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    border-bottom-color: rgba(45, 212, 191, 0.12);
}

/* ============================================================
   Accessibility
   ============================================================ */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 1rem;
    background: var(--primary);
    color: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
}

/* Focus visible styles */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Inline course status badge for Coming Soon
   ============================================================ */
.course-card-disabled {
    pointer-events: none;
    cursor: default;
    opacity: 0.45;
    filter: grayscale(0.5);
}

.course-card-disabled .course-cta {
    color: var(--text-muted);
}

.course-badge-soon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(107, 114, 128, 0.12);
    border: 1px solid rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
    align-self: flex-start;
}

/* ============================================================
   Theme Toggle Button & Controls
   ============================================================ */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-left: auto;
    margin-right: 0.5rem;
}

.theme-toggle:hover {
    background: rgba(45, 212, 191, 0.08);
    color: var(--primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(20deg);
}

/* Icons styling: default (dark mode) shows sun, hides moon */
.theme-toggle .sun-icon {
    display: block;
}
.theme-toggle .moon-icon {
    display: none;
}

/* Icons styling: light mode shows moon, hides sun */
[data-theme="light"] .theme-toggle .sun-icon {
    display: none;
}
[data-theme="light"] .theme-toggle .moon-icon {
    display: block;
}

/* Adjustments for light theme specific styles */
[data-theme="light"] .mode-selector {
    background: var(--mode-selector-bg);
}
