:root {
    --paper-light: #f4ece1;
    --paper-dark: #d9c5b2;
    --ink-black: #1a1a1a;
    --ink-red: #8c2f1b;
    --ija-green: #4a5d4e;
    --accent-gold: #b38b4d;
    --danger: #d63031;
    --success: #27ae60;
    --glass: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #121212;
    font-family: 'Inter', sans-serif;
    color: var(--ink-black);
    overflow-x: hidden;
    height: 100vh;
}

.app-container {
    width: 100vw;
    height: 100vh;
    background: #1a1a1a no-repeat center center fixed;
    background-size: cover;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: background-image 1s ease-in-out;
}

.app-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.6) 100%);
    pointer-events: none;
    z-index: 1;
}

.location-highlight-banner {
    position: absolute;
    top: 60px;
    left: 40px;
    z-index: 2;
    pointer-events: none;
}

.location-highlight-banner h1 {
    font-size: 5rem;
    color: white;
    text-shadow: 0 0 20px rgba(0,0,0,0.8), 2px 2px 0px var(--ink-red);
    margin: 0;
    line-height: 0.9;
    opacity: 0.9;
}

.location-highlight-banner .region-tag {
    font-family: 'Special Elite', cursive;
    color: var(--paper-light);
    background: var(--ink-red);
    padding: 2px 10px;
    font-size: 1rem;
    display: inline-block;
}

/* Paper Texture Overlay */
.paper-texture {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    opacity: 0.2;
    pointer-events: none;
    mix-blend-mode: multiply;
}

.vignette {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.1) 100%);
    pointer-events: none;
    z-index: 2; /* Behind most UI */
}

.film-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("https://www.transparenttextures.com/patterns/stardust.png");
    opacity: 0.05;
    pointer-events: none;
    z-index: 3; /* Behind most UI */
    animation: grain 0.5s steps(10) infinite;
}

/* VFX: Screen Shake */
.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* VFX: Alert Flash */
.alert-flash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(231, 76, 60, 0.2);
    pointer-events: none;
    z-index: 2000;
    animation: pulse-red 0.5s infinite;
}

@keyframes pulse-red {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* VFX: Money Popup */
.money-popup {
    position: fixed;
    color: var(--success);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    pointer-events: none;
    z-index: 3000;
    animation: float-up 1s ease-out forwards;
}

@keyframes float-up {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-100px); opacity: 0; }
}

@keyframes grain {
    0%, 100% { transform:translate(0, 0) }
    10% { transform:translate(-2%, -1%) }
    20% { transform:translate(-3%, 2%) }
    30% { transform:translate(2%, -3%) }
    40% { transform:translate(-2%, 4%) }
    50% { transform:translate(-3%, 2%) }
    60% { transform:translate(4%, 0) }
    70% { transform:translate(0, 3%) }
    80% { transform:translate(-4%, 0) }
    90% { transform:translate(3%, 2%) }
}

/* Header */
.port-header {
    background: var(--paper-light);
    padding: 15px 40px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.5);
    border: 2px solid var(--paper-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 5; /* Lower than ticker */
    margin-bottom: 0;
    transform: rotate(-0.5deg);
    overflow: visible; /* Allow plane photo to pop out */
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.weather-display {
    font-family: 'Special Elite', cursive;
    font-size: 0.7rem;
    color: var(--ink-red);
    letter-spacing: 1px;
    margin: 2px 0;
    text-transform: uppercase;
}

.location-stamp {
    position: relative;
}

.stamp-text {
    position: absolute;
    top: -25px;
    left: -10px;
    color: var(--ink-red);
    font-family: 'Special Elite', cursive;
    font-size: 0.8rem;
    border: 2px solid var(--ink-red);
    padding: 2px 8px;
    transform: rotate(-10deg);
    opacity: 0.8;
}

h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    letter-spacing: 4px;
    line-height: 1;
}

.standing-indicators {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-family: 'Special Elite', cursive;
    font-size: 0.75rem;
}

