/* Encyclopedia workspace and detail dashboard */

.setae-encyclopedia,
.enc-detail-view {
    --enc-ink: #17211c;
    --enc-muted: #657169;
    --enc-line: #dce3de;
    --enc-soft: #f4f7f5;
    --enc-green: #1f6b4f;
    --enc-green-soft: #eaf4ef;
    --enc-blue: #265b82;
    --enc-blue-soft: #edf5fa;
    --enc-amber: #8a5a12;
    --enc-amber-soft: #fbf3e4;
    --enc-card-radius: var(--setae-radius-card, 16px);
    color: var(--enc-ink);
}

.enc-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--enc-line);
}

.enc-page-kicker,
.enc-section-heading span,
.enc-detail-header-title > span {
    display: block;
    margin-bottom: 5px;
    color: var(--enc-muted);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.2;
    text-transform: uppercase;
}

.enc-page-header h1 {
    margin: 0;
    color: var(--enc-ink);
    font-size: 28px;
    font-weight: 760;
    line-height: 1.1;
}

.enc-page-count {
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: var(--enc-muted);
    white-space: nowrap;
}

.enc-page-count strong {
    color: var(--enc-ink);
    font-size: 24px;
    font-weight: 760;
}

.enc-page-count span {
    font-size: 12px;
    font-weight: 650;
}

.enc-workspace {
    display: grid;
    grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 42px);
    align-items: start;
}

.enc-filter-sidebar {
    position: sticky;
    top: 112px;
    min-width: 0;
}

.enc-filter-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.enc-filter-sidebar h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 750;
}

.enc-text-button {
    border: 0;
    padding: 3px 0;
    background: transparent;
    color: var(--enc-blue);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.enc-text-button:hover,
.enc-text-button:focus-visible {
    color: var(--enc-green);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.enc-filter-group {
    margin-bottom: 17px;
}

.enc-filter-group label,
.enc-mobile-filters label > span {
    display: block;
    margin-bottom: 7px;
    color: var(--enc-muted);
    font-size: 11px;
    font-weight: 700;
}

.enc-select {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    border: 1px solid var(--enc-line);
    border-radius: 6px;
    padding: 0 34px 0 11px;
    background-color: #fff;
    color: var(--enc-ink);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.enc-select:focus {
    outline: 0;
    border-color: var(--enc-green);
    box-shadow: 0 0 0 3px rgba(31, 107, 79, 0.12);
}

.enc-results-column {
    min-width: 0;
}

.enc-search-toolbar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.enc-search-field {
    position: relative;
    min-width: 0;
    flex: 1;
}

.enc-search-field > svg {
    position: absolute;
    top: 50%;
    left: 13px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--enc-muted);
    pointer-events: none;
}

.enc-search-field input {
    width: 100%;
    min-height: 46px;
    box-sizing: border-box;
    border: 1px solid var(--enc-line);
    border-radius: 8px;
    padding: 0 42px;
    background: #fff;
    color: var(--enc-ink);
    font: inherit;
    font-size: 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.enc-search-field input:focus {
    outline: 0;
    border-color: var(--enc-green);
    box-shadow: 0 0 0 3px rgba(31, 107, 79, 0.12);
}

.enc-search-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--enc-muted);
    cursor: pointer;
}

.enc-search-clear svg {
    width: 16px;
    height: 16px;
}

.enc-search-clear:hover,
.enc-search-clear:focus-visible {
    background: var(--enc-soft);
    color: var(--enc-ink);
}

.enc-mobile-filter-toggle {
    display: none;
}

.enc-content-switch {
    display: flex;
    gap: 3px;
    width: max-content;
    max-width: 100%;
    margin-bottom: 17px;
    padding: 3px;
    border: 1px solid var(--enc-line);
    border-radius: 8px;
    overflow-x: auto;
    background: var(--enc-soft);
    scrollbar-width: none;
}

.enc-content-switch::-webkit-scrollbar,
.enc-detail-tabs::-webkit-scrollbar {
    display: none;
}

.enc-content-switch button {
    min-height: 34px;
    border: 0;
    border-radius: 5px;
    padding: 0 13px;
    background: transparent;
    color: var(--enc-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.enc-content-switch button.active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(24, 40, 31, 0.1);
    color: var(--enc-ink);
}

.enc-content-switch button:focus-visible {
    outline: 2px solid var(--enc-green);
    outline-offset: 1px;
}

.enc-results-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    min-height: 24px;
    margin-bottom: 9px;
}

.enc-results-meta p {
    margin: 0;
    color: var(--enc-muted);
    font-size: 11px;
}

.enc-results-meta p:first-child {
    color: var(--enc-ink);
    font-size: 13px;
    font-weight: 750;
}

.setae-encyclopedia .setae-species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr));
    gap: 16px;
    padding: 0;
    transition: opacity 160ms ease;
}

