/* ================================================================
   G L O B A L   U I   R U N T I M E   L A Y E R S
================================================================ */
#dashboard-layer {
    position: relative;
    background:
        radial-gradient(circle at top left, rgba(201, 106, 61, 0.06), transparent 24%),
        radial-gradient(circle at top right, rgba(45, 122, 120, 0.04), transparent 24%),
        linear-gradient(180deg, #1c1713 0%, #161210 42%, #120f0d 100%);
}

[data-theme="light"] #dashboard-layer {
    background:
        radial-gradient(circle at top left, rgba(201, 106, 61, 0.08), transparent 24%),
        radial-gradient(circle at top right, rgba(45, 122, 120, 0.05), transparent 22%),
        linear-gradient(180deg, #f6f0e5 0%, #f2eadf 45%, #efe6da 100%);
}

/* modal-layer is a passive DOM wrapper — #game-modal is the actual overlay (position:fixed) */
#modal-layer {
    display: contents; /* transparent wrapper, no layout effect */
}

#workspace-layer {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: var(--bg);
    overflow: hidden;
}

/* Modal overlay — hidden by default, shown via JS display:flex */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
}

/* When JS sets display:flex, centering kicks in */
.modal.is-open {
    display: flex;
}

.modal-content {
    background: var(--bg, #111);
    border-radius: 12px;
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    width: 90%;
    max-width: 860px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 64px rgba(0,0,0,0.6);
    animation: modalPopIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

#game-modal .modal-content {
    width: min(96vw, 1180px);
    max-width: 1180px;
    max-height: 92vh;
}

@keyframes modalPopIn {
    from {
        transform: scale(0.93) translateY(16px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* ================================================================
   HUB LAYER SYSTEM
   Persistent sidebar + workspace for Teacher, Pedagogue, School hubs.
================================================================ */

#hub-layer {
    /* fills the full viewport below the top-nav */
    position: fixed;
    top: calc(64px + var(--csl-cn-h, 0px)); /* height of .top-nav + evt. opbygnings-bjælke */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background:
        radial-gradient(circle at top left, rgba(201, 106, 61, 0.12), transparent 26%),
        radial-gradient(circle at bottom right, rgba(45, 122, 120, 0.09), transparent 28%),
        linear-gradient(180deg, #2b2118, #1d1611);
    overflow: hidden;
}

[data-theme="light"] #hub-layer {
    background:
        radial-gradient(circle at top left, rgba(201, 106, 61, 0.08), transparent 24%),
        radial-gradient(circle at bottom right, rgba(45, 122, 120, 0.06), transparent 26%),
        linear-gradient(180deg, #f6f0e5, #efe7da);
}

.hub-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

/* ── Sidebar ─────────────────────────────────────── */
.hub-sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background:
        linear-gradient(180deg, rgba(33, 28, 23, 0.98), rgba(24, 20, 16, 0.98));
    border-right: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
    box-shadow: 12px 0 32px rgba(11, 9, 7, 0.18);
    overflow: hidden;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

[data-theme="light"] .hub-sidebar {
    background: linear-gradient(180deg, rgba(250, 245, 237, 0.98), rgba(245, 238, 227, 0.98));
    border-right: 1px solid rgba(67, 54, 37, 0.12);
    box-shadow: 12px 0 28px rgba(31, 42, 36, 0.06);
}

.hub-sidebar.sidebar-expanded  { width: 276px; }
.hub-sidebar.sidebar-collapsed { width: 74px; }

/* ── Hub Sidebar Logo / Home Link ─────────────────── */
.hub-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px 12px;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(201, 106, 61, 0.14);
    cursor: pointer;
    text-align: left;
    flex-shrink: 0;
    font-family: inherit;
    transition: background 0.15s ease;
    overflow: hidden;
    white-space: nowrap;
}
.hub-sidebar-logo:hover {
    background: rgba(255, 251, 244, 0.035);
}
.hub-sidebar-logo:focus-visible,
.hub-sidebar-toggle:focus-visible,
.hub-nav-item:focus-visible {
    outline: 2px solid rgba(201, 106, 61, 0.72);
    outline-offset: 2px;
}
.hub-sidebar-logo-img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: block;
    border-radius: 10px;
    filter: drop-shadow(0 0 6px rgba(201, 106, 61, 0.18));
    transition: filter 0.2s ease, transform 0.2s ease;
}
.hub-sidebar-logo:hover .hub-sidebar-logo-img {
    filter: drop-shadow(0 0 10px rgba(201, 106, 61, 0.28));
    transform: scale(1.06);
}
.hub-sidebar-logo-text {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(244, 239, 230, 0.82);
    text-transform: uppercase;
    opacity: 1;
    transition: opacity 0.15s ease;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .hub-sidebar-logo {
    border-bottom-color: rgba(67, 54, 37, 0.1);
}

[data-theme="light"] .hub-sidebar-logo:hover {
    background: rgba(201, 106, 61, 0.05);
}

[data-theme="light"] .hub-sidebar-logo-text,
[data-theme="light"] .hub-sidebar-title {
    color: #1f2a24;
}
/* Hide text when sidebar collapsed, logo still shows */
.sidebar-collapsed .hub-sidebar-logo-text { opacity: 0; width: 0; }
.sidebar-collapsed .hub-sidebar-logo { padding: 14px 16px 12px; justify-content: center; }


/* Sidebar header */
.hub-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(201, 106, 61, 0.12);
    flex-shrink: 0;
    gap: 0.5rem;
    min-height: 60px;
}

.hub-sidebar-title {
    font-size: 0.96rem;
    font-weight: 800;
    color: rgba(244, 239, 230, 0.96);
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.15s ease;
    letter-spacing: 0.01em;
}

.sidebar-collapsed .hub-sidebar-title { opacity: 0; width: 0; }

/* Toggle button */
.hub-sidebar-toggle {
    background: none;
    border: 1px solid rgba(201, 106, 61, 0.16);
    color: rgba(244, 239, 230, 0.72);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 999px;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1;
}
.hub-sidebar-toggle:hover {
    background: rgba(255, 251, 244, 0.07);
    color: #f4efe6;
}

[data-theme="light"] .hub-sidebar-toggle {
    color: #445149;
    border-color: rgba(67, 54, 37, 0.12);
}

[data-theme="light"] .hub-sidebar-toggle:hover {
    background: rgba(201, 106, 61, 0.08);
    color: #1f2a24;
}

/* Sidebar nav list */
.hub-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    padding: 0.9rem 0.6rem;
    overflow-y: auto;
    flex: 1;
}

/* Each nav item */
.hub-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(201, 106, 61, 0.08);
    background: rgba(255, 251, 244, 0.028);
    color: rgba(244, 239, 230, 0.8);
    border-radius: 18px;
    cursor: pointer;
    text-align: left;
    font-family: "Public Sans", "Outfit", sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    width: 100%;
    overflow: hidden;
}
.hub-nav-item:hover {
    background: rgba(255, 251, 244, 0.065);
    color: #f4efe6;
    border-color: rgba(201, 106, 61, 0.22);
    transform: translateX(2px);
}
.hub-nav-item.active {
    background: linear-gradient(135deg, rgba(201, 106, 61, 0.24), rgba(45, 122, 120, 0.14));
    color: #fff7ef;
    border-color: rgba(201, 106, 61, 0.4);
    box-shadow: inset 0 0 0 1px rgba(255, 251, 244, 0.08), 0 10px 22px rgba(0, 0, 0, 0.14);
}