.standing-label span {
    font-weight: bold;
    padding: 1px 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.tier-hostile { color: #e74c3c; border-color: #e74c3c !important; }
.tier-distrusted { color: #e67e22; border-color: #e67e22 !important; }
.tier-neutral { color: #7f8c8d; border-color: #7f8c8d !important; }
.tier-respected { color: #2ecc71; border-color: #2ecc71 !important; }
.tier-ally { color: #3498db; border-color: #3498db !important; }

#control-status {
    font-family: 'Special Elite', cursive;
    font-size: 0.9rem;
    margin-top: 5px;
}

.ijaas {
    color: var(--ija-green);
    font-weight: bold;
    text-decoration: underline;
}

.current-date {
    font-family: 'Special Elite', cursive;
    font-size: 1.2rem;
    color: var(--ink-black);
    opacity: 0.7;
}

.reset-link {
    background: none;
    border: none;
    color: var(--ink-red);
    font-family: 'Special Elite', cursive;
    font-size: 0.6rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.6;
    margin-top: 5px;
    display: block;
    text-align: right;
}

.reset-link:hover {
    opacity: 1;
}

/* War Ticker */
.ticker-container.full-width {
    width: 100%;
    background: #e5d1bc;
    height: 35px;
    border-top: 1px solid rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--paper-dark);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    z-index: 10; /* Above header */
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.ticker-label {
    background: var(--ink-red);
    color: white;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.8rem;
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 2;
}

.ticker-wrap {
    width: 100%;
    overflow: hidden;
}

.ticker-move {
    display: inline-block;
    white-space: nowrap;
    font-family: 'Special Elite', cursive;
    font-size: 0.8rem;
    padding-left: 100%;
    animation: ticker 30s linear infinite;
}

@keyframes ticker {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    z-index: 10;
    overflow-y: auto;
}

.card {
    background: var(--paper-light);
    padding: 25px;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
    border: 1px solid var(--paper-dark);
    position: relative;
    margin-bottom: 20px;
}

h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--ink-red);
    margin-bottom: 20px;
    padding-bottom: 5px;
    color: var(--ink-red);
    display: inline-block; /* Fix for too long line */
}

/* Narrative */
.narrative-card {
    min-height: 200px;
}

.typewriter {
    font-family: 'Special Elite', cursive;
    line-height: 1.6;
    font-size: 1.05rem;
    color: #2c3e50;
}

.mission-item {
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--paper-dark);
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}

.mission-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    color: var(--ink-black);
    display: block;
}

.mission-reward {
    font-family: 'Special Elite', cursive;
    color: var(--success);
    font-size: 0.8rem;
    position: absolute;
    top: 10px;
    right: 12px;
}

.mission-desc {
    font-size: 0.75rem;
    color: #555;
    margin: 5px 0;
    line-height: 1.2;
}

.mission-btn {
    background: var(--ink-red);
    color: white;
    border: none;
    padding: 4px 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 5px;
}

.risk-badge {
    font-size: 0.6rem;
    padding: 2px 4px;
    background: #eee;
    margin-right: 5px;
    text-transform: uppercase;
}

.risk-extreme { color: var(--danger); font-weight: bold; }

.active-plane-display {
    width: 150px;
    aspect-ratio: 1 / 1;
    background: white;
    border: 10px solid #fdfdfd;
    position: absolute;
    top: 30px;
    right: 40px;
    z-index: 15; /* Below ticker and action bar */
    transform: rotate(4deg);
    box-shadow: 
        10px 15px 30px rgba(0,0,0,0.5),
        inset 0 0 40px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.active-plane-display:hover {
    transform: rotate(0deg) scale(1.15);
    z-index: 1002;
    cursor: help;
}

.active-plane-display img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.4) contrast(1.1) brightness(0.9);
}

.plane-label {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 0;
    font-family: 'Special Elite', cursive;
    font-size: 0.65rem;
    text-align: center;
    letter-spacing: 1px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.active-plane-display::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 40%);
    z-index: 10;
    pointer-events: none;
}

.portrait-box {
    display: none;
    width: 60px;
    height: 60px;
    border: 1px solid var(--paper-dark);
    margin-right: 15px;
    background: #fff;
    flex-shrink: 0;
}

.portrait-box.visible {
    display: block;
}

