/* ============================================
   LADDER SNAKE - MOBILE FIRST DESIGN
   ============================================ */

/* === VARIABLES === */
:root {
    --bg-color: #0f172a;
    --primary: #6366f1;
    --accent: #f43f5e;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --cell-1: #1e293b;
    --cell-2: #334155;
    --success: #22c55e;
    --warning: #fbbf24;
    --danger: #ef4444;
}

/* === RESET & BASE === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    background: var(--bg-color);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(244, 63, 94, 0.15), transparent 25%);
}

/* === UTILITIES === */
.hidden {
    display: none !important;
}

/* === APP CONTAINER === */
.app-container {
    width: 100%;
    min-height: 100vh;
    padding: 16px;
}

/* === SCREENS === */
.screen {
    display: none;
    width: 100%;
    min-height: calc(100vh - 32px);
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === LOGIN PAGE FESTIVE === */
.login-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.float-icon {
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    animation: floatAround 8s ease-in-out infinite;
}

.float-icon:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.float-icon:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 1.5s;
}

.float-icon:nth-child(3) {
    bottom: 30%;
    left: 5%;
    animation-delay: 3s;
}

.float-icon:nth-child(4) {
    bottom: 15%;
    right: 10%;
    animation-delay: 4.5s;
}

.float-icon:nth-child(5) {
    top: 50%;
    left: 50%;
    animation-delay: 6s;
}

@keyframes floatAround {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(10px, -15px) rotate(5deg);
    }

    50% {
        transform: translate(-5px, 10px) rotate(-3deg);
    }

    75% {
        transform: translate(-10px, -5px) rotate(3deg);
    }
}

.login-card {
    text-align: center;
    position: relative;
    z-index: 1;
    animation: cardPop 0.6s ease-out;
}

@keyframes cardPop {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

.game-logo {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.login-card h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.login-card .subtitle {
    font-size: 0.95rem;
    margin-bottom: 24px;
    color: var(--text-muted);
}

.login-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === GLASS CARDS === */
.glass-card,
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
}

.glass-panel {
    max-width: 100%;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
}

/* === TYPOGRAPHY === */
h1,
h2,
h3 {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.1rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.user-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

#my-nickname {
    color: var(--warning);
    font-weight: 600;
}

/* === FORM ELEMENTS === */
input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 16px;
    /* Prevents iOS zoom */
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* === BUTTONS === */
.btn-primary,
.btn-action {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    min-height: 48px;
}

.btn-primary:active,
.btn-action:active {
    transform: scale(0.98);
}

.btn-primary:disabled,
.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-secondary {
    width: 100%;
    padding: 14px 24px;
    background: rgba(100, 116, 139, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
}

/* Icon Buttons */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

.btn-icon-small {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 6px 10px;
    color: white;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

#nickname-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#nickname-edit input {
    width: 100px;
    padding: 6px 10px;
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* === LOBBY SCREEN === */
#lobby-screen .glass-panel {
    padding: 20px;
}

#lobby-screen header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.lobby-content {
    flex: 1;
    overflow-y: auto;
}

.player-list-container h3 {
    color: white;
    margin-bottom: 4px;
}

.hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

#online-players-list {
    list-style: none;
}

#online-players-list li {
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#online-players-list li.selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

#lobby-screen footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

/* === INVITE STATUS PANEL === */
.invite-status-panel {
    margin-top: 16px;
    padding: 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
}

.invite-status-panel h3 {
    margin-bottom: 12px;
    color: white;
}

#invite-status-list {
    list-style: none;
    margin-bottom: 12px;
}

#invite-status-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 6px;
}

.status-pending {
    color: var(--warning);
}

.status-accepted {
    color: var(--success);
}

.status-declined {
    color: var(--danger);
}

.invite-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === INVITE POPUP === */
.invite-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

.invite-popup-content {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(244, 63, 94, 0.2));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    width: 100%;
    max-width: 320px;
}

.invite-popup-content h3 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.invite-popup-content p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

#invite-host-name {
    color: var(--warning);
    font-weight: 600;
}

.invite-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* === GAME SCREEN === */
#game-screen {
    padding: 0;
}

#game-screen.active {
    justify-content: flex-start;
}

#chaos-timer-container {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 100;
}

#chaos-timer {
    color: var(--warning);
    font-weight: 700;
}

.game-layout {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    order: 2;
}

.glass-card.mini {
    padding: 12px;
    border-radius: 12px;
}

.glass-card.mini h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

#game-player-list {
    list-style: none;
    font-size: 0.85rem;
}

#game-player-list li {
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

.glass-card.mini.controls {
    text-align: center;
}

#turn-indicator {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.dice {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 8px 0;
}

.dice.rolling {
    animation: shake 0.3s infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(10deg);
    }

    75% {
        transform: rotate(-10deg);
    }
}