[data-theme="light"] .hub-nav-item {
    background: rgba(255, 251, 244, 0.82);
    border-color: rgba(67, 54, 37, 0.1);
    color: #445149;
}

[data-theme="light"] .hub-nav-item:hover {
    background: rgba(201, 106, 61, 0.08);
    color: #1f2a24;
    border-color: rgba(201, 106, 61, 0.16);
}

[data-theme="light"] .hub-nav-item.active {
    background: rgba(201, 106, 61, 0.16);
    color: #8e4f2f;
    border-color: rgba(201, 106, 61, 0.26);
    box-shadow: inset 0 0 0 1px rgba(255, 251, 244, 0.5);
}
.hub-nav-item .nav-icon {
    font-size: 1.08rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}
.hub-nav-item .nav-label {
    opacity: 1;
    transition: opacity 0.15s ease;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-collapsed .hub-nav-item .nav-label { opacity: 0; width: 0; }

/* ── Workspace ───────────────────────────────────── */
.hub-workspace {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: clamp(1rem, 2.2vw, 2rem);
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: linear-gradient(180deg, rgba(255, 251, 244, 0.015), transparent 240px);
}

[data-theme="light"] .hub-workspace {
    background: linear-gradient(180deg, rgba(255, 251, 244, 0.3), transparent 240px);
}

.hub-plugin-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Hub welcome / welcome screen shown when no plugin is open */
.hub-welcome {
    max-width: 1120px;
    width: 100%;
    display: grid;
    gap: 1.15rem;
}
.hub-welcome h2 { margin-top: 0; }
.hub-section-shell {
    display: grid;
    gap: 0.9rem;
}
.hub-section-heading {
    display: grid;
    gap: 0.3rem;
}
.hub-section-kicker {
    display: inline-flex;
    width: max-content;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8e4f2f;
}
.hub-section-heading h3 {
    margin: 0;
    color: #1f2a24;
    font-family: "Fraunces", Georgia, serif;
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    font-weight: 600;
    line-height: 1.08;
}
.hub-section-heading p {
    margin: 0;
    color: #5f6b63;
    line-height: 1.55;
}
.hub-hero-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}
.hub-hero-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.72rem 1rem;
    margin: 0;
    border-radius: 999px;
    border: 1px solid rgba(67, 54, 37, 0.14);
    background: rgba(255, 251, 244, 0.72);
    color: #1f2a24;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.hub-hero-action:hover {
    transform: translateY(-1px);
    border-color: rgba(201, 106, 61, 0.24);
    background: rgba(255, 247, 236, 0.92);
}
.hub-hero-action.is-primary {
    background: rgba(201, 106, 61, 0.14);
    color: #8e4f2f;
    border-color: rgba(201, 106, 61, 0.24);
}
.hub-spotlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.hub-spotlight-card {
    display: grid;
    gap: 0.6rem;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    min-height: 176px;
    width: 100%;
    padding: 1rem 1.05rem;
    margin: 0;
    border-radius: 22px;
    border: 1px solid rgba(67, 54, 37, 0.12);
    background:
        radial-gradient(circle at top right, rgba(215, 169, 40, 0.07), transparent 36%),
        linear-gradient(180deg, rgba(246, 239, 229, 0.98), rgba(239, 229, 214, 0.96));
    text-align: left;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.hub-spotlight-card:hover {
    transform: translateY(-2px);
    border-color: rgba(201, 106, 61, 0.22);
    box-shadow: 0 18px 34px rgba(17, 14, 12, 0.12);
}
.hub-spotlight-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.hub-spotlight-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8e4f2f;
}
.hub-spotlight-icon {
    font-size: 1.25rem;
}
.hub-spotlight-title {
    color: #1f2a24;
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.08;
}
.hub-spotlight-body {
    margin: 0;
    color: #5f6b63;
    line-height: 1.55;
}
.hub-tool-grid-quick {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
[data-hub-style="pedagogue"] .hub-section-kicker,
[data-hub-style="pedagogue"] .hub-spotlight-kicker,
[data-hub-style="pedagogue"] .hub-header-kicker {
    color: #2d7a78;
}

[data-hub-style="pedagogue"] .hub-hero-action.is-primary {
    background: rgba(45, 122, 120, 0.14);
    color: #216765;
    border-color: rgba(45, 122, 120, 0.24);
}

[data-hub-style="pedagogue"] .hub-spotlight-card {
    background:
        radial-gradient(circle at top right, rgba(45, 122, 120, 0.09), transparent 36%),
        linear-gradient(180deg, rgba(246, 239, 229, 0.98), rgba(239, 229, 214, 0.96));
}

[data-hub-style="teacher"] .hub-section-kicker,
[data-hub-style="teacher"] .hub-spotlight-kicker,
[data-hub-style="teacher"] .hub-header-kicker {
    color: #8e4f2f;
}

[data-hub-style="teacher"] .hub-hero-action.is-primary {
    background: rgba(201, 106, 61, 0.14);
    color: #8e4f2f;
    border-color: rgba(201, 106, 61, 0.24);
}

[data-hub-style="teacher"] .hub-spotlight-card {
    background:
        radial-gradient(circle at top right, rgba(201, 106, 61, 0.09), transparent 36%),
        linear-gradient(180deg, rgba(246, 239, 229, 0.98), rgba(239, 229, 214, 0.96));
}

/* ── Hub Continue / Resume zone ──────────────────── */.hub-continue-shell {
    padding: 1.1rem 1.35rem;
    border: 1px solid rgba(45, 122, 120, 0.18);
    border-radius: 22px;
    background: rgba(45, 122, 120, 0.06);
}
.hub-continue-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.hub-continue-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(45, 122, 120, 0.22);
    background: rgba(255, 252, 248, 0.88);
    color: #1f2a24;
    font-family: "Public Sans", "Outfit", sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.hub-continue-chip:hover {
    background: rgba(45, 122, 120, 0.12);
    border-color: rgba(45, 122, 120, 0.36);
    color: #216765;
}
.hub-continue-chip-icon {
    font-size: 1rem;
    line-height: 1;
}
[data-theme="dark"] .hub-continue-shell {
    border-color: rgba(45, 122, 120, 0.22);
    background: rgba(45, 122, 120, 0.08);
}
[data-theme="dark"] .hub-continue-chip {
    background: rgba(40, 33, 26, 0.72);
    border-color: rgba(45, 122, 120, 0.24);
    color: rgba(244, 239, 230, 0.88);
}
[data-theme="dark"] .hub-continue-chip:hover {
    background: rgba(45, 122, 120, 0.18);
    border-color: rgba(45, 122, 120, 0.42);
    color: #8fd8d6;
}

[data-hub-style="school"] .hub-section-kicker,
[data-hub-style="school"] .hub-spotlight-kicker,
[data-hub-style="school"] .hub-header-kicker {
    color: #6f5a3f;
}

[data-hub-style="school"] .hub-hero-action.is-primary {
    background: rgba(111, 90, 63, 0.14);
    color: #5f4d36;
    border-color: rgba(111, 90, 63, 0.24);
}

[data-hub-style="school"] .hub-spotlight-card {
    background:
        radial-gradient(circle at top right, rgba(111, 90, 63, 0.08), transparent 36%),
        linear-gradient(180deg, rgba(246, 239, 229, 0.98), rgba(239, 229, 214, 0.96));
}

[data-hub-style="school"] .hub-header-meta {
    min-width: 140px;
}

.hub-spotlight-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.hub-header-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.35rem 1.35rem;
    border: 1px solid rgba(67, 54, 37, 0.12);
    border-radius: 26px;
    background:
        radial-gradient(circle at top right, rgba(215, 169, 40, 0.07), transparent 30%),
        linear-gradient(180deg, rgba(247, 240, 230, 0.97), rgba(239, 229, 214, 0.96));
    box-shadow: 0 18px 34px rgba(17, 14, 12, 0.12);
}
.hub-header-copy {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
}
.hub-header-copy h2 {
    color: #1f2a24;
    font-family: "Fraunces", Georgia, serif;
    font-size: clamp(1.9rem, 2.8vw, 2.6rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.04;
}
.hub-header-copy p {
    margin: 0;
    color: #5f6b63;
    line-height: 1.55;
    max-width: 62ch;
}
.hub-header-kicker {
    display: inline-flex;
    width: max-content;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8e4f2f;
}
.hub-header-meta {
    display: grid;
    gap: 0.2rem;
    min-width: 120px;
    padding: 0.85rem 0.95rem;
    border-radius: 18px;
    border: 1px solid rgba(67, 54, 37, 0.12);
    background: rgba(255, 250, 242, 0.85);
    text-align: right;
}
.hub-header-meta strong {
    font-size: 1.35rem;
    line-height: 1;
    color: #1f2a24;
}
.hub-header-meta span {
    font-size: 0.8rem;
    color: #5f6b63;
}

[data-theme="dark"] .hub-header-card {
    border-color: rgba(201, 106, 61, 0.14);
    background:
        radial-gradient(circle at top right, rgba(215, 169, 40, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(34, 27, 21, 0.98), rgba(26, 20, 16, 0.98));
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .hub-section-kicker,
[data-theme="dark"] .hub-spotlight-kicker {
    color: #d38a61;
}

[data-theme="dark"] .hub-section-heading h3,
[data-theme="dark"] .hub-spotlight-title {
    color: #f3e8d9;
}

[data-theme="dark"] .hub-section-heading p,
[data-theme="dark"] .hub-spotlight-body {
    color: #cbb7a3;
}

[data-theme="dark"] .hub-hero-action {
    background: rgba(245, 236, 223, 0.08);
    border-color: rgba(201, 106, 61, 0.16);
    color: #f3e8d9;
}

[data-theme="dark"] .hub-hero-action:hover {
    background: rgba(245, 236, 223, 0.12);
    border-color: rgba(201, 106, 61, 0.28);
}

[data-theme="dark"] .hub-hero-action.is-primary {
    background: rgba(201, 106, 61, 0.16);
    color: #f5ddd0;
}

[data-theme="dark"] [data-hub-style="pedagogue"] .hub-section-kicker,
[data-theme="dark"] [data-hub-style="pedagogue"] .hub-spotlight-kicker,
[data-theme="dark"] [data-hub-style="pedagogue"] .hub-header-kicker {
    color: #8fd0cc;
}

[data-theme="dark"] [data-hub-style="pedagogue"] .hub-hero-action.is-primary {
    background: rgba(45, 122, 120, 0.18);
    color: #b9e7e3;
    border-color: rgba(45, 122, 120, 0.3);
}

[data-theme="dark"] [data-hub-style="school"] .hub-section-kicker,
[data-theme="dark"] [data-hub-style="school"] .hub-spotlight-kicker,
[data-theme="dark"] [data-hub-style="school"] .hub-header-kicker {
    color: #cbb391;
}

[data-theme="dark"] [data-hub-style="school"] .hub-hero-action.is-primary {
    background: rgba(111, 90, 63, 0.22);
    color: #ead8c2;
    border-color: rgba(111, 90, 63, 0.32);
}

[data-theme="dark"] .hub-spotlight-card {
    border-color: rgba(201, 106, 61, 0.14);
    background:
        radial-gradient(circle at top right, rgba(215, 169, 40, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(35, 28, 22, 0.98), rgba(27, 21, 17, 0.98));
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.16);
}

[data-theme="dark"] [data-hub-style="pedagogue"] .hub-spotlight-card {
    border-color: rgba(45, 122, 120, 0.14);
    background:
        radial-gradient(circle at top right, rgba(45, 122, 120, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(35, 28, 22, 0.98), rgba(27, 21, 17, 0.98));
}

[data-theme="dark"] [data-hub-style="school"] .hub-spotlight-card {
    border-color: rgba(111, 90, 63, 0.16);
    background:
        radial-gradient(circle at top right, rgba(111, 90, 63, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(35, 28, 22, 0.98), rgba(27, 21, 17, 0.98));
}

[data-theme="dark"] .hub-spotlight-card:hover {
    border-color: rgba(201, 106, 61, 0.24);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .hub-header-copy h2 {
    color: #f3e8d9;
}

[data-theme="dark"] .hub-header-copy p {
    color: #cebba8;
}

[data-theme="dark"] .hub-header-kicker {
    color: #d38a61;
}

[data-theme="dark"] .hub-header-meta {
    background: rgba(245, 236, 223, 0.92);
    border-color: rgba(201, 106, 61, 0.12);
}

[data-theme="light"] .hub-header-card {
    background:
        radial-gradient(circle at top right, rgba(215, 169, 40, 0.06), transparent 30%),
        linear-gradient(180deg, rgba(246, 239, 229, 0.98), rgba(239, 229, 214, 0.96));
}

[data-theme="light"] .hub-hero-action {
    background: rgba(255, 251, 244, 0.78);
}

[data-theme="light"] .hub-spotlight-card {
    background:
        radial-gradient(circle at top right, rgba(215, 169, 40, 0.08), transparent 36%),
        linear-gradient(180deg, rgba(246, 239, 229, 0.98), rgba(239, 229, 214, 0.96));
}

[data-theme="light"] .hub-header-meta {
    background: rgba(247, 240, 230, 0.9);
}
.hub-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}
.hub-tool-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    min-height: 154px;
    padding: 1.1rem 1.15rem;
    background: rgba(246, 239, 229, 0.96);
    border: 1px solid rgba(67, 54, 37, 0.12);
    border-radius: 22px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.hub-tool-card:hover {
    transform: translateY(-2px);
    border-color: rgba(201, 106, 61, 0.24);
    box-shadow: 0 18px 34px rgba(17, 14, 12, 0.12);
}
.hub-tool-card:focus-visible {
    outline: 2px solid rgba(201, 106, 61, 0.72);
    outline-offset: 2px;
}
.teacher-tool-card:focus-visible {
    outline: 2px solid rgba(201, 106, 61, 0.72);
    outline-offset: 2px;
}
.hub-tool-card-icon {
    font-size: 1.45rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 247, 236, 0.94), rgba(244, 235, 222, 0.96));
    border: 1px solid rgba(201, 106, 61, 0.14);
    flex-shrink: 0;
}
.hub-tool-card-copy {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}
.hub-tool-card-top {
    display: flex;
    justify-content: space-between;
    gap: 0.65rem;
    align-items: flex-start;
}
.hub-tool-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2a24;
    overflow-wrap: anywhere;
}
.hub-tool-card-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.24rem 0.55rem;
    border-radius: 999px;
    background: rgba(45, 122, 120, 0.12);
    color: #2d7a78;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

[data-theme="light"] .hub-tool-card-status {
    background: rgba(45, 122, 120, 0.14);
    color: #216765;
}
.hub-tool-card-desc {
    margin: 0;
    color: #5f6b63;
    line-height: 1.52;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

[data-theme="dark"] .hub-tool-card {
    background: linear-gradient(180deg, rgba(32, 25, 19, 0.98), rgba(25, 20, 16, 0.98));
    border-color: rgba(201, 106, 61, 0.12);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.16);
}

[data-theme="dark"] .hub-tool-card:hover {
    border-color: rgba(201, 106, 61, 0.24);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .hub-tool-card-icon {
    background: linear-gradient(180deg, rgba(246, 239, 229, 0.95), rgba(236, 226, 212, 0.95));
    border-color: rgba(201, 106, 61, 0.16);
}

[data-theme="dark"] .hub-tool-card-title {
    color: #f3e8d9;
}

[data-theme="dark"] .hub-tool-card-desc {
    color: #cbb7a3;
}

[data-theme="dark"] .hub-tool-card-status {
    background: rgba(45, 122, 120, 0.24);
    color: #a2e0db;
    box-shadow: inset 0 0 0 1px rgba(45, 122, 120, 0.16);
}

[data-theme="light"] .hub-tool-card {
    background: rgba(245, 238, 227, 0.98);
}

[data-theme="light"] .hub-tool-card-icon {
    background: linear-gradient(180deg, rgba(247, 240, 230, 0.98), rgba(239, 229, 214, 0.98));
}

/* ── Hubs must NOT have max-width constraint applied by .page-view ── */
#teacher-view,
#pedagogue-view,
#school-hub-view {
    max-width: none;
}

/* Mobile: stack sidebar above workspace */
@media (max-width: 768px) {
    .hub-layout { flex-direction: column; }
    .hub-sidebar.sidebar-expanded  { width: 100%; height: auto; }
    .hub-sidebar.sidebar-collapsed { width: 100%; height: auto; }
    .hub-sidebar-header { padding: 0.9rem 0.85rem; }
    .hub-sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 0.5rem 0.65rem;
        gap: 0.45rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .hub-sidebar-nav::-webkit-scrollbar { display: none; }
    .hub-nav-item {
        flex-direction: row;
        gap: 0.55rem;
        padding: 0.72rem 0.9rem;
        font-size: 0.8rem;
        min-height: 44px;
        min-width: max-content;
        justify-content: flex-start;
        border-radius: 16px;
    }
    .hub-nav-item .nav-label,
    .sidebar-collapsed .hub-nav-item .nav-label {
        opacity: 1;
        width: auto;
    }
    .hub-workspace { padding: 1rem; }
    .hub-header-card,
    .hub-workspace-backbar { display: grid; grid-template-columns: 1fr; }
    .hub-header-meta { text-align: left; min-width: 0; }
    .hub-tool-grid { grid-template-columns: 1fr; }
    .hub-tool-card { min-height: 0; }
    .hub-hero-actions { display: grid; grid-template-columns: 1fr; }
    .hub-spotlight-grid { grid-template-columns: 1fr; }
    .hub-spotlight-card { min-height: 0; }
}

/* ── Hub Workspace Back Navigation ─────────────────────────── */

/* Bar injected at the top of every non-welcome workspace */
.hub-workspace-backbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(67, 54, 37, 0.12);
    border-radius: 22px;
    background: rgba(255, 251, 244, 0.94);
    box-shadow: 0 12px 28px rgba(17, 14, 12, 0.08);
    flex-shrink: 0;
}
.hub-workspace-backnav { flex-shrink: 0; }
.hub-workspace-meta {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}
.hub-workspace-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8e4f2f;
}
.hub-workspace-title {
    font-family: "Fraunces", Georgia, serif;
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 600;
    line-height: 1.1;
    color: #1f2a24;
    overflow-wrap: anywhere;
}
.hub-workspace-desc {
    margin: 0;
    color: #5f6b63;
    line-height: 1.5;
    max-width: 72ch;
    overflow-wrap: anywhere;
}

