body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    background-color: #f8fafc;
    /* Subtle, engineering grid in the background */
    background-image: 
        linear-gradient(rgba(0, 105, 60, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 105, 60, 0.04) 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: hidden;
}

/* Glassmorphism on the side panel */
#sidebar {
    width: 420px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.6);
    padding: 30px;
    box-shadow: 10px 0 30px rgba(30, 30, 30, 0.04);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;          /* a longer legend / skill list = the panel scrolls */
    overflow-x: hidden;
}

.brand-header {
    margin-bottom: 25px;
    border-bottom: 3px solid #00693C; /* AGH green */
    padding-bottom: 15px;
}

.agh-logo-mock {
    background-color: #00693C;
    color: #FFFFFF;
    font-weight: 800;
    font-size: 1.2rem;
    padding: 6px 14px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

h1 {
    font-size: 1.4rem;
    margin: 0;
    color: #1E1E1E; /* AGH black */
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Custom, modern Dropdown */
.filter-section {
    margin-bottom: 26px;
}
.select-wrapper {
    position: relative;
    margin-top: 10px;
}
.select-wrapper::after {
    content: "▼";
    font-size: 0.7rem;
    color: #00693C;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
select {
    width: 100%;
    padding: 14px 15px;
    appearance: none;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1E1E1E;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
select:focus {
    outline: none;
    border-color: #00693C;
    box-shadow: 0 0 0 4px rgba(0, 105, 60, 0.15);
}

/* Futuristic details panel */
#details-panel {
    padding: 25px 20px;
    background: #ffffff;
    border-radius: 12px;
    border-left: 5px solid #A71930; /* AGH red */
    min-height: 250px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.detail-title {
    font-weight: 800;
    margin-bottom: 15px;
    color: #A71930;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#network-container {
    flex-grow: 1;
    position: relative;
    height: 100%;
}
#mynetwork {
    width: 100%;
    height: 100%;
}

/* Semester Headers (Pill Design) */
#column-headers {
    position: absolute;
    top: 30px;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 5;
}

.sem-header {
    position: absolute;
    transform: translateX(-50%);
    transform-origin: center top; /* scaling with zoom relative to the top edge */
    background-color: #1E1E1E; 
    color: #FFFFFF;
    padding: 8px 24px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 6px 15px rgba(30, 30, 30, 0.15);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    display: none;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Pulsing dot animation for semesters */
.dot {
    width: 8px;
    height: 8px;
    background-color: #00693C;
    border-radius: 50%;
    display: inline-block;
    animation: pulseGreen 2s infinite;
}

/* UI Animations */
@keyframes pulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(0, 105, 60, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(0, 105, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 105, 60, 0); }
}

.placeholder-anim {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #64748b;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.5;
}
.pulse-circle {
    width: 12px;
    height: 12px;
    margin-top: 4px;
    background-color: #A71930;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulseRed 2s infinite;
}
@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(167, 25, 48, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(167, 25, 48, 0); }
    100% { box-shadow: 0 0 0 0 rgba(167, 25, 48, 0); }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Legend ===== */
.legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 22px;
    padding: 14px 16px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.legend-group-title {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin: 4px 0 2px;
}
.legend-group-title:first-child { margin-top: 0; }
.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    line-height: 1.3;
}
.legend-item.legend-note {
    font-weight: 500;
    color: #64748b;
    font-size: 0.76rem;
}
.legend-swatch {
    width: 26px;
    height: 16px;
    border-radius: 5px;
    flex-shrink: 0;
    box-sizing: border-box;
}
/* Swatches showing the subject type (border) */
.swatch-solid  { background: #cbd5e1; border: 2px solid #475569; }
.swatch-dashed { background: #cbd5e1; border: 2px dashed #0B5D8A; }
.swatch-block  { background: rgba(11, 93, 138, 0.08); border: 2px dashed #0B5D8A; }

/* ===== Details panel - eyebrow / heading / description ===== */
.detail-eyebrow {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.detail-heading {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.25;
}
.detail-desc {
    color: #475569;
    line-height: 1.6;
    font-size: 0.95rem;
    margin: 2px 0 16px;
}

/* Domain category chip */
.cat-chip {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 14px;
}

/* Hint below the archetype menu */
.filter-hint {
    margin: 10px 2px 0;
    font-size: 0.76rem;
    line-height: 1.45;
    color: #64748b;
    font-weight: 500;
}

/* ===== Archetype panel: priority key + core subjects ===== */
.arch-key {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}
.arch-key-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.4;
}
.arch-key-row strong { color: #1E1E1E; }
.arch-dot {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 1px;
    box-sizing: border-box;
}
/* Core: full color + red border (as on the map) */
.arch-dot-core    { background: #1C7ED6; border: 3px solid #A71930; box-shadow: 0 0 0 1px #A71930; }
/* Support: full color, regular domain border */
.arch-dot-support { background: #1C7ED6; border: 2px solid #1256A0; }
/* Context: dimmed */
.arch-dot-context { background: #f1f5f9; border: 2px solid #e2e8f0; }

.arch-section-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #A71930;
    margin: 16px 0 6px;
}
.arch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.arch-chip {
    font-size: 0.75rem;
    font-weight: 600;
    color: #0B5D8A;
    background: rgba(11, 93, 138, 0.08);
    border: 1px solid rgba(11, 93, 138, 0.18);
    border-radius: 14px;
    padding: 4px 10px;
    line-height: 1.2;
}

/* Elective block in the details panel */
.elective-box {
    background: rgba(11, 93, 138, 0.06);
    border: 1.5px dashed #0B5D8A;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.elective-box-head {
    color: #0B5D8A;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.45;
    margin-bottom: 8px;
}
.elective-siblings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.elective-siblings li {
    font-size: 0.84rem;
    color: #475569;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(11, 93, 138, 0.12);
}
.elective-siblings li.current {
    color: #0B5D8A;
    font-weight: 700;
    background: rgba(11, 93, 138, 0.12);
    border-color: rgba(11, 93, 138, 0.35);
}
.elective-siblings .tick {
    font-size: 0.72rem;
    font-weight: 700;
    color: #A71930;
    margin-left: 4px;
    white-space: nowrap;
}

/* Syllabus button (PDF) */
.syllabus-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: #00693C;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 11px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 105, 60, 0.22);
}
.syllabus-btn:hover {
    background: #A71930;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(167, 25, 48, 0.28);
}
.syllabus-btn:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
}

/* Skills list in the details panel */
.skills-title {
    color: #1E1E1E;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.skills-list {
    margin: 8px 0 0 0;
    padding-left: 18px;
    color: #475569;
    font-size: 0.88rem;
    line-height: 1.55;
}
.skills-list li {
    margin-bottom: 7px;
}

/* Details panel - content scrolling (on desktop the whole #sidebar scrolls) */
.detail-content {
    padding-right: 6px;
}

/* ===== Collapsible side panel ===== */
#sidebar {
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
/* 400px width + 2x30px padding + 1px border = 461px */
#sidebar.collapsed {
    margin-left: -461px;
}

#sidebar-toggle {
    position: fixed;
    left: 461px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 7px;
    background-color: #00693C;
    color: #ffffff;
    border: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    box-shadow: 4px 0 12px rgba(30, 30, 30, 0.12);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s ease,
                padding 0.35s ease;
}
#sidebar-toggle:hover {
    background-color: #A71930;
}
#sidebar-toggle:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
}

#sidebar-toggle .chevron {
    font-size: 0.85rem;
    line-height: 1;
    transition: transform 0.35s ease;
}

