/* === ANIMLA ENCYCLOPEDIA & INTERACTIVE TREE STYLES === */
.dex-nav-btn {
    background: var(--card-color);
    color: var(--text-muted-color);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}
.dex-nav-btn:hover {
    background-color: #3a3a3a;
    color: var(--text-color);
    transform: scale(1.05);
}

.dex-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted-color);
    margin-bottom: 12px;
    align-items: center;
}
.dex-breadcrumbs a {
    color: var(--text-muted-color);
    text-decoration: none;
    background: rgba(0,0,0,0.28);
    padding: 4px 9px;
    border-radius: 12px;
    transition: color 0.2s, background 0.2s;
}
.dex-breadcrumbs a:hover {
    color: var(--text-color);
    background: var(--card-color);
}

/* CTA Banner - Fixad så <strong><em> inuti span INTE radbryter! */
.dex-play-banner {
    background: linear-gradient(135deg, #1f2e21 0%, #172218 100%);
    border: 1px solid #3d5a40;
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.2s, border-color 0.2s;
}
.dex-play-banner:hover {
    transform: translateY(-2px);
    border-color: var(--correct-color);
}
.dex-play-banner-text > strong {
    display: block;
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 2px;
}
.dex-play-banner-text > span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted-color);
    line-height: 1.35;
}
.dex-play-banner-text > span strong {
    display: inline;
    color: #e0e8e0;
    font-weight: 600;
}
.dex-play-btn {
    background: var(--correct-color);
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 8px 14px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(29, 185, 84, 0.35);
}

/* Sektionsavdelare */
.dex-section-divider {
    grid-column: span 6;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted-color);
    font-weight: 700;
    margin: 6px 0 2px 2px;
}
.dex-section-divider::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    background: rgba(255,255,255,0.08);
}

/* Neutrala Faktabrickor */
.dex-card .attribute-tile {
    opacity: 1 !important;
    transform: none !important;
    background-color: #2b352c !important;
    border: 1px solid #3d4d3e;
}
.dex-card .attribute-tile .label {
    color: #a3b8a5;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.dex-card .attribute-tile .value {
    font-size: 0.92rem;
    color: #ffffff;
}

/* TAXONOMI-NODER UTAN BOCKAR */
.dex-card .node-row {
    opacity: 1 !important;
    transform: none !important;
}
.dex-card .node-connector {
    transform: scaleY(1) !important;
    background-color: #6c8c6e !important;
    top: 14px;
    left: 11px;
}
.dex-tree-bullet {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dex-tree-bullet::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #1e261f;
    border: 2.5px solid #8ab88d;
    box-shadow: 0 0 0 2px #2b352c;
}
.dex-tree-bullet::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #8ab88d;
}
.dex-card .node-text {
    color: #e0e8e0;
}
.dex-card .node-text strong.rank-label {
    color: #a3b8a5;
    font-weight: 600;
}
.dex-card .node-text a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255,255,255,0.4);
    transition: color 0.2s, border-color 0.2s;
}
.dex-card .node-text a:hover {
    color: var(--correct-color);
    border-bottom-color: var(--correct-color);
}

/* Kort-header & Wiki-knapp */
.dex-animal-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dex-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dex-wiki-btn {
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.dex-wiki-btn:hover { transform: scale(1.1); }
.dex-wiki-btn svg { width: 18px; height: 18px; display: block; }
.dex-wiki-btn svg path { fill: #000; }

/* MINI-QUIZ */
.inline-quiz-box {
    grid-column: span 6;
    background-color: #161a16;
    border: 1px solid #343d34;
    border-left: 3px solid var(--order-color);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 4px 0 6px 0;
    text-align: left;
}
.inline-quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--order-color);
    font-weight: 700;
    margin-bottom: 4px;
}
.inline-quiz-question {
    font-size: 0.86rem;
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.35;
}
.inline-quiz-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
@media (max-width: 420px) {
    .inline-quiz-options { grid-template-columns: 1fr; }
}
.quiz-opt-btn {
    background-color: #2a2a2a;
    color: var(--text-color);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 8px 6px;
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    overflow-wrap: anywhere;
    hyphens: auto;
}
.quiz-opt-btn:hover:not(:disabled) {
    background-color: #3a3a3a;
    border-color: #777;
}
.quiz-opt-btn.correct-ans {
    background-color: var(--correct-color) !important;
    border-color: var(--correct-color) !important;
    color: #fff;
}
.quiz-opt-btn.wrong-ans {
    background-color: var(--incorrect-color) !important;
    border-color: var(--incorrect-color) !important;
    color: #fff;
    opacity: 0.85;
}
.quiz-opt-btn:disabled { cursor: default; }

