/* =====================================================================
   Shared Overlay Panel Base
   All major feature panels (realm, char, ship, city, settings) share
   this geometry, background, and open/close transition. Per-panel
   selectors only override what is genuinely different.
   ===================================================================== */
.overlay-panel {
    position: absolute;
    top: var(--overlay-top);
    left: var(--overlay-left);
    right: var(--overlay-right);
    bottom: 0;
    z-index: var(--z-panel-overlay);
    background: #080b10;
    margin: var(--panel-gap) var(--panel-gap-inner);
    max-width: var(--content-max-w);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-16px);
    pointer-events: none;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        visibility 0s linear 0.22s;
}

.overlay-panel--open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}
.overlay-panel--instant,
.overlay-panel--instant.overlay-panel--open {
    transition: none !important;
}

/* =====================================================================
   Character Panel
   Same position/size as the Realm panel; toggled by Command button.
   ===================================================================== */
#char-panel.char-panel--open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

/* Shared scroll wrapper - sits inside both panels, behind the fixed frame */
.panel-scroll {
    position: absolute;
    inset: 0;
    left: 12px; /* clears the 10px decorative left-edge frame strip - px intentional */
    right: 12px; /* clears the 10px decorative right-edge frame strip - px intentional */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #2a2010 #080b10;
}
.panel-scroll::-webkit-scrollbar {
    width: 5px;
}
.panel-scroll::-webkit-scrollbar-track {
    background: #080b10;
}
.panel-scroll::-webkit-scrollbar-thumb {
    background: #2a2010;
    border-radius: 2px;
}

