:root {
    --bg: #07121f;
    --bg-soft: #102438;
    --surface: rgba(14, 30, 48, 0.82);
    --surface-strong: rgba(8, 21, 36, 0.95);
    --text: #f2f8ff;
    --muted: #a8c3da;
    --line: rgba(197, 227, 255, 0.18);
    --accent: #2ac7b8;
    --accent-2: #ffb648;
    --accent-3: #7ed0ff;
    --danger: #ff6f61;
    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow: 0 24px 60px rgba(1, 12, 23, 0.45);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 10%, rgba(42, 199, 184, 0.2), transparent 35%),
        radial-gradient(circle at 90% 0%, rgba(255, 182, 72, 0.15), transparent 40%),
        linear-gradient(150deg, #06101b 0%, #081e31 45%, #040c17 100%);
    overflow-x: hidden;
}

.bg-orb {
    position: fixed;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    filter: blur(70px);
    z-index: -1;
    opacity: 0.55;
}

.orb-a {
    background: #1e7fbf;
    top: -120px;
    left: -90px;
}

.orb-b {
    background: #1fa784;
    right: -120px;
    bottom: -110px;
}

.shell {
    width: min(1280px, 94vw);
    margin: 0 auto;
}

.hero {
    padding: 28px 0 16px;
}

.hero-content {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(20, 43, 66, 0.88), rgba(8, 20, 34, 0.85));
    border-radius: var(--radius-lg);
    padding: clamp(18px, 3vw, 34px);
    box-shadow: var(--shadow);
}

.eyebrow {
    font-family: "Baloo 2", cursive;
    color: var(--accent);
    letter-spacing: 0.06em;
    font-size: 17px;
    margin-bottom: 8px;
}

h1,
h2,
h3 {
    font-family: "Baloo 2", cursive;
    font-weight: 700;
}

h1 {
    font-size: clamp(34px, 5.2vw, 62px);
    line-height: 0.98;
}

.hero-desc {
    margin-top: 12px;
    color: var(--muted);
    max-width: 90ch;
    line-height: 1.75;
}

.hero-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chip-link {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    font-size: 14px;
}

