/* Stafspel 2025 - Spelbord CSS Styling */
/* Mobile-first responsive design met Scouting thema */

:root {
    --scouting-green: #2d5016;
    --scouting-brown: #8b4513;
    --scouting-light-green: #90ee90;
    --scouting-tan: #d2b48c;
    --scouting-dark-green: #1a3009;
    --scouting-gold: #ffd700;
    --scouting-red: #8b0000;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.25);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--scouting-light-green), var(--scouting-tan));
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    color: var(--scouting-dark-green);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(45, 80, 22, 0.05) 2px, rgba(45, 80, 22, 0.05) 4px),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(45, 80, 22, 0.04) 2px, rgba(45, 80, 22, 0.04) 4px);
    pointer-events: none;
    z-index: 1;
}

.game-header {
    position: relative;
    z-index: 2;
    width: min(1100px, 100%);
    margin: clamp(16px, 4vw, 32px) auto;
    padding: clamp(18px, 4vw, 32px);
    background: linear-gradient(135deg, var(--scouting-brown), #5d3210);
    color: var(--white);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 3vw, 22px);
}

.title-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.game-title {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.35);
}

.game-subtitle {
    font-size: clamp(0.95rem, 2.2vw, 1.1rem);
    opacity: 0.85;
    letter-spacing: 0.06em;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.fullscreen-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--white);
    border: none;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    min-width: 44px;
    min-height: 44px;
}

.fullscreen-btn:hover,
.fullscreen-btn:focus-visible {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.fullscreen-btn i {
    font-size: 1.1rem;
    margin-right: 8px;
}

.fullscreen-btn i.fa-expand::before {
    transition: transform 0.25s ease;
}

body.fullscreen .fullscreen-btn i.fa-expand::before {
    content: "\f066"; /* compress icon */
}

.btn-label {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.game-layout {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 24px;
    padding: clamp(16px, 5vw, 40px);
    width: min(1100px, 100%);
    margin: 0 auto 40px;
}

.board-section {
    display: flex;
    justify-content: center;
}

.board-container {
    position: relative;
    width: clamp(280px, 66vw, 900px);
    aspect-ratio: 1;
    background: radial-gradient(circle at center, #f2d8a2, #d7b981 65%, #ba9a5a 100%);
    border: 6px solid rgba(92, 61, 28, 0.72);
    border-radius: 22px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
    padding: clamp(12px, 3vw, 22px);
}

/* Removed radial overlay to keep bord open */
.board-container::before { display: none; }

.spiral-board {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(var(--grid-size, 14), 1fr);
    grid-template-rows: repeat(var(--grid-size, 14), 1fr);
    gap: 0;
    border-radius: 18px;
    overflow: visible;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(233, 205, 156, 0.7));
}

.board-space {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 222, 173, 0.9));
    border: 2px solid rgba(72, 46, 24, 0.65);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.56rem, 1.4vmin, 0.95rem);
    font-weight: 700;
    color: var(--scouting-dark-green);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 2;
    box-sizing: border-box;
}

.board-space::before {
    content: '';
    position: absolute;
    inset: 12%;
    border-radius: inherit;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.15);
    opacity: 0.8;
}

.board-space:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
    z-index: 12;
}

.board-space.start-tile {
    background: linear-gradient(135deg, var(--scouting-light-green), rgba(255, 255, 255, 0.95));
    border-color: var(--scouting-light-green);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: clamp(0.6rem, 1.3vmin, 1.5rem);
}

.board-space.end-tile {
    background: linear-gradient(135deg, var(--scouting-red), var(--scouting-gold));
    border-color: var(--scouting-red);
    color: #fffaf2;
    font-size: clamp(1rem, 2.4vmin, 2.2rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.board-space.end-tile::before {
    display: none;
}

.space-number {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: clamp(0.5rem, 1.1vmin, 0.85rem);
    color: rgba(43, 70, 25, 0.85);
    font-weight: 800;
}



.special-space,
.board-space[data-position="1"],
.board-space[data-position="10"],
.board-space[data-position="20"],
.board-space[data-position="30"],
.board-space[data-position="40"],
.board-space[data-position="50"],
.board-space[data-position="60"],
.board-space[data-position="70"],
.board-space[data-position="80"],
.board-space[data-position="90"],
.board-space[data-position="100"] {
    border-width: 4px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.25);
}

/* Special colors for milestone spaces - all orange like space 50 */
.board-space[data-position="10"],
.board-space[data-position="20"],
.board-space[data-position="30"],
.board-space[data-position="40"],
.board-space[data-position="50"],
.board-space[data-position="60"],
.board-space[data-position="70"],
.board-space[data-position="80"],
.board-space[data-position="90"],
.board-space[data-position="100"] {
    background: linear-gradient(135deg, #fff5e6, #ffe8cc);
    border-color: #ff8c00;
}





.board-empty-state {
    position: absolute;
    inset: 18%;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px dashed rgba(45, 80, 22, 0.35);
    box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.12);
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    flex-direction: column;
    gap: 8px;
    color: var(--scouting-green);
    font-size: clamp(0.95rem, 2.2vw, 1.1rem);
    z-index: 11;
}

.board-empty-state.visible {
    display: flex;
}

.board-empty-state span {
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    color: rgba(26, 48, 9, 0.7);
}

.player-piece {
    position: absolute;
    width: clamp(22px, 3.4vmin, 36px);
    height: clamp(22px, 3.4vmin, 36px);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.55rem, 1.2vmin, 0.85rem);
    font-weight: 700;
    color: var(--white);
    transition: all 2s ease-in-out;
    z-index: 20;
    cursor: pointer;
}