.setae-encyclopedia .species-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--enc-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.setae-encyclopedia .species-card:hover {
    z-index: auto;
    border-color: #b9c7be;
    box-shadow: 0 8px 22px rgba(26, 44, 34, 0.09);
    transform: translateY(-2px);
}

.setae-encyclopedia .species-card:active {
    transform: translateY(0);
}

.setae-encyclopedia .species-card .card-link {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.setae-encyclopedia .species-card .card-link:focus-visible {
    outline: 3px solid rgba(31, 107, 79, 0.35);
    outline-offset: -3px;
}

.setae-encyclopedia .card-image-box {
    aspect-ratio: 16 / 10;
    background: #eef2ef;
}

.setae-encyclopedia .card-image-box > img {
    object-fit: cover;
}

.setae-encyclopedia .no-image {
    border: 0;
    background: #eef2ef;
}

.setae-encyclopedia .no-image img {
    width: 42%;
    height: 42%;
    object-fit: contain;
    opacity: 0.28;
    filter: grayscale(1);
}

.species-card-status-row {
    position: absolute;
    top: 9px;
    right: 9px;
    left: 9px;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

.species-research-badge,
.species-breeding-badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    border-radius: 5px;
    padding: 0 7px;
    box-shadow: 0 1px 4px rgba(18, 28, 22, 0.13);
    backdrop-filter: blur(8px);
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}

.species-research-badge {
    background: rgba(255, 255, 255, 0.92);
    color: var(--enc-muted);
}

.species-research-badge.is-draft {
    background: rgba(237, 245, 250, 0.94);
    color: var(--enc-blue);
}

.species-research-badge.is-reviewed,
.species-research-badge.is-verified {
    background: rgba(234, 244, 239, 0.94);
    color: var(--enc-green);
}

.species-breeding-badge {
    margin-left: auto;
    background: rgba(251, 243, 228, 0.95);
    color: var(--enc-amber);
}

.setae-encyclopedia .card-content {
    min-width: 0;
    padding: 14px;
}

.setae-encyclopedia .species-names {
    min-width: 0;
    margin-bottom: 8px;
}

.setae-encyclopedia .ja-name {
    min-height: 20px;
    color: var(--enc-ink);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.setae-encyclopedia .sci-name {
    margin-top: 3px;
    color: var(--enc-muted);
    font-size: 11px;
}

.species-card-excerpt {
    display: -webkit-box;
    min-height: 35px;
    margin: 0 0 11px;
    overflow: hidden;
    color: #536158;
    font-size: 11px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.species-card-taxonomy {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 23px;
    margin-bottom: 12px;
}

.species-card-taxonomy span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 4px;
    padding: 0 7px;
    background: var(--enc-soft);
    color: var(--enc-muted);
    font-size: 9px;
    font-weight: 700;
}

.species-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: auto 0 0;
    padding: 11px 0;
    border-top: 1px solid var(--enc-line);
    border-bottom: 1px solid var(--enc-line);
}

.species-card-metrics div {
    min-width: 0;
    padding: 0 8px;
    text-align: center;
}

.species-card-metrics div:first-child {
    padding-left: 0;
}

.species-card-metrics div:last-child {
    padding-right: 0;
}

.species-card-metrics div + div {
    border-left: 1px solid var(--enc-line);
}

.species-card-metrics dt {
    color: var(--enc-muted);
    font-size: 9px;
    font-weight: 650;
}

.species-card-metrics dd {
    margin: 2px 0 0;
    color: var(--enc-ink);
    font-size: 14px;
    font-weight: 760;
}

.species-card-care-range {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    color: var(--enc-muted);
    font-size: 9px;
    font-weight: 650;
}

.enc-list-loader,
.enc-detail-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--enc-muted);
    font-size: 11px;
    font-weight: 650;
}