.portrait-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--paper-dark);
    padding-bottom: 10px;
}

.hold-capacity {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    color: var(--ink-red);
}

.market-table,
.hold-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', sans-serif;
    table-layout: fixed;
}

.market-table th,
.hold-table th {
    text-align: left;
    font-size: 0.8rem;
    color: #7f8c8d;
    padding: 6px 10px;
    border-bottom: 1px solid var(--paper-dark);
}

.market-table td,
.hold-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.hold-table th:nth-child(1),
.hold-table td:nth-child(1) { width: 35%; }
.hold-table th:nth-child(2),
.hold-table td:nth-child(2) { width: 10%; }
.hold-table th:nth-child(3),
.hold-table td:nth-child(3) { width: 18%; }
.hold-table th:nth-child(4),
.hold-table td:nth-child(4) { width: 18%; }
.hold-table th:nth-child(5),
.hold-table td:nth-child(5) { width: 19%; }

.cargo-name {
    font-weight: bold;
    color: var(--ink-black);
}

.price {
    font-family: 'Special Elite', cursive;
    font-weight: bold;
}

.contraband-row {
    background: rgba(140, 47, 27, 0.05);
}

.contraband-row .cargo-name {
    color: var(--ink-red);
    font-size: 1.1rem; /* Slightly larger */
}

.warning-tag {
    background: var(--ink-red);
    color: white;
    font-size: 0.75rem; /* Larger than 0.6rem */
    padding: 2px 6px;
    border-radius: 2px;
    margin-left: 5px;
    vertical-align: middle;
    font-family: 'Bebas Neue', sans-serif; /* More impactful */
}

.buy-btn {
    padding: 3px 12px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.9rem;
    background: var(--paper-dark);
    border: 1px solid #999;
    cursor: pointer;
}

.contraband-row .buy-btn {
    background: var(--ink-red);
    color: white;
    border: none;
}

.market-row:hover {
    background: rgba(0,0,0,0.04);
}

.market-row.selected-row {
    background: rgba(139, 90, 43, 0.12);
    outline: 1px solid rgba(139, 90, 43, 0.3);
}

/* Rumors */
.intel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.rumors-card {
    border-left: 5px solid var(--accent-gold);
}

#rumor-content {
    font-style: italic;
    color: #444;
    line-height: 1.5;
}

/* Stats */
.status-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(217, 197, 178, 0.9);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.label {
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.stat-bar {
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.fill {
    height: 100%;
    background: var(--success);
    transition: width 0.5s ease;
}

.fill.heat {
    background: var(--danger);
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: rgba(43, 38, 33, 0.9);
    z-index: 20;
    border-top: 2px solid var(--accent-gold);
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border-bottom: 5px solid rgba(0,0,0,0.3);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.btn:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
}

.btn:active {
    transform: translateY(3px);
    border-bottom-width: 1px;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.4);
}

.btn-primary { background: var(--ija-green); color: white; }
.btn-secondary { background: var(--accent-gold); color: white; }
.btn-danger { background: var(--ink-red); color: white; }
.btn-nav { background: #34495e; color: white; }

.btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--paper-light);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border: 4px double var(--ink-red);
    position: relative;
    box-shadow: 0 0 50px rgba(140, 47, 27, 0.5);
}

.urgency-red {
    border-color: var(--ink-red);
}

.modal-header h2 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.subtitle {
    font-family: 'Special Elite', cursive;
    font-size: 1rem; /* Increased size */
    color: var(--ink-red);
    margin-bottom: 20px;
    letter-spacing: 1px;
    font-weight: bold;
}

/* Specific Sanctuary Subtitle Override */
.sanctuary-header .subtitle {
    color: #ff8e8e; /* Brighter, higher contrast red for blue background */
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--paper-dark);
}

.location-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: rgba(0,0,0,0.05);
    border: 2px solid var(--paper-dark);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
}

.node-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.node-intel {
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px dashed var(--paper-dark);
    font-size: 0.65rem;
    font-family: 'Special Elite', cursive;
    color: var(--ink-red);
    display: flex;
    flex-direction: column;
    width: 100%;
}

