/* ==================== Color Definitions ==================== */
/* All colors are defined here as CSS custom properties.
   To change a color, update the variable below. */
:root {
    /* Player colors */
    --player-red: #e74c3c;
    --player-blue: #3498db;
    --player-white: #ecf0f1;
    --player-orange: #e67e22;
    --player-brown: #8b4513;
    --player-green: #27ae60;
    --player-yellow: #f1c40f;
    --player-purple: #9b59b6;

    /* Resource/tile colors */
    --resource-brick: #c45c26;
    --resource-wood: #1a6b1a;
    --resource-ore: #708090;
    --resource-grain: #d4a826;
    --resource-wool: #8bc34a;
    --resource-desert: #c4a66a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background-color: #16213e;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #0f3460;
}

header h1 {
    font-size: 1.5rem;
    color: #e94560;
}

#game-info {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #aaa;
}

#playing-as-display {
    font-weight: bold;
}

.info-separator {
    color: #555;
}

.header-buttons {
    display: flex;
    gap: 0.25rem;
}

main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #0a1628;
    background-image:
        radial-gradient(circle at center, #1a2a4a 0%, #0a1628 100%);
    position: relative;
    overflow: hidden;
}

#board {
    width: 90%;
    height: 90%;
    transition: transform 0.2s ease;
}

/* Zoom Controls */
#zoom-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    background-color: rgba(22, 33, 62, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #0f3460;
}

#zoom-controls button {
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#zoom-controls #btn-zoom-reset {
    width: auto;
    padding: 0 12px;
    font-size: 0.8rem;
}

#zoom-level {
    font-size: 0.85rem;
    color: #aaa;
    min-width: 45px;
    text-align: center;
}

/* Pan Controls */
#pan-controls {
    position: absolute;
    top: 60px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 100;
    background-color: rgba(22, 33, 62, 0.9);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #0f3460;
}

#pan-controls-middle {
    display: flex;
    gap: 2px;
}

#pan-controls button {
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pan-controls #btn-pan-reset {
    font-size: 1.2rem;
}

/* Dice Display */
#dice-display {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    background-color: rgba(22, 33, 62, 0.9);
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #0f3460;
}

#dice-display span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #f5f5dc;
    color: #1a1a2e;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 6px;
}

#sidebar {
    width: 320px;
    background-color: #16213e;
    padding: 1rem;
    overflow-y: auto;
    border-left: 2px solid #0f3460;
}

#sidebar h2 {
    font-size: 1rem;
    color: #e94560;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #0f3460;
}

#sidebar section {
    margin-bottom: 1.5rem;
}

/* Player Cards */
.player-card {
    position: relative;
    background-color: #0f3460;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid;
}

/* Gain notification overlay */
.gain-notification {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
    z-index: 10;
}

.gain-notification.visible {
    opacity: 1;
}

.gain-notification .resource-box {
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
    min-width: 1.5rem;
    text-align: center;
}

.gain-notification .dev-card-box {
    background-color: #8b5cf6;
    min-width: 1.25rem;
    min-height: 1.25rem;
}

.player-card.current {
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.player-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.player-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.25rem;
    vertical-align: baseline;
    position: relative;
    top: -2px;
}

.road-badge,
.army-badge {
    background-color: #fef08a;
    color: #000;
}

.player-stats {
    font-size: 0.8rem;
    color: #aaa;
}

.player-resources-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
}

.player-resources {
    display: flex;
    gap: 0.25rem;
}

.player-dev-cards {
    font-size: 0.85rem;
    font-weight: bold;
    color: #aaa;
}

.dev-card-letter {
    margin: 0 1px;
}

.dev-card-ready {
    color: #fff;
}

.dev-card-purchased {
    color: #666;
}

.resource-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #000 !important;
}

.resource-box.resource-Brick {
    background-color: var(--resource-brick);
}

.resource-box.resource-Wood {
    background-color: var(--resource-wood);
}

.resource-box.resource-Ore {
    background-color: var(--resource-ore);
}

.resource-box.resource-Grain {
    background-color: var(--resource-grain);
}

.resource-box.resource-Wool {
    background-color: var(--resource-wool);
}

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

.player-card .remove-btn {
    background: transparent;
    color: #e94560;
    border: 1px solid #e94560;
    padding: 2px 8px;
    font-size: 0.7rem;
    width: auto;
}

/* Buttons */
button {
    background-color: #e94560;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s;
}

button:hover:not(:disabled) {
    background-color: #ff6b6b;
}

