/* TyraMarine atlas UI */

:root {
    --sky-top: #8dd5ec;
    --sky-mid: #d4f1f1;
    --sky-low: #f8d79d;
    --sunset-edge: #d07d52;
    --sea-deep: #1d5a7b;
    --sea-shallow: #79d4d3;
    --foam: #eef9ef;

    --paper-light: #f4e6b7;
    --paper-mid: #e9d396;
    --paper-dark: #cfb16f;
    --paper-shadow: #9c7d4f;
    --wood-light: #9d7744;
    --wood-mid: #76532b;
    --wood-dark: #4c3218;
    --wood-shadow: rgba(39, 22, 8, 0.42);
    --trim-green: #6f9648;
    --trim-deep: #3d5a26;
    --berry: #c96656;
    --gold: #d6b25f;
    --ink: #342214;
    --ink-soft: #6a5232;
    --ink-faint: #8c7353;
    --cream: #fff8da;

    --font-pixel: 'Silkscreen', monospace;
    --font-body: 'M PLUS Rounded 1c', sans-serif;
    --font-ledger: 'VT323', monospace;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    --ui-motion-fast: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --ui-motion-panel: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --ui-motion-slow: 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #1f5c78;
    color: var(--ink);
    font-family: var(--font-body);
    image-rendering: pixelated;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.08;
    z-index: 2;
}

#ocean-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#ocean-canvas:active {
    cursor: grabbing;
}

.title-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 28px 88px;
    overflow: hidden;
    background:
        linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 44%, var(--sky-low) 72%, #e9b36f 100%);
}

.title-screen::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34%;
    background:
        linear-gradient(180deg, transparent 0, rgba(93, 161, 134, 0.18) 12%, rgba(74, 125, 85, 0.75) 12%, rgba(74, 125, 85, 0.75) 100%);
    clip-path: polygon(0 56%, 8% 48%, 16% 56%, 28% 44%, 38% 58%, 47% 47%, 57% 61%, 69% 46%, 78% 56%, 88% 43%, 100% 54%, 100% 100%, 0 100%);
}

.title-screen::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 24%;
    background:
        linear-gradient(180deg, rgba(94, 195, 191, 0.25) 0, rgba(73, 155, 173, 0.88) 36%, rgba(29, 90, 123, 0.95) 100%);
    box-shadow: inset 0 8px 0 rgba(238, 249, 239, 0.45);
}

.title-screen.fade-out {
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 420ms ease, transform 420ms ease;
    pointer-events: none;
}

.title-stage {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(320px, 620px) 220px;
    gap: 20px;
    align-items: start;
}

.title-sign,
.title-note,
.loading-content,
.ui-topbar-panel,
.data-card,
.atlas-legend,
.species-dictionary,
.discovery-toast {
    position: relative;
    border: 4px solid var(--wood-dark);
    box-shadow:
        0 0 0 4px rgba(251, 235, 182, 0.28),
        6px 6px 0 var(--wood-shadow);
}

.title-sign::before,
.title-note::before,
.loading-content::before,
.data-card::before,
.atlas-legend::before,
.species-dictionary::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px solid rgba(88, 58, 29, 0.28);
    pointer-events: none;
}

.title-sign {
    padding: 28px 28px 24px;
    background:
        linear-gradient(180deg, rgba(255, 251, 229, 0.16), rgba(0, 0, 0, 0) 18%),
        linear-gradient(180deg, rgba(171, 130, 79, 0.98), rgba(142, 104, 58, 0.98)),
        repeating-linear-gradient(180deg, rgba(255, 244, 206, 0.05) 0 16px, rgba(92, 62, 29, 0.08) 16px 32px);
}

.title-ribbon {
    display: inline-block;
    margin-bottom: 18px;
    padding: 6px 10px 4px;
    background: rgba(45, 82, 26, 0.9);
    color: #f7f2dc;
    border: 2px solid #223715;
    font-family: var(--font-pixel);
    font-size: 10px;
    line-height: 1.4;
}