.player-initial {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.45);
}

.player-piece:hover {
    transform: scale(1.2);
    z-index: 25;
}

.player-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--scouting-dark-green);
    color: var(--white);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 30;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.player-piece:hover .player-tooltip {
    opacity: 1;
}

.player-tooltip strong {
    font-weight: 700;
}

.player-red { background-color: #dc3545; }
.player-blue { background-color: #007bff; }
.player-green { background-color: #28a745; }
.player-yellow { background-color: #ffc107; color: var(--scouting-dark-green); }
.player-purple { background-color: #6f42c1; }
.player-orange { background-color: #fd7e14; }

.info-panel {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 24px);
}

.status-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    padding: clamp(16px, 3vw, 24px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(45, 80, 22, 0.15);
    backdrop-filter: blur(3px);
}

.section-title {
    font-size: 1.1rem;
    margin-bottom: clamp(10px, 2vw, 14px);
    font-weight: 700;
    color: var(--scouting-green);
}

.player-legend {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-legend:empty {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(45, 80, 22, 0.12);
    border: 1px solid rgba(45, 80, 22, 0.18);
}

.legend-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(45, 80, 22, 0.25);
}

.legend-position {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(26, 48, 9, 0.8);
}

.empty-state {
    margin-top: 6px;
    font-size: 0.9rem;
    color: rgba(26, 48, 9, 0.7);
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px dashed rgba(45, 80, 22, 0.3);
    display: none;
}

.empty-state.visible {
    display: block;
}

.connection-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.connection-status::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
}

.connection-status.connecting {
    background: rgba(255, 193, 7, 0.2);
    color: #c27f02;
}

.connection-status.connected {
    background: rgba(40, 167, 69, 0.18);
    color: #1c7c34;
}

.connection-status.error {
    background: rgba(220, 53, 69, 0.18);
    color: #a11d2e;
}

.state-timestamp {
    font-size: 0.85rem;
    color: rgba(26, 48, 9, 0.7);
}

.status-help {
    margin-top: 10px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(26, 48, 9, 0.75);
}

footer.game-info {
    z-index: 2;
    position: relative;
    width: min(1100px, 100%);
    margin: 0 auto clamp(24px, 6vw, 40px);
    text-align: center;
    color: rgba(26, 48, 9, 0.75);
    font-size: 0.9rem;
}

@media (min-width: 900px) {
    .game-layout {
        grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
        align-items: start;
    }
}

@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .board-container {
        width: min(90vw, 480px);
    }

    .controls {
        justify-content: center;
    }
}


/* Fullscreen styles */
body.fullscreen {
    overflow: hidden;
}

body.fullscreen .game-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 450px;
    height: 100vh;
    margin: 0;
    border-radius: 0 18px 18px 0;
    max-width: none;
    padding: clamp(20px, 3vw, 32px);
    background: linear-gradient(135deg, var(--scouting-brown), #5d3210);
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 24px);
    padding-bottom: 0; /* Remove bottom padding for info panel */
}

body.fullscreen .game-layout {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    z-index: 1;
    padding-left: 450px; /* Account for sidebar width */
}

body.fullscreen .board-section {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.fullscreen .board-container {
    max-width: min(95vmin, 1000px);
    max-height: min(95vmin, 1000px);
    width: min(95vmin, 1000px);
    height: min(95vmin, 1000px);
}

/* Move info panel content into sidebar in fullscreen */
body.fullscreen .game-header .info-panel {
    position: absolute;
    bottom: clamp(20px, 3vw, 32px);
    left: clamp(20px, 3vw, 32px);
    right: clamp(20px, 3vw, 32px);
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 24px);
}

/* Hide the original right info panel in fullscreen */
body.fullscreen main .info-panel {
    display: none;
}

/* Keep the cloned info panel visible */
body.fullscreen .game-header .info-panel {
    display: flex;
}

body.fullscreen .status-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    padding: clamp(16px, 3vw, 24px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(45, 80, 22, 0.15);
    backdrop-filter: blur(3px);
    color: var(--scouting-dark-green);
}

body.fullscreen .section-title {
    font-size: 1.1rem;
    margin-bottom: clamp(10px, 2vw, 14px);
    font-weight: 700;
    color: var(--scouting-green);
}

body.fullscreen .player-legend {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

body.fullscreen .legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(45, 80, 22, 0.12);
    border: 1px solid rgba(45, 80, 22, 0.18);
}

body.fullscreen .legend-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--scouting-dark-green);
}

body.fullscreen .legend-position {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(26, 48, 9, 0.8);
}

body.fullscreen .connection-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

body.fullscreen .connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.fullscreen .connection-status.connecting {
    background: rgba(255, 193, 7, 0.2);
    color: #c27f02;
}

body.fullscreen .connection-status.connected {
    background: rgba(40, 167, 69, 0.18);
    color: #1c7c34;
}

body.fullscreen .connection-status.error {
    background: rgba(220, 53, 69, 0.18);
    color: #a11d2e;
}

body.fullscreen .state-timestamp {
    font-size: 0.85rem;
    color: rgba(26, 48, 9, 0.7);
}

body.fullscreen footer.game-info {
    display: none;
}

/* Responsive fullscreen sidebar */
@media (max-width: 768px) {
    body.fullscreen .game-header {
        width: 450px;
        padding: 16px;
    }

    body.fullscreen .game-layout {
        padding-left: 450px;
    }
}