button:disabled {
    background-color: #444;
    cursor: not-allowed;
    opacity: 0.6;
}

button.secondary {
    background-color: #0f3460;
    border: 1px solid #e94560;
}

button.secondary:hover:not(:disabled) {
    background-color: #1a4a80;
}

button.small-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    width: auto;
}

.icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form Elements */
input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background-color: #0a1628;
    color: #eee;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: #e94560;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.button-group button,
.button-group select,
.button-group input {
    flex: 1;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: #aaa;
    font-size: 0.85rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.volume-control input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #444;
    border-radius: 3px;
    cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#volume-value {
    min-width: 40px;
    text-align: right;
    color: #ccc;
    font-size: 0.9rem;
}

.small-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.small-btn:hover {
    background: #666;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #aaa;
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Player Selection */
#player-select-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background-color: #0a1628;
    border-radius: 6px;
}

#player-select-container label {
    color: #aaa;
    font-size: 0.85rem;
    white-space: nowrap;
}

#playing-as-select {
    flex: 1;
    margin-bottom: 0;
}

/* Action Button Rows */
#action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.action-row {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
}

#situational-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#situational-actions:empty {
    margin-top: 0;
}

.action-btn {
    text-align: left;
    padding: 0.6rem 0.8rem;
}

.action-btn.icon-btn {
    font-size: 1.5rem;
    text-align: center;
    padding: 0.3rem 0.8rem;
    line-height: 1;
    flex: 0 0 auto;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.highlight {
    background-color: #2ecc71;
}

.action-btn.highlight:hover {
    background-color: #27ae60;
}

/* Status Box (shows "Waiting on..." or "Select an action...") */
#action-status-bar {
    background-color: #0a1628;
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem;
}

#action-status-text {
    color: #a0aec0;
}

#action-status-bar.selection #action-status-text {
    color: #e94560;
    font-weight: bold;
}

/* Resources Display */
#resources-display {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.resource-item {
    text-align: center;
    padding: 0.5rem;
    background-color: #0a1628;
    border-radius: 6px;
}

.resource-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.resource-count {
    font-weight: bold;
}

.resource-name {
    font-size: 0.65rem;
    color: #888;
}

/* Resource colors */
.resource-Brick { color: var(--resource-brick); }
.resource-Wood { color: var(--resource-wood); }
.resource-Ore { color: var(--resource-ore); }
.resource-Grain { color: var(--resource-grain); }
.resource-Wool { color: var(--resource-wool); }

/* History Log (event log) */
#history-log {
    min-height: 100px;
    max-height: 400px;
    height: 150px;
    overflow-y: auto;
    font-size: 0.8rem;
    color: #888;
    background-color: #0a1628;
    padding: 0.5rem;
    border-radius: 6px;
    resize: vertical;
}

.log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid #0f3460;
}

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

.log-entry.error {
    color: #e94560;
}

.log-entry.success {
    color: #2ecc71;
}

/* Debug Log */
#debug-log {
    min-height: 40px;
    max-height: 300px;
    height: 50px;
    overflow-y: auto;
    font-size: 0.75rem;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #8bc34a;
    background-color: #0a1628;
    padding: 0.5rem;
    border-radius: 6px;
    resize: vertical;
}

.debug-entry {
    padding: 0.15rem 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.debug-entry.warn {
    color: #ffc107;
}

.debug-entry.error {
    color: #e94560;
}

.debug-entry.info {
    color: #2196f3;
}

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

/* Error modal appears on top of other modals */
#error-modal {
    z-index: 1100;
}

#error-modal #error-message {
    margin-bottom: 1rem;
}

.modal-content {
    background-color: #16213e;
    padding: 1.5rem;
    border-radius: 12px;
    min-width: 350px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid #0f3460;
}

.modal-content h2 {
    color: #e94560;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #0f3460;
}

.modal-divider {
    border: none;
    border-top: 1px solid #0f3460;
    margin: 1rem 0;
}

/* Game Menu Modal */
#menu-playing-as-container {
    margin-bottom: 0;
}

#menu-invite-links-container {
    margin-top: 0.75rem;
}

#menu-invite-links-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.invite-link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.invite-link-row .player-name {
    flex: 1;
    font-size: 0.9rem;
}

.invite-link-row .copy-link-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.invite-link-row .copy-link-btn:hover {
    opacity: 1;
}

.invite-link-row .copy-link-btn.copied {
    color: #27ae60;
}

