/* Ship info panel */
.ship-panel-portrait {
    position: relative;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}
#tile-ship-section .ship-panel-portrait {
    height: 150px;
}
#tile-ship-img {
    height: 190px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.9));
    transform: rotate(0deg);
    margin-top: -40px;
    position: relative;
}
#hex-ship-img:not([src]),
#hex-ship-img[src=''] {
    display: none;
    z-index: 1;
}
.ship-panel-name-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 14px 8px;
    background: none;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.ship-panel-shipname {
    color: var(--gold);
    font-size: var(--font-size-lg);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.ship-panel-lvl {
    color: #666;
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ship-panel-stats {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 16px;
    border-bottom: 1px solid #111820;
    font-family: var(--font-body);
    font-size: var(--font-size-base);
}
.stat-label {
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.stat-value {
    color: #c9d1d9;
    font-weight: bold;
}
.stat-value.gold-val {
    color: var(--gold);
}

/* Badge overlay - tiny corner indicator in top-left */
.ship-portrait-overlays {
    position: absolute;
    top: 8px;
    left: 8px;
    pointer-events: none;
    z-index: 2;
}
.portrait-badge {
    width: 1.5px;
    height: 1.5px;
}
/* Faction flag - full-height strip pinned to the right edge, behind ship */
.portrait-flag {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: auto;
    z-index: 0;
    pointer-events: none;
}

/* ── Collapsible stat sections ─────────────────────────────────── */
/* Diverges intentionally from .panel-section-title - interactive collapsible trigger with chevron, not a static heading. */
.stat-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 16px 4px;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold);
    opacity: 0.6;
    border-bottom: 1px solid #1a2333;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s;
}
.stat-section-label:hover {
    opacity: 0.9;
}
.stat-section-chevron {
    font-size: var(--font-size-base);
    line-height: 1;
    transition: transform 0.2s;
    opacity: 0.7;
}
.stat-section-label.collapsed .stat-section-chevron {
    transform: rotate(-90deg);
}
.stat-section-body {
    overflow: hidden;
    transition: max-height 0.22s ease;
}
.stat-section-body.collapsed {
    max-height: 0 !important;
}

/* ── Two-column stat grid for hex ship panel ────────────────────── */
.ship-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 4px;
    padding: 6px 8px 4px;
}
.ship-stats-col .stat-section-label {
    padding: 4px 8px 3px;
    font-size: var(--font-size-xs);
    cursor: default;
    pointer-events: none;
}
.ship-stats-col .stat-row {
    padding: 3px 8px;
}

/* ── Square action cards ─────────────────────────────────────────── */
.tile-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
    padding: 8px 10px;
    margin-left: 6px;
    margin-right: 6px;
}
.tile-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px 7px;
    background: rgba(0, 25, 55, 0.4);
    border: 1px solid rgba(80, 120, 160, 0.3);
    border-radius: 5px;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s;
    min-height: 68px;
    text-align: center;
}
.tile-action-card:hover {
    background: rgba(0, 40, 80, 0.6);
    border-color: rgba(120, 170, 210, 0.5);
}
.tile-action-card.locked {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}
.tile-action-card--soon {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
.tile-action-card--disabled {
    opacity: 0.45;
    cursor: unset;
    pointer-events: none;
}
.tile-action-card--disabled .tile-action-sub {
    color: #c0392b;
}
.tile-action-icon {
    font-size: var(--font-size-3xl);
    line-height: 1;
}
.tile-action-skill-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
}
.tile-action-name {
    font-size: var(--font-size-base);
    color: #a0c0d8;
    letter-spacing: 0.04em;
    line-height: 1.2;
}
.tile-action-sub {
    font-size: var(--font-size-base);
    color: #4a7a9a;
}
/* ── Server / Client source badges on stat rows ─────────────────── */
.src-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 2px;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    font-weight: bold;
    letter-spacing: 0.06em;
    vertical-align: middle;
    margin-left: 5px;
    line-height: 1.4;
}
.src-srv {
    background: rgba(197, 160, 89, 0.12);
    color: var(--gold);
    border: 1px solid rgba(197, 160, 89, 0.3);
}
.src-cli {
    background: rgba(100, 160, 220, 0.1);
    color: #5b9bd5;
    border: 1px solid rgba(100, 160, 220, 0.25);
}

/* Status-effect tags */
.effect-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: bold;
    margin: 1px;
}
.effect-flooding {
    background: #0d3a5c;
    color: #7ec8e3;
}
.effect-ablaze {
    background: #5c1a00;
    color: #ff8c42;
}
.effect-sails-torn {
    background: #2a2020;
    color: #c0a080;
}

.panel-hint {
    padding: 8px 16px;
    color: #2a3545;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    text-align: center;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-top: 1px solid #111820;
    flex-shrink: 0;
}

/* Tile info panel */
.tile-panel-portrait {
    position: relative;
    height: 170px;
    background: #05070a;
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tile-panel-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}
.tile-panel-coords-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 14px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 60%, transparent);
}
.tile-panel-coord-text {
    color: var(--gold);
    font-family: var(--font-body);
    font-size: var(--font-size-lg);
    font-weight: bold;
    letter-spacing: 0.06em;
}
.tile-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* Scroll area inside tile-info-panel - grows to fill, allows contextual
   bar at the bottom to always stay pinned to the panel footer */
#tile-panel-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Message input bar */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgb(43 32 16);
    flex-shrink: 0;
}
.chat-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
}
.chat-input {
    flex: 1;
    background: #00000026;
    border: 1px solid #453b29;
    color: #e6edf3;
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    padding: 7px 10px;
    outline: none;
    transition: border-color 0.15s;
}
.chat-input::placeholder {
    color: #564a32;
}
.chat-input:focus {
    border-color: var(--gold);
}
.chat-send-btn {
    background: none;
    border: 1px solid #453b29;
    color: #564a32;
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: bold;
    letter-spacing: 0.08em;
    padding: 7px 12px;
    cursor: pointer;
    text-transform: uppercase;
    transition:
        background 0.15s,
        color 0.15s;
    flex-shrink: 0;
}
.chat-send-btn:hover {
    background: var(--gold);
    color: #000;
}

/* ── Active task panel - inside char-summary ───────────────────── */
#active-task-panel {
    flex-shrink: 0;
    background: rgba(197, 160, 89, 0.02);
    border: 1px dashed rgba(197, 160, 89, 0.1);
    border-top: 0;
    position: relative;
}
