@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: #1a1a3e;
    --bg-card-hover: #222255;
    --accent: #ff4d8d;
    --accent2: #7c3aed;
    --accent3: #06b6d4;
    --gold: #fbbf24;
    --green: #22c55e;
    --red: #ef4444;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #2d2d5e;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(255,77,141,0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; position: relative; z-index: 1; }

/* Header */
.game-header {
    text-align: center;
    padding: 30px 0;
}
.game-header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    letter-spacing: 2px;
}
.game-header .subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white; }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: linear-gradient(135deg, var(--green), #16a34a); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--red), #dc2626); color: white; }
.btn-gold { background: linear-gradient(135deg, var(--gold), #f59e0b); color: #1a1a1a; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 40px; font-size: 1.2rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Cards/Panels */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}
.panel h2, .panel h3 {
    margin-bottom: 16px;
    font-weight: 600;
}

/* Form elements */
input[type="text"], input[type="number"], select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 14px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    width: 100%;
    transition: border-color 0.3s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.9rem; }
.form-group { margin-bottom: 16px; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
    font-size: 0.9rem;
}
.checkbox-label input[type="checkbox"] {
    width: 20px; height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Screen management */
.screen { display: none; }
.screen.active { display: block; }

/* ===== SETUP SCREEN ===== */
.setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
@media (max-width: 900px) { .setup-grid { grid-template-columns: 1fr; } }

.player-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s;
    position: relative;
}
.player-card.active-player { border-color: var(--accent); }
.player-card .player-number {
    position: absolute;
    top: -12px;
    left: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 2px 14px;
    border-radius: 20px;
}
.player-card .remove-player {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: var(--red);
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}
.player-card .remove-player:hover { opacity: 1; }

.gender-select {
    display: flex;
    gap: 8px;
}
.gender-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}
.gender-btn.selected { border-color: var(--accent); background: rgba(255,77,141,0.15); }
.gender-btn:hover { border-color: var(--accent2); }

.clothes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.categories-section { margin-top: 12px; }
.category-group { margin-bottom: 8px; }
.category-group-header {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--accent);
    padding: 4px 0;
    cursor: pointer;
}
.perm-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(45,45,94,0.3);
}
.perm-row.perm-parent {
    background: rgba(124,58,237,0.06);
    border-radius: 6px;
    padding: 6px 4px;
    margin-top: 4px;
}
.perm-row .perm-name { font-size: 0.8rem; }
.perm-header {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}
.perm-check { text-align: center; }
.perm-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.perm-toggle {
    display: inline-block;
    width: 16px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--accent);
    transition: transform 0.2s;
    user-select: none;
}
.perm-group { margin-bottom: 2px; }

/* Settings panel */
.settings-panel { margin-top: 20px; }
.toys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
}
.speed-control {
    display: flex;
    align-items: center;
    gap: 12px;
}
.speed-control input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}

/* ===== GAME BOARD ===== */
.game-layout {
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    gap: 16px;
    margin-top: 16px;
}
@media (max-width: 1100px) {
    .game-layout { grid-template-columns: 1fr; }
}

/* Board */
.board-container { position: relative; }
.board-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
}
.board-field {
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    text-align: center;
    padding: 2px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 60px;
}
.board-field:hover { border-color: var(--accent); transform: scale(1.05); z-index: 2; }
.board-field .field-icon { font-size: 1.2rem; line-height: 1; }
.board-field .field-name { font-size: 0.5rem; color: var(--text-muted); margin-top: 1px; line-height: 1.1; }
.board-field.f-start { background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(22,163,74,0.1)); border-color: var(--green); }
.board-field.f-task { background: rgba(124,58,237,0.1); }
.board-field.f-buy { background: rgba(255,77,141,0.08); }
.board-field.f-tavern { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); }
.board-field.f-friday13 { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); }
.board-field.f-bonus { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); }
.board-field.f-teleporter { background: rgba(6,182,212,0.12); }
.board-field.f-casino { background: rgba(251,191,36,0.15); }
.board-field.f-fairy { background: rgba(168,85,247,0.15); border-color: rgba(168,85,247,0.3); }
.board-field.f-challenge_x2 { background: rgba(255,165,0,0.15); border-color: rgba(255,165,0,0.4); }
.board-field.f-wheel { background: linear-gradient(135deg, rgba(255,77,141,0.1), rgba(124,58,237,0.1)); }
.board-field.f-rivalry { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }
.board-field.f-auction { background: rgba(251,191,36,0.1); }
.board-field.f-bazaar { background: rgba(6,182,212,0.1); }
.board-field.f-extra_turn { background: rgba(34,197,94,0.1); }
.board-field.f-hot_line { background: rgba(255,77,141,0.15); border-color: rgba(255,77,141,0.3); }
.board-field.f-mirror { background: rgba(168,85,247,0.1); }
.board-field.f-secret_mission { background: rgba(100,100,100,0.15); }
.board-field.f-owned { box-shadow: inset 0 -3px 0 var(--owner-color, var(--accent)); }