/* Trade Modal */
#trade-offer-section,
#trade-request-section {
    margin-bottom: 1rem;
}

#trade-offer-section h3,
#trade-request-section h3 {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 0.5rem;
}

#trade-offer-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

#trade-request-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trade-card {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
}

.trade-card:hover {
    border-color: #aaa;
}

.trade-card.selected {
    border-color: #e94560;
    box-shadow: 0 0 6px rgba(233, 69, 96, 0.6);
}

#trade-summary {
    background-color: #0a1628;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-align: center;
    color: #e94560;
    font-weight: bold;
}

/* Discard Selection */
#discard-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.discard-card {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
}

.discard-card:hover {
    border-color: #aaa;
}

.discard-card.selected {
    border-color: #e94560;
    box-shadow: 0 0 6px rgba(233, 69, 96, 0.6);
}

/* Resource Selection */
#resource-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.resource-option {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resource-option:hover {
    border-color: #aaa;
}

.resource-option.selected {
    border-color: #e94560;
    box-shadow: 0 0 6px rgba(233, 69, 96, 0.6);
}

.resource-option .resource-count {
    font-size: 1.25rem;
    font-weight: bold;
    color: #000 !important;
}

/* Resource option background colors */
.resource-option.resource-Brick {
    background-color: var(--resource-brick);
}

.resource-option.resource-Wood {
    background-color: var(--resource-wood);
}

.resource-option.resource-Ore {
    background-color: var(--resource-ore);
}

.resource-option.resource-Grain {
    background-color: var(--resource-grain);
}

.resource-option.resource-Wool {
    background-color: var(--resource-wool);
}

/* ==================== Help Modal ==================== */

#help-modal .modal-content {
    max-width: 550px;
}

.help-section {
    margin-bottom: 1rem;
}