/* Vertical label - visible only after collapsing the panel */
#sidebar-toggle .toggle-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

/* Collapsed state: button at the edge, arrow rotated, label visible */
#sidebar-toggle.collapsed {
    left: 0;
    padding: 18px 9px;
}
#sidebar-toggle.collapsed .chevron {
    transform: rotate(180deg);
}
#sidebar-toggle.collapsed .toggle-label {
    max-height: 220px;
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    #sidebar, #sidebar-toggle,
    #sidebar-toggle .chevron,
    #sidebar-toggle .toggle-label {
        transition: none;
    }
}

/* =====================================================================
   KARTA POSTACI (EngineerArc) - atrybuty + kompetencje
   ===================================================================== */
.char-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 14px 12px;
    margin-bottom: 16px;
    box-shadow: 0 6px 16px rgba(30, 30, 30, 0.05);
}
.char-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid #00693C; /* AGH green */
}
.char-card-logo {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1E1E1E;
    color: #ffffff;
    font-size: 1.2rem;
    border-radius: 9px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.char-card-kicker {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #00693C;
}
.char-card-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1E1E1E;
    line-height: 1.2;
}

/* Attributes (T / R / S / C) */
.char-attrs {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}
.char-attr {
    display: flex;
    align-items: center;
    gap: 9px;
}
.char-attr-key {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1E1E1E;
    color: #ffffff;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 800;
}
.char-attr-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    width: 104px;
    flex-shrink: 0;
    overflow-wrap: anywhere;
}
.char-attr-track {
    flex: 1;
    height: 7px;
    background: #eef2f6;
    border-radius: 4px;
    overflow: hidden;
}
.char-attr-fill {
    display: block;
    height: 100%;
    background: #00693C; /* AGH green */
    border-radius: 4px;
}
.char-attr-val {
    font-size: 0.82rem;
    font-weight: 800;
    color: #1E1E1E;
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}

