@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Cinzel+Decorative:wght@700&display=swap');

/* ── Mobile portrait overlay ──────────────────────────── */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #1a0e06;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 32px;
    z-index: 9999;
    gap: 28px;
}

.mobile-overlay-msg {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #c8a880;
    line-height: 1.8;
    max-width: 320px;
}

.mobile-overlay-msg a {
    color: #c8a040;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 767px) and (orientation: portrait) {
    .mobile-overlay { display: flex; }
}

/* ── Responsive board: --cell drives all tile sizes ─────── */
:root { --cell: 100px; }

@media (max-width: 1299px) {
    :root { --cell: 84px; }
    body { padding: 14px; }
    .treasure-card-thumb { width: 84px; height: 84px; }
}

@media (max-width: 1099px) {
    :root { --cell: 72px; }
    body { padding: 10px; }
    .sidebar { width: 220px; }
    .treasure-card-thumb { width: 72px; height: 72px; }
    .player-card { padding: 10px; gap: 7px; }
}

@media (max-width: 939px) {
    :root { --cell: 62px; }
    .sidebar { width: 200px; }
    .container { gap: 14px; }
    .treasure-card-thumb { width: 62px; height: 62px; }
    .player-card { padding: 8px; gap: 6px; }
    .player-card-name { font-size: 0.85rem; }
    .timer-display { font-size: 1.6rem; }
}

/* ── Particles ────────────────────────────────────────── */
#particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    perspective: 500px;
    overflow: hidden;
    pointer-events: none;
}

#particle-container .p {
    position: absolute;
    border-radius: 50%;
}

/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 20px;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Cinzel', serif;
    background-color: #1a0e06;
    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px,
            transparent 1px, transparent 60px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px,
            transparent 1px, transparent 60px
        );
    color: #e8d5a0;
}

/* ── Logo ─────────────────────────────────────────────── */
.site-logo {
    height: 320px;
    width: auto;
    display: block;
    clip-path: inset(0 0 60px 0);
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7));
    margin: 0 0 -50px;
}


/* ── Game view wrapper ────────────────────────────────── */
#gameView {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

.site-logo-small {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.7));
}

/* ── Solo timer ───────────────────────────────────────── */
.timer-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px;
    background: #1a0c03;
    border: 2px solid #3a2008;
    border-radius: 6px;
}

.timer-label {
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #957042;
}

.timer-display {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #c8a040;
    text-shadow: 0 0 16px rgba(200, 160, 64, 0.4);
    font-variant-numeric: tabular-nums;
}

/* ── Layout container ─────────────────────────────────── */
.container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    max-height: 100%;
}

/* ── Board ────────────────────────────────────────────── */
.board {
    display: grid;
    grid-template-columns: repeat(9, var(--cell));
    grid-template-rows: repeat(9, var(--cell));
    gap: 4px;
    padding: 14px;
    background-color: #3b2005;
    border: 2px solid #c8a040;
    border-radius: 6px;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.7),
        inset 0 0 20px rgba(0,0,0,0.3);
}

/* ── Tiles ────────────────────────────────────────────── */
.tile {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    border-radius: 3px;
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 3px;
}

/* ── Shift arrow buttons ──────────────────────────────── */
.button-tile {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    transition: transform 0.1s ease, filter 0.1s ease;
}

.button-tile:hover { filter: brightness(1.4); transform: scale(1.15); }
.button-tile:active { transform: scale(0.95); }

/* Arrow shape via clip-path on a pseudo-element */
.button-tile::after {
    content: '';
    display: block;
    background: #c8a040;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.button-tile[data-direction="down"]::after {
    width: 0; height: 0;
    background: transparent;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 30px solid #c8a040;
    filter: drop-shadow(0 3px 4px rgba(0,0,0,0.5));
}
.button-tile[data-direction="up"]::after {
    width: 0; height: 0;
    background: transparent;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-bottom: 30px solid #c8a040;
    filter: drop-shadow(0 -1px 4px rgba(0,0,0,0.5));
}
.button-tile[data-direction="right"]::after {
    width: 0; height: 0;
    background: transparent;
    border-top: 18px solid transparent;
    border-bottom: 18px solid transparent;
    border-left: 30px solid #c8a040;
    filter: drop-shadow(3px 0 4px rgba(0,0,0,0.5));
}
.button-tile[data-direction="left"]::after {
    width: 0; height: 0;
    background: transparent;
    border-top: 18px solid transparent;
    border-bottom: 18px solid transparent;
    border-right: 30px solid #c8a040;
    filter: drop-shadow(-3px 0 4px rgba(0,0,0,0.5));
}

/* ── Invisible corner/filler cells ───────────────────── */
.invisible {
    background: transparent;
    border: none;
}

/* ── Player markers ───────────────────────────────────── */
.player-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    border: 2px solid rgba(255,255,255,0.6);
    box-shadow: 0 2px 6px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.3);
    z-index: 10;
}

