/* ==================== DETAILED PILOT SCREEN - TIGHT FIT DESIGN ==================== */
#detailed-pilot-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, #07130b 0%, #020200 55%, #000 100%);
    overflow: hidden;
    z-index: 1000;
    padding: 50px 40px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    --accent: #00FF88;
    --mech-accent: #00E5FF;
    --danger: #FF3B3B;
    --warning: #FFAA33;
}

#detailed-pilot-container {
    max-width: 1650px;
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 100px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
}

/* ==================== THREE-COLUMN LAYOUT - ROBUST & TIGHT ==================== */
.detailed-grid {
    display: grid;
    grid-template-columns: clamp(320px, 22vw, 420px) 1fr clamp(340px, 24vw, 460px);
    grid-template-rows: 1fr;
    gap: 28px;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* ==================== LEFT COLUMN: PILOT INFO ==================== */
.pilot-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    height: 100%;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #00FF88;
    text-transform: uppercase;
    border-left: 5px solid var(--accent);
    padding-left: 14px;
    margin-bottom: 10px;
    text-shadow: 0 0 15px rgba(0,255,136,0.7);
}

/* Pilot portrait - ABSOLUTE SNUG FIT */
.detailed-portrait {
    width: 100%;
    height: 220px;
    border: 3px solid var(--accent);
    position: relative;
    overflow: hidden;
    padding: 0;
    margin: 0;
    display: block;
    line-height: 0;
    box-sizing: border-box;
}

/* Override legacy "loaded" rules from `style.css` that add padding and cause
   gaps between the image and the border. */
.detailed-portrait.loaded {
    padding: 0;
}

.detailed-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    vertical-align: bottom;
    max-width: none;
    max-height: none;
}

/* The app sets a class on injected images; ensure it cannot re-introduce size caps. */
.detailed-pilot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    max-width: none;
    max-height: none;
}

.portrait-placeholder-detailed {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: rgba(124,255,178,0.5);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background: rgba(0,0,0,0.8);
    line-height: 1.4;
}

/* Pilot info grid - THICKER & MORE ROBUST */
.pilot-info-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: rgba(124,255,178,0.9);
}

.info-row-compact {
    background: rgba(0,20,10,0.4);
    border-left: 4px solid rgba(0,255,136,0.5);
    padding: 12px 14px;
}

.info-row-compact.full-width {
    grid-column: 1 / -1;
}

.info-label {
    color: rgba(124,255,178,0.7);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.info-value {
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
    display: block;
}

/* Status: make it stand out + color based on condition */
.pilot-status-value {
    display: inline-block;
    width: fit-content;
    padding: 3px 10px;
    margin-top: 2px;
    border: 1px solid rgba(0,255,136,0.35);
    background: rgba(0,0,0,0.35);
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0,255,136,0.35);
}

.pilot-status-value.status-active {
    color: var(--accent);
    border-color: rgba(0,255,136,0.55);
    box-shadow: 0 0 18px rgba(0,255,136,0.18), inset 0 0 14px rgba(0,255,136,0.06);
    text-shadow: 0 0 12px rgba(0,255,136,0.55);
}

.pilot-status-value.status-inactive {
    color: var(--danger);
    border-color: rgba(255,59,59,0.65);
    box-shadow: 0 0 18px rgba(255,59,59,0.14), inset 0 0 14px rgba(255,59,59,0.05);
    text-shadow: 0 0 12px rgba(255,59,59,0.45);
}

.pilot-status-value.status-unknown {
    color: var(--warning);
    border-color: rgba(255,170,51,0.55);
    box-shadow: 0 0 16px rgba(255,170,51,0.10), inset 0 0 12px rgba(255,170,51,0.04);
    text-shadow: 0 0 10px rgba(255,170,51,0.35);
}

/* ==================== CENTER COLUMN: MECH & BIO ==================== */
.center-column {
    display: grid;
    grid-template-rows:
        auto
        minmax(200px, 0.38fr)
        minmax(320px, 0.62fr);
    gap: 18px;
    min-height: 0;
    height: 100%;
}

/* Mech info - THICKER BORDERS */
.mech-info-compact {
    background:
        linear-gradient(180deg, rgba(0,229,255,0.06) 0%, rgba(0,0,0,0.10) 28%, rgba(0,0,0,0.06) 100%),
        rgba(0,12,18,0.32);
    border: 3px solid rgba(0,229,255,0.28);
    padding: 18px;
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,229,255,0.65) rgba(0,0,0,0.25);
}

.mech-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
}

.mech-info-item {
    background: rgba(0,0,0,0.4);
    border-left: 4px solid rgba(0,229,255,0.55);
    padding: 12px;
}

.mech-info-compact .info-label {
    color: rgba(160,240,255,0.75);
}