/* Competency section header */
.char-comp-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #A71930; /* AGH red */
    margin-bottom: 8px;
}
.char-comp-hint {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #94a3b8;
}

/* Competency list (clickable rows) */
.char-comps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.char-comp {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    background: #f8fafc;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.char-comp:hover {
    background: #ffffff;
    border-color: #0B5D8A;
    transform: translateX(2px);
}
.char-comp:focus-visible {
    outline: 2px solid #0B5D8A;
    outline-offset: 1px;
}
.char-comp-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1E1E1E;
    line-height: 1.25;
}
.char-comp-track {
    width: 46px;
    height: 6px;
    flex-shrink: 0;
    background: #e6ebf1;
    border-radius: 4px;
    overflow: hidden;
}
.char-comp-fill {
    display: block;
    height: 100%;
    background: #0B5D8A; /* AGH navy */
    border-radius: 4px;
}
.char-comp-count {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.74rem;
    font-weight: 800;
    color: #0B5D8A;
}
/* Competency not expandable in this archetype (0 subjects) */
.char-comp.is-empty {
    cursor: default;
    opacity: 0.5;
}
.char-comp.is-empty:hover {
    background: #f8fafc;
    border-color: #eef2f6;
    transform: none;
}
.char-comp.is-empty .char-comp-fill { background: #cbd5e1; }
.char-comp.is-empty .char-comp-count { color: #94a3b8; }

/* Return from the competency view to the card */
.char-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: #00693C;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0;
    margin-bottom: 12px;
}
.char-back:hover { color: #A71930; }
.char-back:focus-visible {
    outline: 2px solid #A71930;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Note in the competency view */
.char-detail-note {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.55;
    background: rgba(0, 105, 60, 0.06);
    border: 1px solid rgba(0, 105, 60, 0.18);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 4px;
}

/* =====================================================================
   CHARACTER CARD - "Build your own build" mode (editable)
   ===================================================================== */
/* Card variant with a navy accent (distinguishes a build from the archetype view) */
.char-card-custom {
    border-color: rgba(11, 93, 138, 0.35);
}
.char-card-custom .char-card-head {
    border-bottom-color: #0B5D8A; /* AGH navy instead of green */
}
.char-card-custom .char-card-kicker {
    color: #0B5D8A;
}

/* Introduction / instructions for distributing points */
.char-build-intro {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.55;
    margin: 0 0 12px;
}
.char-build-intro b { color: #1E1E1E; font-weight: 800; }

/* Point budget counters (attributes / skills) */
.char-budget {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.char-budget-pill {
    flex: 1 1 120px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    line-height: 1.3;
}
.char-budget-pill b { color: #00693C; font-weight: 800; }
/* Budget exceeded - red alarm */
.char-budget-pill.over {
    color: #A71930;
    background: rgba(167, 25, 48, 0.06);
    border-color: rgba(167, 25, 48, 0.3);
}
.char-budget-pill.over b { color: #A71930; }

/* Steppers +/- (shared for attributes and competencies) */
.char-steppers {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.char-attr-edit .char-attr-val,
.char-comp-edit .char-comp-count {
    width: 16px;
}
.char-step {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #00693C;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.char-step:hover:not(:disabled) {
    background: #00693C;
    border-color: #00693C;
    color: #ffffff;
}
.char-step:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.char-step:focus-visible {
    outline: 2px solid #A71930;
    outline-offset: 1px;
}

/* Attribute row in edit mode - narrower label to fit the steppers */
.char-attr-edit .char-attr-label { width: 100px; }

/* Competency row in edit mode - the whole thing is non-clickable, the name is clicked */
.char-comp-edit {
    cursor: default;
}
.char-comp-edit:hover {
    background: #f8fafc;
    border-color: #eef2f6;
    transform: none;
}
.char-comp-edit.has-points {
    background: #ffffff;
    border-color: rgba(11, 93, 138, 0.35);
}
.char-comp-name-btn {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: left;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1E1E1E;
    line-height: 1.25;
}
.char-comp-name-btn:hover {
    color: #0B5D8A;
    text-decoration: underline;
}
.char-comp-name-btn:focus-visible {
    outline: 2px solid #0B5D8A;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Build actions (copy link / clear) */
.char-build-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eef2f6;
}
.char-action {
    flex: 1 1 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #00693C; /* AGH green */
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 105, 60, 0.22);
}
.char-action:hover {
    background: #A71930; /* AGH red */
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(167, 25, 48, 0.28);
}
.char-action:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
}
/* "ghost" variant - secondary action (clear) */
.char-action-ghost {
    flex: 0 0 auto;
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: none;
}
.char-action-ghost:hover {
    background: #f8fafc;
    color: #A71930;
    border-color: #A71930;
    transform: translateY(-1px);
    box-shadow: none;
}

/* ===== Mobile version (phones and small tablets) ===== */
@media (max-width: 768px) {

    /* The side panel becomes a "drawer" sliding up from the bottom */
    #sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: auto;
        height: 62vh;
        margin-left: 0 !important;
        padding: 18px 20px 20px;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 30px rgba(30, 30, 30, 0.15);
        overflow-y: auto;              /* the whole drawer scrolls as one area */
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;  /* the scroll does not "escape" to the page background */
        transform: translateY(0);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    #sidebar.collapsed {
        margin-left: 0 !important;
        transform: translateY(105%);
    }

    /* Compact header and legend */
    .brand-header {
        flex: 0 0 auto;   /* does not shrink - the drawer scrolls instead of squeezing the content */
        margin-bottom: 14px;
        padding-bottom: 10px;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .agh-logo-mock { margin-bottom: 0; font-size: 1rem; padding: 5px 10px; }
    h1 { font-size: 1.05rem; }
    .filter-section { flex: 0 0 auto; margin-bottom: 14px; }
    select { padding: 12px; }
    .legend {
        flex: 0 0 auto;   /* does not shrink */
        order: 2;         /* legend below the details - after tapping a subject its description is immediately visible */
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px 16px;
        margin-bottom: 14px;
        padding: 10px 14px;
    }
    .legend-group-title { width: 100%; }
    #details-panel {
        flex: 0 0 auto;    /* grows with content; the whole drawer scrolls */
        order: 1;          /* above the legend */
        padding: 18px 16px;
        overflow: visible;
    }
    .detail-content {
        overflow: visible; /* the whole drawer scrolls, not this box separately */
        max-height: none;
        padding-right: 4px;
    }

    /* Button as a horizontal pill at the bottom of the screen */
    #sidebar-toggle {
        left: 50%;
        top: auto;
        bottom: calc(62vh + 12px);
        transform: translateX(-50%);
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 30px;
        transition: bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    background-color 0.2s ease;
    }
    #sidebar-toggle.collapsed {
        left: 50%;
        bottom: 16px;
        padding: 10px 20px;
    }

    /* Arrow: down when the panel is open, up when collapsed */
    #sidebar-toggle .chevron { transform: rotate(-90deg); }
    #sidebar-toggle.collapsed .chevron { transform: rotate(90deg); }

    /* Horizontal label, always visible */
    #sidebar-toggle .toggle-label,
    #sidebar-toggle.collapsed .toggle-label {
        writing-mode: horizontal-tb;
        max-height: none;
        max-width: none;
        opacity: 1;
        font-size: 0.8rem;
        letter-spacing: 1px;
    }

    /* Semester headers - smaller, higher */
    #column-headers { top: 14px; }
    .sem-header {
        padding: 6px 14px;
        font-size: 0.7rem;
        letter-spacing: 1px;
        gap: 7px;
    }

    /* Character card on a phone - slightly larger touch targets */
    .char-comp { padding: 9px 10px; }
    .char-attr-label { width: 100px; }
    .char-step { width: 28px; height: 28px; font-size: 1.05rem; }
    .char-action { padding: 12px 14px; }
}

/* =====================================================================
   PRZYCISK "O PROJEKCIE" + OKNO MODALNE
   ===================================================================== */

/* Row: green AGH block + round "i" button */
.brand-logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.brand-logo-row .agh-logo-mock {
    margin-bottom: 0; /* margin moved to the row */
}

.about-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #ffffff;
    color: #00693C;
    border: 2px solid #00693C;
    border-radius: 50%;
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease,
                transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 105, 60, 0.15);
}
.about-btn:hover {
    background: #00693C;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 105, 60, 0.28);
}
.about-btn:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
}