.enc-list-loader {
    min-height: 76px;
}

.enc-list-loader[hidden],
.enc-detail-loader[hidden] {
    display: none;
}

.enc-loader-mark {
    width: 17px;
    height: 17px;
    box-sizing: border-box;
    border: 2px solid #d7dfda;
    border-top-color: var(--enc-green);
    border-radius: 50%;
    animation: enc-spin 800ms linear infinite;
}

@keyframes enc-spin {
    to { transform: rotate(360deg); }
}

/* Detail dashboard */

.enc-detail-view {
    min-width: 0;
}

.enc-detail-header {
    position: sticky;
    top: 80px;
    z-index: 60;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    min-height: 58px;
    margin: -20px -20px 20px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(220, 227, 222, 0.9);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(15px);
}

.enc-detail-back,
.enc-detail-edit {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--enc-ink);
    cursor: pointer;
}

.enc-detail-back:hover,
.enc-detail-edit:hover,
.enc-detail-back:focus-visible,
.enc-detail-edit:focus-visible {
    background: var(--enc-soft);
}

.enc-detail-back svg,
.enc-detail-edit svg {
    width: 20px;
    height: 20px;
}

.enc-detail-header-title {
    min-width: 0;
    padding: 0 12px;
    text-align: center;
}

.enc-detail-header-title > span {
    margin: 0;
    font-size: 8px;
}

.enc-detail-header-title strong {
    display: block;
    overflow: hidden;
    color: var(--enc-ink);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enc-detail-loader {
    min-height: 48vh;
}

.enc-detail-content[hidden] {
    display: none;
}

.enc-detail-hero {
    display: grid;
    grid-template-columns: minmax(300px, 0.92fr) minmax(320px, 1.08fr);
    min-height: 320px;
    overflow: hidden;
    border: 1px solid var(--enc-line);
    border-radius: 8px;
    background: #fff;
}

.enc-detail-figure {
    position: relative;
    min-width: 0;
    min-height: 320px;
    margin: 0;
    overflow: hidden;
    background: #e8eeea;
}

.enc-detail-figure > img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 320px;
    max-height: 430px;
    object-fit: cover;
}

.enc-detail-image-placeholder {
    position: absolute;
    inset: 0;
    background: #e8eeea;
}

#enc-detail-image-credit-overlay {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 24px);
    border-radius: 6px;
    padding: 6px 9px;
    background: rgba(18, 26, 21, 0.76);
    color: #fff;
    backdrop-filter: blur(8px);
}

#enc-detail-image-credit-overlay[hidden] {
    display: none;
}

.enc-credit-avatar {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #526159;
    color: #fff;
    font-size: 10px;
    font-weight: 750;
}

.enc-credit-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#enc-detail-image-credit-overlay small,
#enc-detail-image-credit-overlay strong {
    display: block;
    overflow: hidden;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#enc-detail-image-credit-overlay small {
    color: rgba(255, 255, 255, 0.72);
    font-size: 8px;
}

#enc-detail-image-credit-overlay strong {
    font-size: 10px;
}

.enc-detail-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: clamp(24px, 4vw, 52px);
}

.enc-detail-genus {
    margin: 0 0 8px;
    color: var(--enc-muted);
    font-size: 11px;
    font-style: italic;
}

.enc-detail-common-name {
    margin: 0 0 4px;
    color: var(--enc-green);
    font-size: 15px;
    font-weight: 750;
}

.enc-detail-identity h1 {
    margin: 0;
    color: var(--enc-ink);
    font-size: 34px;
    font-weight: 760;
    line-height: 1.14;
    overflow-wrap: anywhere;
}

.enc-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 25px;
    margin-top: 15px;
}

