/* ── Ship context action bar - map-level widget, bottom-centre ──── */
#ship-navigation-panel {
    position: absolute;
    bottom: 2.8rem;
    left: 40%;
    transform: translateX(-50%);
    z-index: var(--z-ship-nav);
    background: none;
    backdrop-filter: blur(8px);
    border: none;
    box-shadow: none;
    min-width: 42rem;
    max-width: 52rem;
    pointer-events: auto;
    border-radius: var(--radius-sm);
}
/* Task bar state-divs (sidebar active-task strip) */
.task-bar-state {
    display: none;
}
#active-task-panel[data-state='idle'] .task-bar--idle {
    display: block;
}
#active-task-panel[data-state='running'] .task-bar--running {
    display: block;
    border: none;
}
#active-task-panel[data-state='sailing'] .task-bar--sailing {
    display: block;
}
#active-task-panel[data-state='hauling'] .task-bar--hauling {
    display: block;
}

/* Shared inner layout */
.context-bar-inner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
}
.context-bar-inner--clickable {
    cursor: pointer;
    transition: background 0.15s;
}
.context-bar-inner--clickable:hover {
    background: rgba(197, 160, 89, 0.06);
}

.context-icon {
    font-size: var(--font-size-2xl);
    flex-shrink: 0;
    width: 2.8rem;
    height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.context-icon--warn {
    color: rgba(197, 160, 89, 0.65);
}
.context-icon--sail {
    animation: voyage-pulse 2.4s ease-in-out infinite;
    font-size: var(--font-size-2xl);
}
.context-icon-img {
    width: 2.8rem;
    height: 2.8rem;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.85;
}
.sidebar-header-icon-img {
    width: 2.8rem;
    height: 2.8rem;
    object-fit: contain;
    vertical-align: middle;
    opacity: 0.7;
    flex-shrink: 0;
}

@keyframes voyage-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.context-info {
    flex: 1;
    min-width: 0;
}
.context-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.context-sub {
    font-size: var(--font-size-base);
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Idle state dims the title slightly */
.task-bar--idle .context-title {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Skill-specific tints on running task bar ───────────────────── */
#active-task-panel {
    transition:
        background 0.4s,
        border-color 0.4s;
}
#active-task-panel[data-state='running'][data-skill='mining'] {
    background: rgba(90, 55, 15, 0.18);
    border-top: 1px solid rgba(180, 110, 40, 0.35);
}
#active-task-panel[data-state='running'][data-skill='logging'] {
    background: none;
    border-top: 1px solid rgba(50, 140, 50, 0.35);
}
#active-task-panel[data-state='running'][data-skill='smelting'] {
    background: none;
}
#active-task-panel[data-state='running'][data-skill='fishing'] {
    background: rgba(10, 50, 110, 0.18);
    border-top: 1px solid rgba(40, 110, 200, 0.35);
}
#active-task-panel[data-state='running'][data-skill='shipwright'] {
    background: rgba(50, 30, 60, 0.18);
    border-top: 1px solid rgba(120, 70, 160, 0.35);
}
#active-task-panel[data-state='running'][data-skill='cooking'] {
    background: rgba(80, 30, 20, 0.18);
    border-top: 1px solid rgba(200, 80, 50, 0.35);
}
#active-task-panel[data-state='hauling'] {
    border-top: 1px solid rgba(197, 160, 89, 0.35);
}

/* Shared button styles */
.context-btn-group {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.context-btn {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(197, 160, 89, 0.1);
    color: rgba(197, 160, 89, 0.75);
    border: 1px solid rgba(197, 160, 89, 0.25);
    border-radius: 3px;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition:
        background 0.15s,
        color 0.15s;
}
.context-btn:hover {
    background: rgba(197, 160, 89, 0.22);
    color: #f0d585;
}
.context-btn--primary {
    background: rgba(197, 160, 89, 0.18);
    color: var(--gold);
    border-color: rgba(197, 160, 89, 0.4);
}
.context-btn--primary:hover {
    background: rgba(197, 160, 89, 0.32);
}
.context-btn--danger {
    color: var(--text-danger);
    border-color: rgba(210, 90, 80, 0.3);
    background: transparent;
}
.context-btn--danger:hover {
    background: rgba(210, 90, 80, 0.12);
    color: #e06060;
}
.context-btn--repair {
    background: rgba(200, 90, 80, 0.15);
    color: #e08070;
    border-color: rgba(200, 90, 80, 0.4);
}
.context-btn--repair:hover {
    background: rgba(200, 90, 80, 0.28);
}

/* Task progress bar */
.context-progress-wrap {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    min-width: 60px;
    max-width: 120px;
}
.context-progress-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, rgba(197, 160, 89, 0.6), var(--gold));
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    will-change: transform;
}