.title-heading {
    margin: 0;
    color: var(--cream);
    font-family: var(--font-pixel);
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.35;
    text-shadow:
        4px 4px 0 rgba(67, 39, 12, 0.8),
        0 0 0 rgba(0, 0, 0, 0);
}

.title-subtitle,
.title-dedication,
.title-version,
.loading-note,
.atlas-legend-note,
.data-card-description,
.data-card-source {
    font-size: 15px;
    line-height: 1.65;
}

.title-subtitle {
    max-width: 32rem;
    margin: 18px 0 0;
    color: #fff8dc;
}

.title-dedication {
    max-width: 30rem;
    margin: 12px 0 0;
    color: rgba(255, 245, 223, 0.84);
}

.btn-start {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding: 14px 18px 12px;
    background:
        linear-gradient(180deg, rgba(250, 235, 190, 0.98), rgba(229, 199, 129, 0.98) 55%, rgba(180, 126, 68, 0.98));
    color: #4a2f14;
    border: 3px solid #5b3619;
    box-shadow:
        inset 0 0 0 1px rgba(255, 250, 230, 0.35),
        4px 4px 0 rgba(65, 37, 16, 0.48);
    font-family: var(--font-pixel);
    font-size: 11px;
    line-height: 1.4;
    cursor: pointer;
}

.btn-start:hover {
    filter: brightness(1.05);
}

.btn-start:disabled {
    cursor: wait;
    filter: saturate(0.75);
}

.btn-start:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(65, 37, 16, 0.48);
}

.title-note {
    margin-top: 18px;
    padding: 18px 16px 14px;
    background:
        linear-gradient(180deg, rgba(255, 248, 215, 0.88), rgba(236, 208, 133, 0.96));
    transform: rotate(1.5deg);
}

.title-note-label,
.atlas-legend-title,
.data-card-section,
.loading-title,
.ui-region-label,
.ui-zoom-label,
.ui-brand-sub {
    font-family: var(--font-pixel);
    font-size: 10px;
    line-height: 1.4;
    color: var(--ink-soft);
}

.title-note-line {
    padding: 8px 0;
    border-top: 2px dashed rgba(102, 76, 43, 0.34);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
}

.title-note-line:first-of-type {
    margin-top: 10px;
}

.title-footer {
    position: absolute;
    left: 50%;
    bottom: 20px;
    z-index: 1;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    padding: 8px 14px;
    transform: translateX(-50%);
    background: rgba(68, 94, 44, 0.88);
    border: 3px solid #31461d;
    box-shadow: 4px 4px 0 rgba(45, 27, 10, 0.35);
    color: #f4efda;
}

.title-divider {
    color: rgba(244, 239, 218, 0.7);
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(33, 78, 91, 0.72);
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    width: min(460px, 100%);
    padding: 24px 24px 20px;
    background: linear-gradient(180deg, var(--paper-light), var(--paper-mid));
    text-align: center;
}

.loading-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 74px;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #8f5c32, #63401e);
    border: 3px solid var(--wood-dark);
    color: var(--cream);
    font-family: var(--font-pixel);
    font-size: 19px;
}

.loading-title {
    margin: 0;
    color: var(--ink);
}

.loading-status {
    margin: 12px 0 14px;
    font-size: 17px;
    color: var(--ink-soft);
}

.loading-bar-track {
    height: 18px;
    padding: 2px;
    background: #c39e62;
    border: 3px solid var(--wood-dark);
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background:
        repeating-linear-gradient(
            90deg,
            #f8e08c 0 14px,
            #e2c163 14px 28px
        );
}

.loading-note {
    margin: 12px 0 0;
    color: var(--ink-soft);
}

.ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--ui-motion-fast), visibility var(--ui-motion-fast);
}

.ui-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.ui-overlay > * {
    pointer-events: auto;
}

.ui-topbar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr) 96px;
    gap: 10px;
}

