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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    color: #e0e0e0;
    touch-action: pan-x pan-y;
}

#board-container {
    touch-action: none;
}

.hidden {
    display: none !important;
}

/* Player Selection Screen */
#player-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

#player-select h1 {
    color: white;
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#player-select h2 {
    color: white;
    font-size: 1.5em;
    margin-bottom: 40px;
}

.color-selection {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-btn {
    padding: 20px 40px;
    font-size: 1.2em;
    font-weight: bold;
    border: 3px solid white;
    border-radius: 10px;
    cursor: pointer;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 120px;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.color-btn:active {
    transform: scale(0.95);
}

.color-btn:disabled,
.color-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.color-btn:disabled:hover,
.color-btn.disabled:hover {
    transform: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Waiting Room */
#waiting-room {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.waiting-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.waiting-container h2 {
    color: white;
    font-size: 2em;
    margin-bottom: 30px;
}

#waiting-players-list {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 10px;
    min-width: 400px;
    margin-bottom: 30px;
    color: #000;
}

#start-game-container, #waiting-message {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 400px;
    color: #000;
}

#start-game-container p, #waiting-message p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

.victory-points-setting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.victory-points-setting label {
    font-weight: bold;
    color: #2c3e50;
}

.victory-points-setting input {
    width: 80px;
    padding: 8px;
    border: 2px solid #667eea;
    border-radius: 5px;
    font-size: 1.1em;
    text-align: center;
}

.validation-mode-setting {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
}

.validation-mode-setting label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e67e22;
    font-weight: bold;
    cursor: pointer;
}

.validation-mode-setting input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.validation-mode-setting input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.validation-mode-setting label:has(input:disabled) {
    color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

#add-dummy-player-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    padding: 10px;
    background: #fef3e2;
    border-radius: 8px;
    border: 1px solid #e67e22;
}

#add-dummy-player-container label {
    font-weight: bold;
    color: #2c3e50;
}

#dummy-player-select {
    padding: 8px;
    border: 2px solid #667eea;
    border-radius: 5px;
    font-size: 1em;
}

#add-dummy-btn {
    padding: 8px 15px;
}

.validation-mode-indicator {
    background: #e67e22;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9em;
    margin-left: 10px;
}

.room-code-display {
    background: #3498db;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.8em;
    white-space: nowrap;
}

.room-code-display strong {
    letter-spacing: 2px;
}

/* Rejoin Form */
.rejoin-option {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.rejoin-form {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.rejoin-form input {
    padding: 10px 15px;
    font-size: 1.2em;
    width: 120px;
    text-align: center;
    border: 2px solid #667eea;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.rejoin-divider {
    color: #888;
    margin: 15px 0;
}

.dummy-player-tag {
    background: #95a5a6;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    margin-left: 5px;
}

.negative-resource {
    color: #e74c3c !important;
    font-weight: bold;
}

/* Game Screen */
#game-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    color: #000;
}

.header h1 {
    font-size: 1.8em;
    color: #667eea;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #000;
}

.player-info .btn-secondary {
    padding: 6px 12px;
    font-size: 0.85em;
    width: auto;
    margin-bottom: 0;
    white-space: nowrap;
}

#player-color {
    text-transform: capitalize;
}

.main-container {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

/* Host Controls */
.host-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    color: #000;
}

.host-controls .btn-secondary {
    width: auto;
    min-width: 200px;
    margin-bottom: 0;
}

/* Board and Side Panel Wrapper */
.board-side-wrapper {
    display: flex;
    flex: 1;
    gap: 20px;
}

/* Board Container */
.board-container {
    flex: 1;
    background: #000000;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    position: relative;
    overflow: hidden;
    transition: border 0.4s ease, box-shadow 0.4s ease;
}