.intel-label {
    font-weight: bold;
    text-decoration: underline;
    margin-bottom: 2px;
}

.intel-item {
    display: block;
}

/* Canteen Tabs */
.canteen-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    background: var(--paper-dark);
    padding: 2px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: #c7b299;
    border: none;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    color: #444;
}

.tab-btn.active {
    background: var(--paper-light);
    color: var(--ink-red);
    font-weight: bold;
}

.intel-box {
    background: rgba(0,0,0,0.05);
    border: 2px dashed var(--paper-dark);
    padding: 20px;
    text-align: center;
}

#canteen-rumor-text {
    font-family: 'Special Elite', cursive;
    font-size: 1.1rem;
    margin-bottom: 15px;
    min-height: 60px;
}

.option-info h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.option-info p {
    font-size: 0.8rem;
    color: #666;
}

/* Bar Dossier */
.bar-dossier {
    border-color: var(--accent-gold);
    background: #ede0d4;
    transform: rotate(0.5deg);
}

.bar-dossier::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 10px;
    background: #8b4513;
    border-radius: 2px;
}

.modal-footer {
    margin-top: 30px;
    border-top: 1px dashed var(--paper-dark);
    padding-top: 15px;
    text-align: center;
}

.tip {
    font-family: 'Special Elite', cursive;
    font-size: 0.75rem;
    font-style: italic;
    color: #555;
}

.hire-btn {
    background: var(--accent-gold);
    color: white;
    padding: 8px 15px;
    font-family: 'Bebas Neue', sans-serif;
    border: none;
    cursor: pointer;
}

.close-bar-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

.level-badge {
    background: var(--ink-red);
    color: white;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 10px;
    margin-left: 5px;
}
/* Trading Ledger */
.ledger-dossier {
    max-width: 1200px;
    width: 90%;
    border-color: #34495e;
    background: #fdf5e6; /* Old Lace */
}

.exchange-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    height: 500px;
}

.exchange-column {
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 15px;
    border-radius: 4px;
    height: 100%;
}

.ledger-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.scroll-view {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.ledger-section h3 {
    font-family: 'Bebas Neue', sans-serif;
    border-bottom: 2px solid var(--ink-black);
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: var(--ink-black);
    display: flex;
    justify-content: space-between;
}

.refuel-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.refuel-input {
    width: 70px;
    padding: 6px 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    background: #fdf5e6;
    text-align: center;
}

.refuel-cost-preview {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.9rem;
    color: var(--success);
    min-width: 40px;
}

.hold-capacity-banner {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    color: var(--ink-red);
    background: rgba(0,0,0,0.05);
    padding: 5px 15px;
    border-radius: 20px;
}

.ledger-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
    font-family: 'Special Elite', cursive;
    font-size: 0.9rem;
}

.ledger-item.mini {
    font-size: 0.7rem;
    padding: 4px 0;
}

.ledger-intel-block {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
}

.ledger-intel-block h4 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    color: var(--ink-red);
    margin-bottom: 5px;
}

.close-ledger-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Combat Mode */
.combat-mode {
    background: rgba(0,0,0,0.95);
    display: none; /* Hidden by default */
}

.combat-container {
    background: #1a1a1a;
    border: 5px solid #333;
    width: 95%;
    max-width: 800px;
    padding: 40px;
    color: #eee;
    position: relative;
    box-shadow: 0 0 100px rgba(214, 48, 49, 0.2);
}

.combat-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.combat-header h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem;
    color: var(--danger);
    letter-spacing: 5px;
    border: none;
}

.warning-light {
    width: 30px;
    height: 30px;
    background: var(--danger);
    border-radius: 50%;
    animation: blink 0.5s infinite alternate;
}

@keyframes blink {
    from { opacity: 1; box-shadow: 0 0 20px var(--danger); }
    to { opacity: 0.3; box-shadow: none; }
}

.combat-display {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
    background: #222;
    padding: 20px;
    border: 1px solid #444;
}

.distance-meter .meter {
    height: 20px;
    background: #111;
    border: 1px solid #555;
    margin-top: 10px;
}

#hull-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    color: var(--success);
}