.tool-dock {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}

.ui-overlay:not(.hidden) .tool-dock {
    animation: dock-rise 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tool-dock-button,
.panel-close-button {
    cursor: pointer;
    transition:
        transform var(--ui-motion-fast),
        filter var(--ui-motion-fast),
        box-shadow var(--ui-motion-fast),
        opacity var(--ui-motion-fast);
}

.tool-dock-button {
    display: grid;
    grid-template-columns: 42px auto;
    gap: 8px;
    align-items: center;
    min-width: 120px;
    padding: 8px 12px 8px 8px;
    border: 3px solid #5a371a;
    background:
        linear-gradient(180deg, rgba(255, 247, 220, 0.97), rgba(240, 216, 151, 0.97) 58%, rgba(186, 131, 73, 0.98));
    box-shadow:
        inset 0 0 0 1px rgba(255, 249, 229, 0.34),
        3px 3px 0 rgba(65, 37, 16, 0.48);
    color: #4a2d13;
    text-align: left;
}

.tool-dock-button:hover,
.panel-close-button:hover {
    filter: brightness(1.05);
}

.tool-dock-button:active,
.panel-close-button:active {
    transform: translate(1px, 1px);
}

.tool-dock-button.is-active {
    transform: translateX(6px);
    box-shadow:
        inset 0 0 0 1px rgba(255, 252, 236, 0.42),
        5px 5px 0 rgba(65, 37, 16, 0.48);
    background:
        linear-gradient(180deg, rgba(255, 250, 231, 0.98), rgba(245, 223, 168, 0.98) 58%, rgba(198, 140, 80, 0.99));
}

.tool-dock-button.is-disabled {
    opacity: 0.55;
    filter: saturate(0.62);
}

.tool-dock-glyph,
.tool-dock-label {
    font-family: var(--font-pixel);
}

.tool-dock-glyph {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    border: 2px solid rgba(92, 61, 28, 0.82);
    background:
        linear-gradient(180deg, rgba(255, 249, 225, 0.88), rgba(233, 209, 151, 0.82));
    box-shadow: inset 0 0 0 1px rgba(255, 250, 230, 0.34);
    font-size: 9px;
    line-height: 1.2;
}

.tool-dock-label {
    font-size: 9px;
    line-height: 1.4;
    color: #533117;
}

.atlas-panel {
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.98);
    transform-origin: bottom left;
    visibility: hidden;
    transition:
        opacity var(--ui-motion-panel),
        transform var(--ui-motion-panel),
        visibility var(--ui-motion-panel);
    background: #fdf8e7;
    border: 2px solid #3a2618;
    border-radius: 4px 12px 12px 4px;
    box-shadow: 
        inset -2px 0 8px rgba(0,0,0,0.04),
        4px 4px 0 rgba(14, 38, 56, 0.25);
    display: flex;
    flex-direction: column;
}

.atlas-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(90deg, #5c3a21, #4a2d18 80%, #3a2618);
    border-right: 2px solid #2d1a0e;
    z-index: 1;
}

.atlas-panel::after {
    content: '';
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 20px;
    width: 4px;
    background: repeating-linear-gradient(
        0deg,
        transparent, transparent 8px,
        rgba(255, 245, 220, 0.9) 8px, rgba(255, 245, 220, 0.9) 16px
    );
    z-index: 2;
    pointer-events: none;
}

.atlas-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    visibility: visible;
    z-index: 6;
}

.atlas-panel.is-open::before {
    animation: panel-frame-in var(--ui-motion-slow);
}

.panel-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 24px;
    border: 2px solid #735027;
    background:
        linear-gradient(180deg, rgba(255, 246, 214, 0.96), rgba(229, 196, 118, 0.96));
    box-shadow:
        inset 0 0 0 1px rgba(255, 251, 236, 0.36),
        2px 2px 0 rgba(88, 56, 25, 0.18);
    color: #6a421c;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.ui-topbar-panel {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 8px 10px;
    background:
        linear-gradient(180deg, rgba(247, 236, 196, 0.96), rgba(220, 194, 122, 0.98));
}