/* Player tokens on board */
.player-token {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid white;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 6px currentColor;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    letter-spacing: -0.5px;
}
.player-token.moving {
    animation: tokenBounce 0.3s ease;
}
@keyframes tokenBounce {
    0% { transform: scale(1) translateY(0); }
    40% { transform: scale(1.3) translateY(-8px); }
    100% { transform: scale(1) translateY(0); }
}
.player-token.landed {
    animation: tokenLand 0.4s ease;
}
@keyframes tokenLand {
    0% { transform: scale(1); }
    30% { transform: scale(1.5); box-shadow: 0 0 16px currentColor; }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Cash change floating animation */
.cash-float {
    position: fixed;
    font-size: 1.6rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 300;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    animation: cashFloat 1.5s ease-out forwards;
}
.cash-float.positive { color: var(--green); }
.cash-float.negative { color: var(--red); }
@keyframes cashFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    30% { transform: translateY(-20px) scale(1.3); }
    100% { opacity: 0; transform: translateY(-80px) scale(0.8); }
}

/* Stat pulse animation */
.stat-pulse-green {
    animation: pulseGreen 0.6s ease;
}
@keyframes pulseGreen {
    0% { color: var(--text); }
    30% { color: var(--green); transform: scale(1.4); text-shadow: 0 0 12px rgba(34,197,94,0.6); }
    100% { color: var(--text); transform: scale(1); }
}
.stat-pulse-red {
    animation: pulseRed 0.6s ease;
}
@keyframes pulseRed {
    0% { color: var(--text); }
    30% { color: var(--red); transform: scale(1.4); text-shadow: 0 0 12px rgba(239,68,68,0.6); }
    100% { color: var(--text); transform: scale(1); }
}

/* Level up animation */
.level-up-anim {
    animation: levelUp 1s ease;
}
@keyframes levelUp {
    0% { transform: scale(1); }
    20% { transform: scale(1.5); color: var(--gold); text-shadow: 0 0 20px rgba(251,191,36,0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Board field highlight when player lands */
.board-field.field-active {
    animation: fieldGlow 1s ease;
    z-index: 5;
}
@keyframes fieldGlow {
    0% { box-shadow: none; }
    30% { box-shadow: 0 0 20px rgba(255,77,141,0.6), inset 0 0 10px rgba(255,77,141,0.2); transform: scale(1.1); }
    100% { box-shadow: none; transform: scale(1); }
}

/* Player info highlight on turn */
.player-info.turn-glow {
    animation: turnGlow 1.5s ease infinite alternate;
}
@keyframes turnGlow {
    0% { box-shadow: 0 0 8px rgba(251,191,36,0.2); }
    100% { box-shadow: 0 0 20px rgba(251,191,36,0.5), 0 0 40px rgba(251,191,36,0.1); }
}

/* Dice shake */
.dice-btn.shake {
    animation: diceShake 0.15s ease infinite;
}
@keyframes diceShake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg) scale(1.05); }
    50% { transform: rotate(8deg) scale(1.05); }
    75% { transform: rotate(-4deg); }
    100% { transform: rotate(0deg); }
}

/* Strip animation */
.strip-flash {
    animation: stripFlash 0.8s ease;
}
@keyframes stripFlash {
    0% { background: transparent; }
    30% { background: rgba(239,68,68,0.3); }
    100% { background: transparent; }
}