[data-theme="dark"] .hub-workspace-backbar {
    background: linear-gradient(180deg, rgba(33, 26, 21, 0.98), rgba(26, 20, 16, 0.98));
    border-color: rgba(201, 106, 61, 0.16);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

[data-theme="dark"] .hub-workspace-kicker {
    color: #d38a61;
}

[data-theme="dark"] .hub-workspace-title {
    color: #f3e8d9;
}

[data-theme="dark"] .hub-workspace-desc {
    color: #cbb7a3;
}

[data-theme="light"] .hub-workspace-backbar {
    background: rgba(246, 239, 229, 0.94);
    border-color: rgba(67, 54, 37, 0.14);
}

/* The back button itself */
.hub-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 247, 236, 0.94);
    border: 1px solid rgba(67, 54, 37, 0.12);
    color: #445149;
    font-family: "Public Sans", "Outfit", sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    line-height: 1;
}
.hub-back-btn:hover {
    background: rgba(255, 242, 226, 0.98);
    color: #1f2a24;
    border-color: rgba(201, 106, 61, 0.22);
}
.hub-back-btn svg {
    flex-shrink: 0;
}

/* ── Workspace empty / stub / not-ready states ──── */
.ws-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52vh;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}
.ws-empty-state-icon {
    font-size: 2.5rem;
    opacity: 0.38;
    line-height: 1;
}
.ws-empty-state-title {
    margin: 0;
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main, #1f2a24);
}
.ws-empty-state-body {
    margin: 0;
    max-width: 38ch;
    line-height: 1.55;
}
.ws-empty-state-action {
    margin-top: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: 1px solid rgba(67, 54, 37, 0.14);
    background: rgba(255, 251, 244, 0.9);
    color: #445149;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.ws-empty-state-action:hover {
    background: rgba(201, 106, 61, 0.08);
    border-color: rgba(201, 106, 61, 0.2);
    color: #1f2a24;
}
[data-theme="dark"] .ws-empty-state-action {
    background: rgba(40, 33, 26, 0.72);
    border-color: rgba(201, 106, 61, 0.16);
    color: rgba(244, 239, 230, 0.82);
}
[data-theme="dark"] .ws-empty-state-action:hover {
    background: rgba(201, 106, 61, 0.12);
    border-color: rgba(201, 106, 61, 0.28);
    color: #f4efe6;
}
.ws-empty-state-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.24);
    color: #b45309;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