.btn-start:focus-visible,
.tool-dock-button:focus-visible,
.panel-close-button:focus-visible,
.species-dictionary-row.is-found:focus-visible {
    outline: 3px solid rgba(103, 157, 67, 0.9);
    outline-offset: 2px;
}

.ui-overlay:not(.hidden) .ui-topbar-panel {
    animation: topbar-settle 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ui-brand-panel {
    gap: 12px;
}

.ui-brand-mark {
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: linear-gradient(180deg, #7f5b33, #5f3d1f);
    border: 3px solid #4a3018;
    color: var(--cream);
    font-family: var(--font-pixel);
    font-size: 10px;
}

.ui-brand-name {
    font-family: var(--font-pixel);
    font-size: 10px;
    line-height: 1.45;
    color: var(--ink);
}

.ui-brand-sub {
    margin-top: 2px;
}

.ui-region-panel,
.ui-zoom-panel {
    justify-content: space-between;
}

.ui-region-panel {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.ui-caption {
    margin-top: 2px;
    font-size: 16px;
    line-height: 1.05;
    color: var(--ink);
    font-family: var(--font-ledger);
}

.ui-zoom-panel {
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    text-align: right;
}

.ui-zoom-info {
    margin-top: 2px;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--berry);
}

.data-card {
    position: absolute;
    top: 88px;
    right: 12px;
    bottom: 12px;
    width: min(352px, calc(100vw - 24px));
    overflow: hidden;
    transform-origin: bottom right;
}



.data-card .panel-scroll-area {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 14px 18px 44px;
}

.data-card-close {
    position: absolute;
}

.data-card-header {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding-right: 28px;
}

.data-card-portrait-frame {
    padding: 6px;
    background: linear-gradient(180deg, #94693b, #6c4724);
    border: 3px solid var(--wood-dark);
}

.data-card-portrait {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(rgba(139, 107, 58, 0.15) 2px, transparent 2px),
        linear-gradient(90deg, rgba(139, 107, 58, 0.15) 2px, transparent 2px),
        linear-gradient(180deg, #f4dfaa, #ddc37a);
    background-size: 12px 12px, 12px 12px, auto;
    color: #604321;
    font-family: var(--font-pixel);
    font-size: 22px;
}

.data-card-kicker {
    display: inline-block;
    padding: 5px 8px 3px;
    background: rgba(78, 123, 44, 0.15);
    border: 2px solid rgba(78, 123, 44, 0.35);
    color: #425a28;
    font-family: var(--font-pixel);
    font-size: 9px;
    line-height: 1.35;
}

.data-card-name {
    margin: 8px 0 0;
    font-family: var(--font-pixel);
    font-size: 17px;
    line-height: 1.45;
    color: var(--ink);
}

.data-card-scientific {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--ink-soft);
    font-family: var(--font-ledger);
}

.data-card-body {
    margin-top: 12px;
    padding-bottom: 12px;
}

.data-card-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 2px dashed rgba(103, 74, 36, 0.32);
}

.data-card-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

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

.stat-box {
    padding: 10px;
    background: rgba(255, 250, 233, 0.72);
    border: 2px solid rgba(103, 74, 36, 0.28);
}

.stat-label {
    color: var(--ink-faint);
    font-family: var(--font-pixel);
    font-size: 9px;
    line-height: 1.4;
}

.stat-value {
    margin-top: 6px;
    color: var(--ink);
    font-family: var(--font-ledger);
    font-size: 19px;
    line-height: 1;
}

.stat-value.safe {
    color: #49752d;
}

.stat-value.warning,
.stat-value.danger {
    color: #a8533d;
}

.stat-value.glow {
    color: #537e34;
}

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

.data-card-meta-line {
    min-width: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink);
    padding-bottom: 4px;
    border-bottom: 1px dotted rgba(103, 74, 36, 0.18);
}

.data-card-meta-label {
    display: block;
    margin-bottom: 2px;
    color: var(--ink-faint);
    font-family: var(--font-pixel);
    font-size: 8px;
    line-height: 1.4;
}

.data-card-description,
.data-card-source {
    margin-top: 8px;
    color: var(--ink-soft);
}

.data-card-source {
    font-family: var(--font-ledger);
    font-size: 15px;
}

.atlas-legend {
    position: absolute;
    left: 146px;
    bottom: 12px;
    width: min(292px, calc(100vw - 24px));
    overflow: hidden;
}

.atlas-legend .panel-scroll-area {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 40px 14px 44px;
}

.atlas-legend-subtitle {
    margin: 8px 0 0;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.4;
}

.atlas-legend-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ink);
}

