:root {
    --bg-dark: #050507;
    --bg-panel: rgba(15, 15, 20, 0.7);
    --primary-neon: #ff00ff;
    --primary-glow: rgba(255, 0, 255, 0.5);
    --secondary-neon: #00ffff;
    --secondary-glow: rgba(0, 255, 255, 0.5);
    --accent-gold: #d4af37;
    --accent-gold-glow: rgba(212, 175, 55, 0.4);
    --text-main: #f0f0f0;
    --text-dim: #a0a0a0;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-heavy: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.12);
    --shadow-deep: 0 15px 45px rgba(0, 0, 0, 0.9);
    --neon-shadow: 0 0 15px var(--primary-glow);
    --board-size: min(750px, 80vh);
}

.hidden {
    display: none !important;
}

@keyframes pulse-glow {
    0% {
        filter: drop-shadow(0 0 5px var(--primary-glow));
    }

    50% {
        filter: drop-shadow(0 0 15px var(--primary-glow));
    }

    100% {
        filter: drop-shadow(0 0 5px var(--primary-glow));
    }
}

@keyframes bg-shimmer {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #050507 100%);
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: url('assets/luxury_bg.png') no-repeat center center;
    background-size: cover;
    position: relative;
    overflow: hidden;
}

#app::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    /* Reduced opacity for better visibility */
    backdrop-filter: blur(8px);
    z-index: 0;
    pointer-events: none;
    /* Crucial: allow clicks through the overlay */
}

header,
#game-container,
aside {
    position: relative;
    z-index: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 25px;
    background: var(--bg-panel);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-deep);
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 6vh, 3rem);
    font-weight: 800;
    background: linear-gradient(90deg, var(--primary-neon), var(--secondary-neon));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--primary-glow));
    letter-spacing: 2px;
}

#game-info {
    display: flex;
    gap: 30px;
    font-size: clamp(0.9rem, 2vh, 1.2rem);
    font-weight: 600;
    align-items: center;
}

#turn-count {
    display: flex;
    align-items: center;
    gap: 10px;
    font-variant-numeric: tabular-nums;
}

.btn-timer-toggle {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    width: auto;
}

#turn-count {
    color: var(--accent-gold);
}

#game-container {
    display: flex;
    flex: 1;
    gap: 40px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#board-wrapper {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 20px;
    box-shadow: var(--shadow-deep), 0 0 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    position: relative;
}

.board {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    grid-template-rows: repeat(11, minmax(0, 1fr));
    width: var(--board-size);
    height: var(--board-size);
    gap: 3px;
    background-color: rgba(255, 255, 255, 0.05);
}

/* Tile Styles */
.tile {
    background-color: #111116;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding: 2px;
    font-size: clamp(0.35rem, 1.1vh, 0.7rem);
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: manual;
    color: var(--text-dim);
}

.tile:hover {
    background-color: #1a1a24;
    z-index: 10;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Ownership highlight: Woman (#ff00ff) and Man (#00ffff) */
.tile.owned-by-woman {
    border-color: #ff00ff;
    box-shadow: inset 0 0 14px rgba(255, 0, 255, 0.35), 0 0 14px rgba(255, 0, 255, 0.25);
}

.tile.owned-by-man {
    border-color: #00ffff;
    box-shadow: inset 0 0 14px rgba(0, 255, 255, 0.35), 0 0 14px rgba(0, 255, 255, 0.25);
}

.tile.owned-by-woman:hover {
    border-color: #ff00ff;
    box-shadow: inset 0 0 14px rgba(255, 0, 255, 0.4), 0 0 20px rgba(255, 0, 255, 0.35);
}

.tile.owned-by-man:hover {
    border-color: #00ffff;
    box-shadow: inset 0 0 14px rgba(0, 255, 255, 0.4), 0 0 20px rgba(0, 255, 255, 0.35);
}

.tile.property .color-bar {
    width: 100%;
    height: 10px;
    margin-bottom: 2px;
    border-radius: 1px;
    flex-shrink: 0;
}

.tile-name {
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 0 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.houses {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.6em;
    margin-top: 2px;
    width: 100%;
}

.tile-name.long-text {
    font-size: 0.9em;
    font-weight: 500;
    letter-spacing: 0;
}

.tile-name.extra-long-text {
    font-size: 0.8em;
    font-weight: 400;
    letter-spacing: -0.2px;
    line-height: 1.1;
}

/* Side Panel */
#side-panel {
    width: 380px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: var(--board-size);
    overflow-y: auto;
    padding: 10px 10px 10px 20px;
    /* Added left padding for hover effect */
}

#player-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.player-card {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    transition: transform 0.3s, border-color 0.3s;
    box-shadow: var(--shadow-deep);
}

.player-card.active {
    border-color: var(--player-glow, var(--primary-neon));
    transform: translateX(-10px);
    box-shadow: -3px 0 10px color-mix(in srgb, var(--player-glow, var(--primary-glow)) 60%, transparent);
}

.player-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.player-effects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.effect-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

.effect-badge.effect-half {
    border-color: rgba(212, 175, 55, 0.6);
    color: var(--accent-gold);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

.effect-badge.effect-blindfold {
    border-color: rgba(255, 0, 255, 0.6);
    color: var(--primary-neon);
    box-shadow: 0 0 12px rgba(255, 0, 255, 0.35);
}

.effect-badge.effect-free {
    border-color: rgba(0, 255, 255, 0.6);
    color: var(--secondary-neon);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.35);
}

.effect-badge.effect-jail {
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--text-dim);
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

#controls,
#orgasm-controls {
    background: var(--bg-panel);
    padding: 25px;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-deep);
}