.enc-detail-tags .setae-chip,
.enc-detail-tags .enc-detail-tag-empty {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    border-radius: 4px;
    padding: 0 8px;
    background: var(--enc-soft);
    color: var(--enc-muted);
    font-size: 10px;
    font-weight: 700;
}

.enc-detail-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 26px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--enc-line);
}

.enc-detail-metrics div {
    min-width: 0;
    padding: 0 10px;
}

.enc-detail-metrics div:first-child {
    padding-left: 0;
}

.enc-detail-metrics div + div {
    border-left: 1px solid var(--enc-line);
}

.enc-detail-metrics dt {
    color: var(--enc-muted);
    font-size: 9px;
    font-weight: 650;
    white-space: nowrap;
}

.enc-detail-metrics dd {
    margin: 4px 0 0;
    color: var(--enc-ink);
    font-size: 18px;
    font-weight: 760;
}

.enc-detail-tabs {
    position: sticky;
    top: 138px;
    z-index: 50;
    display: flex;
    gap: 24px;
    margin: 24px 0 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--enc-line);
    background: #fff;
    scrollbar-width: none;
}

.enc-detail-tabs button {
    position: relative;
    min-width: max-content;
    min-height: 48px;
    border: 0;
    padding: 0 2px;
    background: transparent;
    color: var(--enc-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.enc-detail-tabs button::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: transparent;
    content: '';
}

.enc-detail-tabs button.active {
    color: var(--enc-ink);
}

.enc-detail-tabs button.active::after {
    background: var(--enc-green);
}

.enc-detail-tabs button:focus-visible {
    outline: 2px solid var(--enc-green);
    outline-offset: -3px;
}

.enc-detail-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(270px, 330px);
    gap: clamp(30px, 4vw, 56px);
    align-items: start;
    padding-top: 30px;
}

.enc-detail-main,
.enc-detail-panel {
    min-width: 0;
}

.enc-detail-panel[hidden] {
    display: none;
}

.enc-detail-panel > section,
.enc-detail-panel > article {
    padding-bottom: 32px;
}

.enc-detail-panel > section + section,
.enc-detail-panel > article + section {
    padding-top: 31px;
    border-top: 1px solid var(--enc-line);
}

.enc-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.enc-section-heading span {
    color: var(--enc-green);
}

.enc-section-heading h2 {
    margin: 0;
    color: var(--enc-ink);
    font-size: 17px;
    font-weight: 750;
    line-height: 1.25;
}

.enc-section-heading time {
    color: var(--enc-muted);
    font-size: 10px;
    white-space: nowrap;
}

.enc-section-heading-actions {
    align-items: center;
}

.enc-detail-description,
.enc-content-section p {
    color: #3e4b43;
    font-size: 13px;
    line-height: 1.85;
}

.enc-detail-description p:first-child,
.enc-detail-description > :first-child {
    margin-top: 0;
}

.enc-detail-description p:last-child,
.enc-detail-description > :last-child {
    margin-bottom: 0;
}

.enc-content-sections {
    margin-top: 26px;
}

.enc-content-section {
    display: grid;
    grid-template-columns: minmax(110px, 0.28fr) minmax(0, 1fr);
    gap: 24px;
    padding: 18px 0;
    border-top: 1px solid var(--enc-line);
}

.enc-content-section h3 {
    margin: 0;
    color: var(--enc-ink);
    font-size: 12px;
    font-weight: 750;
}

.enc-content-section p {
    margin: 0;
}

.enc-research-status,
.enc-approved-label {
    display: inline-flex !important;
    align-items: center;
    min-height: 25px;
    border-radius: 4px;
    padding: 0 8px;
    background: var(--enc-soft);
    color: var(--enc-muted) !important;
    font-size: 9px !important;
    font-weight: 750;
    white-space: nowrap;
}

.enc-research-status.is-draft {
    background: var(--enc-blue-soft);
    color: var(--enc-blue) !important;
}

.enc-research-status.is-reviewed,
.enc-research-status.is-verified,
.enc-approved-label {
    background: var(--enc-green-soft);
    color: var(--enc-green) !important;
}

.enc-source-list {
    display: grid;
    gap: 9px;
}