/* Background (backdrop) */
.about-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(30, 30, 30, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.about-overlay.open {
    display: flex;
    animation: aboutFade 0.25s ease forwards;
}
@keyframes aboutFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Window card */
.about-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 4px solid #00693C; /* AGH green */
    border-radius: 16px;
    padding: 30px 32px 34px;
    box-shadow: 0 25px 60px rgba(30, 30, 30, 0.28);
    animation: aboutRise 0.32s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
@keyframes aboutRise {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Close button */
.about-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    color: #64748b;
    border: none;
    border-radius: 8px;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.about-close:hover { background: #f1f5f9; color: #A71930; }
.about-close:focus-visible {
    outline: 2px solid #A71930;
    outline-offset: 2px;
}

/* Window header */
.about-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #00693C;
    margin-bottom: 6px;
}
.about-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
    color: #1E1E1E;
    margin: 0 0 22px;
    text-transform: uppercase;
}

/* Sections */
.about-section {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid #eef2f6;
}
.about-section:first-of-type {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}
.about-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 10px;
}

/* Authors */
.about-authors {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.about-authors li {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #00693C;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}
.about-person { font-weight: 800; color: #1E1E1E; font-size: 0.95rem; }
a.about-person {
    text-decoration: none;
    width: fit-content;
    transition: color 0.15s ease;
}
a.about-person:hover,
a.about-person:focus-visible {
    color: #00693C;
    text-decoration: underline;
}
a.about-person:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
    border-radius: 4px;
}
.about-role {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 2px;
}

/* Affiliation / text */
.about-affil,
.about-text {
    color: #475569;
    line-height: 1.6;
    font-size: 0.9rem;
    margin: 0;
}
.about-affil { font-weight: 600; }

/* Contact (CTA) */
.about-contact-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 12px;
}
.about-contact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #00693C;
    color: #ffffff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 105, 60, 0.22);
}
.about-contact:hover {
    background: #A71930;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(167, 25, 48, 0.28);
}
.about-contact:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
}
.about-contact-icon {
    transition: transform 0.25s ease;
}
.about-contact[aria-expanded="true"] .about-contact-icon {
    transform: rotate(90deg);
}