/* Dress animation */
.dress-flash {
    animation: dressFlash 0.8s ease;
}
@keyframes dressFlash {
    0% { background: transparent; }
    30% { background: rgba(34,197,94,0.3); }
    100% { background: transparent; }
}

/* Screen shake for big events */
.screen-shake {
    animation: screenShake 0.4s ease;
}
@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px) rotate(-0.5deg); }
    40% { transform: translateX(6px) rotate(0.5deg); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Modal entrance with more drama */
.modal.modal-dramatic {
    animation: modalDramatic 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalDramatic {
    0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
    60% { transform: scale(1.05) rotate(1deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Confetti burst for big wins */
.confetti-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 250;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confettiFall 2s ease-out forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Player sidebar */
.players-sidebar .player-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.3s;
}
.players-sidebar .player-info.current-turn {
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(251,191,36,0.2);
}
.player-info .pi-name {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.player-info .pi-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.player-info .pi-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.player-info .pi-stat-val { font-weight: 600; color: var(--text); }
.player-info .pi-clothes {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 6px;
}
.cloth-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(124,58,237,0.2);
    color: var(--accent2);
}
.cloth-tag.stripped { background: rgba(239,68,68,0.2); color: var(--red); text-decoration: line-through; }

.player-info .pi-buffs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}
.buff-tag {
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(34,197,94,0.2);
    color: var(--green);
}
.buff-tag.debuff { background: rgba(239,68,68,0.2); color: var(--red); }

/* Game info sidebar */
.info-status-row {
    display: contents; /* on desktop, children flow normally in sidebar */
}
.game-info-sidebar .info-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
}
.info-block h4 {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 8px;
}

/* Dice */
.dice-area {
    text-align: center;
    padding: 16px;
}
.dice-btn {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    border: 3px solid var(--accent);
    background: var(--bg-card);
    color: white;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.dice-btn:hover { background: var(--bg-card-hover); transform: scale(1.05); box-shadow: 0 0 20px rgba(255,77,141,0.3); }
.dice-btn.rolling { animation: diceRoll 0.5s ease; }
@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}
.dice-result {
    font-size: 1.2rem;
    margin-top: 8px;
    color: var(--gold);
    font-weight: 600;
}

/* Log */
.game-log {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.75rem;
}
.game-log .log-entry {
    padding: 3px 0;
    border-bottom: 1px solid rgba(45,45,94,0.5);
    color: var(--text-muted);
}
.game-log .log-entry .log-highlight { color: var(--accent); font-weight: 600; }

/* ===== MODALS / OVERLAYS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    text-align: center;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Task card display */
.task-display {
    background: linear-gradient(135deg, var(--bg-card), rgba(124,58,237,0.1));
    border: 2px solid var(--accent2);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin: 16px 0;
}
.task-display .task-level {
    font-size: 0.8rem;
    color: var(--gold);
    margin-bottom: 8px;
}
.task-display .task-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 12px;
}
.task-display .task-price {
    font-size: 0.9rem;
    color: var(--green);
}
.task-display .task-penalty {
    font-size: 0.9rem;
    color: var(--red);
    margin-top: 4px;
}
.task-display .task-time {
    font-size: 0.8rem;
    color: var(--accent3);
    margin-top: 4px;
}

.player-task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 10px;
    margin: 6px 0;
    transition: all 0.3s ease;
}
.player-task-row[data-status="done"] {
    border-color: var(--green);
    background: rgba(34,197,94,0.15);
}
.player-task-row[data-status="fail"] {
    border-color: var(--red);
    background: rgba(239,68,68,0.15);
}
.player-task-row .ptr-name { font-weight: 600; font-size: 1rem; }
.player-task-row .ptr-actions { display: flex; gap: 8px; }
.player-task-row .ptr-actions .btn { transition: all 0.2s; }
.player-task-row .ptr-actions .btn.btn-secondary { opacity: 0.5; }

/* Wheel animation */
.wheel-container {
    width: 280px;
    height: 280px;
    margin: 20px auto;
    position: relative;
}
.wheel-spinner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--accent);
    position: relative;
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    overflow: hidden;
}
.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    z-index: 5;
}