.atlas-legend-note {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 2px dashed rgba(103, 74, 36, 0.32);
    color: var(--ink-soft);
}

.legend-swatch {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    border: 2px solid #624322;
}

.legend-swatch-fish {
    background: #cb7159;
}

.legend-swatch-station {
    background: #d5bb78;
}

.legend-swatch-shore {
    background: #8ad3cf;
}

.species-dictionary {
    position: absolute;
    left: 146px;
    bottom: 12px;
    width: min(292px, calc(100vw - 24px));
    max-height: min(46vh, calc(100vh - 214px));
    overflow: hidden;
}

.species-dictionary .panel-scroll-area {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 40px 14px 44px;
}

.species-dictionary-topline {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
}

.species-dictionary-title,
.species-dictionary-count,
.species-dictionary-rarity {
    font-family: var(--font-pixel);
    font-size: 9px;
    line-height: 1.4;
}

.species-dictionary-count {
    color: var(--berry);
}

.species-dictionary-note {
    margin-top: 8px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.45;
    padding-bottom: 10px;
    border-bottom: 2px dashed rgba(103, 74, 36, 0.22);
}

.species-dictionary-list {
    margin-top: 12px;
    display: grid;
    gap: 8px;
    padding-bottom: 4px;
}

.species-dictionary-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 72px;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 8px;
    border: 2px solid rgba(103, 74, 36, 0.24);
    background: rgba(255, 250, 233, 0.58);
    color: var(--ink);
    text-align: left;
}

.species-dictionary-row:disabled {
    opacity: 0.52;
}

.species-dictionary-row.is-found {
    border-color: rgba(73, 117, 45, 0.42);
    background: rgba(255, 250, 232, 0.78);
    cursor: pointer;
}

.species-dictionary-row.is-found:hover {
    background: rgba(255, 251, 238, 0.96);
}

.species-dictionary-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid rgba(92, 67, 34, 0.36);
    background: linear-gradient(180deg, #f4dfaa, #ddc37a);
    color: #604321;
    font-family: var(--font-pixel);
    font-size: 12px;
}

.species-dictionary-copy,
.species-dictionary-state {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.species-dictionary-name {
    font-size: 13px;
    line-height: 1.3;
    color: var(--ink);
    font-weight: 700;
}

.species-dictionary-meta,
.species-dictionary-seen {
    color: var(--ink-soft);
    font-family: var(--font-ledger);
    font-size: 12px;
    line-height: 1.3;
}

.species-dictionary-state {
    justify-items: end;
    text-align: right;
}

.discovery-toast {
    position: absolute;
    top: 74px;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    transform: translateX(-50%);
    background:
        linear-gradient(180deg, #f1d386 0%, #d9b060 52%, #b67d3f 52%, #9a632f 100%);
    color: #48260e;
    font-family: var(--font-pixel);
    font-size: 10px;
    line-height: 1.4;
    opacity: 0;
}

.discovery-toast.show {
    opacity: 1;
}

.discovery-toast.hidden {
    display: none;
}

.discovery-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 250, 220, 0.45);
    border: 2px solid rgba(82, 47, 18, 0.35);
}

