/* Catan 1v1 Bot — Shared dark theme */

:root {
    --bg: #080e1a;
    --surface: #0e1827;
    --surface-2: #172236;
    --border: #1e3255;
    --border-bright: #2d4a78;
    --gold: #c8871a;
    --gold-bright: #e9a030;
    --gold-dim: #7a5010;
    --blue: #3a72c0;
    --blue-bright: #5a9ade;
    --s-text: #ccdff5;
    --s-text-muted: #4d6b92;
    --s-text-dim: #2a3f60;
}

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

body {
    font-family: 'Barlow', -apple-system, sans-serif;
    background: #080e1a;
    color: #b8d0ee;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: #0a1220;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #0a1220;
    border-bottom: 1px solid #1a2e4a;
    color: #b8d0ee;
    padding: 10px 16px;
}

.controls {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 0;
}

.btn {
    padding: 5px 12px;
    background: #1a2e4a;
    color: #6a90b8;
    border: 1px solid #2d4a78;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-family: 'Barlow', sans-serif;
    transition: all 0.18s;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: #223a5e;
    color: #9abfe0;
    border-color: #3d6090;
}

.btn.active {
    background: #1e3f6a;
    color: #c8dff5;
    border-color: #4a7ec0;
}

input[type="number"],
input[type="text"] {
    padding: 5px 8px;
    background: #0e1827;
    border: 1px solid #1e3255;
    border-radius: 3px;
    color: #b8d0ee;
    font-size: 12px;
    font-family: 'Barlow', sans-serif;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #c8871a;
}

label {
    font-size: 11px;
    color: #4d6b92;
}

select {
    font-size: 11px;
    padding: 5px 8px;
    background: #0e1827;
    border: 1px solid #1e3255;
    border-radius: 3px;
    color: #b8d0ee;
    font-family: 'Barlow', sans-serif;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.board-container {
    flex: 7;
    padding: 0;
    display: flex;
    background: #0d1825;
    overflow: hidden;
}

.info-panel {
    flex: 3;
    min-width: 260px;
    max-width: 340px;
    padding: 8px;
    border-left: 1px solid #1a2e4a;
    background: #0a1220;
    overflow-y: auto;
}

.info-section {
    margin-bottom: 7px;
    background: #0e1827;
    padding: 8px;
    border-radius: 3px;
    border: 1px solid #1a2e4a;
}

.info-section h3 {
    font-size: 11px;
    margin-bottom: 7px;
    color: #4d6b92;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'Barlow', sans-serif;
}

.info-item {
    padding: 7px 0;
    border-bottom: 1px solid #1a2e4a;
    font-size: 13px;
    color: #b8d0ee;
}

/* ── Shared action log ── */
.log-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1e3255 transparent;
}

.log-panel::-webkit-scrollbar { width: 4px; }
.log-panel::-webkit-scrollbar-track { background: transparent; }
.log-panel::-webkit-scrollbar-thumb { background: #1e3255; border-radius: 2px; }

.log-entry {
    padding: 4px 6px;
    font-size: 12px;
    border-bottom: 1px solid rgba(30,50,85,0.5);
    line-height: 1.4;
    font-family: 'Barlow', sans-serif;
    color: #6a90b8;
    display: flex;
    gap: 5px;
    align-items: baseline;
}

.log-entry:first-child { border-top: none; }

.log-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    flex-shrink: 0;
    width: 42px;
    color: #2d4a78;
}

