.player1-number {
    color: orange;
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player2-number {
    color: #ADFF2F; /* GreenYellow */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player3-number {
    color: #FFD700; /* Gold */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player4-number {
    color: #FF69B4; /* HotPink */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player5-number {
    color: #FF4500; /* OrangeRed */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player6-number {
    color: #DA70D6; /* Orchid */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player7-number {
    color: #FFFFFF; /* White */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player8-number {
    color: #7FFF00; /* Chartreuse */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.player9-number {
    color: #DC143C; /* Crimson */
    font-weight: bold;
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 40%, #2a1a4a 60%, #0a0a1a 100%);
    background-attachment: fixed;
    color: #fff;
    padding-top: 5px; padding-right: 20px; padding-bottom: 20px; padding-left: 20px; /* MODIFIED */
    overflow-x: auto;
    min-height: 100vh;
    position: relative;
}

/* Simple starfield background - no animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at calc(3% * 1) calc(4% * 1), rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at calc(3% * 7) calc(4% * 3), rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at calc(3% * 13) calc(4% * 6), rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at calc(3% * 19) calc(4% * 9), rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at calc(3% * 25) calc(4% * 12), rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at calc(3% * 31) calc(4% * 15), rgba(255,255,255,0.5), transparent);
    background-size: 500px 500px;
    background-repeat: repeat;
    pointer-events: none;
    opacity: 0.3;
    z-index: -1;
}

/* Removed animations */        header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 2px solid rgba(255, 152, 0, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

h1 {
    color: #ff9800;
    margin-top: 0; /* Reduce space above H1 */
    margin-bottom: 10px; /* Space between H1 and P */
    text-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
}

header {
    text-align: center;
    padding: 10px 0 5px 0; /* 10px top, 5px bottom */
    background: rgba(30, 30, 30, 0.9);
    border-radius: 12px;
    border: 2px solid rgba(255, 152, 0, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    margin-bottom: 0; /* REMOVE margin-bottom */
}

header p {
    margin-top: 5px; /* Small space below H1 */
    margin-bottom: 0; /* Header's padding-bottom handles space after P */
    font-size: 1em; /* Or adjust as preferred */
    color: #ccc; /* Subtitle color */
}

/* Controls Panel and Menu */
.controls-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.menu-toggle {
    background-color: #2c3e50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.menu-toggle:hover {
    background-color: #34495e;
}

.menu {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-top: 10px;
    min-width: 250px;
}

.menu.show {
    display: block;
}

.menu-section {
    margin-bottom: 15px;
}

.menu-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c3e50;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    margin: 5px 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: .4s;
    margin-right: 10px;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked + .toggle-slider {
    background-color: #2196F3;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    color: #333;
}

/* Hide player numbers when toggled off */
.hide-player-numbers [class*="player"][class*="-number"] {
    display: none !important;
}

/* Hide tile art when toggled off, but keep special hexes visible */
.hide-tile-art .hex:not(.hex-hyperlane):not(.hex-hyperlane-83A):not(.hex-hyperlane-86A):not(.hex-center):not(.hex-player) {
    background-image: none !important;
}

.hide-tile-art .hex:not(.hex-hyperlane):not(.hex-hyperlane-83A):not(.hex-hyperlane-86A):not(.hex-center):not(.hex-player) .tile-slot {
    background-image: none !important;
}

.hide-tile-art .hex:not(.hex-hyperlane):not(.hex-hyperlane-83A):not(.hex-hyperlane-86A):not(.hex-center):not(.hex-player).has-tile-image {
    background-image: none !important;
}

/* Restore default ring colors when tile art is hidden */
.hide-tile-art .hex-inner:not(.hex-hyperlane):not(.hex-hyperlane-83A):not(.hex-hyperlane-86A):not(.hex-center):not(.hex-player) {
    background: radial-gradient(circle, #44bfff 0%, #0099dd 100%) !important;
    box-shadow: 0 0 15px rgba(68, 191, 255, 0.4) !important;
}

.hide-tile-art .hex-middle:not(.hex-hyperlane):not(.hex-hyperlane-83A):not(.hex-hyperlane-86A):not(.hex-center):not(.hex-player) {
    background: radial-gradient(circle, #4488ff 0%, #0044bb 100%) !important;
    box-shadow: 0 0 15px rgba(68, 136, 255, 0.4) !important;
}

.hide-tile-art .hex-outer:not(.hex-hyperlane):not(.hex-hyperlane-83A):not(.hex-hyperlane-86A):not(.hex-center):not(.hex-player) {
    background: radial-gradient(circle, #3366bb 0%, #002288 100%) !important;
    box-shadow: 0 0 15px rgba(51, 102, 187, 0.4) !important;
}

.hide-tile-art .hex-outermost:not(.hex-hyperlane):not(.hex-hyperlane-83A):not(.hex-hyperlane-86A):not(.hex-center):not(.hex-player) {
    background: radial-gradient(circle, #224488 0%, #001155 100%) !important;
    box-shadow: 0 0 15px rgba(34, 68, 136, 0.4) !important;
}

.map-container {
    position: relative;
    padding: 0;
    margin: 0;
    min-height: 0;
    z-index: 1;
    display: block;
}

.hex-map {
    position: absolute; /* CHANGED */
    top: -200px; /* ADDED - positions at top of .map-container's content box */
    left: 50%; /* ADDED - for horizontal centering with transform */
    width: 1400px;
    height: 1400px;
    margin: 0 auto;
    transform: translateX(-50%) scale(1); /* CHANGED */
    transform-origin: 50% 0; /* ADDED - scale from top-center */
    transition: transform 0.3s ease;
}

@media (max-width: 1600px) {
    .hex-map {
        transform: translateX(-50%) scale(0.8); /* CHANGED */
    }
}

@media (max-width: 1200px) {
    .hex-map {
        transform: translateX(-50%) scale(0.6); /* CHANGED */
    }
}        .hex {
    position: absolute;
    width: 80px;
    height: 80px;
    clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0% 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    color: #000;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    backface-visibility: hidden;
}        .hex:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.4);
}        /* Maintain rotation on hover for hyperlanes */
.hex-hyperlane.rotate-0:hover { transform: rotate(0deg) scale(1.15); }
.hex-hyperlane.rotate-60:hover { transform: rotate(60deg) scale(1.15); }
.hex-hyperlane.rotate-120:hover { transform: rotate(120deg) scale(1.15); }
.hex-hyperlane.rotate-180:hover { transform: rotate(180deg) scale(1.15); }
.hex-hyperlane.rotate-240:hover { transform: rotate(240deg) scale(1.15); }
.hex-hyperlane.rotate-300:hover { transform: rotate(300deg) scale(1.15); }

/* Maintain rotation on hover for ST_86A hyperlanes */
.hex-hyperlane-86A.rotate-0:hover { transform: rotate(0deg) scale(1.15); }
.hex-hyperlane-86A.rotate-60:hover { transform: rotate(60deg) scale(1.15); }
.hex-hyperlane-86A.rotate-120:hover { transform: rotate(120deg) scale(1.15); }
.hex-hyperlane-86A.rotate-180:hover { transform: rotate(180deg) scale(1.15); }
.hex-hyperlane-86A.rotate-240:hover { transform: rotate(240deg) scale(1.15); }
.hex-hyperlane-86A.rotate-300:hover { transform: rotate(300deg) scale(1.15); }

/* Maintain rotation on hover for ST_83A hyperlanes */
.hex-hyperlane-83A.rotate-0:hover { transform: rotate(0deg) scale(1.15); }
.hex-hyperlane-83A.rotate-60:hover { transform: rotate(60deg) scale(1.15); }
.hex-hyperlane-83A.rotate-120:hover { transform: rotate(120deg) scale(1.15); }
.hex-hyperlane-83A.rotate-180:hover { transform: rotate(180deg) scale(1.15); }
.hex-hyperlane-83A.rotate-240:hover { transform: rotate(240deg) scale(1.15); }
.hex-hyperlane-83A.rotate-300:hover { transform: rotate(300deg) scale(1.15); }

/* Tile slot - for future tile images */
.tile-slot {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}        /* Center hex - Mecatol Rex */
.hex-center {
    background: radial-gradient(circle, #ff4444 0%, #cc0000 100%);
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-size: 14px;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
}

/* Override center hex background when it has a tile image */
.hex-center.has-tile-image {
    background: transparent !important;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6) !important;
}/* Inner ring - Light blue */
.hex-inner {
    background: radial-gradient(circle, #44bfff 0%, #0099dd 100%);
    box-shadow: 0 0 15px rgba(68, 191, 255, 0.4);
}        /* Hyperlane tiles */
.hex-hyperlane {
    background-image: url('img/tiles/ST_87A.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* ST_86A hyperlane tile (connects left and right neighbors) */
.hex-hyperlane-86A {
    background-image: url('img/tiles/ST_86A.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* ST_83A hyperlane tile */
.hex-hyperlane-83A {
    background-image: url('img/tiles/ST_83A.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}        /* Hyperlane rotations for Ring 1 - pointing toward center */
.hex-hyperlane.rotate-0 { transform: rotate(0deg); }
.hex-hyperlane.rotate-60 { transform: rotate(60deg); }
.hex-hyperlane.rotate-120 { transform: rotate(120deg); }
.hex-hyperlane.rotate-180 { transform: rotate(180deg); }
.hex-hyperlane.rotate-240 { transform: rotate(240deg); }
.hex-hyperlane.rotate-300 { transform: rotate(300deg); }

/* Rotations for ST_86A hyperlane tiles */
.hex-hyperlane-86A.rotate-0 { transform: rotate(0deg); }
.hex-hyperlane-86A.rotate-60 { transform: rotate(60deg); }
.hex-hyperlane-86A.rotate-120 { transform: rotate(120deg); }
.hex-hyperlane-86A.rotate-180 { transform: rotate(180deg); }
.hex-hyperlane-86A.rotate-240 { transform: rotate(240deg); }
.hex-hyperlane-86A.rotate-300 { transform: rotate(300deg); }

/* Rotations for ST_83A hyperlane tiles */
.hex-hyperlane-83A.rotate-0 { transform: rotate(0deg); }
.hex-hyperlane-83A.rotate-60 { transform: rotate(60deg); }
.hex-hyperlane-83A.rotate-120 { transform: rotate(120deg); }
.hex-hyperlane-83A.rotate-180 { transform: rotate(180deg); }
.hex-hyperlane-83A.rotate-240 { transform: rotate(240deg); }
.hex-hyperlane-83A.rotate-300 { transform: rotate(300deg); }

/* Middle ring - Blue */
.hex-middle {
    background: radial-gradient(circle, #4488ff 0%, #0044bb 100%);
    box-shadow: 0 0 15px rgba(68, 136, 255, 0.4);
}        /* Outer ring - Dark blue */
.hex-outer {
    background: radial-gradient(circle, #3366bb 0%, #002288 100%);
    box-shadow: 0 0 15px rgba(51, 102, 187, 0.4);
}

/* Outermost ring - Very dark blue */
.hex-outermost {
    background: radial-gradient(circle, #224488 0%, #001155 100%);
    box-shadow: 0 0 15px rgba(34, 68, 136, 0.4);        }/* Numbered player positions - Using ST_0.png tile */
.hex-player {
    background-image: url('img/tiles/ST_0.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Empty space - for future tile placement */
.hex-empty {
    background-color: transparent;
    border: 2px dashed rgba(255,255,255,0.3);
}        /* Coordinate system helper - Enhanced tile details box */
.coordinates {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    border: 1px solid rgba(255, 152, 0, 0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 1000;
    min-width: 280px;
    max-width: 320px;
}

.coord-header {
    color: #ff9800;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 152, 0, 0.3);
    padding-bottom: 8px;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.coord-content {
    display: flex;
    gap: 12px;
}

.coord-image-section {
    flex-shrink: 0;
}

.coord-hex-preview {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 152, 0, 0.2);
    overflow: hidden;
    position: relative;
    clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0% 50%);
}

.coord-placeholder-text {
    color: #666;
    font-size: 10px;
    text-align: center;
    font-style: italic;
    line-height: 1.2;
}

.coord-hex-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coord-info-section {
    flex: 1;
    min-width: 0;
}

.coord-basic-info {
    margin-bottom: 8px;
}

.coord-basic-info div {
    color: #ccc;
    font-size: 12px;
    margin: 2px 0;
    font-family: 'Courier New', monospace;
}

.coord-detailed-info {
    font-size: 11px;
    line-height: 1.3;
}

.coord-resources {
    margin-bottom: 6px;
}

.coord-resource-item {
    color: #ffcc00;
    font-weight: bold;
}

.coord-influence-item {
    color: #4682b4;
    font-weight: bold;
}

.coord-planets {
    margin-bottom: 6px;
}

.coord-planet-name {
    color: #8bc34a;
    font-weight: bold;
    display: block;
    margin: 2px 0;
}

.coord-planet-stats {
    color: #ccc;
    font-size: 10px;
    margin-left: 8px;
}

.coord-special {
    color: #ff9800;
    font-style: italic;
    font-size: 10px;
}

.coord-anomaly {
    color: #ff5555;
}

.coord-wormhole {
    color: #aa55ff;
}

.coord-tech {
    color: #00ccff;
}

/* Mini hex for coordinate preview */
.coord-mini-hex {
    width: 100%;
    height: 100%;
    background: rgba(50, 50, 70, 0.8);
    border-radius: 4px;
    position: relative;
}

/* Section styling for detailed info */
.coord-section-header {
    color: #ff9800;
    font-weight: bold;
    font-size: 11px;
    margin: 8px 0 4px 0;
    border-bottom: 1px solid rgba(255, 152, 0, 0.2);
    padding-bottom: 2px;
}

.coord-section-content {
    margin-bottom: 6px;
}

.coord-stat {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
    font-size: 10px;
}

.coord-stat-label {
    color: #ccc;
}

.coord-stat-value {
    color: #fff;
    font-weight: bold;
}

.coord-planet-item {
    margin: 4px 0;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.coord-planet-item:last-child {
    border-bottom: none;
}

.coord-planet-name {
    color: #8bc34a;
    font-weight: bold;
    font-size: 11px;
}

.coord-planet-stats {
    color: #ccc;
    font-size: 10px;
    margin: 1px 0;
}

.coord-planet-specialty {
    color: #00ccff;
    font-size: 9px;
    font-style: italic;
}

.coord-planet-trait {
    color: #ffcc00;
    font-size: 9px;
}

.coord-planet-legendary {
    color: #ff9800;
    font-size: 9px;
    font-weight: bold;
}

.coord-special-item {
    color: #ff9800;
    font-size: 10px;
    margin: 2px 0;
    font-style: italic;
}

/* Info panel */
.info-panel {
    position: fixed;
    top: 5px;
    left: 20px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 10px;
    font-size: 14px;
    max-width: 250px;
    border: 1px solid rgba(255, 152, 0, 0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 1000;
}

.info-panel h3 {
    color: #ff9800;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

/* Tile Selection Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal-content {
    background: rgba(30, 30, 50, 0.95);
    margin: 5% auto;
    padding: 20px;
    border: 1px solid rgba(255, 152, 0, 0.5);
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 25px rgba(255, 152, 0, 0.3);
    backdrop-filter: blur(10px);
    color: #fff;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #ff9800;
    text-decoration: none;
}

.search-container {
    margin: 15px 0;
}

#tileSearchInput {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 5px;
    background-color: rgba(30, 30, 50, 0.8);
    color: white;
    font-size: 16px;
}

.tile-list-container {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.tile-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.tile-item {
    background: rgba(50, 50, 70, 0.8);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tile-item:hover {
    background: rgba(70, 70, 90, 0.9);
    border-color: rgba(255, 152, 0, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.2);
}

.tile-item.green {
    border-left: 4px solid #4CAF50;
}

.tile-item.blue {
    border-left: 4px solid #2196F3;
}

.tile-item.red {
    border-left: 4px solid #F44336;
}

.tile-id {
    font-weight: bold;
    font-size: 1.2em;
    color: #ff9800;
    margin-bottom: 5px;
}

.tile-details {
    font-size: 0.9em;
    color: #ccc;
}

.tile-planets {
    margin-top: 5px;
    font-size: 0.85em;
}

.planet-name {
    color: #8bc34a;
}

/* Tile preview styles for modal */
.tile-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.tile-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.tile-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.tile-preview-placeholder {
    color: #666;
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
}

.tile-info {
    flex: 1;
    min-width: 0; /* Allow text to wrap */
}

/* Adjust grid for larger tile items with previews */
.tile-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.tile-item {
    background: rgba(50, 50, 70, 0.8);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 5px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 100px;
}

/* Tile item hover effects */
.tile-item:hover .tile-preview-image {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Large preview on hover */
.tile-preview {
    position: relative;
}

.tile-preview:hover::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    transform: scale(2.5);
    z-index: 1000;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tile-preview:hover .tile-preview-image {
    opacity: 0;
}

.tile-preview:hover::after {
    opacity: 1;
    transform: scale(3);
}

.tile-type-green {
    background: radial-gradient(circle, #4CAF50 0%, #2E7D32 100%) !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5) !important;
}

.tile-type-blue {
    background: radial-gradient(circle, #2196F3 0%, #0D47A1 100%) !important;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.5) !important;
}

.tile-type-red {
    background: radial-gradient(circle, #F44336 0%, #B71C1C 100%) !important;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.5) !important;
}

/* Tile ID display in hex */
.hex-tile-id {
    font-weight: bold;
    font-size: 1.2em;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

/* Tile ID overlay for hexes with tile images */
.hex-tile-id-overlay {
    font-weight: bold;
    font-size: 0.9em;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 6;
    pointer-events: none;
}

/* Override positioning when tile number is shown */
.hex-tile-id-overlay.tile-number {
    top: 8px;
    bottom: auto;
    right: 8px;
    font-size: 10px;
    padding: 1px 4px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 2px;
    z-index: 10;
}

/* Styling for hexes with tile images */
.has-tile-image {
    /* Override any existing background gradients when a tile image is present */
    background-color: transparent !important;
}

/* Adjust tile type styling for hexes with images */
.has-tile-image.tile-type-green {
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.8) !important;
    border: 2px solid rgba(76, 175, 80, 0.6) !important;
}

.has-tile-image.tile-type-blue {
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.8) !important;
    border: 2px solid rgba(33, 150, 243, 0.6) !important;
}

.has-tile-image.tile-type-red {
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.8) !important;
    border: 2px solid rgba(244, 67, 54, 0.6) !important;
}

/* Override gradient backgrounds when tile images are present */
.hex.has-tile-image {
    background: none !important;
}

.hex-inner.has-tile-image,
.hex-middle.has-tile-image,
.hex-outer.has-tile-image,
.hex-outermost.has-tile-image,
.hex-empty.has-tile-image {
    background: none !important;
}

/* Ensure tile images display properly on all hex types */
.hex.has-tile-image {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}        /* Random Fill Universe Button Styling */
.action-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.action-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-description {
    font-size: 12px;
    color: #666;
    margin: 0;
    line-height: 1.3;
    text-align: center;
}

.excluded-tiles-container {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 152, 0, 0.2);
    padding-top: 15px;
}

.excluded-tiles-container h4 {
    color: #ff9800;
    margin-bottom: 8px;
}

#excludedTilesInput {
    width: 100%;
    height: 80px;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 4px;
    color: #fff;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    margin-bottom: 8px;
    resize: vertical;
}

.action-button.mini {
    padding: 5px 10px;
    font-size: 12px;
    margin-top: 5px;
}

.menu-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.menu-section:last-child {
    border-bottom: none;
}

/* Secondary button styling */
.action-button.secondary {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    margin-top: 10px;
}

.action-button.secondary:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* Alternate Tile Placeholder Styles */
.alternate-tile-placeholder {
    position: fixed;
    top: 150px;
    left: calc(50% + 420px);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #4a9eff;
    border-radius: 10px;
    padding: 20px;
    min-width: 280px;
    max-width: 320px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(74, 158, 255, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.alternate-tile-placeholder.hidden {
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
}

.placeholder-header {
    color: #4a9eff;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #4a9eff;
    padding-bottom: 8px;
    line-height: 1.4;
}

.placeholder-header small {
    font-size: 10px;
    font-weight: normal;
    color: #888;
    display: block;
    margin-top: 3px;
}

.placeholder-hex {
    width: 80px;
    height: 80px;
    margin: 15px auto;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
    /* Default hex-outer styling when no tile is placed */
    background: radial-gradient(circle, #3366bb 0%, #002288 100%);
    box-shadow: 0 0 15px rgba(51, 102, 187, 0.4);
}

.placeholder-hex:hover {
    transform: scale(1.05);
}

.placeholder-hex .tile-slot {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.placeholder-text {
    color: #888;
    font-size: 10px;
    text-align: center;
    font-style: italic;
}

.placeholder-info {
    text-align: center;
    margin-top: 10px;
}

.placeholder-info .tile-id,
.placeholder-info .tile-type {
    color: #ccc;
    font-size: 12px;
    margin: 2px 0;
}

.placeholder-info .tile-id {    color: #4a9eff;
    font-weight: bold;
}

/* Tile info overlay styles - based on index.html design */
.tile-info-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 3px;
    align-items: center;
    z-index: 15;
    pointer-events: none;
}

.tile-stats-text {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 4px;
    border-radius: 8px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 2px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.tile-resource {
    color: #ffcc00;
    font-weight: bold;
}

.tile-influence {
    color: #4682b4;
    font-weight: bold;
}

.tile-stat-separator {
    margin: 0 2px;
    color: #999;
}

/* Special tile indicators */
.anomaly-text {
    color: #ff5555;
    font-style: italic;
    font-size: 0.8rem;
}

.wormhole-text {
    color: #aa55ff;
    font-weight: bold;
    font-size: 1.2rem;
}

.empty-text {
    color: #999999;
    font-style: italic;
    font-size: 0.8rem;
}

.tile-tech-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.tile-tech-icon img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.tile-wormhole-icon {
    background-color: rgba(0, 0, 0, 0.8);
    color: #aa55ff;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Hide tile info overlays by default */
.tile-info-overlay {
    display: none;
}

/* Show tile info overlays when enabled */
.map-container.show-tile-info .tile-info-overlay {
    display: flex;
}

/* Show alternate tile info overlays when enabled */
body.show-tile-info .alternate-tile-placeholder .tile-info-overlay {
    display: flex;
}

/* Value heatmap overlay styles */
.hex-value-heatmap-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    border-radius: inherit;
    mix-blend-mode: overlay;
    opacity: 0.6;
}

/* Make heatmap overlay more opaque when tile art is off */
.hide-tile-art .hex-value-heatmap-overlay {
    opacity: 0.85;
    mix-blend-mode: hard-light;
}

/* Adjust overlay positioning for hexes with hover effects */
.hex:hover .tile-info-overlay {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Ensure overlays don't interfere with hex interactions */
.tile-info-overlay * {
    pointer-events: none;
}

/* Tile numbers visibility control */
.tile-number {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
    min-width: auto;
    width: auto;
    height: auto;
    line-height: 1.2;
    white-space: nowrap;
    box-sizing: border-box;
}

.map-container.show-tile-numbers .tile-number {
    display: inline-block;
}

/* Show tile numbers in alternate tile when enabled */
body.show-tile-numbers .alternate-tile-placeholder .tile-number {
    display: inline-block;
}

/* No tiles message styling */
.no-tiles-message {
    text-align: center;
    padding: 30px 20px;
    background: rgba(50, 50, 70, 0.8);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 8px;
    color: #ccc;
    font-size: 16px;
    font-style: italic;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Map notification styling */
.map-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    border: 1px solid rgba(255, 152, 0, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.map-notification.show {
    opacity: 1;
}

/* Shareable link container styling */
.shareable-link-container {
    display: flex;
    margin: 20px 0;
    gap: 10px;
}

#shareableLinkInput {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: rgba(30, 30, 30, 0.9);
    color: #fff;
}

.no-tiles-message .message-icon {
    font-size: 24px;
    color: #ff9800;
    margin-bottom: 10px;
    display: block;
}

/* Enhanced alternate tile placeholder styling */
/* When alternate tile has tile art, remove default background */
.placeholder-hex.has-tile-image {
    background: none !important;
    box-shadow: none;
}

/* When tile art is hidden, revert to hex-outer styling even with tile - maximum specificity */
.hide-tile-art .placeholder-hex,
body.hide-tile-art .placeholder-hex,
.hide-tile-art .placeholder-hex.has-tile-image,
body.hide-tile-art .placeholder-hex.has-tile-image,
.hide-tile-art .alternate-tile-placeholder .placeholder-hex.has-tile-image,
body.hide-tile-art .alternate-tile-placeholder .placeholder-hex.has-tile-image {
    background: radial-gradient(circle, #3366bb 0%, #002288 100%) !important;
    box-shadow: 0 0 15px rgba(51, 102, 187, 0.4) !important;
}

/* Hide tile images in alternate placeholder when tile art is off */
.hide-tile-art .placeholder-hex img,
body.hide-tile-art .placeholder-hex img {
    display: none !important;
}

/* Style the placeholder text (number 4) to match player slice numbers */
.placeholder-text {
    color: orange !important;
    font-weight: bold !important;
    font-size: 2em !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    pointer-events: none !important;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
}

/* Hide placeholder text when tile is placed */
.placeholder-hex.has-tile-image .placeholder-text {
    display: none;
}

/* Show placeholder text when tile art is hidden */
.hide-tile-art .placeholder-hex .placeholder-text,
body.hide-tile-art .placeholder-hex .placeholder-text {
    display: flex !important;
    color: orange;
}