.glass-card.mini.log {
    max-height: 120px;
    overflow-y: auto;
}

#game-log {
    font-size: 0.75rem;
    display: flex;
    flex-direction: column-reverse;
}

.log-entry {
    padding: 4px 8px;
    margin-bottom: 2px;
    border-radius: 4px;
    border-left: 2px solid var(--text-muted);
}

.log-info {
    border-left-color: var(--text-muted);
}

.log-success {
    border-left-color: var(--success);
    color: var(--success);
}

.log-warning {
    border-left-color: var(--warning);
    color: var(--warning);
}

.log-danger {
    border-left-color: var(--danger);
    color: var(--danger);
}

/* === GAME BOARD === */
.board-container {
    order: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: calc(100vw - 48px);
    height: calc(100vw - 48px);
    max-width: 400px;
    max-height: 400px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    position: relative;
}

.cell {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cell.odd {
    background: var(--cell-1);
}

.cell.even {
    background: var(--cell-2);
}

#board-overlay {
    position: absolute;
    width: calc(100vw - 48px);
    height: calc(100vw - 48px);
    max-width: 400px;
    max-height: 400px;
    pointer-events: none;
}

.player-token {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    position: absolute;
    transition: all 0.4s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.effect-snake {
    animation: snakeEffect 0.5s ease;
    border-color: var(--danger) !important;
}

.effect-ladder {
    animation: ladderEffect 0.5s ease;
    border-color: var(--warning) !important;
}

@keyframes snakeEffect {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
        filter: hue-rotate(90deg);
    }
}

@keyframes ladderEffect {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
        box-shadow: 0 0 20px var(--warning);
    }
}

/* === INITIATIVE OVERLAY === */
.initiative-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 2000;
}

.initiative-overlay.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.initiative-content {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(244, 63, 94, 0.2));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.initiative-content h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--warning);
}

#initiative-rolls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.initiative-roll-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.initiative-roll-item .player-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    text-align: left;
}

.dice-container {
    display: flex;
    gap: 4px;
}

.dice-container .die {
    width: 28px;
    height: 28px;
    background: var(--cell-1);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
}

.dice-container .die.rolling {
    animation: diceRoll 0.2s infinite;
}

@keyframes diceRoll {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(15deg);
    }
}

.dice-container .die.revealed {
    background: var(--warning);
    color: var(--bg-color);
}

.roll-total {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 45px;
    text-align: right;
}

.roll-total.revealed {
    color: var(--success);
}

#initiative-result {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#initiative-result h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: white;
}

#initiative-result ol {
    list-style: none;
    text-align: left;
}

#initiative-result ol li {
    padding: 6px 0;
    font-weight: 600;
}

/* === MODALS === */
.winner-modal,
.loser-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

.winner-content,
.loser-content {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(244, 63, 94, 0.2));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 32px 24px;
    text-align: center;
    width: 100%;
    max-width: 320px;
    animation: contentPop 0.5s ease;
}

@keyframes contentPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

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

.trophy {
    font-size: 4rem;
    animation: bounce 1s infinite;
}

.loser-emoji {
    font-size: 3.5rem;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.winner-title {
    font-size: 2rem;
    margin: 16px 0 8px;
    background: linear-gradient(135deg, var(--warning), #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.loser-title {
    font-size: 1.8rem;
    color: var(--text-muted);
    margin: 16px 0 8px;
}

.winner-name {
    font-size: 1.4rem;
    color: white;
}

.loser-text {
    font-size: 1.2rem;
    color: var(--text);
}

.loser-text span {
    color: var(--warning);
    font-weight: 600;
}

.winner-subtitle,
.loser-subtitle {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.winner-stars {
    font-size: 1.5rem;
    margin: 12px 0;
}

#confetti-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    top: -10px;
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* === DESKTOP ENHANCEMENTS === */
@media (min-width: 768px) {
    .app-container {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 24px;
    }

    .glass-card {
        padding: 40px;
    }

    .glass-panel {
        max-width: 600px;
        padding: 32px;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .game-layout {
        flex-direction: row;
        max-width: 1200px;
        margin: 0 auto;
    }

    .game-sidebar {
        width: 280px;
        order: 1;
    }

    .board-container {
        flex: 1;
        order: 2;
    }

    .game-board,
    #board-overlay {
        width: 500px;
        height: 500px;
        max-width: 500px;
        max-height: 500px;
    }

    .cell {
        font-size: 0.75rem;
    }

    .player-token {
        width: 20px;
        height: 20px;
    }

    .dice {
        font-size: 3rem;
    }

    .glass-card.mini.log {
        max-height: 200px;
    }

    .initiative-content {
        max-width: 450px;
        padding: 40px;
    }

    .dice-container .die {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .winner-content,
    .loser-content {
        max-width: 400px;
        padding: 48px 40px;
    }

    .trophy {
        font-size: 5rem;
    }

    .winner-title {
        font-size: 2.5rem;
    }

    .invite-popup-actions,
    .invite-actions {
        flex-direction: row;
    }

    .invite-popup-actions .btn-primary,
    .invite-popup-actions .btn-secondary,
    .invite-actions .btn-primary,
    .invite-actions .btn-secondary {
        flex: 1;
    }
}

@media (min-width: 1024px) {

    .game-board,
    #board-overlay {
        width: 600px;
        height: 600px;
        max-width: 600px;
        max-height: 600px;
    }

    .cell {
        font-size: 0.85rem;
    }

    .player-token {
        width: 24px;
        height: 24px;
    }
}

/* === TABBED SIDEBAR === */
.sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3), transparent);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(244, 63, 94, 0.3));
    border-color: rgba(99, 102, 241, 0.5);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    max-height: 100px;
    background: rgba(0, 0, 0, 0.2);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.tab-panel.active {
    display: block;
}