.log-entry.log-roll   .log-label { color: #5a7ac0; }
.log-entry.log-roll   { color: #8ab0d8; }
.log-entry.log-build  .log-label { color: #4a9a6a; }
.log-entry.log-build  { color: #70c090; }
.log-entry.log-trade  .log-label { color: #c8871a; }
.log-entry.log-trade  { color: #e8a030; }
.log-entry.log-dev    .log-label { color: #9060c0; }
.log-entry.log-dev    { color: #b080e0; }
.log-entry.log-p0     .log-label { color: #3a7fd4; }
.log-entry.log-p0     { color: #6aaaea; }
.log-entry.log-p1     .log-label { color: #c04040; }
.log-entry.log-p1     { color: #e07070; }
.log-entry.log-bot    .log-label { color: #c04040; }
.log-entry.log-bot    { color: #e07070; }
.log-entry.log-system .log-label { color: #2d4a78; }
.log-entry.log-system { color: #4d6b92; font-style: italic; }

.log-empty {
    padding: 8px 6px;
    font-size: 10px;
    color: #2d4a78;
    font-style: italic;
    font-family: 'Barlow', sans-serif;
}

.player-hand {
    background: #0e1827;
    border-color: #1a2e4a;
}

.player-hand.active {
    background: rgba(200, 135, 26, 0.07);
    border-color: #c8871a;
    box-shadow: 0 0 0 1px rgba(200,135,26,0.2);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.player-header h3 {
    margin: 0;
    font-size: 12px;
    color: #8ab0d8;
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.player-vp {
    font-weight: bold;
    font-size: 13px;
    font-family: 'Cinzel', serif;
    color: #c8b880;
}

.player-stats {
    font-size: 10px;
    margin-top: 3px;
    color: #3d5a80;
}

.dev-cards-compact {
    font-size: 10px;
    margin-top: 3px;
    color: #4d6b92;
}

.resource-list {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}

.resource-item {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: #172236;
    border: 1px solid #1e3255;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    color: #8ab0d8;
}

.resource-count {
    font-weight: bold;
    color: #ccdff5;
    margin-left: 2px;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dice-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    background: #0e1827;
    border-radius: 3px;
}

.dice-result {
    font-size: 26px;
    font-weight: bold;
    color: #e8d5a8;
    font-family: 'Cinzel', serif;
    margin: 0;
    min-width: 40px;
}

.btn-large {
    padding: 7px 14px;
    font-size: 12px;
}

.dev-deck-info {
    font-size: 11px;
    color: #3d5a80;
}

#board-svg {
    flex: 1;
    min-width: 0;
    background: #0d1825;
}

.hex {
    stroke: rgba(0,0,0,0.45);
    stroke-width: 2;
}

.number-token {
    fill: #1e2d40;
    stroke: #2d4a68;
    stroke-width: 1;
}

.number-text {
    font-size: 30px;
    font-weight: bold;
    fill: #c8d8f0;
    text-anchor: middle;
    dominant-baseline: middle;
}

.pip {
    fill: #c8d8f0;
}

.dice-prob-label {
    font-size: 9px;
    fill: #ecf0f1;
    font-weight: bold;
}

.robber {
    fill: #c8871a;
    stroke: #7a5010;
    stroke-width: 1;
}

.error {
    color: #e87070;
    padding: 10px;
    background: rgba(180, 50, 50, 0.15);
    border: 1px solid rgba(180, 50, 50, 0.3);
    border-radius: 4px;
    margin: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #3d5a80;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #5a1a1a;
    border: 1px solid #8b2020;
    color: #f0c0c0;
    padding: 12px 18px;
    border-radius: 3px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    max-width: 350px;
    animation: slideIn 0.3s ease-out;
    font-family: 'Barlow', sans-serif;
    font-size: 13px;
}

.toast.success {
    background: #1a3a28;
    border-color: #2a7a50;
    color: #90e0b0;
}

.toast.warning {
    background: #3a2a0a;
    border-color: #8a6010;
    color: #e0c060;
}

.toast.info {
    background: #0e1e3a;
    border-color: #2a4a8a;
    color: #80b0e8;
}

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

.toast.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

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

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

#road-building-modal-overlay {
    background: rgba(0,0,0,0.3);
    pointer-events: none;
    align-items: flex-start;
    padding-top: 20px;
}

#road-building-modal-overlay .modal {
    pointer-events: auto;
}

.modal {
    background: #0e1827;
    border: 1px solid #1e3255;
    padding: 28px;
    border-radius: 4px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    color: #b8d0ee;
    font-family: 'Barlow', sans-serif;
}

.modal h2 {
    margin-bottom: 16px;
    color: #e8d5a8;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    letter-spacing: 0.1em;
}

.modal p {
    font-size: 13px;
    color: #7a9cc0;
    margin-bottom: 8px;
}

.modal-btn {
    padding: 10px 22px;
    margin: 4px;
    background: #1a2e4a;
    color: #6a90b8;
    border: 1px solid #2d4a78;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Barlow', sans-serif;
    transition: all 0.18s;
}

.modal-btn:hover {
    background: #223a5e;
    color: #9abfe0;
    border-color: #3d6090;
}

.modal-btn.cancel {
    background: #0e1827;
    border-color: #1e3255;
    color: #3d5a80;
}

.modal-btn.cancel:hover {
    background: #172236;
    color: #6a90b8;
}

.resource-selector {
    margin: 16px 0;
}

.resource-selector label {
    display: block;
    margin: 10px 0 5px;
    font-weight: 600;
    font-size: 12px;
    color: #4d6b92;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.resource-selector input,
.resource-selector select {
    width: 100%;
    padding: 8px 10px;
    background: #0a1220;
    border: 1px solid #1e3255;
    border-radius: 3px;
    color: #b8d0ee;
    font-size: 13px;
    font-family: 'Barlow', sans-serif;
}

.resource-selector select option {
    background: #172236;
}

/* Dev card chips (used in player panels) */
.dev-card-item {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: rgba(130, 60, 180, 0.3);
    border: 1px solid rgba(130, 60, 180, 0.55);
    color: #d0a0f0;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
}

.dev-card-count {
    font-weight: bold;
    margin-left: 3px;
    color: #e0c0ff;
}

/* Shared color-coded resource chips */
.res-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 3px;
    font-size: 15px;
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    border: 1px solid transparent;
    transition: opacity 0.2s;
}

.res-chip[data-zero] { opacity: 0.3; }

.res-chip-WOOD  { background: rgba(42,110,66,0.35);  border-color: rgba(42,110,66,0.6); }
.res-chip-BRICK { background: rgba(158,48,32,0.35);  border-color: rgba(158,48,32,0.6); }
.res-chip-SHEEP { background: rgba(58,170,106,0.30); border-color: rgba(58,170,106,0.5); }
.res-chip-WHEAT { background: rgba(200,144,24,0.30); border-color: rgba(200,144,24,0.5); }
.res-chip-ORE   { background: rgba(74,90,112,0.40);  border-color: rgba(74,90,112,0.7); }