.enc-source-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--enc-line);
    border-radius: 6px;
    padding: 13px 14px;
    color: inherit;
    text-decoration: none;
}

.enc-source-item:hover,
.enc-source-item:focus-visible {
    border-color: #aebdb4;
    background: var(--enc-soft);
}

.enc-source-item strong,
.enc-source-item small {
    display: block;
}

.enc-source-item strong {
    color: var(--enc-ink);
    font-size: 12px;
    line-height: 1.45;
}

.enc-source-item small {
    margin-top: 4px;
    color: var(--enc-muted);
    font-size: 9px;
    line-height: 1.45;
}

.enc-source-item svg,
.enc-reference-link svg {
    width: 17px;
    height: 17px;
}

.enc-panel-empty {
    border: 1px dashed #c8d2cb;
    border-radius: 6px;
    padding: 22px;
    background: #fafcfb;
    text-align: center;
}

.enc-panel-empty[hidden] {
    display: none;
}

.enc-panel-empty strong,
.enc-panel-empty p {
    display: block;
}

.enc-panel-empty strong {
    color: var(--enc-ink);
    font-size: 13px;
}

.enc-panel-empty p {
    max-width: 520px;
    margin: 7px auto 0;
    color: var(--enc-muted);
    font-size: 11px;
    line-height: 1.65;
}

.enc-panel-empty a {
    display: inline-block;
    margin-top: 12px;
    color: var(--enc-blue);
    font-size: 11px;
    font-weight: 700;
}

.enc-external-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.enc-external-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--enc-line);
    border-radius: 5px;
    padding: 0 10px;
    color: var(--enc-blue);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.enc-related-list {
    display: grid;
    gap: 8px;
}

.enc-related-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 13px;
    align-items: center;
    width: 100%;
    min-width: 0;
    border: 1px solid var(--enc-line);
    border-radius: 6px;
    padding: 11px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.enc-related-topic {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px;
}

.enc-related-item:hover,
.enc-related-item:focus-visible {
    border-color: #aebdb4;
    background: var(--enc-soft);
}

.enc-related-thumb {
    width: 58px;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 5px;
    background: #e9eeeb;
}

.enc-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.enc-related-main {
    min-width: 0;
}

.enc-related-main strong {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: var(--enc-ink);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enc-related-main p {
    display: -webkit-box;
    margin: 4px 0 0;
    overflow: hidden;
    color: var(--enc-muted);
    font-size: 10px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.enc-related-badges {
    display: flex;
    align-items: center;
    gap: 5px;
}

.enc-related-meta,
.enc-related-date {
    color: var(--enc-muted);
    font-size: 9px;
    white-space: nowrap;
}

.enc-related-empty {
    border: 1px dashed #c8d2cb;
    border-radius: 6px;
    padding: 24px;
    color: var(--enc-muted);
    font-size: 11px;
    text-align: center;
}

.enc-related-actions {
    display: flex;
    gap: 7px;
}

.enc-primary-button,
.enc-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 5px;
    padding: 0 12px;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
}

.enc-primary-button {
    border: 1px solid var(--enc-green);
    background: var(--enc-green);
    color: #fff;
}

.enc-secondary-button {
    border: 1px solid var(--enc-line);
    background: #fff;
    color: var(--enc-ink);
}

.enc-primary-button:hover,
.enc-primary-button:focus-visible {
    background: #18563f;
}

.enc-secondary-button:hover,
.enc-secondary-button:focus-visible {
    border-color: #aebdb4;
    background: var(--enc-soft);
}

.enc-breeding-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.enc-breeding-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
    border: 1px solid var(--enc-line);
    border-radius: 6px;
    padding: 10px;
    background: #fff;
}

.enc-breeding-item img,
.enc-breeding-image-empty {
    width: 72px;
    height: 72px;
    border-radius: 5px;
    object-fit: cover;
    background: #e9eeeb;
}

.enc-breeding-item strong,
.enc-breeding-item small,
.enc-breeding-item span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enc-breeding-item strong {
    color: var(--enc-ink);
    font-size: 12px;
}