.board-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 20% 30%, white, transparent),
        radial-gradient(1px 1px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(1px 1px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 85%, white, transparent),
        radial-gradient(1px 1px at 15% 75%, white, transparent),
        radial-gradient(1px 1px at 70% 25%, white, transparent),
        radial-gradient(1px 1px at 40% 15%, white, transparent),
        radial-gradient(1px 1px at 85% 85%, white, transparent),
        radial-gradient(1px 1px at 25% 45%, white, transparent),
        radial-gradient(1px 1px at 95% 35%, white, transparent),
        radial-gradient(1px 1px at 10% 90%, white, transparent),
        radial-gradient(1px 1px at 45% 60%, white, transparent),
        radial-gradient(1px 1px at 65% 90%, white, transparent),
        radial-gradient(1px 1px at 5% 20%, white, transparent),
        radial-gradient(1px 1px at 75% 55%, white, transparent),
        radial-gradient(1px 1px at 55% 5%, white, transparent),
        radial-gradient(1px 1px at 30% 95%, white, transparent),
        radial-gradient(1px 1px at 88% 45%, white, transparent),
        radial-gradient(2px 2px at 22% 68%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 72% 12%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 42% 38%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 8% 58%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 92% 78%, rgba(255,255,255,0.8), transparent);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
}

#game-board {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 10;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 5px;
    background: #667eea;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

/* Resource Costs Reference */
.resource-costs {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10;
    font-size: 0.9em;
}

.resource-costs h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.1em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.resource-costs .cost-item {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.resource-costs .cost-item:last-child {
    margin-bottom: 0;
}

.resource-costs .cost-item strong {
    min-width: 130px;
    color: #000;
}

.resource-costs .resource-icon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #2c3e50;
    display: inline-block;
    vertical-align: middle;
}

.zoom-btn:active {
    transform: scale(0.95);
}

/* Hex Tiles */
.hex-tile {
    stroke: #2c3e50;
    stroke-width: 2;
    cursor: pointer;
    transition: opacity 0.2s;
}

.hex-tile:hover {
    opacity: 0.8;
}

.hex-number {
    font-size: 24px;
    font-weight: bold;
    fill: #2c3e50;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    stroke: white;
    stroke-width: 3px;
    paint-order: stroke fill;
}

.hex-resource-text {
    font-size: 12px;
    fill: #2c3e50;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    stroke: white;
    stroke-width: 2px;
    paint-order: stroke fill;
}

.outpost {
    /* fill, stroke, and stroke-width are set dynamically via setAttribute */
    transition: opacity 0.2s;
    cursor: pointer;
}

.outpost:hover {
    opacity: 0.8;
}

.starbase {
    /* fill, stroke, and stroke-width are set dynamically via setAttribute */
}

.lane {
    cursor: pointer;
    transition: opacity 0.2s;
}

.lane:hover {
    opacity: 0.8;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2000;
    padding: 5px;
    min-width: 180px;
}



#side-panel-context {
    padding: 20px;
}

.action-menu-resources-section {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
}

.action-menu-resources-section h3 {
    font-size: 0.8em;
    margin: 0 0 4px 0;
    opacity: 0.7;
}

.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
    color: #000;
}

.context-menu-item:hover {
    background: #f0f0f0;
}

.context-menu-item:active {
    background: #e0e0e0;
}

/* Side Panel */
.side-panel {
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    color: #000;
}

.panel-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

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

.panel-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* Players List */
#players-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.player-item {
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #000;
    min-width: 0;
}

.player-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #2c3e50;
    flex-shrink: 0;
}

/* Resources */
.resource-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 5px;
    color: #000;
}

.resource-icon {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    border: 2px solid #2c3e50;
    background-color: black;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.resource-icon.hydrogen { background-image: url('/static/png/hydrogen.png'); }
.resource-icon.silicon { background-image: url('/static/png/silicon.png'); }
.resource-icon.helium { background-image: url('/static/png/helium.png'); }
.resource-icon.oxygen { background-image: url('/static/png/oxygen.png'); }
.resource-icon.titanium { background-image: url('/static/png/titanium-resource.png'); }

/* Collapsible resources header */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.collapse-arrow {
    font-size: 0.7em;
    transition: transform 0.2s ease;
    display: inline-block;
}
.collapsible-header.collapsed .collapse-arrow {
    transform: rotate(-90deg);
}

/* Compact (collapsed) resources list */
#resources-list.compact .trade-resource-name {
    display: none;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 10px;
    width: 100%;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.directive-mode-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.directive-mode-btn.active:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a3f96);
}

.btn-primary:active, .btn-secondary:active {
    transform: scale(0.95);
}

/* Dice Result */
.dice-result {
    background: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    margin: 10px 0;
    color: #000;
}

#dice-value {
    font-size: 1.5em;
    color: #667eea;
}