.combat-log {
    height: 150px;
    background: #e0d5c1;
    padding: 15px;
    font-family: 'Special Elite', cursive;
    font-size: 0.9rem;
    color: #222;
    overflow-y: auto;
    border: 1px solid #c4b59d;
    border-left: 10px solid var(--ink-red);
    margin-bottom: 30px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    position: relative;
}

.combat-log div {
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 5px 0;
}

.combat-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.combat-btn {
    background: #333;
    border: 1px solid #555;
    padding: 20px;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s;
}

.combat-btn:hover {
    background: #444;
    border-color: #777;
}

.btn-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
}

.btn-stat {
    font-size: 0.7rem;
    color: #888;
    letter-spacing: 2px;
}

.btn-panic {
    background: var(--ink-red);
}

/* Map Table */
.map-table {
    max-width: 1000px;
    height: 80vh;
    background: #e6dcc7 url('https://www.transparenttextures.com/patterns/aged-paper.png');
    border: 10px solid #2b2621;
    display: flex;
    flex-direction: column;
}

.map-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    flex: 1;
    overflow: hidden;
    border-top: 2px solid var(--paper-dark);
}

.region-sidebar {
    border-right: 2px solid var(--paper-dark);
    padding: 20px;
    background: rgba(0,0,0,0.05);
    overflow-y: auto;
}

.region-btn {
    width: 100%;
    text-align: left;
    padding: 15px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--paper-dark);
    cursor: pointer;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
    color: var(--ink-black);
}

.region-btn:hover, .region-btn.active {
    background: var(--paper-dark);
    color: var(--ink-red);
}

.location-grid {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    background: url('https://www.transparenttextures.com/patterns/notebook.png');
    align-content: start;
}

.location-node {
    padding: 15px;
    background: white;
    border: 1px solid var(--paper-dark);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.location-node:hover {
    transform: scale(1.05);
    border-color: var(--ink-red);
    z-index: 5;
}

.location-node.selected {
    background: var(--paper-light);
    border: 3px solid var(--ink-red);
}

.node-icon {
    font-size: 2rem;
    margin-bottom: 5px;
    display: block;
}

.node-name {
    font-family: 'Special Elite', cursive;
    font-size: 0.8rem;
    font-weight: bold;
}

.node-control {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.node-control.ijaas { color: var(--ija-green); }
.node-control.usaaf { color: #2980b9; }

.map-footer {
    padding: 20px;
    background: #2b2621;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.discovery-chance {
    font-family: 'Special Elite', cursive;
    font-size: 0.9rem;
}

#discovery-stat {
    color: var(--accent-gold);
    font-weight: bold;
}

.close-bar-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

/* The Sanctuary */
.sanctuary-mode {
    background: rgba(0,0,0,0.4); /* Much lighter overlay to see background */
}

.sanctuary-dossier {
    max-width: 800px;
    background: #fdf6e3 url('https://www.transparenttextures.com/patterns/aged-paper.png');
    border: 4px solid var(--accent-gold);
    box-shadow: 0 0 100px rgba(0,0,0,0.5), 10px 10px 0 rgba(0,0,0,0.1);
    transform: rotate(-0.5deg);
}

.sanctuary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.sanctuary-card {
    background: rgba(0, 0, 0, 0.03); /* Subtle indent look on paper */
    padding: 20px;
    border-radius: 2px;
    border: 1px dashed var(--paper-dark);
    text-align: center;
    transition: transform 0.2s, background 0.2s;
}

.sanctuary-card:hover {
    transform: translateY(-3px);
    background: rgba(0, 0, 0, 0.06);
    border-color: var(--accent-gold);
}

.sanctuary-card .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.sanctuary-card h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: var(--ink-black);
    text-shadow: none;
}

.sanctuary-card p {
    font-size: 0.85rem;
    font-weight: normal;
    color: #444; /* Dark for paper readability */
    margin-bottom: 15px;
    line-height: 1.3;
}

.sanctuary-footer {
    border-top: 1px solid var(--paper-dark);
    padding-top: 20px;
    display: flex;
    justify-content: center;
}

/* Warehouse Sub-Modal */
.warehouse-layout {
    display: grid;
    grid-template-columns: 1fr 50px 1fr;
    gap: 20px;
    margin-top: 20px;
    min-height: 300px;
}

.transfer-list {
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--paper-dark);
    padding: 10px;
    height: 250px;
    overflow-y: auto;
}