h3 {
    margin-bottom: 15px;
    font-family: 'Playfair Display', serif;
    color: var(--accent-gold);
    font-size: 1.4rem;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(45deg, #ff00ff, #800080);
    border: none;
    color: white;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 15px rgba(255, 0, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(1px);
}

.orgasm-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-orgasm {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-heavy);
    color: var(--text-dim);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-orgasm.woman:hover {
    background: rgba(255, 20, 147, 0.4);
    color: #ff1493;
    border-color: #ff1493;
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.4);
}

.btn-orgasm.man:hover {
    background: rgba(30, 144, 255, 0.4);
    color: #1e90ff;
    border-color: #1e90ff;
    box-shadow: 0 0 15px rgba(30, 144, 255, 0.4);
}

/* Modals */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    z-index: 20000;
    pointer-events: none;
    /* Ensure it's above pawns */
}

#modal-overlay:not(.hidden) {
    pointer-events: all;
}

.modal {
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    width: 500px;
    max-width: 90vw;
    padding: 40px;
    border-radius: 25px;
    border: 2px solid var(--glass-border);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--primary-glow), inset 0 0 20px rgba(255, 0, 255, 0.1);
    text-align: center;
    animation: modal-enter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: all;
    position: absolute;
    left: var(--modal-center-x, 50%);
    top: var(--modal-center-y, 50%);
    transform: translate(-50%, -50%);
    z-index: 10000;
}

@keyframes modal-enter {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

#modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: var(--accent-gold);
}

.action-desc {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 30px;
    color: var(--text-main);
}

.modal-hint {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: -10px;
}

.action-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.action-icon img {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

#timer-display {
    font-size: 4rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    color: var(--secondary-neon);
    text-shadow: 0 0 20px var(--secondary-glow);
    margin: 20px 0;
}

.btn-secondary {
    background: var(--glass-heavy);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--glass-border);
}

/* Pawns */
.player-pawn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
    position: fixed;
    /* Changed from relative to fixed for persistence */
    z-index: 1000;
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none;
}

.player-pawn.moving {
    transition: left 0.25s ease-out, top 0.25s ease-out;
}

.player-pawn::after {
    content: '';
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: -5px;
    right: -5px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.5;
    animation: pulse-glow 2s infinite;
}

/* Center Logo */
.board-logo {
    font-family: 'Playfair Display', serif;
    font-size: 8vh;
    font-weight: 900;
    opacity: 0.15;
    letter-spacing: 20px;
    transform: rotate(-45deg);
    user-select: none;
    background: linear-gradient(45deg, var(--primary-neon), var(--secondary-neon));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    pointer-events: none;
}

/* Dice Animation */
#dice-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.die {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: black;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.rolling {
    animation: die-roll 0.1s infinite;
}

@keyframes die-roll {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

.pulse-once {
    animation: pulse-grow 0.5s ease-out;
}

@keyframes pulse-grow {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.02);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* RL Helper Styles */
#rl-helper {
    width: 100%;
    height: 100%;
    padding: 30px;
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #050507 100%);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-display {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    margin: 30px 0;
    min-height: 250px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-deep);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s;
}

.helper-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 100%;
}

.control-group h3 {
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.placeholder-text {
    font-size: 1.5rem;
    color: var(--text-dim);
    font-style: italic;
}

.btn-timer-preset {
    background: var(--glass-heavy);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-timer-preset:hover,
.btn-timer-preset.active {
    background: var(--secondary-glow);
    border-color: var(--secondary-neon);
    color: white;
}

.btn-stop {
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid rgba(255, 0, 0, 0.4);
    color: #ff4d4d;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
}

.btn-stop-header {
    width: auto;
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 10px;
}

.btn-stop:hover {
    background: rgba(255, 0, 0, 0.25);
    border-color: #ff0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}