.discovery-text {
    white-space: nowrap;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(145, 111, 64, 0.12);
}

::-webkit-scrollbar-thumb {
    background: rgba(150, 115, 67, 0.72);
    border: 1px solid rgba(110, 74, 37, 0.38);
}

.hidden {
    display: none;
}

@media (max-width: 980px) {
    .title-stage {
        grid-template-columns: 1fr;
        max-width: 640px;
    }

    .title-note {
        justify-self: end;
        width: min(100%, 300px);
    }

    .ui-topbar {
        grid-template-columns: 1fr;
    }

    .ui-region-panel,
    .ui-zoom-panel {
        align-items: flex-start;
        gap: 6px;
    }

    .data-card {
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 72px;
        width: auto;
        max-height: min(58vh, 560px);
    }

    .tool-dock {
        left: auto;
        right: 12px;
        bottom: 12px;
    }
}

@media (max-width: 720px) {
    .title-screen {
        padding: 28px 16px 72px;
    }

    .title-sign,
    .title-note,
    .loading-content,
    .atlas-legend,
    .data-card,
    .species-dictionary,
    .ui-topbar-panel {
        box-shadow:
            0 0 0 3px rgba(251, 235, 182, 0.24),
            4px 4px 0 var(--wood-shadow);
    }

    .title-heading {
        font-size: 24px;
    }

    .ui-topbar {
        top: 10px;
        left: 10px;
        right: 10px;
        grid-template-columns: minmax(0, 1fr) 84px;
        gap: 8px;
    }

    .ui-brand-panel {
        grid-column: 1 / 2;
    }

    .ui-zoom-panel {
        grid-column: 2 / 3;
    }

    .ui-region-panel {
        grid-column: 1 / 3;
    }

    .ui-topbar-panel {
        min-height: 44px;
        padding: 7px 8px;
    }

    .ui-brand-mark {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    .ui-caption {
        font-size: 14px;
    }

    .title-subtitle,
    .title-dedication,
    .atlas-legend-note,
    .data-card-description,
    .data-card-source {
        font-size: 14px;
    }

    .atlas-legend,
    .species-dictionary,
    .data-card {
        left: 10px;
        right: 10px;
        top: 90px;
        bottom: auto;
        width: auto;
        max-height: calc(100vh - 160px);
        z-index: 100;
    }

    .data-card .panel-scroll-area {
        padding: 12px 12px 12px 40px;
    }

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

    .data-card-portrait-frame {
        width: 110px;
    }

    .data-card-body {
        padding-left: 0;
    }

    .data-card-stats,
    .data-card-meta {
        grid-template-columns: 1fr;
    }

    .atlas-legend .panel-scroll-area,
    .species-dictionary .panel-scroll-area {
        padding: 12px 12px 12px 40px;
    }

    .tool-dock {
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 4;
        display: flex;
        flex-direction: row;
        gap: 8px;
        pointer-events: auto;
    }

    .tool-dock-button {
        grid-template-columns: 44px;
        min-width: 44px;
        padding: 6px;
    }

    .tool-dock-button.is-active {
        transform: translateY(-4px);
    }

    .tool-dock-label {
        display: none;
    }

    .tool-dock-glyph {
        height: 32px;
    }

    .discovery-toast {
        left: 10px;
        right: 10px;
        transform: none;
        justify-content: center;
        white-space: normal;
    }

    .discovery-text {
        white-space: normal;
    }
}

@media (max-width: 768px) {
    .data-card-stats {
        gap: 12px;
        padding: 4px 0;
    }

    .species-dictionary-row {
        padding: 12px 10px;
        gap: 10px;
    }

    .data-card-name {
        font-size: 20px;
    }

    .species-dictionary-name {
        font-size: 15px;
    }

    .panel-close-button {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
}

@keyframes panel-frame-in {
    0% {
        opacity: 0.6;
        transform: scale(0.985);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes dock-rise {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes topbar-settle {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