.transfer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-family: 'Special Elite', cursive;
    font-size: 0.8rem;
}

.transfer-btn {
    background: var(--accent-gold);
    border: none;
    color: white;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.7rem;
}

.transfer-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--paper-dark);
}

.close-warehouse-btn, .close-sickbay-btn, .close-hangar-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

.hangar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.plane-card {
    border: 1px solid var(--paper-dark);
    transition: transform 0.2s;
}

.plane-card.active-plane {
    background: rgba(46, 204, 113, 0.1);
    border: 2px solid #2ecc71;
}

.stats-mini {
    font-size: 0.7rem;
    color: #666;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    .action-bar {
        flex-wrap: wrap;
    }
    .btn {
        flex: 1 1 40%;
    }
}

/* Port Arrival Splash */
.splash-mode .splash-content {
    background: #1a1a1a;
    width: 800px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 0 50px rgba(0,0,0,1);
    display: flex;
    flex-direction: column;
}

.splash-image-container {
    height: 400px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.splash-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.3) contrast(1.1) brightness(0.8);
}

.splash-details {
    padding: 40px;
    text-align: center;
    background: linear-gradient(to bottom, #1a1a1a, #000);
}

.splash-region {
    font-family: 'Special Elite', cursive;
    color: var(--ink-red);
    letter-spacing: 5px;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 10px;
}

.splash-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 5rem;
    color: white;
    margin: 0;
    line-height: 0.9;
    text-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.splash-control {
    font-family: 'Special Elite', cursive;
    color: #888;
    margin: 20px 0 30px 0;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

/* Event Outcome */
.outcome-dossier {
    max-width: 600px;
    background: #fdf5e6;
    border-color: #2c3e50;
}

.outcome-body {
    padding: 20px 0;
}

.outcome-rewards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.reward-tag {
    font-family: 'Special Elite', cursive;
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 2px;
    font-weight: bold;
    color: white;
}

.reward-tag.damage { background: #c0392b; }
.reward-tag.cargo { background: #2980b9; }
.reward-tag.rep { background: #27ae60; }
.reward-tag.morale { background: #8e44ad; }
.reward-tag.money { background: #f39c12; }

/* Status Telegram Modal */
.status-telegram {
    max-width: 450px;
    background: #e5d1bc;
    border: 2px solid #2c3e50;
    padding: 30px;
    position: relative;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.2);
}

.telegram-header {
    border-bottom: 2px solid #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.telegram-header h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    color: var(--ink-black);
    margin: 0;
}

.telegram-header .priority {
    font-family: 'Special Elite', cursive;
    font-size: 0.7rem;
    color: #c0392b;
    font-weight: bold;
    letter-spacing: 2px;
}

.telegram-body p {
    font-family: 'Special Elite', cursive;
    line-height: 1.5;
    font-size: 1rem;
    color: #333;
}

/* Ensure modals are clickable and have proper layering */
.modal-overlay {
    z-index: 2000 !important;
}

/* Visual Tactical Map */
.visual-map {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: 100%;
    min-height: 500px;
}

.map-sidebar {
    background: rgba(30, 25, 20, 0.95);
    border-right: 3px solid var(--paper-dark);
    display: flex;
    flex-direction: column;
    color: var(--paper-light);
    z-index: 10;
}

.map-log {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    font-family: 'Special Elite', cursive;
    font-size: 0.85rem;
    border-bottom: 1px solid #444;
}

.map-log h3 {
    font-family: 'Bebas Neue', sans-serif;
    color: var(--accent-gold);
    border-bottom: 1px solid var(--accent-gold);
    margin-bottom: 10px;
    margin-top: 0;
}

.region-tabs {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.region-tab {
    background: #333;
    border: 1px solid #555;
    color: #aaa;
    padding: 10px;
    cursor: pointer;
    font-family: 'Bebas Neue', sans-serif;
    transition: all 0.2s;
    text-align: left;
}

.region-tab.active {
    background: var(--accent-gold);
    color: black;
    border-color: white;
}

.region-tab:hover:not(.active) {
    background: #444;
    color: white;
}

.map-canvas-container {
    position: relative;
    background: #c4b59d;
    overflow: hidden;
    cursor: crosshair;
    flex: 1;
}

.tactical-chart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a3a5a; /* Ocean Blue */
    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: 50px 50px;
}

.map-node {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #2ecc71; /* Island Green */
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.4);
}

.map-node:hover {
    width: 28px;
    height: 28px;
    box-shadow: 0 0 15px white;
}

.map-node.selected {
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px var(--accent-gold);
    animation: mapPulse 2s infinite;
}

@keyframes mapPulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.map-node.japanese { background: var(--ink-red); border-color: #ffd700; }
.map-node.american { background: #2980b9; border-color: white; }
.map-node.neutral { background: #7f8c8d; border-color: #333; }
.map-node.poi { background: transparent; border: 2px dashed #666; border-radius: 4px; }

.node-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    pointer-events: none;
    margin-top: 5px;
    opacity: 0.8;
}

.map-node:hover .node-label, .map-node.selected .node-label {
    opacity: 1;
    background: black;
    z-index: 10;
}

.map-selection-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(20, 15, 10, 0.9);
    border: 1px solid var(--accent-gold);
    padding: 15px;
    color: white;
    width: 260px;
    pointer-events: none;
    font-family: 'Special Elite', cursive;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 20;
}

.map-selection-overlay h4 {
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--accent-gold);
}

/* Directional Navigation Arrows */
.map-nav-arrow {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
    color: var(--accent-gold);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
    pointer-events: all;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.map-nav-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.5);
}

.map-nav-arrow.top { top: 0; left: 0; width: 100%; height: 50px; }
.map-nav-arrow.bottom { bottom: 0; left: 0; width: 100%; height: 50px; }
.map-nav-arrow.left { top: 0; left: 0; width: 50px; height: 100%; writing-mode: vertical-rl; transform: rotate(180deg); }
.map-nav-arrow.right { top: 0; right: 0; width: 50px; height: 100%; writing-mode: vertical-rl; }

.map-nav-arrow::before {
    content: "▲";
    margin: 5px;
}
.map-nav-arrow.bottom::before { content: "▼"; }
.map-nav-arrow.left::before { content: "◀"; }
.map-nav-arrow.right::before { content: "▶"; }

/* Sidebar Map Details */
.map-details-panel {
    padding: 20px;
    background: rgba(40, 35, 30, 0.95);
    border-top: 2px solid var(--paper-dark);
    flex-shrink: 0;
    font-family: 'Special Elite', cursive;
    color: var(--paper-light);
}

.map-details-panel h4 {
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--accent-gold);
}

.discovery-box {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #888;
}

#discovery-stat {
    font-weight: bold;
}

.btn-block {
    width: 100%;
}

.visual-map {
    grid-template-columns: 280px 1fr !important;
}

/* Travel Animation Modal */
#travel-modal {
    z-index: 9999 !important;
    display: none; /* Controlled by JS */
}

.travel-dossier {
    background: linear-gradient(135deg, #1a2a3a 0%, #0d1b2a 100%) !important;
    border: 3px solid #2c3e50 !important;
    max-width: 450px !important;
    text-align: center;
    padding: 30px !important;
    box-shadow: 0 0 50px rgba(0,0,0,1);
}

.plane-silhouette {
    position: relative;
    height: 180px;
    margin: 20px 0;
    background: rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.1);
}

.plane-silhouette img {
    width: 120px;
    z-index: 2;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
    animation: planeBob 3s ease-in-out infinite;
}

@keyframes planeBob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

.cloud-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: cloudScroll 10s linear infinite;
    z-index: 1;
}

@keyframes cloudScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.countdown-panel h1 {
    font-family: 'Special Elite', cursive;
    font-size: 3rem !important;
    color: var(--accent-gold);
    margin: 10px 0;
}

.progress-container {
    width: 100%;
    height: 8px;
    background: #111;
    border-radius: 4px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-gold);
}