/* Game Log */
#game-log {
    background: #ecf0f1;
    padding: 10px;
    border-radius: 5px;
    max-height: 150px;
    overflow-y: auto;
    font-size: 0.9em;
    color: #000;
}

.log-entry {
    padding: 5px;
    border-bottom: 1px solid #bdc3c7;
    color: #000;
}

.log-entry:last-child {
    border-bottom: none;
}

/* Modal */
.modal {
    position: fixed;
    top: var(--vvp-top, 0px);
    left: var(--vvp-left, 0px);
    width: var(--vvp-width, 100%);
    height: var(--vvp-height, 100%);
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 5000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    color: #000;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.modal-content p {
    color: #000;
}

@keyframes ctxHighlightSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes hexImageSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hex-image-spin {
    transform-box: fill-box;
    transform-origin: center;
}

.victory-content {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
}

.victory-content h2 {
    color: #ffd700;
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.victory-img {
    width: 300px;
    height: auto;
    display: block;
    margin: 0 auto 20px auto;
    white-space: nowrap;
}

.victory-content p {
    color: white !important;
    font-size: 1.3em;
    margin-bottom: 20px;
}

.victory-content #victory-player {
    color: #ffd700;
    font-size: 1.2em;
}

#victory-host-controls {
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

#victory-host-controls p {
    margin-bottom: 15px;
}

/* Longest Route / Accolade Modals */
.longest-route-modal,
.accolade-modal {
    pointer-events: none;
}

.longest-route-content,
.accolade-content {
    text-align: center;
    padding: 30px 40px;
    animation: longestRoutePopIn 0.4s ease-out;
}

.longest-route-content h2,
.accolade-content h2 {
    font-size: 2em;
    margin-bottom: 15px;
}

.longest-route-content p,
.accolade-content p {
    font-size: 1.1em;
    margin: 0;
}

/* Accolade image inside modals */
.accolade-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    display: block;
    margin: 0 auto 16px;
}

@keyframes longestRoutePopIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.trade-section {
    margin-bottom: 20px;
    color: #000;
}

.trade-section h3 {
    color: #000;
    margin-bottom: 10px;
    font-size: 1em;
}

.resource-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #000;
}

.resource-selector label {
    flex: 0 0 auto;
    color: #000;
    display: flex;
    align-items: center;
}