/* ── Character panel inner layout ─────────────────────────────────── */
.pp-inner {
    max-width: var(--panel-content-max);
    margin: 0 auto;
    padding: 38px 44px 48px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Hero banner */
.pp-hero {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    background: linear-gradient(180deg, rgb(7 8 13 / 80%) 0%, rgb(7 7 13 / 90%) 100%);
    box-shadow:
        0 15px 45px rgba(0, 0, 0, 0.9),
        0px 0 12px rgba(0, 0, 0, 0.6),
        -3px 0 12px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid #1e2330;
    border-radius: 3px;
    padding: 0 24px 20px 0;
    min-height: 160px;
    position: relative;
    overflow: hidden;
}
.pp-hero-portrait {
    width: 140px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    align-self: stretch;
    padding-top: 12px;
}
.pp-hero-portrait img {
    width: 120px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.8));
}
.pp-hero-portrait-placeholder {
    width: 90px;
    height: 120px;
    background: radial-gradient(circle at 50% 40%, #1c1810, #080b10);
    border: 1px dashed #2a3040;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2a3040;
    font-size: var(--font-size-4xl);
}
.pp-hero-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 4px;
    gap: 4px;
}
.pp-hero-levels {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #4a5568;
}
.pp-hero-levels span {
    color: var(--gold);
}
.pp-hero-name {
    font-family: var(--font-body);
    font-size: var(--font-size-4xl);
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    margin: 2px 0 8px;
}
.pp-hero-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pp-hero-search {
    background: rgba(13, 17, 23, 0.9);
    border: 1px solid #2a3040;
    color: #5a6475;
    font-family: var(--font-body);
    font-size: var(--font-size-lg);
    font-style: italic;
    padding: 6px 12px;
    width: 180px;
    outline: none;
    transition:
        border-color 0.15s,
        color 0.15s;
}
.pp-hero-search:focus {
    border-color: var(--gold);
    color: #c8d0da;
}
.pp-hero-edit {
    background: none;
    border: 1px solid #2a3040;
    color: #5a6475;
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: bold;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 6px 14px;
    cursor: pointer;
    transition:
        border-color 0.15s,
        color 0.15s;
}
.pp-hero-edit:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.pp-hero-corner-btn {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* Completion bar */
.pp-completion {
    background: rgba(197, 160, 89, 0.02);
    border: 1px solid rgba(197, 160, 89, 0.1);
    border-radius: 3px;
    padding: 20px 22px 18px;
}
.pp-completion-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.pp-completion-title {
    font-family: var(--font-body);
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.pp-completion-pct {
    font-family: var(--font-body);
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--gold);
}
.pp-completion-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
}
.pp-completion-meta span {
    font-family: var(--font-body);
    font-size: var(--font-size-md);
    color: var(--text-muted);
}
.pp-completion-meta span b {
    color: #8a95a3;
}
.pp-completion-val {
    color: var(--text-primary);
}
.pp-completion-track {
    height: 18px;
    background: #080b10;
    border: 1px solid #161c26;
    position: relative;
    overflow: hidden;
}
.pp-completion-fill {
    height: 100%;
    background: linear-gradient(90deg, #8a6820, var(--gold));
    transition: width 0.4s ease;
}
.pp-completion-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    padding: 0 1px;
}
.pp-completion-markers span {
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Skills section */
.pp-skills-heading {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 1px solid #161c26;
}
.pp-skills-cols {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.pp-skill-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.pp-skill-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}
@media (min-width: 768px) {
    .pp-skill-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 1024px) {
    .pp-skill-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Apply the same icon-left grid layout as the char summary skill cards */
.pp-skill-grid .pp-skill-card {
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-2xs) var(--space-xs);
    padding: 10px 14px 10px 14px;
    align-items: center;
    min-width: 0;
}
.pp-skill-grid .pp-skill-top {
    display: contents;
}
.pp-skill-grid .pp-skill-icon {
    grid-column: 1;
    grid-row: 1 / 4;
    align-self: center;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    background: rgba(197, 160, 89, 0.06);
}
.pp-skill-grid .pp-skill-icon img {
    width: 3rem;
    height: 3rem;
    border-radius: 3px;
    object-fit: contain;
}
.pp-skill-grid .pp-skill-badge {
    display: none;
}
.pp-skill-grid .pp-skill-name {
    grid-column: 2;
    grid-row: 1;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.pp-skill-grid .pp-skill-bottom {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: baseline;
    gap: 3px;
    min-width: 0;
}
.pp-skill-grid .pp-skill-lv {
    font-size: var(--font-size-sm);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.pp-skill-grid .pp-skill-xp {
    font-size: var(--font-size-sm);
    color: rgba(197, 160, 89, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.pp-skill-grid .pp-skill-pct {
    display: none;
}
.pp-skill-grid .pp-skill-bar {
    grid-column: 2;
    grid-row: 3;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 1px;
    overflow: hidden;
}
.pp-skill-grid .pp-skill-bar-fill {
    background: linear-gradient(90deg, #5a3a10, var(--gold));
}

.pp-skill-card {
    background: rgba(197, 160, 89, 0.02);
    border: 1px solid rgba(197, 160, 89, 0.1);
    border-radius: 2px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    transition: border-color 0.14s;
    cursor: pointer;
}
.pp-skill-card:hover {
    border-color: var(--text-secondary);
}
.pp-skill-card--training {
    border-color: rgb(197 160 89 / 39%);
}

.pp-skill-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.pp-skill-badge {
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 40% 35%, #2a1f0e, #0d0a05);
    border: 1px solid #2a2010;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--gold);
    flex-shrink: 0;
}
.pp-skill-name {
    font-family: var(--font-body);
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    flex: 1;
}
.pp-skill-icon {
    font-size: var(--font-size-xl);
    opacity: 0.65;
    flex-shrink: 0;
    transition: opacity 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pp-skill-icon img {
    width: 2rem;
    height: 2rem;
    padding: 0.3rem;
    object-fit: contain;
    border: 1px solid #5a4a2b;
    background: rgba(197, 160, 89, 0.06);
}
.pp-skill-card:hover .pp-skill-icon {
    opacity: 0.85;
}
#sidebar-skills-root {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
}

/* Sidebar skills: at sea, cards are read-only - no hover / no click */
#sidebar-skills-root.sidebar-skills--at-sea .pp-skill-card {
    cursor: default;
    pointer-events: none;
}
#sidebar-skills-root.sidebar-skills--at-sea .pp-skill-card:hover {
    border-color: #161c26;
}
#sidebar-skills-root.sidebar-skills--at-sea .pp-skill-card:hover .pp-skill-icon {
    opacity: 0.55;
}
.pp-skill-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pp-skill-xp {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    color: var(--text-muted);
    text-align: right;
}
.pp-skill-pct {
    font-family: var(--font-body);
    font-size: var(--font-size-lg);
    color: var(--text-muted);
}
.pp-skill-bar {
    height: 2px;
    background: #1a1e23;
    border-radius: 1px;
    overflow: hidden;
    display: flex;
}
.pp-skill-bar-fill {
    width: 0%;
    height: 100%;
    flex-shrink: 0;
    background: linear-gradient(90deg, #5a3a10, var(--gold));
    transition: width 0.4s ease;
}
/* Pending (unconfirmed) XP segment - shown between confirmed fill and grey remainder */
.pp-skill-bar-pending {
    height: 100%;
    flex-shrink: 0;
    width: 0%;
    background: rgba(197, 160, 89, 0.35);
    border-radius: 0 1px 1px 0;
    transition: width 0.15s linear;
}
/* Brief gold pulse when XP is awarded */
@keyframes skillBarPulse {
    0% {
        filter: brightness(1);
    }
    40% {
        filter: brightness(2.2);
    }
    100% {
        filter: brightness(1);
    }
}
.pp-skill-bar-fill.pp-skill-bar-pulse {
    animation: skillBarPulse 0.55s ease-out forwards;
}