/* Stop button */
.context-x-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid rgba(197, 160, 89, 0.3);
    color: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: var(--font-size-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        border-color 0.15s,
        color 0.15s;
}
.context-x-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.context-btn-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.12s;
}
.context-x-btn:hover .context-btn-icon {
    opacity: 1;
}
#city-panel .context-btn-icon {
    width: 10px;
    height: 10px;
}
.context-view-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid rgba(197, 160, 89, 0.3);
    color: rgba(197, 160, 89, 0.7);
    border-radius: 4px;
    padding: 0 8px;
    height: 22px;
    font-size: var(--font-size-base);
    font-family: inherit;
    letter-spacing: 0.04em;
    cursor: pointer;
    white-space: nowrap;
    transition:
        border-color 0.15s,
        color 0.15s;
}
.context-view-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.tf-timer__val {
    display: inline-block;
    min-width: 1.9ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.context-end-timer {
    flex-shrink: 0;
    color: rgba(197, 160, 89, 0.7);
    font-size: var(--font-size-base);
    font-family: 'Gothic A1', monospace;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* Global navigation - vertical panel
   Gap + padding also scale with viewport height via clamp() so the full
   set of nav buttons fits even on shorter screens (≤1080p laptops, docked
   windows, etc.) without being clipped. */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: clamp(0.8rem, 2svh, 2.5rem);
    padding: clamp(0.75rem, 2svh, 2rem) 0;
    border-top: none;
    background: transparent;
    width: 100%;
    height: calc(100% - clamp(1rem, 4.5svh, 5.8rem));
    margin-top: clamp(1rem, 4.5svh, 5.8rem);
}
.sidebar-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s;
    position: relative;
}

.sidebar-nav-btn:hover {
    transform: translateY(-2px);
}
.sidebar-nav-icon {
    /* svh (small viewport height) excludes browser chrome, giving consistent
       sizing across Chrome and Firefox. Caps at 5.2rem on tall screens;
       floor at 3rem so icons stay legible on short viewports. */
    width: clamp(3rem, 6svh, 5.2rem);
    height: clamp(3rem, 6svh, 5.2rem);
    max-width: 7rem;
    max-height: 7rem;
    border-radius: 50%;
    box-shadow:
        rgb(118 118 118 / 30%) 0px 8px 24px,
        rgba(197, 160, 89, 0.15) 0px 1px 3px inset;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s;
}
.sidebar-nav-icon img {
    width: 135%;
    height: 135%;
    object-fit: contain;
    transition: filter 0.2s;
}
/* City nav - hidden until docked, warm sepia tint */
#city-nav-btn {
    display: none;
}
#city-nav-btn .sidebar-nav-label {
    color: var(--text-muted);
}
#city-nav-btn.active .sidebar-nav-label {
    color: #d4a870;
}

/* Active nav state */
.sidebar-nav-btn.active .sidebar-nav-icon {
    filter: sepia(1);
}
.sidebar-nav-btn.active .sidebar-nav-label {
    color: #cdcdcd;
}
@media (max-resolution: 1dppx) {
    .sidebar-nav-icon {
        margin-bottom: 5px;
    }
}

/* .dock-bar-btn kept for any legacy references */
.dock-bar-btn {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(197, 160, 89, 0.1);
    color: rgba(197, 160, 89, 0.75);
    border: 1px solid rgba(197, 160, 89, 0.25);
    border-radius: 3px;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 0.15s,
        color 0.15s;
}
.dock-bar-btn:hover {
    background: rgba(197, 160, 89, 0.22);
    color: #f0d585;
}

/* ── Alpha version tag - bottom of nav ──────────────────────────────── */
.sidebar-alpha-tag {
    display: block;
    margin-top: auto;
    margin-bottom: 4rem;
    text-align: center;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.35);
    user-select: none;
}

button.sidebar-alpha-tag {
    width: 100%;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
}

button.sidebar-alpha-tag:hover {
    color: rgba(197, 160, 89, 0.65);
}

/* ── Audio nav button - full-width row layout ────────────────────────── */
.sidebar-audio-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: auto;
    margin-bottom: 4rem;
    padding: 8px 10px;
    border: 1px solid rgba(197, 160, 89, 0.45);
    border-radius: 4px;
    background: rgba(5, 7, 10, 0.85);
    color: rgba(197, 160, 89, 0.75);
    font-family: var(--font-heading);
    font-size: var(--font-size-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
    user-select: none;
}
.sidebar-audio-btn:hover,
.sidebar-audio-btn.is-open {
    background: rgba(197, 160, 89, 0.12);
    color: #f0d585;
    border-color: rgba(197, 160, 89, 0.7);
}
.sidebar-audio-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: inherit;
}
.sidebar-audio-label {
    font-size: var(--font-size-sm);
    line-height: 1;
    margin-left: -3px;
}
.nav-label-count {
    color: #d47070;
}
.sidebar-nav-btn.active .nav-label-count {
    color: #e88888;
}