.player1 { background: radial-gradient(circle at 35% 35%, #ff6b6b, #c0392b); }
.player2 { background: radial-gradient(circle at 35% 35%, #ffe066, #d4a000); color: #333; border-color: rgba(0,0,0,0.3); }
.player3 { background: radial-gradient(circle at 35% 35%, #51cf66, #1a7a30); }
.player4 { background: radial-gradient(circle at 35% 35%, #4dabf7, #1864ab); }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 260px;
    flex-shrink: 0;
    max-height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

/* ── Phase label (used inside player cards) ───────────── */
.phase-label {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    text-align: center;
}

.phase-label.shift {
    background: rgba(200, 160, 64, 0.15);
    color: #c8a040;
    border: 1px solid rgba(200, 160, 64, 0.35);
}

.phase-label.move {
    background: rgba(80, 200, 120, 0.15);
    color: #50c878;
    border: 1px solid rgba(80, 200, 120, 0.35);
}

/* ── Players panel ────────────────────────────────────── */
.players-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Player card ──────────────────────────────────────── */
.player-card {
    background: #1a0c03;
    border: 2px solid #3a2008;
    border-radius: 6px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.player-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-color-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 4px currentColor;
}

.player-card-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #e8d5a0;
    flex: 1;
}

.your-turn-badge {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 8px;
    background: rgba(200, 160, 64, 0.15);
    color: #c8a040;
    border: 1px solid rgba(200, 160, 64, 0.4);
    border-radius: 10px;
    white-space: nowrap;
}

.winning-crown {
    font-size: 0.95rem;
    color: #c8a040;
    text-shadow: 0 0 6px rgba(200, 160, 64, 0.7);
    line-height: 1;
}

.cards-remaining-badge {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #b8955a;
    white-space: nowrap;
}

/* ── Current treasure target ──────────────────────────── */
.treasure-target-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.treasure-card-thumb {
    width: 100px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid #c8a040;
    box-shadow: 0 0 10px rgba(200, 160, 64, 0.6);
}

.treasure-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.treasure-target-name {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #e8d5a0;
    text-align: center;
}

.treasure-progress {
    font-size: 0.90rem;
    color: #b8955a;
    text-align: center;
    font-weight: bold;
}

.treasure-all-found {
    text-align: center;
    color: #50c878;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.5;
}

/* ── Progress bar (inactive players) ─────────────────── */
.player-card-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-bar-track {
    height: 6px;
    background: #2a1505;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
    opacity: 0.7;
}

.progress-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #c8a060;
    letter-spacing: 0.06em;
}

/* ── Skip move button ─────────────────────────────────── */
.skip-move-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 10px;
    background: linear-gradient(135deg, #3a2008, #2a1505);
    color: #c8a040;
    border: 1px solid rgba(200, 160, 64, 0.5);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    width: 100%;
}

.skip-move-btn:hover {
    background: linear-gradient(135deg, #5a3010, #3a2008);
    transform: scale(1.02);
}

/* ── Disabled / blocked shift arrows ─────────────────── */
.button-tile.phase-disabled {
    opacity: 0;
    pointer-events: none;
}

.button-tile.blocked {
    opacity: 0.25;
    cursor: not-allowed;
}

/* ── Inactive player markers (not current player) ─────── */
.player-marker.inactive {
    opacity: 0.45;
    cursor: default;
}

/* ── Disabled rotation buttons ────────────────────────── */
.rotation-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* ── Free tile panel ──────────────────────────────────── */
.free-tile-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    background: #2a1505;
    border: 2px solid #7a5520;
    border-radius: 6px;
    box-shadow:
        0 0 0 1px #c8a040,
        0 8px 24px rgba(0,0,0,0.6);
}

.free-tile-panel h3 {
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #c8a040;
}

.free-tile img {
    width: calc(var(--cell) * 1.3);
    height: calc(var(--cell) * 1.3);
    border-radius: 4px;
    border: 2px solid #7a5520;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: block;
}

/* ── Rotation buttons ─────────────────────────────────── */
.rotation-controls {
    display: flex;
    gap: 10px;
}

.rotation-controls button {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    cursor: pointer;
    background: linear-gradient(135deg, #8a6020, #5a3a08);
    color: #e8d5a0;
    border: 1px solid #c8a040;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.rotation-controls button:hover {
    background: linear-gradient(135deg, #c8a040, #8a6020);
    transform: scale(1.1);
}

.rotation-controls button:active { transform: scale(0.93); }


/* ── Reachable tile highlight ─────────────────────────── */
@keyframes reachable-pulse {
    0%, 100% {
        outline-color: rgba(var(--reach-rgb), 0.7);
        background-color: rgba(var(--reach-rgb), 0.1);
    }
    50% {
        outline-color: rgba(var(--reach-rgb), 1);
        background-color: rgba(var(--reach-rgb), 0.3);
    }
}

.reachable {
    --reach-rgb: 255, 200, 40;  /* fallback */
    outline: 3px solid rgba(var(--reach-rgb), 0.7);
    outline-offset: -3px;
    cursor: pointer;
    animation: reachable-pulse 1.4s ease-in-out infinite;
}

.reachable:hover {
    outline-color: rgba(var(--reach-rgb), 1);
    background-color: rgba(var(--reach-rgb), 0.4);
    animation: none;
}

/* ── Selected player marker ───────────────────────────── */
.player-marker {
    cursor: pointer;
}

.player-marker.selected {
    box-shadow:
        0 0 0 3px white,
        0 0 10px 4px rgba(255, 220, 80, 0.9);
    scale: 1.2;
}