[data-theme="dark"] .ws-empty-state-tag {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.28);
    color: #fbbf24;
}
.ws-loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(67, 54, 37, 0.12);
    border-top-color: #c86a3d;
    border-radius: 50%;
    animation: ws-spin 0.8s linear infinite;
}
[data-theme="dark"] .ws-loading-spinner {
    border-color: rgba(244, 239, 230, 0.12);
    border-top-color: #e89860;
}
@keyframes ws-spin {
    to { transform: rotate(360deg); }
}


   No horizontal scrolling. Max-width centered containers.
================================================================ */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* All main page views stay within 1200px, except dedicated full-page game detail */
.page-view,
#dashboard-view,
#school-hub-view,
#archive-view,
#teacher-view,
#pedagogue-view,
#generator-view {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

#game-detail-view {
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    overflow-x: hidden;
}

/* Archive grid also centered */
.archive-layout {
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    overflow-x: hidden;
}

.app-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Section Fade Transition (show/hide views) */
.app-layout, .archive-layout {
    transition: opacity 0.35s ease, transform 0.35s ease;
}

/* App Tabs */
.app-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Principles Grid used in School Profiles and CSL Lab */
.principles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.princip-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
}

.princip-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border-radius: 12px;
}


/* Background Animated Blobs */
.blob-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, rgba(201, 106, 61, 0.24) 0%, rgba(215, 169, 40, 0.18) 100%);
    filter: blur(90px);
    border-radius: 50%;
    z-index: -1;
    animation: float 20s infinite alternate ease-in-out;
    top: -100px;
    left: -100px;
}