.chip-link.muted {
    color: var(--muted);
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding-bottom: 42px;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.control-panel {
    padding: 18px;
}

.view-switch {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.view-btn {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 9px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.view-btn:hover {
    transform: translateY(-1px);
}

.view-btn.active {
    background: linear-gradient(125deg, #1d8f85, #247cae);
    border-color: transparent;
}

.search-row {
    margin-top: 15px;
}

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 7px;
}

input,
select,
button {
    font: inherit;
}

#search-input,
select {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

#search-input:focus,
select:focus {
    border-color: rgba(42, 199, 184, 0.8);
}

.filters {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.filter-item {
    min-width: 0;
}

.ghost-btn {
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    height: 41px;
    cursor: pointer;
}

.hint-row {
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hint-row span {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    padding: 3px 8px;
    border-radius: 999px;
}

.content-panel {
    padding: 14px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.animal-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(160deg, rgba(16, 36, 57, 0.9), rgba(8, 19, 33, 0.88));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.animal-card[data-open-animal] {
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.animal-card[data-open-animal]:hover {
    transform: translateY(-2px);
    border-color: rgba(126, 208, 255, 0.5);
}

.card-media {
    height: 146px;
    background: linear-gradient(140deg, #1d3d5b, #1c755f);
    position: relative;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-media .img-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 46px;
}

.card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.card-title h3 {
    font-size: 24px;
    line-height: 1;
}

.card-title p {
    color: var(--muted);
    font-size: 13px;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 8px;
    color: #d2edff;
    background: rgba(126, 208, 255, 0.14);
}

.badge.level-apex {
    background: rgba(255, 111, 97, 0.18);
    color: #ffd2cc;
}

.badge.level-herbivore {
    background: rgba(42, 199, 184, 0.2);
    color: #cefff7;
}

.card-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.action-btn {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.meta {
    color: var(--muted);
    font-size: 12px;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

thead th {
    color: var(--muted);
    font-weight: 500;
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    white-space: nowrap;
}

tbody td {
    border-bottom: 1px dashed rgba(197, 227, 255, 0.2);
    padding: 9px 10px;
    vertical-align: middle;
    font-size: 14px;
}

.list-row-clickable {
    cursor: pointer;
    transition: background 0.18s ease;
}

.list-row-clickable:hover {
    background: rgba(126, 208, 255, 0.08);
}

.table-name {
    font-weight: 600;
}

.table-sub {
    color: var(--muted);
    font-size: 12px;
}

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

.list-animal {
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-thumb-wrap {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(140deg, #1d3d5b, #1c755f);
    border: 1px solid var(--line);
    flex-shrink: 0;
}

.list-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-thumb-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 24px;
}

.food-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 12px;
}

.globe-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.food-canvas,
.globe-canvas {
    height: 620px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
}

.food-canvas {
    overflow: auto;
    height: auto;
    min-height: 440px;
    max-height: 700px;
    padding: 4px;
}

.globe-canvas {
    overflow: hidden;
    position: relative;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 52% 42%, rgba(41, 121, 187, 0.22), transparent 46%),
        radial-gradient(circle at 20% 20%, rgba(126, 208, 255, 0.15), transparent 32%),
        radial-gradient(circle at 80% 72%, rgba(42, 199, 184, 0.14), transparent 38%),
        linear-gradient(145deg, rgba(6, 18, 33, 0.95), rgba(3, 10, 20, 0.98));
}

.globe-canvas::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.32;
    background-image:
        radial-gradient(2px 2px at 10% 20%, rgba(255,255,255,0.85), transparent 55%),
        radial-gradient(1.5px 1.5px at 35% 14%, rgba(255,255,255,0.75), transparent 55%),
        radial-gradient(2px 2px at 60% 26%, rgba(255,255,255,0.8), transparent 55%),
        radial-gradient(1.5px 1.5px at 82% 18%, rgba(255,255,255,0.82), transparent 55%),
        radial-gradient(2px 2px at 74% 44%, rgba(255,255,255,0.7), transparent 55%),
        radial-gradient(1.5px 1.5px at 18% 68%, rgba(255,255,255,0.7), transparent 55%),
        radial-gradient(2px 2px at 46% 78%, rgba(255,255,255,0.75), transparent 55%),
        radial-gradient(1.5px 1.5px at 88% 74%, rgba(255,255,255,0.68), transparent 55%);
}

.globe-canvas > canvas {
    display: block !important;
    margin: 0 auto !important;
    max-width: 100%;
}

.globe-status {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    text-align: center;
    color: var(--text);
    background: linear-gradient(145deg, rgba(14, 34, 53, 0.88), rgba(8, 20, 35, 0.94));
}

.globe-status p {
    margin: 0;
    line-height: 1.6;
}

.globe-status small {
    display: block;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.5;
}

.food-side,
.globe-side {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(8, 22, 36, 0.9);
    padding: 12px;
}

.food-side p,
.globe-side p {
    color: var(--muted);
    margin: 7px 0 10px;
    font-size: 13px;
    line-height: 1.6;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.food-gallery {
    display: grid;
    gap: 12px;
}

.food-focus-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(7, 24, 38, 0.9);
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 12px;
    padding: 12px;
}

.food-focus-media {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    min-height: 130px;
    background: linear-gradient(140deg, #1d3d5b, #1c755f);
}

.food-focus-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.food-focus-body h3 {
    margin: 0;
    font-size: 1.18rem;
}

.food-focus-body h3 small {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.food-focus-body p {
    margin: 8px 0 0;
}

.food-focus-actions {
    margin-top: 10px;
}

.food-group {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(7, 24, 38, 0.9);
    padding: 10px;
}

.food-group h4 {
    margin: 0 0 8px;
    font-size: 0.98rem;
    color: #d6e9fa;
}

.food-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
}

.food-animal-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
    padding: 0;
    text-align: left;
    overflow: hidden;
}

.food-animal-card:hover {
    border-color: rgba(126, 208, 255, 0.55);
}

.food-animal-media {
    position: relative;
    height: 92px;
    background: linear-gradient(140deg, #1d3d5b, #1c755f);
}

.food-animal-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.food-animal-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 1.7rem;
}

.food-focus-fallback {
    font-size: 2.2rem;
}

.food-animal-body {
    padding: 8px;
}

.food-animal-body strong {
    display: block;
    font-size: 0.94rem;
    line-height: 1.2;
}

.food-animal-body p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.food-animal-chip {
    display: inline-block;
    margin-top: 6px;
    border: 1px solid rgba(126, 208, 255, 0.42);
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 0.72rem;
    color: #d6efff;
}

.food-mini-btn {
    margin-top: 8px;
    display: inline-block;
    border: 1px solid rgba(126, 208, 255, 0.46);
    border-radius: 9px;
    background: rgba(126, 208, 255, 0.11);
    color: #d6efff;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.food-mini-btn:hover {
    background: rgba(126, 208, 255, 0.2);
}

.food-empty {
    color: var(--muted);
    font-size: 0.88rem;
    padding: 6px 2px;
}

.food-bars {
    margin: 10px 0 8px;
    display: grid;
    gap: 6px;
}

.food-bar-row {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 8px;
    align-items: center;
    font-size: 0.76rem;
    color: #d6e9fa;
}

.food-bar-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.food-bar-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2ac7b8, #7ed0ff);
}

.globe-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.globe-controls .action-btn {
    font-size: 12px;
    padding: 8px 4px;
}

.globe-pin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: #102235;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 10px rgba(2, 9, 18, 0.45);
}

.globe-pin:hover {
    transform: translate(-50%, -54%);
}

.globe-pin-fallback {
    font-size: 14px;
    line-height: 1;
}

.globe-pin-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.globe-detail {
    margin-top: 12px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 10px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}

.globe-detail strong {
    color: var(--text);
}

.detail-layout {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(7, 24, 38, 0.9);
    padding: 12px;
}

.detail-body {
    min-height: 280px;
}

.detail-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.detail-tip {
    color: var(--muted);
    font-size: 12px;
}

.detail-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(5, 17, 29, 0.8);
    padding: 12px;
}

.detail-header {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 12px;
}

.detail-media {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    min-height: 180px;
    background: linear-gradient(140deg, #1d3d5b, #1c755f);
}

.detail-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-fallback {
    font-size: 2.4rem;
}

.detail-summary h2 {
    margin: 0;
    font-size: 1.45rem;
}

.detail-summary h2 small {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.detail-summary p {
    margin: 8px 0 0;
    color: #d6e9fa;
}

.detail-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.detail-bars {
    margin-top: 10px;
    max-width: 460px;
}

.detail-section {
    margin-top: 12px;
    border-top: 1px dashed rgba(126, 208, 255, 0.25);
    padding-top: 10px;
}

.detail-section h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

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

.wiki-link {
    border: 1px solid rgba(126, 208, 255, 0.42);
    border-radius: 999px;
    background: rgba(126, 208, 255, 0.12);
    color: #e9f7ff;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
}

.wiki-link:hover {
    background: rgba(126, 208, 255, 0.22);
}

.wiki-tag {
    border-color: rgba(42, 199, 184, 0.45);
    background: rgba(42, 199, 184, 0.12);
}

.wiki-empty {
    color: var(--muted);
    font-size: 13px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) translateY(20px);
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(5, 17, 29, 0.95);
    color: var(--text);
    padding: 8px 14px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 30;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 1080px) {
    .filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .food-layout {
        grid-template-columns: 1fr;
    }

    .food-canvas,
    .globe-canvas {
        height: 520px;
    }

    .food-canvas {
        height: auto;
        min-height: 400px;
        max-height: 620px;
    }
}

@media (max-width: 760px) {
    .hero {
        padding-top: 20px;
    }

    .control-panel,
    .content-panel {
        padding: 12px;
    }

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

    .card-grid {
        grid-template-columns: 1fr;
    }

    .food-focus-card {
        grid-template-columns: 1fr;
    }

    .detail-header {
        grid-template-columns: 1fr;
    }

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

    .food-canvas,
    .globe-canvas {
        height: 440px;
    }

    .food-canvas {
        height: auto;
        min-height: 340px;
        max-height: 520px;
    }
}