.resource-selector label .resource-icon {
    width: 28px;
    height: 28px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.resource-selector label .element-symbol {
    position: absolute;
    font-size: 0.75em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.resource-selector label .resource-available {
    margin-left: 8px;
    font-size: 0.9em;
    color: #666;
    font-weight: bold;
}

.resource-input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: flex-end;
}

.resource-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.resource-minus {
    background: #e74c3c;
    color: white;
}

.resource-minus:hover {
    background: #c0392b;
}

.resource-minus:active {
    transform: scale(0.95);
}

.resource-plus {
    background: #27ae60;
    color: white;
}

.resource-plus:hover {
    background: #1e8449;
}

.resource-plus:active {
    transform: scale(0.95);
}

.resource-selector input {
    width: 50px;
    padding: 8px 5px;
    border: 2px solid #ecf0f1;
    border-radius: 5px;
    color: #000;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
}

/* Hide number input spinners */
.resource-selector input::-webkit-outer-spin-button,
.resource-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.resource-selector input[type=number] {
    -moz-appearance: textfield;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option .radio-label {
    padding: 5px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    background: #f8f9fa;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Default checked state (non-resource) */
.radio-option input[type="radio"]:checked + .radio-label {
    border-color: #2980b9;
    box-shadow: 0 0 0 2px #2980b9;
    background: #e8f4fd;
}

/* Per-resource checked state */
.radio-option input[value="hydrogen"]:checked + .radio-label {
    border-color: #5B9BD5;
    box-shadow: 0 0 0 2px #5B9BD5;
    background: rgba(91,155,213,0.15);
}
.radio-option input[value="silicon"]:checked + .radio-label {
    border-color: #CD853F;
    box-shadow: 0 0 0 2px #CD853F;
    background: rgba(205,133,63,0.15);
}
.radio-option input[value="helium"]:checked + .radio-label {
    border-color: #FFC14D;
    box-shadow: 0 0 0 2px #FFC14D;
    background: rgba(255,193,77,0.15);
}
.radio-option input[value="oxygen"]:checked + .radio-label {
    border-color: #9a93ef;
    box-shadow: 0 0 0 2px #9a93ef;
    background: rgba(154,147,239,0.15);
}
.radio-option input[value="titanium"]:checked + .radio-label {
    border-color: #6c757d;
    box-shadow: 0 0 0 2px #6c757d;
    background: rgba(108,117,125,0.15);
}

/* Per-resource hover state */
.radio-option:hover:not(.disabled) input[value="hydrogen"] + .radio-label { border-color: #5B9BD5; }
.radio-option:hover:not(.disabled) input[value="silicon"]  + .radio-label { border-color: #CD853F; }
.radio-option:hover:not(.disabled) input[value="helium"]   + .radio-label { border-color: #FFC14D; }
.radio-option:hover:not(.disabled) input[value="oxygen"]   + .radio-label { border-color: #9a93ef; }
.radio-option:hover:not(.disabled) input[value="titanium"] + .radio-label { border-color: #6c757d; }

.radio-option.disabled .radio-label,
.radio-option input[type="radio"]:disabled + .radio-label {
    opacity: 0.4;
    cursor: not-allowed;
}

.radio-option:hover:not(.disabled) .radio-label {
    border-color: #2980b9;
}

select, input, textarea {
    color: #000;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

#trade-details {
    background: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    color: #000;
}

/* Buildings Info */
#buildings-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#buildings-info div {
    padding: 8px;
    background: #ecf0f1;
    border-radius: 5px;
    color: #000;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.info {
    background: #667eea;
}

.toast.success {
    background: #66bb6a;
}

.toast.warning {
    background: #ffa726;
}

.toast.error {
    background: #ef5350;
}

.toast-message {
    flex: 1;
    font-size: 0.95em;
    line-height: 1.4;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

/* Dens and Traders */
.den-marker {
    cursor: pointer;
    transition: opacity 0.2s;
}

.den-marker:hover {
    opacity: 0.8;
}

.den-icon {
    /* Fill is set dynamically based on resource type */
    stroke: #2c3e50;
    stroke-width: 2;
}

.trader-marker {
    cursor: pointer;
}

.trader-icon {
    fill: #9c27b0;
    stroke: #6a1b9a;
    stroke-width: 2;
}

/* Current Turn / Players Panel */
.mobile-turn-indicator {
    display: block;
    text-align: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-weight: bold;
    color: #2c3e50;
}

#mobile-current-turn {
    font-weight: bold;
}

.turn-players-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.turn-players-list {
    margin-top: 10px;
}

#players-list.collapsed {
    display: none;
}

/* Mobile Build Costs */
.mobile-build-costs {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 10px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: 0.85em;
}

.mobile-build-costs .costs-header {
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-build-costs .costs-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    max-height: 100px;
    opacity: 1;
}

.mobile-build-costs.collapsed .costs-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.mobile-build-costs .collapse-icon {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.mobile-build-costs.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.mobile-build-costs .cost-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.mobile-build-costs .cost-item strong {
    margin-right: 5px;
    color: #2c3e50;
}

.mobile-build-costs .resource-icon {
    width: 18px;
    height: 18px;
    font-size: 0.65em;
}

/* Mobile View Toggle */
.mobile-view-toggle {
    display: none;
    gap: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.view-toggle-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #667eea;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.view-toggle-btn.active {
    background: #667eea;
    color: white;
}

.view-toggle-btn:not(.active):hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Prevent text selection on mobile */
    * {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-build-costs {
        display: block;
    }

    /* Hide original build costs on mobile */
    .board-container .resource-costs {
        display: none;
    }

    .mobile-view-toggle {
        display: flex;
    }

    .board-side-wrapper {
        flex-direction: column;
    }

    .board-container {
        min-height: 400px;
    }

    .side-panel {
        width: 100%;
        max-height: none;
    }

    /* Hide panel by default on mobile, show board */
    .board-side-wrapper .side-panel {
        display: none;
    }

    .board-side-wrapper.show-panel .side-panel {
        display: block;
    }

    .board-side-wrapper.show-panel .board-container {
        display: none;
    }

    /* Header adjustments for mobile */
    .header {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header h1 {
        font-size: 1.3em;
        width: 100%;
        text-align: center;
    }

    .player-info {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Host controls on mobile */
    .host-controls {
        flex-wrap: wrap;
    }

    .host-controls .btn-secondary {
        min-width: 150px;
    }

    /* Hide zoom controls on mobile (pinch-to-zoom is available) */
    .zoom-controls {
        display: none;
    }

    /* Hide normal roll dice button on mobile only when floating button is active */
    #roll-dice-btn:not(.floating-hidden) {
        display: none;
    }

    /* Resource costs box on mobile */
    .resource-costs {
        font-size: 0.8em;
        padding: 10px;
    }

    .resource-costs .cost-item strong {
        min-width: 100px;
    }

    /* Toast positioning on mobile */
    .toast-container {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .toast {
        min-width: auto;
    }

    /* Your Turn dialog mobile adjustments */
    .your-turn-content {
        padding: 25px 20px;
        margin: 20px;
        max-width: calc(100vw - 40px);
    }

    .your-turn-content h2 {
        font-size: 1.8em;
    }

    .your-turn-icon .your-turn-img {
        width: 140px;
    }
}

/* Your Turn Dialog */
.your-turn-dialog {
    position: fixed;
    top: var(--vvp-top, 0px);
    left: var(--vvp-left, 0px);
    width: var(--vvp-width, 100%);
    height: var(--vvp-height, 100%);
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    animation: fadeInOverlay 0.3s ease-out;
}

.your-turn-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 35px 45px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 350px;
    width: 90%;
}

.your-turn-icon {
    margin-bottom: 10px;
    animation: pulse 1.5s ease-in-out infinite;
    white-space: nowrap;
}

.your-turn-img {
    width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.your-turn-content h2 {
    color: #fff;
    font-size: 2.2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.your-turn-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    margin-bottom: 25px;
}

.your-turn-content .btn-primary {
    background: #fff;
    color: #667eea;
    font-size: 1.1em;
    padding: 14px 40px;
    width: auto;
    margin: 0;
}

.your-turn-content .btn-primary:hover {
    background: #f0f0f0;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Victory board recolor animation */
.board-recoloring .lane-line,
.board-recoloring .property-node * {
    transition: fill 1.5s ease, stroke 1.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Floating Roll Dice Button (Mobile) */
.floating-roll-dice {
    display: none;
    position: fixed;
    bottom: var(--vvp-bottom-30, 30px);
    left: var(--vvp-center, 50%);
    transform: translateX(-50%);
    padding: 18px 50px;
    font-size: 1.3em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
    cursor: pointer;
    z-index: 2000;
    animation: floatPulse 2s ease-in-out infinite;
}

.floating-roll-dice:active {
    transform: translateX(-50%) scale(0.95);
}

/* Floating Dice Result (Mobile) */
.floating-dice-result {
    display: none;
    position: fixed;
    bottom: var(--vvp-bottom-110, 110px);
    left: var(--vvp-center, 50%);
    transform: translateX(-50%);
    padding: 15px 35px;
    font-size: 1.2em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    animation: popIn 0.3s ease-out;
}

.floating-dice-result strong {
    color: #667eea;
    font-size: 1.3em;
}

/* Floating End Turn Button (Mobile) */
.floating-end-turn {
    display: none;
    position: fixed;
    bottom: var(--vvp-bottom-30, 30px);
    left: var(--vvp-center, 50%);
    transform: translateX(-50%);
    padding: 18px 50px;
    font-size: 1.3em;
    font-weight: bold;
    background: linear-gradient(135deg, #ef5350 0%, #c62828 100%);
    color: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 6px 25px rgba(239, 83, 80, 0.5);
    cursor: pointer;
    z-index: 2000;
    animation: popIn 0.3s ease-out;
}

.floating-end-turn:active {
    transform: translateX(-50%) scale(0.95);
}

.floating-end-turn.disabled {
    pointer-events: none;
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}


.floating-end-turn.minimized {
    left: auto;
    right: 0;
    bottom: 38%;
    transform: none;
    padding: 20px 10px;
    border-radius: 12px 0 0 12px;
    width: 44px;
    animation: none;
    box-shadow: -4px 4px 16px rgba(102, 187, 106, 0.45);
}

.floating-end-turn.minimized:active {
    transform: scale(0.95);
}

.floating-end-turn.minimized .end-turn-label {
    display: none;
}

@keyframes floatPulse {
    0%, 100% {
        box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 8px 35px rgba(102, 126, 234, 0.7);
    }
}

@media (max-width: 768px) {
    .floating-roll-dice:not(.hidden) {
        display: block;
    }

    .floating-dice-result:not(.hidden) {
        display: block;
    }

    .floating-end-turn:not(.hidden) {
        display: block;
    }

}

/* Hide floating board buttons when panel view is active or game screen is not shown */
body.board-hidden #action-tray,
body.board-hidden #action-tray-tab,
body.board-hidden #floating-roll-dice-btn,
body.board-hidden #floating-dice-result,
#game-screen.hidden ~ #action-tray,
#game-screen.hidden ~ #action-tray-tab,
#game-screen.hidden ~ #floating-roll-dice-btn,
#game-screen.hidden ~ #floating-dice-result {
    display: none !important;
}

/* Hide collapse icon on desktop */
.collapse-icon {
    display: none;
}

@media (max-width: 768px) {
    .collapse-icon {
        display: inline;
    }
}

/* Spectator Mode Styles */
.spectator-option {
    margin-top: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
}

.spectator-option p {
    color: #ffa726;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.spectator-option .btn-primary {
    width: auto;
    padding: 15px 40px;
}

.spectator-badge {
    background: #ffa726;
    color: #000;
    font-size: 0.5em;
    padding: 5px 12px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 10px;
}

.spectator-header {
    justify-content: space-between;
}

.spectator-header .btn-secondary {
    width: auto;
    margin: 0;
}

.spectator-container {
    flex: 1;
    display: flex;
    padding: 20px;
    justify-content: center;
    align-items: center;
}

.spectator-board {
    width: 100%;
    max-width: 1400px;
    height: calc(100vh - 120px);
    position: relative;
}

.spectator-board svg {
    width: 100%;
    height: 100%;
}

.spectator-costs {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 100;
}

.spectator-turn-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 12px 20px;
    font-size: 1.1em;
    background: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.spectator-turn-indicator strong {
    font-size: 1.1em;
}

#spectator-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.spectator-dice-result {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    font-size: 1.3em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.spectator-dice-result strong {
    color: #667eea;
    font-size: 1.2em;
}

#spectator-current-player {
    font-weight: bold;
}

.spectator-victory-note {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 20px;
}

#spectator-victory-modal .btn-secondary {
    width: auto;
    margin: 0 auto;
}

/* Outpost Confirmation Modal */
.outpost-confirm-content {
    text-align: center;
    padding: 25px;
}

.outpost-confirm-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.outpost-confirm-content .modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.outpost-confirm-content .btn-primary,
.outpost-confirm-content .btn-secondary {
    width: auto;
    padding: 12px 30px;
}

/* Trade Modal - Your Resources Display */
.your-resources-section {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
}

.your-resources-section h3 {
    margin-bottom: 10px;
    color: inherit;
    font-size: 0.95em;
}

.trade-resource-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-start;
}

.trade-resource-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.95em;
    color: #ffffff;
}

.trade-resource-item .resource-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
}

.trade-resource-item .resource-icon.hydrogen { background-color: var(--hydrogen); }
.trade-resource-item .resource-icon.silicon  { background-color: var(--silicon);  }
.trade-resource-item .resource-icon.helium   { background-color: var(--helium);   }
.trade-resource-item .resource-icon.oxygen   { background-color: var(--oxygen);   }
.trade-resource-item .resource-icon.titanium { background-color: var(--titanium); }

.trade-resource-name {
    font-size: 0.85em;
    color: inherit;
}

.trade-resource-count {
    font-weight: bold;
    min-width: 16px;
    text-align: right;
}

/* Element symbols in build costs */
.cost-item .resource-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.cost-item .element-symbol {
    position: absolute;
    font-size: 0.7em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 2px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.5);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Mobile touch handling - prevent browser gestures on game board */
.board-container {
    touch-action: none;
}


/* ============== Galactic Expanse: Blockade/Pirate Styles ============== */

/* Seven Choice Modal */
.seven-choice-content {
    text-align: center;
    max-width: 450px;
}

.seven-choice-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.seven-choice-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    font-size: 1em;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.seven-choice-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.choice-icon {
    height: 100px;
    width: auto;
    border-radius: 6px;
    flex-shrink: 0;
}

.choice-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    flex: 1;
}

#choose-blockade-btn .choice-text {
    text-align: right;
}

.choice-title {
    font-weight: bold;
    font-size: 1.2em;
}

.choice-desc {
    font-size: 0.85em;
    opacity: 0.8;
    margin-top: 5px;
}

.seven-choice-alt {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

/* Blockade Result Modal */
.blockade-result-content {
    text-align: center;
    min-width: 300px;
}

.blockade-roll {
    font-size: 2em;
    font-weight: bold;
    margin: 15px 0;
    padding: 15px;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
}

#blockade-result-modal.success .blockade-roll {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.2);
}

#blockade-result-modal.failure .blockade-roll {
    color: #f44336;
    background: rgba(244, 67, 54, 0.2);
}

/* Pirate Steal Modal */
.pirate-steal-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.pirate-steal-player {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 8px;
}

.pirate-steal-player-label {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.pirate-steal-resources {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pirate-steal-resource-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
}

/* Blockaded Notification */
.blockaded-content {
    text-align: center;
    background: linear-gradient(135deg, #ff6b6b 0%, #c0392b 100%);
    color: white;
}

.blockaded-content h2 {
    color: white;
}

/* Pirate Victim Notification */
.pirate-victim-content {
    text-align: center;
    background: linear-gradient(135deg, #9b59b6 0%, #6c3483 100%);
    color: white;
}

.pirate-victim-content h2 {
    color: white;
}

/* Bonus Info Display */
.bonus-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.bonus-item {
    padding: 5px 10px;
    margin: 5px 0;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: bold;
}

.bonus-item-hint {
    opacity: 0.5;
    font-style: italic;
}

#longest-route-bonus {
    background: linear-gradient(135deg, #c0399a 0%, #8e1a72 100%);
    color: white;
}

#blockade-bonus {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

#pirate-bonus {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

#star-map-bonus {
    background: linear-gradient(135deg, #f5c518 0%, #c8960c 100%);
    color: #1a1200;
}

/* Blockade overlay animation */
.blockade-overlay {
    animation: blockadePulse 2s ease-in-out infinite;
}

@keyframes blockadePulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Hex hover state during blockade selection */
.hex-tile[style*="crosshair"]:hover {
    filter: brightness(1.2);
}

/* Blockade Confirmation Modal */
.blockade-confirm-content {
    text-align: center;
    min-width: 300px;
}

.blockade-hex-info {
    font-size: 1.5em;
    font-weight: bold;
    padding: 15px;
    margin: 15px 0;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    color: #fff;
}

.blockade-confirm-note {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

/* Maintenance Banner */
.maintenance-banner {
    background: linear-gradient(135deg, #e65100, #ffa726);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: bold;
    font-size: 0.95em;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(230, 81, 0, 0.4);
}

/* Maintenance Schedule Info */
.maintenance-schedule {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    margin-bottom: 12px;
}

/* Server IP Display */
.server-ip-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.2em;
}

.server-ip-display .ip-address {
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 4px;
    color: #4fc3f7;
    user-select: all;
}

/* Lane Placement Target Highlighting */
@keyframes laneTargetPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.15; }
}

.lane-placement-dot {
    animation: laneTargetPulse 2s ease-in-out infinite;
}

/* Action Tray Tab — always-visible side toggle */
.action-tray-tab {
    position: fixed;
    left: 0;
    bottom: 40%;
    z-index: 2500;
    background: rgba(0, 6, 22, 0.92);
    border: 1px solid var(--border-accent, rgba(0, 170, 255, 0.35));
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--color-accent, #00d4ff);
    padding: 16px 7px;
    cursor: pointer;
    font-size: 1em;
    box-shadow: 3px 0 12px rgba(0, 160, 255, 0.2);
}
.action-tray-tab:hover { background: rgba(0, 170, 255, 0.12); }
.action-tray-tab.tray-open { color: #fff; border-color: var(--color-accent, #00d4ff); }

/* Action Tray — horizontal floating bar, bottom-left */
.action-tray {
    position: fixed;
    bottom: 24px;
    left: 16px;
    z-index: 2400;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    animation: popIn 0.2s ease-out;
}
.action-tray.hidden { display: none; }

/* End Turn inside tray — match HELM button style, mobile only */
.action-tray .floating-end-turn {
    position: static !important;
    transform: none !important;
    bottom: auto !important;
    left: auto !important;
    padding: 10px 14px !important;
    font-size: 0.9em !important;
    font-weight: normal !important;
    line-height: 1.2 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
    animation: none !important;
    width: auto !important;
}
.action-tray .floating-end-turn:active { transform: scale(0.95); }
@media (max-width: 768px) {
    .action-tray .floating-end-turn:not(.hidden) { display: block; }
}

/* HELM wrapper for panel-above-button layout */
.helm-tray-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* HELM Interface */
.helm-toggle-btn {
    background: linear-gradient(135deg, #004db3 0%, #0077dd 50%, #00a8ff 100%);
    color: white;
    border: 1px solid rgba(0, 200, 255, 0.55);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9em;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(0, 160, 255, 0.25);
    transition: all 0.2s;
}
.helm-toggle-btn:hover {
    background: linear-gradient(135deg, #0060cc 0%, #0088ff 50%, #00c8ff 100%);
    box-shadow: 0 0 28px rgba(0, 200, 255, 0.55);
    border-color: rgba(0, 220, 255, 0.85);
}
.helm-toggle-btn.helm-active { outline: 2px solid var(--color-accent, #00d4ff); }

.helm-tray-item .helm-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    top: auto;
    right: auto;
}

.helm-panel {
    z-index: 3000;
    background: rgba(0, 6, 22, 0.97);
    border: 1px solid var(--border-accent, rgba(0, 170, 255, 0.35));
    border-radius: 10px;
    padding: 10px;
    min-width: 200px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 160, 255, 0.08);
}
.helm-header {
    color: var(--color-accent, #00d4ff);
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 4px 8px 10px;
    border-bottom: 1px solid var(--border-subtle, rgba(0, 170, 255, 0.2));
    margin-bottom: 6px;
}
.helm-cmd {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-subtle, rgba(0, 170, 255, 0.2));
    border-radius: 6px;
    color: var(--color-text, #c0daf5);
    padding: 9px 12px;
    margin-bottom: 6px;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.15s, border-color 0.15s;
}
.helm-cmd:last-child { margin-bottom: 0; }
.helm-cmd:hover { background: rgba(0, 170, 255, 0.12); border-color: var(--border-accent, rgba(0, 170, 255, 0.35)); }
.helm-cmd.helm-cmd-active {
    background: rgba(0, 170, 255, 0.2);
    border-color: var(--color-accent, #00d4ff);
    color: #fff;
}
.helm-cmd:disabled { opacity: 0.35; cursor: not-allowed; }
.helm-icon {
    width: 1em;
    height: 1em;
    vertical-align: middle;
    margin-right: 2px;
}

.directive-ref-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(103,126,234,0.08);
    border: 1px solid rgba(103,126,234,0.25);
    border-radius: 8px;
    padding: 10px;
    width: 100%;
    text-align: left;
    cursor: default;
    color: inherit;
}
.directive-ref-playable {
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.directive-ref-playable:hover {
    background: rgba(103,126,234,0.25);
    border-color: #667eea;
}
.directive-ref-qty {
    font-size: 0.85em;
    color: #7af;
    font-weight: 400;
}
.directive-ref-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}
.directive-ref-info { flex: 1; }
.directive-ref-name {
    font-weight: 700;
    color: #a78bfa;
    font-size: 0.95em;
    margin-bottom: 3px;
}
.directive-ref-desc {
    font-size: 0.82em;
    color: #ccc;
    line-height: 1.4;
}

.helm-dot {
    animation: laneTargetPulse 1.4s ease-in-out infinite;
}

/* Feedback form inputs */
.feedback-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-accent, rgba(0, 170, 255, 0.35));
    background: rgba(0, 20, 50, 0.6);
    color: var(--color-text, #c0daf5);
    font-size: 0.95em;
    box-sizing: border-box;
    font-family: inherit;
}
.feedback-input::placeholder { opacity: 0.45; }
.feedback-input option { background: #00060d; }
textarea.feedback-input { line-height: 1.5; }

/* Feedback button in action tray */
.feedback-tray-btn {
    background: rgba(0, 6, 22, 0.92);
    border: 1px solid var(--border-accent, rgba(0, 170, 255, 0.35));
    border-radius: 8px;
    color: var(--color-text, #c0daf5);
    font-size: 1.1em;
    padding: 8px 10px;
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.feedback-tray-btn:hover { border-color: var(--color-accent, #00d4ff); color: var(--color-accent, #00d4ff); }