.quiz-feedback-drawer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, margin-top 0.25s ease;
    font-size: 0.8rem;
    color: var(--text-muted-color);
    border-top: 1px solid transparent;
}
.quiz-feedback-drawer.open {
    max-height: 90px;
    margin-top: 8px;
    padding-top: 8px;
    border-top-color: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.quiz-feedback-drawer a {
    color: var(--correct-color);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.quiz-feedback-drawer a:hover { text-decoration: underline; }

/* Kort-grid för Släktingar, Kategorisidor & Sökresultat (Fixad för långa sammansatta ord!) */
.relatives-section {
    margin-top: 18px;
    background-color: var(--card-color);
    border-radius: 15px;
    padding: 15px;
}
.relatives-section h2, .relatives-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-color);
}
.relatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 8px;
}
.relative-link-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2a2a2a;
    padding: 8px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.2;
    transition: transform 0.15s, background 0.2s;
    border: 1px solid transparent;
    min-width: 0;
    overflow: hidden;
}
.relative-link-card span {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}
.relative-link-card:hover {
    background: #344336;
    border-color: #4f6b52;
    transform: translateY(-2px);
}
.relative-link-card img {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    background: #333;
    flex-shrink: 0;
}
.taxon-badge-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #2b352c;
    border: 1px solid #3d4d3e;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.15s, border-color 0.2s;
    min-width: 0;
    overflow: hidden;
}
.taxon-badge-card:hover {
    transform: translateY(-2px);
    border-color: var(--correct-color);
}
.taxon-badge-card strong {
    font-size: 0.84rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    hyphens: auto;
}
.taxon-badge-card span { font-size: 0.72rem; color: var(--text-muted-color); margin-top: 2px; }

/* Sökruta med förstoringsglas-ikon på /animals/ */
.dex-search-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}
.dex-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted-color);
    pointer-events: none;
}
html[dir="rtl"] .dex-search-icon {
    left: auto;
    right: 16px;
}
#dex-search-input {
    width: 100%;
    padding: 14px 18px 14px 44px;
    border-radius: 25px;
    border: 1px solid #333;
    background-color: var(--card-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
html[dir="rtl"] #dex-search-input {
    padding: 14px 44px 14px 18px;
}
#dex-search-input:focus {
    outline: none;
    border-color: var(--correct-color);
}

/* === INTERAKTIVT LIVETS TRÄD (EXPLORER PÅ HUBBSIDAN) === */
.tree-explorer-box {
    background-color: var(--card-color);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 18px;
}
.tree-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.tree-zoom-controls {
    display: flex;
    gap: 6px;
}
.tree-zoom-btn {
    background: #2b352c;
    border: 1px solid #3d4d3e;
    color: #fff;
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.tree-zoom-btn:hover { background: #3d4d3e; }

.tree-viewport {
    background: #141814;
    border: 1px solid #2b352c;
    border-radius: 12px;
    padding: 15px;
    overflow: auto;
    max-height: 460px;
    cursor: grab;
}
.tree-viewport:active { cursor: grabbing; }
.tree-canvas {
    transform-origin: top left;
    transition: transform 0.15s ease;
    min-width: 100%;
}

.tree-node-list {
    list-style: none;
    padding-left: 18px;
    border-left: 2px solid #3d523f;
    margin: 6px 0 6px 10px;
}
.tree-root-list {
    list-style: none;
    padding-left: 0;
    border-left: none;
    margin: 0;
}
.tree-node-item {
    margin: 6px 0;
    position: relative;
}
.tree-node-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #252e26;
    border: 1px solid #3d4d3e;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.82rem;
    color: #fff;
    transition: background 0.2s, border-color 0.2s;
}
.tree-node-pill.expanded {
    background: #2f4231;
    border-color: var(--correct-color);
}
.tree-expand-btn {
    background: #171d18;
    border: 1px solid #4a5c4b;
    color: var(--correct-color);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tree-expand-btn:hover {
    background: var(--correct-color);
    color: #fff;
}
.tree-node-link {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}
.tree-node-link:hover {
    color: var(--correct-color);
    text-decoration: underline;
}
.tree-count-badge {
    background: rgba(0,0,0,0.35);
    color: var(--text-muted-color);
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 10px;
}