.help-section h3 {
    color: #e94560;
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.help-section p {
    color: #ccc;
    font-size: 1rem;
    line-height: 1.6;
}

.help-section ul {
    list-style: disc;
    padding-left: 1.25rem;
    color: #ccc;
    font-size: 1rem;
    line-height: 1.6;
}

.help-section li {
    margin-bottom: 0.35rem;
}

.help-section .resource-box {
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.help-cost-table {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.help-cost-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.help-cost-label {
    color: #ccc;
    font-size: 1rem;
    min-width: 80px;
}

/* ==================== SVG Board Styles ==================== */

.tile-hex {
    stroke: #2a2a4a;
    stroke-width: 2;
    cursor: default;
}

.tile-hex.selectable {
    cursor: pointer;
    stroke: #e94560;
    stroke-width: 3;
    stroke-dasharray: 5, 5;
}

.tile-hex.selectable:hover {
    stroke: #ff6b6b;
    stroke-width: 4;
}

.tile-hex.resource-Brick { fill: var(--resource-brick); }
.tile-hex.resource-Wood { fill: var(--resource-wood); }
.tile-hex.resource-Ore { fill: var(--resource-ore); }
.tile-hex.resource-Grain { fill: var(--resource-grain); }
.tile-hex.resource-Wool { fill: var(--resource-wool); }
.tile-hex.resource-Desert { fill: var(--resource-desert); }

.tile-number {
    fill: #1a1a2e;
    font-size: 18px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.tile-number.red {
    fill: #e94560;
}

.tile-number-bg {
    fill: #f5f5dc;
    stroke: #333;
    stroke-width: 1;
}

.probability-dot {
    fill: #1a1a2e;
}

.probability-dot.red {
    fill: #e94560;
}

.tile-id {
    fill: #1a1a2e;
    font-size: 10px;
    font-weight: bold;
    text-anchor: middle;
    pointer-events: none;
}

/* Robber */
.robber {
    pointer-events: none;
}

.robber-shadow {
    fill: rgba(0, 0, 0, 0.4);
}

.robber-body {
    fill: #2a2a2a;
    stroke: #f5f5dc;
    stroke-width: 2;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8));
}

.robber-head {
    fill: #1a1a1a;
    stroke: #f5f5dc;
    stroke-width: 1.5;
}

.robber-eye {
    fill: #ff4444;
}

/* Roads */
.road {
    stroke-width: 8;
    stroke-linecap: round;
    pointer-events: none;
}

.road.player-Red { stroke: var(--player-red); }
.road.player-Blue { stroke: var(--player-blue); }
.road.player-White { stroke: var(--player-white); }
.road.player-Orange { stroke: var(--player-orange); }
.road.player-Brown { stroke: var(--player-brown); }
.road.player-Green { stroke: var(--player-green); }
.road.player-Yellow { stroke: var(--player-yellow); }
.road.player-Purple { stroke: var(--player-purple); }

/* Edge placeholders (for selection) */
.edge-placeholder {
    stroke: #555;
    stroke-width: 6;
    stroke-linecap: round;
    cursor: pointer;
    opacity: 0;
}

.edge-placeholder.selectable {
    opacity: 1;
    stroke: rgba(0, 255, 255, 0.35);
    stroke-width: 10;
}

.edge-placeholder.selectable:hover {
    stroke: rgba(0, 255, 255, 0.6);
}

/* Settlements */
.settlement {
    stroke: #222;
    stroke-width: 2;
    cursor: pointer;
}

.settlement.player-Red { fill: var(--player-red); }
.settlement.player-Blue { fill: var(--player-blue); }
.settlement.player-White { fill: var(--player-white); }
.settlement.player-Orange { fill: var(--player-orange); }
.settlement.player-Brown { fill: var(--player-brown); }
.settlement.player-Green { fill: var(--player-green); }
.settlement.player-Yellow { fill: var(--player-yellow); }
.settlement.player-Purple { fill: var(--player-purple); }

/* Cities */
.city {
    stroke: #222;
    stroke-width: 2;
    pointer-events: none;
}

.city.player-Red { fill: var(--player-red); }
.city.player-Blue { fill: var(--player-blue); }
.city.player-White { fill: var(--player-white); }
.city.player-Orange { fill: var(--player-orange); }
.city.player-Brown { fill: var(--player-brown); }
.city.player-Green { fill: var(--player-green); }
.city.player-Yellow { fill: var(--player-yellow); }
.city.player-Purple { fill: var(--player-purple); }

/* Vertex placeholders (for selection) */
.vertex-placeholder {
    fill: #555;
    cursor: pointer;
    opacity: 0;
}

.vertex-placeholder.selectable {
    opacity: 1;
    fill: rgba(0, 255, 255, 0.2);
    stroke: #00b3b3;
    stroke-width: 2;
}

.vertex-placeholder.selectable:hover {
    fill: rgba(0, 255, 255, 0.4);
    stroke: #00ffff;
}

/* Robber placeholders (for tile selection) */
.robber-placeholder {
    fill: rgba(0, 255, 255, 0.2);
    stroke: #00b3b3;
    stroke-width: 2;
    cursor: pointer;
}

.robber-placeholder:hover {
    fill: rgba(0, 255, 255, 0.4);
    stroke: #00ffff;
}

/* Upgrade placeholders (for city upgrade selection) */
.upgrade-placeholder {
    fill: rgba(0, 255, 255, 0.2);
    stroke: #00b3b3;
    stroke-width: 2;
    cursor: pointer;
}

.upgrade-placeholder:hover {
    fill: rgba(0, 255, 255, 0.4);
    stroke: #00ffff;
}

/* Ports */
.port-line {
    stroke: #f5f5dc;
    stroke-width: 3;
    stroke-dasharray: 5, 5;
}

.port-label {
    fill: #f5f5dc;
    font-size: 11px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
}

.port-bg {
    fill: #0f3460;
    stroke: #f5f5dc;
    stroke-width: 1;
}

/* 2:1 Port background colors - match tile resource colors */
.port-bg-Brick { fill: var(--resource-brick); }
.port-bg-Wood { fill: var(--resource-wood); }
.port-bg-Ore { fill: var(--resource-ore); }
.port-bg-Grain { fill: var(--resource-grain); }
.port-bg-Wool { fill: var(--resource-wool); }

/* Player Trade Modal */
#player-trade-header {
    display: grid;
    grid-template-columns: 28px 40px 1fr 1fr;
    column-gap: 1.5rem;
    row-gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #888;
    text-align: center;
}

#player-trade-header .trade-col-available {
    text-align: center;
}

#player-trade-resources {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.trade-unified-row {
    display: grid;
    grid-template-columns: 28px 40px 1fr 1fr;
    column-gap: 1.5rem;
    row-gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background-color: #0a1628;
    border-radius: 6px;
}

.trade-unified-row .resource-box {
    width: 24px;
    height: 24px;
}

.trade-unified-row .trade-available {
    font-size: 0.9rem;
    color: #888;
    text-align: center;
}

.trade-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.trade-controls .trade-count {
    font-size: 1rem;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    color: #e94560;
}

.trade-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.trade-btn.minus {
    background-color: #0f3460;
    border: 1px solid #e94560;
}