.sidebar-nav-label {
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    letter-spacing: 1.2px;
    margin-top: 3px;
    text-transform: uppercase;
    transition: color 0.2s;
}
/* Map control buttons - vertical circles, right-edge beside #game-sidebar */
#map-controls {
    position: absolute;
    bottom: var(--cab-drawer-h, 2rem);
    right: calc(var(--sidebar-width) + 4.3rem);
    z-index: var(--z-map-controls);
    display: flex;
    flex-direction: column;
    gap: var(--section-gap);
    align-items: center;
}
.map-ctrl-group {
    display: contents;
}
.map-btn {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 50%;
    background: rgb(7 8 13 / 85%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(197, 160, 89, 0.35);
    color: rgba(197, 160, 89, 0.8);
    font-size: var(--font-size-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
    padding: 0;
    line-height: 1;
}
@media (hover: hover) and (pointer: fine) {
    .map-btn:hover {
        background: rgb(20 18 12 / 92%);
        border-color: var(--gold);
        color: var(--gold);
    }
}
@media (hover: none) {
    .map-btn:hover {
        background: rgb(7 8 13 / 85%);
        border-color: rgba(197, 160, 89, 0.35);
        color: rgba(197, 160, 89, 0.8);
    }
}
.map-btn.active {
    background: rgba(197, 160, 89, 0.18);
    border-color: var(--gold);
    color: var(--gold);
}
.map-btn.bc-open {
    background: rgb(7 8 13 / 40%);
    border-color: var(--gold);
    color: var(--gold);
}
/* Battle Colours button: subtle pulse while a hoist/strike timer is running */
.map-btn.bc-transition img {
    animation: bc-transition-pulse 2s ease-in-out infinite;
}
@keyframes bc-transition-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.45;
    }
}

/* #viewport layout lives in base.css (sync-loaded for Pixi init) */

/* ── Tile inspector overrides ─────────────────────────────────────────── */
#tile-context-actions .stat-section-label {
    cursor: default;
    pointer-events: none;
}

/* ── Tile inspector misc ─────────────────────────────────────────────── */
#tile-resource-nodes {
    display: contents;
}
#task-bar-nav-progress-wrap {
    margin-right: 32px;
}

/* ── Audio flyout panel ──────────────────────────────────────────────── */
.audio-flyout {
    position: fixed;
    width: min(260px, 94vw);
    background: #0e1015;
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: 4px;
    z-index: 99999;
    pointer-events: all;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}
.audio-flyout[hidden] {
    display: none;
}
.audio-flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.15);
}
.audio-flyout-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-sm);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.9);
}
.audio-flyout-close {
    background: none;
    border: none;
    color: rgba(197, 160, 89, 0.5);
    cursor: pointer;
    font-size: var(--font-size-xs);
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.15s;
}
.audio-flyout-close:hover {
    color: rgba(197, 160, 89, 0.9);
}
.audio-flyout-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.audio-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.audio-row-icon {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    color: rgba(197, 160, 89, 0.5);
}
.audio-row-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}
.audio-row-icon--btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: rgba(197, 160, 89, 0.5);
}
.audio-row-icon--btn:hover {
    color: rgba(197, 160, 89, 0.85);
}
.audio-row-label {
    flex: 0 0 88px;
    font-size: var(--font-size-xs);
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    white-space: nowrap;
}
.audio-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 2px;
    background: rgba(197, 160, 89, 0.2);
    outline: none;
    cursor: pointer;
}
.audio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(197, 160, 89, 0.85);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 4px rgba(197, 160, 89, 0.4);
}
.audio-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(197, 160, 89, 0.85);
    cursor: pointer;
    border: none;
}
.audio-row-val {
    flex: 0 0 32px;
    font-size: var(--font-size-xs);
    color: rgba(197, 160, 89, 0.65);
    text-align: right;
}
.audio-mute-row {
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    justify-content: space-between;
}
.audio-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    cursor: pointer;
}
.audio-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.audio-toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(197, 160, 89, 0.25);
    transition: background 0.2s;
}
.audio-toggle-track::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(197, 160, 89, 0.5);
    transition:
        transform 0.2s,
        background 0.2s;
}
.audio-toggle input:checked + .audio-toggle-track {
    background: rgba(197, 160, 89, 0.2);
    border-color: rgba(197, 160, 89, 0.5);
}
.audio-toggle input:checked + .audio-toggle-track::after {
    transform: translateX(16px) translateY(-50%);
    background: rgba(197, 160, 89, 0.95);
}