.enc-breeding-item small {
    margin-top: 4px;
    color: var(--enc-muted);
    font-size: 9px;
}

.enc-breeding-item span {
    margin-top: 8px;
    color: var(--enc-amber);
    font-size: 9px;
    font-weight: 750;
}

.enc-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.enc-gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border: 0;
    border-radius: 6px;
    padding: 0;
    background: #e9eeeb;
    cursor: pointer;
}

.enc-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 180ms ease;
}

.enc-gallery-item:hover img,
.enc-gallery-item:focus-visible img {
    transform: scale(1.035);
}

.enc-gallery-credit {
    position: absolute;
    right: 5px;
    bottom: 5px;
    left: 5px;
    overflow: hidden;
    border-radius: 4px;
    padding: 4px 6px;
    background: rgba(17, 26, 21, 0.68);
    color: #fff;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enc-shop-list {
    display: grid;
    gap: 10px;
}

.enc-shop-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--enc-line);
    border-radius: 6px;
    padding: 11px;
    background: #fff;
}

.enc-shop-item img,
.enc-shop-image-empty {
    width: 88px;
    height: 66px;
    border-radius: 5px;
    object-fit: cover;
    background: #e9eeeb;
}

.enc-shop-item-main {
    min-width: 0;
}

.enc-shop-item-main strong,
.enc-shop-item-main small,
.enc-shop-item-main p {
    display: block;
}

.enc-shop-item-main strong {
    color: var(--enc-ink);
    font-size: 12px;
}

.enc-shop-item-main small {
    margin-top: 3px;
    color: var(--enc-amber);
    font-size: 9px;
    font-weight: 750;
}

.enc-shop-item-main p {
    margin: 5px 0 0;
    color: var(--enc-muted);
    font-size: 10px;
    line-height: 1.45;
}

.enc-shop-item a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 5px;
    padding: 0 12px;
    background: var(--enc-green);
    color: #fff;
    font-size: 10px;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}

.enc-detail-aside {
    position: sticky;
    top: 152px;
    display: grid;
    gap: 14px;
}

.enc-facts-panel,
.enc-taxonomy-panel {
    border: 1px solid var(--enc-line);
    border-radius: 8px;
    padding: 17px;
    background: #fff;
}

.enc-facts-panel .enc-section-heading,
.enc-taxonomy-panel .enc-section-heading {
    margin-bottom: 14px;
}

.enc-facts-panel .enc-section-heading h2,
.enc-taxonomy-panel .enc-section-heading h2 {
    font-size: 14px;
}

.enc-facts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    border-top: 1px solid var(--enc-line);
    border-left: 1px solid var(--enc-line);
}

.enc-facts-grid div {
    min-width: 0;
    padding: 10px;
    border-right: 1px solid var(--enc-line);
    border-bottom: 1px solid var(--enc-line);
}

.enc-facts-grid dt,
.enc-taxonomy-panel dt {
    color: var(--enc-muted);
    font-size: 9px;
    font-weight: 650;
}

.enc-facts-grid dd,
.enc-taxonomy-panel dd {
    margin: 4px 0 0;
    color: var(--enc-ink);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.enc-care-profile {
    margin-top: 14px;
}

.enc-care-profile-item {
    padding: 9px 0;
    border-top: 1px solid var(--enc-line);
}

.enc-care-profile-item strong,
.enc-care-profile-item span {
    display: block;
}

.enc-care-profile-item strong {
    color: var(--enc-muted);
    font-size: 9px;
}

.enc-care-profile-item span {
    margin-top: 4px;
    color: var(--enc-ink);
    font-size: 10px;
    line-height: 1.55;
}

.enc-taxonomy-panel dl {
    margin: 0;
}

.enc-taxonomy-panel dl div {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 0;
    border-top: 1px solid var(--enc-line);
}

.enc-taxonomy-panel dl div:first-child {
    border-top: 0;
}

.enc-reference-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    border: 1px solid var(--enc-line);
    border-radius: 6px;
    padding: 0 13px;
    background: #fff;
    color: var(--enc-blue);
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
}

.enc-reference-link:hover,
.enc-reference-link:focus-visible {
    border-color: #aebdb4;
    background: var(--enc-soft);
}