/* Toast notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 24px;
    z-index: 200;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    animation: toastIn 0.3s ease;
    font-size: 0.9rem;
    max-width: 350px;
}
.toast.toast-success { border-color: var(--green); }
.toast.toast-danger { border-color: var(--red); }
.toast.toast-info { border-color: var(--accent3); }
@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Tooltip */
.tip-trigger { cursor: help; position: relative; }
.game-tooltip {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text);
    max-width: 280px;
    z-index: 150;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    pointer-events: none;
    animation: tipIn 0.15s ease;
    line-height: 1.4;
}
@keyframes tipIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Misc */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex-center { display: flex; align-items: center; justify-content: center; gap: 10px; }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 600; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent2); }

/* Turn indicator */
.turn-banner {
    text-align: center;
    padding: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    margin-bottom: 10px;
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.3);
}

/* Countdown timer */
.countdown {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent3);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Rivalry mini-game */
.rivalry-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}
.rivalry-option {
    padding: 20px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 2rem;
}
.rivalry-option:hover { border-color: var(--accent); background: rgba(255,77,141,0.1); }

/* Event animation */
.event-icon {
    font-size: 4rem;
    text-align: center;
    margin: 16px 0;
    animation: bounce 0.6s ease;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab-btn {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    transition: all 0.3s;
}
.tab-btn.active { background: var(--bg-card); color: var(--accent); border-bottom-color: var(--bg-card); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Auction */
.auction-bids {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.auction-bid-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 8px;
}

/* ===== MOBILE RESPONSIVE ===== */

/* Prevent horizontal scrolling */
html, body { overflow-x: hidden; max-width: 100vw; }

@media (max-width: 768px) {
    .container { padding: 8px; }

    /* Header */
    .game-header h1 { font-size: 1.8rem; }
    .game-header .subtitle { font-size: 0.8rem; }
    .game-header[style*="display:flex"] {
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* Buttons */
    .btn { padding: 10px 16px; font-size: 0.85rem; }
    .btn-lg { padding: 14px 24px; font-size: 1rem; }
    .btn-sm { padding: 6px 10px; font-size: 0.75rem; }
    .flex-center { flex-direction: column; width: 100%; }
    .flex-center .btn { width: 100%; justify-content: center; }

    /* Panels */
    .panel { padding: 14px; border-radius: 12px; }

    /* Setup screen */
    .setup-grid { grid-template-columns: 1fr; gap: 12px; }
    .player-card { padding: 14px; }
    .gender-select .gender-btn { padding: 8px; font-size: 0.85rem; }
    .clothes-grid { grid-template-columns: 1fr; }
    .perm-row { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2px; font-size: 0.7rem; }
    .perm-row .perm-name { font-size: 0.7rem; }
    .perm-header { font-size: 0.6rem; }
    .perm-check input { width: 14px; height: 14px; }
    .toys-grid { grid-template-columns: 1fr; }
    .preset-btn { padding: 10px 12px !important; }
    .preset-btn span:last-child { font-size: 0.65rem !important; }

    /* Game layout - stack everything vertically */
    .game-layout {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    /* Reorder: dice first, then board, then players, then log */
    .game-layout { display: flex; flex-direction: column; }
    .game-info-sidebar { order: 1; }
    .board-container { order: 2; }
    .players-sidebar { order: 3; }

    /* Board - smaller grid */
    .board-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 2px;
        padding: 4px;
    }
    .board-field {
        min-height: 40px;
        border-radius: 5px;
        padding: 1px;
    }
    .board-field .field-icon { font-size: 0.9rem; }
    .board-field .field-name { font-size: 0; /* hide names, just icons */ }
    .board-field:hover { transform: none; } /* no hover zoom on mobile */

    /* Tokens */
    .player-token {
        width: 20px;
        height: 20px;
        font-size: 0.45rem;
    }

    /* Players - stacked vertically */
    .players-sidebar {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .players-sidebar .player-info {
        padding: 8px 10px;
        margin-bottom: 0;
    }
    .player-info .pi-name { font-size: 0.8rem; }
    .player-info .pi-stats { font-size: 0.65rem; gap: 2px; }
    .player-info .pi-clothes { gap: 2px; }
    .cloth-tag { font-size: 0.55rem; padding: 1px 4px; }
    .buff-tag { font-size: 0.5rem; padding: 1px 4px; }

    /* Dice - full width button on mobile */
    .dice-area { padding: 6px; }

    /* Game info - reorder: status+history on top, dice below (closest to board) */
    .game-info-sidebar {
        display: flex;
        flex-direction: column;
        gap: 6px;
        order: 1;
    }
    .info-status-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .info-block-status, .info-block-log {
        padding: 8px !important;
        margin-bottom: 0 !important;
    }
    .info-block-status h4, .info-block-log h4 { font-size: 0.75rem; margin-bottom: 4px; }
    .info-block-status div { font-size: 0.7rem !important; }
    .info-block-dice {
        padding: 8px !important;
        margin-bottom: 0 !important;
    }
    .info-block-dice .dice-btn {
        width: 100%;
        height: 56px;
        border-radius: 12px;
        font-size: 2rem;
    }
    .info-block-dice .dice-result { font-size: 0.9rem; margin-top: 4px; }
    .game-log { max-height: 120px; }

    /* Turn banner */
    .turn-banner { font-size: 0.9rem; padding: 6px; }

    /* Modal */
    .modal {
        max-width: 95vw;
        padding: 14px;
        border-radius: 14px;
        max-height: 90vh;
    }
    .modal h2 { font-size: 1rem; margin-bottom: 10px; }
    .modal p { font-size: 0.8rem; }
    .modal-body { font-size: 0.8rem; }
    .modal-actions { gap: 6px; }
    .modal-actions .btn { flex: 1; min-width: 0; text-align: center; justify-content: center; font-size: 0.8rem; padding: 8px 10px; }
    .task-display { padding: 10px; margin: 8px 0; }
    .task-display .task-level { font-size: 0.7rem; }
    .task-display .task-text { font-size: 0.85rem; line-height: 1.4; }
    .task-display .task-price, .task-display .task-penalty, .task-display .task-time { font-size: 0.75rem; }
    .player-task-row { padding: 6px 8px; }
    .player-task-row .ptr-name { font-size: 0.8rem; }
    .player-task-row .ptr-actions { gap: 3px; }
    .player-task-row .ptr-actions .btn { padding: 5px 7px; font-size: 0.65rem; }

    /* Events */
    .event-icon { font-size: 2rem; margin: 8px 0; }
    .rivalry-options { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .rivalry-option { padding: 10px; font-size: 1.2rem; }

    /* Casino memory */
    .casino-card { padding: 8px !important; font-size: 1.2rem !important; }

    /* Toast */
    .toast { max-width: 85vw; right: 10px; top: 10px; font-size: 0.8rem; padding: 10px 14px; }

    /* Tooltip */
    .game-tooltip { max-width: 250px; font-size: 0.75rem; }

    /* Cash float */
    .cash-float { font-size: 1.2rem; }

    /* Audio controls */
    .audio-controls { font-size: 0.65rem !important; }
    .audio-controls .btn { padding: 4px 8px !important; font-size: 0.7rem !important; }
    .audio-controls input[type="range"] { width: 40px !important; }

    /* Force all inline 2-col grids to 1-col on mobile */
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Wheel & casino segments - 2 cols instead of 4 */
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Settings 2-col grid */
    [style*="display:grid"][style*="gap:16px"] {
        grid-template-columns: 1fr !important;
    }
}

/* Extra small screens (iPhone SE etc.) */
@media (max-width: 400px) {
    .game-header h1 { font-size: 1.4rem; }
    .board-grid { grid-template-columns: repeat(6, 1fr); }
    .board-field { min-height: 35px; }
    .board-field .field-icon { font-size: 0.75rem; }
    .players-sidebar .player-info { min-width: 160px; }
    .dice-btn { width: 64px; height: 64px; font-size: 1.6rem; }
    .modal { padding: 12px; }
    .modal h2 { font-size: 1rem; }
    .perm-row { grid-template-columns: 1.2fr 1fr 1fr 1fr; }
}