.trade-btn.plus {
    background-color: #e94560;
}

.trade-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#player-trade-summary {
    background-color: #0a1628;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-align: center;
    color: #aaa;
    font-size: 0.85rem;
}


/* Respond to Trade Modal */
#respond-trade-from {
    color: #aaa;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

#respond-trade-details {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.trade-offer-display,
.trade-request-display {
    flex: 1;
    background-color: #0a1628;
    padding: 0.75rem;
    border-radius: 6px;
}

.trade-offer-display h3,
.trade-request-display h3 {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.5rem;
}

.trade-resource-item {
    padding: 0.4rem 0.6rem;
    background-color: #0f3460;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.trade-resource-boxes {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Accept Trade Modal */
#accept-trade-players {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.accept-trade-player-btn {
    background-color: #1a3a5c;
    text-align: left;
    padding: 0.75rem 1rem;
}

.accept-trade-player-btn:hover:not(:disabled) {
    background-color: #245080;
}

/* Select Target Modal */
#select-target-players {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.select-target-player-btn {
    background-color: #1a3a5c;
    text-align: left;
    padding: 0.75rem 1rem;
}

.select-target-player-btn:hover:not(:disabled) {
    background-color: #245080;
}

/* Trade Rejected Modal */
#trade-rejected-modal .modal-content {
    text-align: center;
}

#trade-rejected-modal p {
    margin-bottom: 1.5rem;
}

#trade-rejected-modal .button-group {
    justify-content: center;
}

#trade-rejected-modal .button-group button {
    flex: none;
    padding: 0.5rem 1.5rem;
}

/* No Activity Modal */
#no-activity-modal .modal-content {
    text-align: center;
}

#no-activity-modal p {
    margin-bottom: 1.5rem;
}

#no-activity-modal .button-group {
    justify-content: center;
}

#no-activity-modal .button-group button {
    flex: none;
    padding: 0.5rem 1.5rem;
}

/* Game Over Modal */
.game-over-content {
    text-align: center;
}

.game-over-content h2 {
    border-bottom: none;
    font-size: 1.5rem;
}

#game-over-message {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

#game-over-message.winner {
    color: #ffd700;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#game-over-stats {
    background-color: #0a1628;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

#game-over-stats .player-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid #0f3460;
}

#game-over-stats .player-score:last-child {
    border-bottom: none;
}

#game-over-stats .player-score.winner {
    background-color: rgba(255, 215, 0, 0.1);
    border-radius: 4px;
}

#game-over-stats .player-name {
    font-weight: bold;
}

#game-over-stats .player-vp {
    color: #e94560;
    font-weight: bold;
}

/* Bank Display */
#bank-display {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    background-color: rgba(22, 33, 62, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #0f3460;
}

/* Dice Display - move below bank */
#dice-display {
    top: 55px;
}

#bank-display i {
    color: #aaa;
    font-size: 1.1rem;
}

#bank-resources {
    display: flex;
    gap: 4px;
}

#bank-resources .resource-box {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
}

/* ==================== Landing Page ==================== */

#landing-page {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #0a1628;
    background-image: radial-gradient(circle at center, #1a2a4a 0%, #0a1628 100%);
}

#landing-content {
    background-color: #16213e;
    padding: 1.5rem;
    border-radius: 12px;
    width: 400px;
    max-width: 90vw;
    border: 2px solid #0f3460;
}

#landing-content h2 {
    color: #e94560;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #0f3460;
}

#landing-error {
    background-color: rgba(233, 69, 96, 0.15);
    border: 1px solid #e94560;
    color: #e94560;
    padding: 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

#btn-landing-start {
    background-color: #2ecc71;
}

#btn-landing-start:hover:not(:disabled) {
    background-color: #27ae60;
}

#landing-hint {
    color: #666;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

#landing-invite-links-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.75rem;
}

#landing-invite-links-list .invite-link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

#landing-invite-links-list .invite-link-row .player-name {
    flex: 1;
    font-size: 0.9rem;
}

#landing-invite-modal p {
    color: #aaa;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

#landing-invite-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.landing-invite-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.landing-invite-row input[type="text"] {
    flex: 1;
    margin-bottom: 0;
}

.landing-invite-row select {
    width: auto;
    min-width: 100px;
    margin-bottom: 0;
}

#landing-invite-error {
    background-color: rgba(233, 69, 96, 0.15);
    border: 1px solid #e94560;
    color: #e94560;
    padding: 0.6rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}