.mech-info-compact .info-value {
    color: rgba(200,255,252,0.95);
    text-shadow: 0 0 10px rgba(0,229,255,0.18);
}

.mech-info-item .info-label {
    font-size: 10px;
}

.mech-info-item .info-value {
    font-size: 14px;
}

/* Biography - THICKER BORDER */
.bio-compact {
    background:
        linear-gradient(180deg, rgba(0,255,136,0.06) 0%, rgba(0,0,0,0.12) 22%, rgba(0,0,0,0.08) 100%),
        rgba(0,20,10,0.28);
    border: 3px solid rgba(0,255,136,0.32);
    padding: 18px;
    overflow: auto;
    min-height: 0;
    box-shadow:
        inset 0 0 0 1px rgba(0,255,136,0.10),
        0 0 18px rgba(0,255,136,0.08);
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.bio-content {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    line-height: 1.65;
    color: rgba(124,255,178,0.9);
}

.bio-compact::-webkit-scrollbar,
.mech-info-compact::-webkit-scrollbar {
    width: 7px;
}

.bio-compact::-webkit-scrollbar-track,
.mech-info-compact::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.25);
}

.bio-compact::-webkit-scrollbar-thumb,
.mech-info-compact::-webkit-scrollbar-thumb {
    background: rgba(0,255,136,0.55);
    border-radius: 6px;
}

/* ==================== RIGHT COLUMN: FLAG & MECH VISUAL ==================== */
.visual-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    height: 100%;
}

/* Flag - ABSOLUTE SNUG FIT, NO CRT */
.detailed-flag {
    width: 100%;
    height: 200px;
    border: 3px solid var(--accent);
    padding: 0;
    margin: 0;
    display: block;
    overflow: hidden;
    position: relative;
    line-height: 0;
}

.detailed-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    vertical-align: bottom;
    filter: none !important;
    image-rendering: auto;
}

.flag-placeholder {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: rgba(124,255,178,0.5);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background: rgba(0,0,0,0.8);
    line-height: 1.4;
}

/* Mech visual - ABSOLUTE SNUG FIT */
.detailed-mech {
    width: 100%;
    height: 320px;
    border: 3px solid var(--mech-accent);
    padding: 0;
    margin: 0;
    display: block;
    position: relative;
    overflow: hidden;
    line-height: 0;
    box-sizing: border-box;
    box-shadow: 0 0 20px rgba(0,229,255,0.10), inset 0 0 0 1px rgba(0,229,255,0.10);
}

/* Override legacy "loaded" rules from `style.css` that add padding and cause
   gaps between the image and the border. */
.detailed-mech.loaded {
    padding: 0;
}

.detailed-mech img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    vertical-align: bottom;
    max-width: none;
    max-height: none;
}

.detailed-mech-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    max-width: none;
    max-height: none;
}

.detailed-mech-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    color: rgba(200,255,252,0.95);
    text-transform: uppercase;
    text-align: center;
    margin-top: 10px;
    padding: 10px 10px;
    background: linear-gradient(90deg, rgba(0,229,255,0.12) 0%, rgba(0,10,12,0.25) 100%);
    border: 2px solid rgba(0,229,255,0.35);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    text-shadow: 0 0 14px rgba(0,229,255,0.35);
    line-height: 1.3;
}

@media (min-width: 1850px) {
    #detailed-pilot-container {
        max-width: 1950px;
    }

    .detailed-grid {
        gap: 24px;
        grid-template-columns: clamp(340px, 18vw, 440px) 1fr clamp(360px, 20vw, 480px);
    }
}

/* ==================== BACK BUTTON - ROBUST ==================== */
#detailed-back-button {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #00FF88;
    background: linear-gradient(90deg, rgba(0,255,136,0.15) 0%, rgba(0,20,10,0.08) 100%);
    border: 3px solid #00FF88;
    border-left-width: 5px;
    padding: 12px 28px;
    cursor: pointer;
    margin: 14px auto 0;
    display: block;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(0,255,136,0.15), inset 0 0 25px rgba(0,255,136,0.03);
    text-shadow: 0 0 10px rgba(0,255,136,0.4);
    transform: translateZ(0);
}

#detailed-back-button .back-arrow {
    display: inline-block;
    margin-right: 10px;
    font-size: 12px;
    color: #00FF88;
    transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

#detailed-back-button:hover {
    background: linear-gradient(90deg, rgba(0,255,136,0.25) 0%, rgba(0,40,20,0.15) 100%);
    box-shadow: 0 0 30px rgba(0,255,136,0.3), inset 0 0 35px rgba(0,255,136,0.06);
    transform: translate3d(-5px, 0, 0);
}

#detailed-back-button:hover .back-arrow {
    transform: translate3d(-5px, 0, 0);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1600px) {
    .detailed-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .center-column {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .pilot-info-compact,
    .mech-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