/* === STICKY LAYOUT ENHANCEMENTS === */

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-left,
.header-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.game-brand {
    font-size: 2rem;
    animation: bounce 3s infinite;
}

.timer-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timer-value {
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.badge-warning {
    color: var(--warning);
}

/* Main Board Area */
.game-main {
    padding-top: 80px;
    /* Header height + spacing */
    padding-bottom: 100px;
    /* Footer height + spacing */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.board-wrapper {
    position: relative;
    width: max-content;
    margin: 0 auto;
    /* Removed padding to ensure absolute overlay aligns with flow content */
}

#board-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Sticky Footer */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    overflow: visible;
    /* Prevent clipping of raised dice panel */
}

.footer-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.footer-btn:active {
    transform: scale(0.9);
}

.footer-btn .btn-label {
    font-size: 0.75rem;
    font-weight: 600;
}

.footer-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 10px;
}

/* Dice Card - Responsive Container */
.dice-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.turn-status {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.turn-status.active {
    color: #4ade80;
}

/* Dice Display */
.dice-display {
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #fff, #e2e8f0);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

.dice-number {
    font-size: 1.8rem;
    font-weight: 900;
    color: #1e293b;
    font-family: 'Outfit', sans-serif;
}

.dice-display.rolling .dice-number {
    animation: diceFlip 0.1s infinite;
}

@keyframes diceFlip {

    0%,
    100% {
        transform: rotateY(0);
    }

    50% {
        transform: rotateY(180deg);
    }
}

/* Roll Button */
.roll-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.roll-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.roll-button:disabled {
    background: linear-gradient(135deg, #475569, #334155);
    opacity: 0.7;
    cursor: not-allowed;
}

.roll-icon {
    font-size: 1rem;
}

.roll-text {
    font-size: 0.7rem;
}

/* Desktop Adjustments */
@media (min-width: 768px) {
    .dice-card {
        padding: 16px 24px;
        min-width: 120px;
    }

    .dice-display {
        width: 60px;
        height: 60px;
    }

    .dice-number {
        font-size: 2.2rem;
    }

    .roll-button {
        padding: 10px 28px;
        font-size: 0.85rem;
    }

    .turn-status {
        font-size: 0.75rem;
        max-width: 120px;
    }
}

.btn-action {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === BOTTOM SHEETS (Players & Log Popups) === */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, #1e293b, #0f172a);
    border-radius: 24px 24px 0 0;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 -15px 50px rgba(0, 0, 0, 0.6);
}

.bottom-sheet.hidden {
    /* Keep hidden but ready to animate */
    transform: translateY(100%);
}

.bottom-sheet.open {
    transform: translateY(0);
}

/* Sheet Handle/Drag Indicator */
.sheet-header {
    padding: 12px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.sheet-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.sheet-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.close-sheet {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-sheet:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.sheet-content {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 50vh;
}

/* Player List in Sheet */
.sheet-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sheet-content li {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 10px;
    border-left: 4px solid;
    font-size: 0.9rem;
}

/* Game Log in Sheet */
.sheet-content #game-log {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-entry {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    border-left: 3px solid;
}

.log-info {
    border-color: #6366f1;
}

.log-success {
    border-color: #22c55e;
}

.log-warning {
    border-color: #f59e0b;
}

.log-danger {
    border-color: #ef4444;
}

/* Overlay */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Desktop Adjustments */
@media (min-width: 768px) {
    .dice-control {
        width: 100px;
        height: 100px;
        top: -25px;
    }

    .dice-control .dice {
        font-size: 2.5rem;
    }

    /* On desktop, maybe show sidebars instead of bottom sheets? 
       For now, let's keep bottom sheets as 'slide-ins' or modals for consistency 
       or just center the board. */

    .game-main {
        align-items: center;
    }
}