/* Expandable e-mail addresses */
.about-emails {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    overflow: hidden;
    animation: about-emails-in 0.25s ease;
}
.about-emails[hidden] {
    display: none;
}
@keyframes about-emails-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.about-email {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #00693C;
    border-radius: 8px;
    color: #1E1E1E;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.about-email:hover {
    background: #f8fafc;
    border-left-color: #A71930;
    transform: translateX(2px);
}
.about-email:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
}
.about-email-icon {
    color: #00693C;
}

/* Links */
.about-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.about-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #1E1E1E;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: border-color 0.15s ease, color 0.15s ease,
                background-color 0.15s ease, transform 0.15s ease;
}
.about-links a:hover {
    border-color: #A71930;
    color: #A71930;
    background: #fff;
    transform: translateX(2px);
}
.about-links a:focus-visible {
    outline: 2px solid #A71930;
    outline-offset: 2px;
}
.about-link-icon {
    color: #A71930;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Mobile version */
@media (max-width: 768px) {
    .brand-logo-row { margin-bottom: 0; }
    .about-dialog { padding: 26px 22px 28px; max-height: 88vh; }
    .about-title { font-size: 1.2rem; }
}

/* The side panel must not shrink (tablets) */
#sidebar {
    flex-shrink: 0;
}
/* ===== Language switch PL / EN ===== */
.lang-switch {
    margin-left: auto;          /* pushed to the right edge of the logo row */
    display: inline-flex;
    padding: 3px;
    border: 2px solid #00693C;
    border-radius: 999px;
    background: #ffffff;
    flex-shrink: 0;
}
.lang-opt {
    min-width: 34px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
    line-height: 1.2;
    color: #00693C;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.lang-opt.is-active {
    background: #00693C;
    color: #ffffff;
    cursor: default;
}
a.lang-opt:hover {
    background: rgba(0, 105, 60, 0.12);
}
a.lang-opt:focus-visible {
    outline: 3px solid #A71930;
    outline-offset: 2px;
}
@media (max-width: 768px) {
    .lang-opt { min-width: 38px; padding: 6px 10px; } /* larger touch targets */
    /* logo row full width, title below it - nothing gets cut off */
    .brand-header { flex-wrap: wrap; row-gap: 8px; }
    .brand-header .brand-logo-row { flex: 1 1 100%; margin-bottom: 0; }
}