.blob-2 {
    background: linear-gradient(135deg, rgba(45, 122, 120, 0.2) 0%, rgba(231, 124, 107, 0.14) 100%);
    top: auto;
    bottom: -100px;
    right: -100px;
    left: auto;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Sidebar Ugeplan */
.ugeplan-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ugeplan-sidebar.open {
    right: 0;
    visibility: visible;
    pointer-events: auto;
}

.ugeplan-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.ugeplan-list {
    overflow: visible;
}

/* ═══ PRINT — skjul alt platform-chrome ═══ */
@media print {
    /* Sidebar, topbar, dashboard */
    #hub-sidebar,
    .hub-sidebar,
    #dashboard-layer,
    .hub-workspace-backbar,
    .hub-workspace-backnav,
    .floating-back-btn,
    .ugeplan-sidebar,
    #toggle-ugeplan-btn,
    .floating-action-btn,
    #system-status-meme,
    #game-modal,
    .modal,
    .blob-bg,
    .particles,
    .top-nav,
    .login-cta,
    #auth-modal {
        display: none !important;
    }

    /* Workspace-layer skal fylde hele siden uden fixed positioning */
    #workspace-layer {
        position: static !important;
        overflow: visible !important;
    }

    /* Fjern baggrund og padding fra workspace-frame */
    .hub-workspace-frame {
        padding: 0 !important;
        margin: 0 !important;
        background: none !important;
    }

    body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}