@media (min-width: 1500px) {
    .setae-encyclopedia .setae-species-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1050px) and (min-width: 768px) {
    .enc-workspace {
        grid-template-columns: 180px minmax(0, 1fr);
        gap: 22px;
    }

    .setae-encyclopedia .setae-species-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .enc-detail-hero {
        grid-template-columns: minmax(260px, 0.85fr) minmax(300px, 1.15fr);
    }

    .enc-detail-workspace {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 26px;
    }

    .enc-detail-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 14px;
    }

    .enc-detail-metrics div:nth-child(3) {
        border-left: 0;
        padding-left: 0;
    }
}

@media (max-width: 767px) {
    .enc-page-header {
        align-items: center;
        margin-bottom: 14px;
        padding-bottom: 13px;
    }

    .enc-page-header h1 {
        font-size: 22px;
    }

    .enc-page-count strong {
        font-size: 18px;
    }

    .enc-page-count span {
        font-size: 10px;
    }

    .enc-workspace {
        display: block;
    }

    .enc-filter-sidebar {
        display: none;
    }

    .enc-search-toolbar {
        position: sticky;
        top: calc(8px + env(safe-area-inset-top));
        margin: 0 -4px 12px;
        padding: 4px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(14px);
    }

    .enc-search-field input {
        min-height: 44px;
    }

    .enc-mobile-filter-toggle {
        position: relative;
        display: inline-flex;
        min-width: 64px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border: 1px solid var(--enc-line);
        border-radius: 7px;
        padding: 0 9px;
        background: #fff;
        color: var(--enc-ink);
        cursor: pointer;
        font: inherit;
        font-size: 10px;
        font-weight: 700;
    }

    .enc-mobile-filter-toggle svg {
        width: 16px;
        height: 16px;
    }

    .enc-mobile-filter-count {
        position: absolute;
        top: -5px;
        right: -4px;
        display: grid;
        width: 18px;
        height: 18px;
        place-items: center;
        border: 2px solid #fff;
        border-radius: 50%;
        background: var(--enc-green);
        color: #fff;
        font-size: 8px;
    }

    .enc-mobile-filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin: -3px 0 13px;
        border: 1px solid var(--enc-line);
        border-radius: 8px;
        padding: 13px;
        background: #fff;
    }

    .enc-mobile-filters[hidden] {
        display: none;
    }

    .enc-mobile-filters label:last-of-type,
    .enc-mobile-filters .enc-text-button {
        grid-column: 1 / -1;
    }

    .enc-content-switch {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 13px;
    }

    .enc-content-switch button {
        flex: 1 0 auto;
        padding: 0 11px;
    }

    .enc-results-meta {
        margin-bottom: 8px;
    }

    .setae-encyclopedia .setae-species-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .setae-encyclopedia .card-image-box {
        aspect-ratio: 4 / 3;
    }

    .setae-encyclopedia .card-content {
        padding: 10px;
    }

    .setae-encyclopedia .ja-name {
        font-size: 13px;
    }

    .setae-encyclopedia .sci-name {
        font-size: 9px;
    }

    .species-card-excerpt {
        display: none;
    }

    .species-card-taxonomy {
        min-height: 20px;
        margin-bottom: 9px;
        overflow: hidden;
        flex-wrap: nowrap;
    }

    .species-card-taxonomy span {
        min-height: 20px;
        padding: 0 5px;
        font-size: 8px;
        white-space: nowrap;
    }

    .species-card-metrics {
        padding: 8px 0;
    }

    .species-card-metrics div {
        padding: 0 4px;
    }

    .species-card-metrics dt,
    .species-card-care-range {
        font-size: 8px;
    }

    .species-card-metrics dd {
        font-size: 12px;
    }

    .species-card-care-range {
        gap: 4px;
        padding-top: 8px;
    }

    .species-card-care-range span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .species-research-badge,
    .species-breeding-badge {
        min-height: 20px;
        padding: 0 5px;
        font-size: 8px;
    }

    .enc-detail-header {
        top: 0;
        min-height: 52px;
        margin: -16px -16px 14px;
        padding: 0 12px;
    }

    .enc-detail-hero {
        display: block;
        min-height: 0;
    }

    .enc-detail-figure,
    .enc-detail-figure > img {
        min-height: 0;
        height: auto;
        aspect-ratio: 16 / 10;
    }

    .enc-detail-identity {
        padding: 17px;
    }

    .enc-detail-common-name {
        font-size: 13px;
    }

    .enc-detail-identity h1 {
        font-size: 22px;
    }

    .enc-detail-metrics {
        margin-top: 18px;
        padding-top: 13px;
    }

    .enc-detail-metrics div {
        padding: 0 6px;
    }

    .enc-detail-metrics dt {
        font-size: 8px;
    }

    .enc-detail-metrics dd {
        font-size: 15px;
    }

    .enc-detail-tabs {
        top: calc(52px + env(safe-area-inset-top));
        gap: 21px;
        margin-top: 14px;
    }

    .enc-detail-tabs button {
        min-height: 44px;
    }

    .enc-detail-workspace {
        display: flex;
        flex-direction: column;
        gap: 24px;
        padding-top: 20px;
    }

    .enc-detail-main {
        width: 100%;
        order: 2;
    }

    .enc-detail-aside {
        position: static;
        width: 100%;
        order: 1;
    }

    .enc-detail-panel > section,
    .enc-detail-panel > article {
        padding-bottom: 24px;
    }

    .enc-detail-panel > section + section,
    .enc-detail-panel > article + section {
        padding-top: 23px;
    }

    .enc-section-heading {
        margin-bottom: 14px;
    }

    .enc-section-heading h2 {
        font-size: 15px;
    }

    .enc-detail-description,
    .enc-content-section p {
        font-size: 12px;
        line-height: 1.8;
    }

    .enc-content-section {
        display: block;
        padding: 15px 0;
    }

    .enc-content-section h3 {
        margin-bottom: 7px;
    }

    .enc-section-heading-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .enc-related-actions {
        width: 100%;
    }

    .enc-related-actions button {
        flex: 1;
    }

    .enc-breeding-grid {
        grid-template-columns: 1fr;
    }

    .enc-related-item {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .enc-related-topic {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .enc-related-thumb {
        width: 52px;
    }

    .enc-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .enc-shop-item {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .enc-shop-item img,
    .enc-shop-image-empty {
        width: 72px;
        height: 58px;
    }

    .enc-shop-item a {
        grid-column: 1 / -1;
    }
}

@media (min-width: 768px) {
    body.admin-bar .enc-detail-header {
        top: 112px;
    }

    body.admin-bar .enc-detail-tabs {
        top: 170px;
    }

    body.admin-bar .enc-detail-aside {
        top: 184px;
    }
}

@media (max-width: 360px) {
    .enc-page-count span,
    #setae-enc-active-summary {
        display: none;
    }

    .enc-mobile-filter-toggle span:not(.enc-mobile-filter-count) {
        display: none;
    }

    .enc-mobile-filter-toggle {
        min-width: 44px;
        padding: 0;
    }

    .setae-encyclopedia .setae-species-grid {
        gap: 7px;
    }

    .setae-encyclopedia .card-content {
        padding: 8px;
    }

    .species-card-taxonomy span:nth-child(n + 3),
    .species-card-care-range span:last-child {
        display: none;
    }

    .enc-detail-metrics dt {
        white-space: normal;
    }
}

/* Match the 16px collection-card language on touch and wide workspaces. */
.setae-encyclopedia .species-card,
.enc-detail-hero,
.enc-source-item,
.enc-panel-empty,
.enc-related-item,
.enc-related-empty,
.enc-breeding-item,
.enc-gallery-item,
.enc-shop-item,
.enc-facts-panel,
.enc-taxonomy-panel {
    border-radius: var(--enc-card-radius);
}

@media (prefers-reduced-motion: reduce) {
    .setae-encyclopedia .species-card,
    .setae-encyclopedia .card-image-box img,
    .enc-gallery-item img {
        transition: none;
    }

    .enc-loader-mark {
        animation-duration: 1.6s;
    }
}
