:root {
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --secondary-hover: #059669;

    /* Resources */
    --res-wood-base: #14532d;
    --res-brick-base: #7f1d1d;
    --res-wool-base: #22c55e;
    --res-wheat-base: #eab308;
    --res-ore-base: #475569;

    --res-wood-text: #86efac;
    --res-brick-text: #fca5a5;
    --res-wool-text: #064e3b;
    --res-wheat-text: #713f12;
    --res-ore-text: #f1f5f9;

    /* Hexagon Background */
    --hex-color: rgba(59, 130, 246, 0.1);
    --hex-glow: rgba(59, 130, 246, 0.3);
}

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

/* Custom Scrollbar - Estilo Premium */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.35);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: content-box;
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.55);
    border: 2px solid transparent;
    background-clip: content-box;
}

/* Firefox Support */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.35) rgba(15, 23, 42, 0.4);
}

body {
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at center, #1e293b, var(--bg-dark));
    color: var(--text-main);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Background Hexagons */
#bg-hex-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1s ease;
}

#bg-hex-container.visible {
    opacity: 1;
}

.bg-hexagon {
    position: absolute;
    width: 100px;
    height: 115px;
    background-color: var(--hex-color);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: hexFade 8s ease-in-out infinite;
    filter: drop-shadow(0 0 10px var(--hex-glow));
}

@keyframes hexFade {

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

    50% {
        opacity: 1;
        transform: scale(1.1) rotate(10deg);
        filter: drop-shadow(0 0 20px var(--hex-glow));
    }
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: relative;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 2.2rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.05);
    text-align: center;
    max-width: 480px;
    width: 90%;
    position: relative;
    z-index: 10;
    animation: panelAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes panelAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

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

.fullscreen-toggle,
.btn-sound-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    margin-left: 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

.fullscreen-toggle.login-fs,
.fullscreen-toggle.lobby-fs {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    margin-left: 0;
}

.fullscreen-toggle:hover,
.btn-sound-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.2rem;
}

.app-logo {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {

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

    50% {
        transform: translateY(-5px) rotate(3deg);
    }
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 0;
    text-align: center;
    line-height: 1.1;
    background: linear-gradient(to bottom, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

h2 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: var(--primary);
    text-align: center;
}

p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-align: center;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input[type="text"] {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

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

.btn {
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

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

.primary {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.primary:hover:not(.disabled) {
    background: linear-gradient(135deg, #4f87ff, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.secondary {
    background: linear-gradient(135deg, var(--secondary), #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.secondary:hover:not(.disabled) {
    background: linear-gradient(135deg, #12d393, #10b981);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn.danger:hover:not(.disabled) {
    background: linear-gradient(135deg, #f87171, #ef4444);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn.success:hover:not(.disabled) {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.divider {
    margin: 0.8rem 0;
    position: relative;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider span {
    background: var(--bg-panel);
    padding: 0 1rem;
    position: relative;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.join-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.join-group button#btn-join-room {
    flex: 0.6;
}

.input-wrapper {
    position: relative;
    flex: 1.5;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.input-wrapper input {
    background: transparent !important;
    border: none !important;
    padding-right: 0.5rem !important;
}

.input-wrapper .btn-icon {
    background: transparent;
    border: none;
    padding: 0.5rem;
    margin-right: 0.3rem;
    font-size: 1rem;
    opacity: 0.6;
    backdrop-filter: none;
}

.input-wrapper .btn-icon:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
    box-shadow: none;
}

#room-code-display {
    font-size: 2.2rem;
    letter-spacing: 4px;
    color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    margin: 0;
    user-select: all;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(59, 130, 246, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(59, 130, 246, 0.1);
    font-weight: 800;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(4px);
}

.btn-icon:hover {
    background: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

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

.players-list-container {
    margin: 1.5rem 0;
    text-align: center;
}

.players-list-container h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

#lobby-players-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    list-style: none;
    padding: 0;
}

#lobby-players-list li {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    animation: playerJoin 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#lobby-players-list li:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

#lobby-players-list li::before {
    content: '👤';
    font-size: 1rem;
}

@keyframes playerJoin {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }

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

.lobby-player-item {
    position: relative;
    padding-right: 2.5rem !important;
    /* Espacio para la X */
}

.btn-kick {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.8;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-kick:hover {
    background: #dc2626;
    transform: translateY(-50%) scale(1.15);
    opacity: 1;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.btn-kick:active {
    transform: translateY(-50%) scale(0.9);
}

.btn-icon.copied {
    background: var(--secondary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

@keyframes pulsateGlow {
    0% {
        box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 25px rgba(59, 130, 246, 0.8);
        transform: scale(1.02);
    }

    100% {
        box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
        transform: scale(1);
    }
}

#btn-start-game:not(.hidden) {
    animation: pulsateGlow 2s infinite ease-in-out;
}

.host-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

/* Game Layout - New Structure */
.game-layout.active {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    align-items: stretch;
    background: transparent;
    padding: 0;
    overflow: hidden;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-panel);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    height: 60px;
    flex-shrink: 0;
}

.horizontal-players-list {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

.horizontal-players-list li {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.middle-section {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    min-height: 0;
}

.middle-section .sidebar-left,
.middle-section .sidebar-right {
    width: 280px;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.middle-section .sidebar-right {
    width: 320px;
}

.bottom-bar {
    min-height: 130px;
    height: auto;
    background: var(--bg-panel);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    flex-shrink: 0;
    gap: 0.75rem;
    overflow: visible;
}

.bottom-bar .resources-grid {
    display: flex;
    gap: 0.65rem;
    align-items: stretch;
    height: 100%;
}

.board-container {
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-grow: 1;
    min-width: 400px;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    cursor: grab;
}

.board-container:active {
    cursor: grabbing;
}

#game-board {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-origin: center center;
}

/* Action Log */
.action-log-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#action-log {
    flex-grow: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-entry {
    padding: 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--primary);
    animation: fadeIn 0.3s ease-out;
}

.log-entry.sistema {
    border-left-color: #64748b;
}

/* Sidebar & Cards */
.sidebar-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.sidebar-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(30, 41, 59, 0.7);
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 1rem;
}

/* Action Buttons */
.action-btn.primary-action {
    width: 100%;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    border: none;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.cost-hint {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: normal;
}


/* Trade Buttons */
.trade-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.trade-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.trade-btn.bank {
    background: rgba(5, 150, 105, 0.15);
    border: 1px solid rgba(5, 150, 105, 0.3);
    color: #34d399;
}

.trade-btn.bank:hover:not(.disabled) {
    background: rgba(5, 150, 105, 0.25);
    transform: translateY(-2px);
}

.trade-btn.p2p {
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: #a78bfa;
}

.trade-btn.p2p:hover:not(.disabled) {
    background: rgba(124, 58, 237, 0.25);
    transform: translateY(-2px);
}

/* Dice */
.dice-section-wrapper {
    position: relative;
    padding: 1.5rem 0;
    display: flex;
    justify-content: center;
}

/* Nudge Button in Dice Section */
.nudge-container {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 20;
}

.btn-nudge-small {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(4px);
}

.btn-nudge-small:hover {
    background: #6366f1;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.nudge-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #1e293b;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(5px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 8px;
}

.nudge-container:hover .nudge-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.dice-tooltip {
    position: absolute;
    top: -10px;
    background: #6366f1;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    animation: bounce 2s infinite;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}

.dice-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #6366f1;
}

.dice-container {
    display: flex;
    gap: 1.25rem;
    padding: 0.5rem;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dice-container.clickable {
    cursor: pointer;
}

.dice-container.clickable:hover {
    transform: scale(1.05);
}

.dice-container.clickable:active {
    transform: scale(0.95);
}

.dice-container.disabled {
    cursor: default;
    opacity: 0.7;
    filter: grayscale(0.5);
    transform: none !important;
}

.die {
    width: 64px;
    height: 64px;
    background: white;
    border-radius: 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 8px;
    gap: 4px;
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.1), 0 8px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: transform 0.1s;
}

.die-dot {
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: 50%;
    transition: background 0.2s;
}

.die-dot.active {
    background: #1e293b;
}

@keyframes bounce {

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

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

    60% {
        transform: translateY(-5px);
    }
}

/* Animaciones de Obtención de Recursos */
@keyframes res-gain-bounce {
    0% {
        transform: scale(1);
        box-shadow: inherit;
        filter: brightness(1);
    }

    15% {
        transform: scale(1.22);
        box-shadow: 0 0 28px 8px rgba(255, 255, 255, 0.6), 0 0 55px 14px rgba(255, 255, 255, 0.2);
        filter: brightness(1.5) saturate(1.35);
    }

    35% {
        transform: scale(0.94);
        box-shadow: 0 0 18px 5px rgba(255, 255, 255, 0.35);
        filter: brightness(1.2);
    }

    55% {
        transform: scale(1.1);
        box-shadow: 0 0 22px 6px rgba(255, 255, 255, 0.4);
        filter: brightness(1.3);
    }

    75% {
        transform: scale(0.97);
        box-shadow: 0 0 10px 3px rgba(255, 255, 255, 0.15);
        filter: brightness(1.1);
    }

    100% {
        transform: scale(1);
        box-shadow: inherit;
        filter: brightness(1);
    }
}

.res-gain-animation {
    animation: res-gain-bounce 1.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 5;
}

/* Texto flotante encima de la carta — coloreado según recurso */
.floating-gain-text {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 800;
    font-size: 1.05rem;
    color: #4ade80;
    pointer-events: none;
    z-index: 200;
    animation: floatUpFade 3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 12px currentColor;
    letter-spacing: 0.03em;
    border-radius: 20px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

/* Colores específicos por recurso */
.floating-gain-text.res-wood {
    color: #4ade80;
}

.floating-gain-text.res-brick {
    color: #fca5a5;
}

.floating-gain-text.res-wool {
    color: #bbf7d0;
}

.floating-gain-text.res-wheat {
    color: #fde047;
}

.floating-gain-text.res-ore {
    color: #cbd5e1;
}

.floating-gain-text.res-devcards {
    color: #a5b4fc;
}

@keyframes floatUpFade {
    0% {
        transform: translate(-50%, 0) scale(0.6);
        opacity: 0;
    }

    10% {
        transform: translate(-50%, -10px) scale(1.18);
        opacity: 1;
    }

    40% {
        transform: translate(-50%, -28px) scale(1.05);
        opacity: 1;
    }

    75% {
        transform: translate(-50%, -42px) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -65px) scale(0.9);
        opacity: 0;
    }
}

/* Animación de resaltado de hexágonos */
@keyframes hex-glow-bounce {

    0%,
    100% {
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8)) brightness(1.4);
    }
}

.hex-highlight {
    animation: hex-glow-bounce 0.8s ease-in-out infinite;
}

.hex-highlight circle.hex-num-bg {
    stroke: #fff !important;
    stroke-width: 2px !important;
}

/* Resources Grid */
.resources-grid {
    display: flex;
    gap: 0.65rem;
    align-items: stretch;
}

.resource-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
    min-width: 76px;
    cursor: default;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.resource-card:not(.desarrollo) {
    overflow: visible;
}

.resource-card.desarrollo {
    overflow: visible;
}

.resource-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.07) 0%, transparent 60%);
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}

/* Buy DevCard Icon Styles */
.buy-devcard-container {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 30;
}

.btn-buy-small {
    background: #4f46e5;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn-buy-small:hover:not(.disabled) {
    background: #6366f1;
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
}

.btn-buy-small.disabled {
    background: #334155;
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(1);
    box-shadow: none;
}

.buy-tooltip {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(5px);
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    z-index: 100;
}

.buy-devcard-container:hover .buy-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.resource-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.res-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.res-icon svg {
    width: 100%;
    height: 100%;
}

.res-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.75;
    line-height: 1;
}

.res-count {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    transition: transform 0.15s ease;
}

.madera {
    background: linear-gradient(145deg, #14532d, #166534);
    color: var(--res-wood-text);
    border-color: rgba(74, 222, 128, 0.2);
}

.arcilla {
    background: linear-gradient(145deg, #7f1d1d, #991b1b);
    color: var(--res-brick-text);
    border-color: rgba(252, 165, 165, 0.2);
}

.lana {
    background: linear-gradient(145deg, #22c55e, #bbf7d0);
    color: var(--res-wool-text);
    border-color: rgba(74, 222, 128, 0.35);
}

.trigo {
    background: linear-gradient(145deg, #eab308, #fef08a);
    color: var(--res-wheat-text);
    border-color: rgba(254, 240, 138, 0.4);
}

.mineral {
    background: linear-gradient(145deg, #1e293b, #334155);
    color: var(--res-ore-text);
    border-color: rgba(148, 163, 184, 0.25);
}

.desarrollo {
    background: linear-gradient(145deg, #2e1065, #3b0764);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.4);
}

/* Efecto de iluminación para la tarjeta de desarrollo cuando es clickable */
.resource-card.desarrollo.clickable {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.resource-card.desarrollo.clickable:hover {
    filter: brightness(1.2) saturate(1.2);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.6), 0 0 50px rgba(139, 92, 246, 0.2);
    transform: translateY(-8px) scale(1.05);
    border-color: rgba(165, 180, 252, 0.6);
}

.resource-card.desarrollo.clickable:active {
    transform: translateY(-4px) scale(0.98);
}


.action-btn {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: left;
}

.action-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none !important;
}

/* SVG Board */
#game-board svg {
    width: 100%;
    height: 100%;
    min-height: 400px;
    max-height: 90vh;
    display: block;
}

.hex {
    fill: #27272a;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2;
    transition: fill 0.3s;
}

.hex-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 22px;
    fill: white;
    text-anchor: middle;
    dominant-baseline: central;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.hex-num-bg {
    transition: all 0.3s ease;
}

.hex-highlight .hex-num-bg {
    stroke: #fbbf24;
    stroke-width: 2.5;
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

/* Recurso colores en tablero con texturas */
.hex.bosque {
    fill: url(#tex-bosque);
}

.hex.colina {
    fill: url(#tex-colina);
}

.hex.pastizal {
    fill: url(#tex-pastizal);
}

.hex.montania {
    fill: url(#tex-montania);
}

.hex.campo {
    fill: url(#tex-campo);
}

/* Trigo */
.hex.desierto {
    fill: url(#tex-desierto);
}

/* Floating text animation */
@keyframes float-up {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    20% {
        transform: translateY(-10px) scale(1.2);
        opacity: 1;
    }

    80% {
        transform: translateY(-35px) scale(1);
        opacity: 1;
    }

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

.floating-text {
    animation: float-up 2.5s ease-out forwards;
    pointer-events: none;
    font-weight: bold;
    font-size: 1.4rem;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.9), 0px 0px 8px rgba(0, 0, 0, 0.8);
}

@keyframes flash-bg {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    30% {
        transform: scale(1.1);
        filter: brightness(1.6);
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
        z-index: 10;
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.flash-resource {
    animation: flash-bg 1s ease-out;
}

/* My Turn Pulse Animation */
@keyframes turn-pulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.08);
        filter: brightness(1.2);
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.active-turn-banner {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-left: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.active-turn-banner.my-turn {
    animation: turn-pulse 1s ease-in-out infinite;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    border-radius: 12px;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* MSN Nudge shake animation */
@keyframes shake {

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

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px) translateY(-2px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px) translateY(2px);
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes popIn {
    0% {
        transform: translate(-50%, -60%);
        opacity: 0;
    }

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

@keyframes msn-shake {
    0% {
        transform: translate(15px, 10px) rotate(0deg);
    }

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

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

    30% {
        transform: translate(10px, 10px) rotate(0deg);
    }

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

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

    60% {
        transform: translate(-15px, 15px) rotate(0deg);
    }

    70% {
        transform: translate(10px, -10px) rotate(-1deg);
    }

    80% {
        transform: translate(-10px, -10px) rotate(1deg);
    }

    90% {
        transform: translate(15px, 10px) rotate(0deg);
    }

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

.shake-animation {
    animation: msn-shake 0.35s cubic-bezier(.36, .07, .19, .97) both;
}

/* ==============================
   BANNER DE ACCIÓN PENDIENTE
   ============================== */
.action-banner {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5), 0 0 0 4px rgba(245, 158, 11, 0.2);
    animation: bannerPulse 2s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.4s;
}

.action-banner.hidden {
    display: none;
}

.action-banner.robber {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5), 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.action-banner.discard {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5), 0 0 0 4px rgba(139, 92, 246, 0.2);
}

#action-banner-icon {
    font-size: 1.3rem;
    animation: iconBounce 1s ease-in-out infinite;
}

@keyframes bannerPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5), 0 0 0 4px rgba(245, 158, 11, 0.2);
    }

    50% {
        box-shadow: 0 4px 30px rgba(245, 158, 11, 0.8), 0 0 0 8px rgba(245, 158, 11, 0.1);
    }
}

@keyframes iconBounce {

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

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

/* ==============================
   MODAL DE INTERCAMBIO P2P
   ============================== */
.trade-offer-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trade-offer-modal.hidden {
    display: none;
}

.trade-offer-inner {
    max-width: 380px;
    width: 90%;
    padding: 2rem;
    text-align: center;
}

.trade-offer-inner h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
}

/* ==============================
   MODAL DE SELECCIÓN DE VÍCTIMA
   ============================== */
.victim-selection-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.victim-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.victim-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
}

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

.victim-card .victim-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.victim-card .victim-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.victim-card .victim-resources {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ==============================
   CANASTAS DE INTERCAMBIO P2P
   ============================== */
.trade-basket {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.give-basket {
    border-color: rgba(52, 211, 153, 0.25);
}

.get-basket {
    border-color: rgba(248, 113, 113, 0.25);
}

.basket-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    padding: 3px 4px;
    border-radius: 5px;
    transition: background 0.15s;
}

.basket-row-active.give-basket .basket-row,
.give-basket .basket-row.basket-row-active {
    background: rgba(52, 211, 153, 0.15);
}

.basket-row-active.get-basket .basket-row,
.get-basket .basket-row.basket-row-active {
    background: rgba(248, 113, 113, 0.15);
}

.basket-label {
    font-size: 0.85rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.basket-btn {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
    line-height: 1;
}

.basket-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

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

.basket-count {
    min-width: 18px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    transition: color 0.15s, font-size 0.1s;
}

.basket-count-active {
    color: #f8fafc;
    font-size: 0.9rem;
}

/* ==============================
   MODAL DE CARTAS DE DESARROLLO
   ============================== */
.dev-card-item {
    width: 100%;
    text-align: left;
    padding: 12px;
    background: rgba(79, 70, 229, 0.15);
    border: 1px solid rgba(165, 180, 252, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.dev-card-item:hover:not(.disabled) {
    background: rgba(79, 70, 229, 0.3);
    border-color: #a5b4fc;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dev-card-item.disabled {
    cursor: not-allowed;
    opacity: 0.6;
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(148, 163, 184, 0.2);
    filter: grayscale(0.5);
}

.dev-card-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.dev-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.dev-card-name {
    color: #a5b4fc;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.dev-card-desc {
    color: #94a3b8;
    font-size: 0.8rem;
    line-height: 1.2;
    margin-top: 2px;
}

.dev-card-status {
    margin-top: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #f87171;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dev-card-status.passive {
    color: #38bdf8;
}

/* ==============================
   BOTTOM BAR CON TRADE PANEL
   ============================== */
/* (bottom-bar base rules already set in main layout section above) */


/* Panel de intercambio — vive dentro del sidebar-right */
.trade-panel {
    display: flex;
    flex-direction: column;
    background: rgba(10, 18, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 100%;
    padding: 10px;
    gap: 6px;
    animation: slideInLeft 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 2px;
}

.trade-panel.hidden {
    display: none;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

.trade-panel-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.trade-tab {
    flex: 1;
    padding: 4px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trade-tab.active {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.2);
}

.trade-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.trade-panel-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.trade-panel-content.hidden {
    display: none;
}

.trade-panel-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.trade-panel-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 1px;
}

.give-label {
    color: #34d399;
}

.get-label {
    color: #f87171;
}

.trade-offer-summary {
    font-size: 0.7rem;
    font-weight: 400;
    color: #f8fafc;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.85;
}

.trade-panel-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-family: inherit;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.15s ease;
    align-self: center;
    width: 100%;
}

.trade-panel-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Zona de cartas de la mano (footer) */
#hand-area {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==============================
   CARTAS SELECCIONABLES (modo trade)
   ============================== */
.resource-card.selectable {
    cursor: pointer !important;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.resource-card.selectable:hover {
    transform: translateY(-10px) scale(1.05) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.35) !important;
}

/* Carta levantada porque está en la oferta */
.resource-card.lifted {
    transform: translateY(-28px) scale(1.06);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(255, 255, 255, 0.5);
    z-index: 20;
    filter: brightness(1.15);
    overflow: visible;
    /* permite que el badge y botón sobresalgan */
}


/* Wrapper flotante: badge + boton menos (encima de la carta levantada) */
.card-offer-wrapper {
    position: absolute;
    top: -38px;
    right: -8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    z-index: 25;
    pointer-events: none;
}

.card-offer-wrapper>* {
    pointer-events: auto;
}

/* Badge de cantidad */
.card-offer-badge {
    background: #f59e0b;
    color: #1e293b;
    font-size: 0.8rem;
    font-weight: 900;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    animation: badgePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    line-height: 1;
}

/* Boton circular de restar */
.card-offer-minus {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease, background 0.15s ease;
}

.card-offer-minus:hover {
    background: #ef4444;
    transform: scale(1.18);
}

.card-offer-minus:active {
    transform: scale(0.88);
}

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

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

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    80% {
        transform: scale(1.3);
    }

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

/* Versión en pantalla */
.app-version {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 600;
    pointer-events: none;
    letter-spacing: 0.05em;
    z-index: 100;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ==============================
   INFO ICON & TOOLTIP
   ============================== */
.info-icon-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    /* Cambiado a la derecha */
    z-index: 1000;
}

.info-icon {
    width: 36px;
    height: 36px;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(59, 130, 246, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    font-weight: 800;
    color: var(--primary);
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Outfit', serif;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.info-icon:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.15) rotate(5deg);
    border-color: white;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

.info-tooltip {
    position: absolute;
    bottom: 50px;
    right: 0;
    /* Alineado a la derecha */
    width: 240px;
    background: var(--bg-panel);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    color: var(--text-main);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 1001;
    border-right: 4px solid var(--primary);
}

.info-icon:hover+.info-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.tooltip-header {
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.build-name {
    font-weight: 600;
    color: var(--text-main);
}

.build-resources {
    font-size: 1.1rem;
    letter-spacing: 2px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ===== SISTEMA DE INTERCAMBIO EN BARRA INFERIOR ===== */

/* Título del modo de intercambio */
.trade-mode-title {
    position: absolute;
    top: -1.6rem;
    left: 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.7rem;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    z-index: 10;
    user-select: none;
    transition: background 0.3s, color 0.3s;
}

.trade-mode-title.offer-mode {
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
}

.trade-mode-title.request-mode {
    background: rgba(22, 163, 74, 0.85);
    color: #fff;
}

/* Barra inferior en modos trade */
#bottom-bar {
    position: relative;
    transition: background 0.4s ease, border-color 0.4s ease;
}

#bottom-bar.trade-mode-offer {
    background: rgba(127, 29, 29, 0.55) !important;
    border-top: 2px solid rgba(239, 68, 68, 0.6);
}

#bottom-bar.trade-mode-request {
    background: rgba(20, 83, 45, 0.55) !important;
    border-top: 2px solid rgba(34, 197, 94, 0.6);
}

/* Badge en cartas seleccionadas */
.card-offer-wrapper {
    position: absolute;
    top: -0.6rem;
    right: -0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 20;
    pointer-events: auto;
}

.card-offer-badge {
    font-size: 0.85rem;
    font-weight: 800;
    padding: 0.1rem 0.35rem;
    border-radius: 50px;
    min-width: 1.4rem;
    text-align: center;
    line-height: 1.4;
}

.card-offer-badge.negative {
    background: rgba(239, 68, 68, 0.95);
    color: #fff;
}

.card-offer-badge.positive {
    background: rgba(34, 197, 94, 0.95);
    color: #fff;
}

.card-offer-minus {
    font-size: 0.9rem;
    font-weight: 800;
    background: rgba(220, 38, 38, 0.8);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.resource-card.lifted {
    transform: translateY(-8px) scale(1.04);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

.resource-card.selectable {
    cursor: pointer;
}

.resource-card.selectable:hover {
    transform: translateY(-4px);
    filter: brightness(1.15);
}

/* Panel de control de intercambio */
.trade-action-panel {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 200px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.trade-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.trade-select {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 6px;
    color: var(--text-main);
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    width: 100%;
}

.trade-rate-info {
    font-size: 0.78rem;
    color: #94a3b8;
    min-height: 1.2rem;
}

.trade-summary-line {
    font-size: 0.8rem;
    color: #e2e8f0;
    min-height: 1.1rem;
}

.trade-close-btn {
    align-self: flex-end;
    padding: 0.2rem 0.6rem !important;
    font-size: 0.8rem !important;
}

/* Modales de trueke */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-card h3 {
    color: #f8fafc;
    font-size: 1.1rem;
    margin: 0;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: flex-end;
}

.trueke-players-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trueke-player-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.2);
    cursor: default;
    transition: border-color 0.2s, background 0.2s;
}

.trueke-player-card.accepted {
    border-color: rgba(34, 197, 94, 0.5);
}

.trueke-player-card.rejected {
    opacity: 0.5;
}

.trueke-player-card.selected {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.15);
}

.trueke-player-card.accepted {
    cursor: pointer;
}

.trueke-player-card.accepted:hover {
    background: rgba(34, 197, 94, 0.1);
}

.trueke-status-icon {
    font-size: 1.1rem;
}

.trueke-player-name {
    font-weight: 600;
    flex: 1;
    font-size: 0.9rem;
}

.trueke-player-pending {
    font-size: 0.78rem;
    color: #94a3b8;
}

.trade-offer-details {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #cbd5e1;
}

.trade-offer-details strong {
    display: block;
    color: #f8fafc;
    margin-bottom: 0.3rem;
}

/* ===== MODO DESCARTE ===== */
#bottom-bar.trade-mode-discard {
    background: rgba(30, 30, 40, 0.75) !important;
    border-top: 2px solid rgba(148, 163, 184, 0.5);
}

.trade-mode-title.discard-mode {
    background: rgba(71, 85, 105, 0.9);
    color: #e2e8f0;
    cursor: default !important;
}

/* ===== VICTORY SCREEN & ANIMATIONS ===== */
.victory-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.98) 0%, rgba(2, 6, 23, 1) 100%);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 0.5s ease;
}

/* Efecto de iluminación cuando explota un fuego artificial */
.victory-screen.firework-light {
    background: radial-gradient(circle at center, var(--ambient-glow) 0%, rgba(2, 6, 23, 1) 100%);
}

.victory-screen.firework-light .victory-card {
    box-shadow: 0 0 50px var(--ambient-glow), 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    border-color: var(--ambient-glow);
}

.victory-animations-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

#victory-fireworks,
#victory-balloons,
#victory-streamers {
    position: absolute;
    inset: 0;
}

.victory-card {
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(25px);
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: 32px;
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    animation: victoryPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 10;
    transition: all 0.4s ease;
}

@keyframes victoryPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

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

.victory-trophy {
    font-size: 6rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 25px rgba(234, 179, 8, 0.5));
    animation: trophyFloat 3s ease-in-out infinite;
}

@keyframes trophyFloat {

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

    50% {
        transform: translateY(-20px) rotate(8deg) scale(1.1);
    }
}

.victory-title {
    color: #fde047;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 20px rgba(253, 224, 71, 0.3);
}

.winner-name {
    display: block;
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.victory-info p {
    color: #cbd5e1;
    font-size: 1.3rem;
}

.victory-ranking {
    margin: 2.5rem 0;
    width: 100%;
}

.podium-highlights {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.podium-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 1.25rem;
    min-width: 130px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.podium-card:hover {
    transform: translateY(-8px) scale(1.05);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.podium-rank {
    font-size: 0.85rem;
    font-weight: 800;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.place-2 {
    border-top: 3px solid #e2e8f0;
}

.place-3 {
    border-top: 3px solid #cd7f32;
}

.podium-name {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
}

.podium-points {
    font-weight: 800;
    color: #fde047;
    font-size: 1.4rem;
}

.ranking-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-item:last-child {
    border-bottom: none;
}

.rank-num {
    width: 45px;
    font-weight: 800;
    color: #64748b;
    font-size: 0.9rem;
}

.rank-name {
    flex: 1;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
}

.rank-points {
    font-weight: 700;
    color: #facc15;
}

.replay-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.replay-question {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.replay-actions {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
}

/* Animations Elements */

/* GLOBOS REALISTAS CON HILOS */
.balloon {
    position: absolute;
    bottom: -150px;
    width: 65px;
    height: 85px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5) 0%, transparent 50%), var(--balloon-color);
    border-radius: 50% 50% 50% 50% / 45% 45% 55% 55%;
    z-index: 5;
    animation: balloonFloat 12s cubic-bezier(0.4, 0, 0.6, 1) forwards;
    box-shadow: inset -8px -12px 20px rgba(0, 0, 0, 0.25), 0 10px 20px rgba(0, 0, 0, 0.3);
}

.balloon::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--balloon-color);
    filter: brightness(0.7);
}

.balloon-string {
    position: absolute;
    bottom: -70px;
    left: 50%;
    width: 1.5px;
    height: 70px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), transparent);
    transform-origin: top center;
    animation: stringWavy 2s ease-in-out infinite;
}

@keyframes stringWavy {

    0%,
    100% {
        transform: translateX(-50%) rotate(7deg);
    }

    50% {
        transform: translateX(-50%) rotate(-7deg);
    }
}

@keyframes balloonFloat {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    25% {
        transform: translateY(-35vh) rotate(8deg) translateX(25px);
    }

    50% {
        transform: translateY(-70vh) rotate(-8deg) translateX(-25px);
    }

    75% {
        transform: translateY(-105vh) rotate(8deg) translateX(20px);
    }

    100% {
        transform: translateY(-140vh) rotate(12deg) translateX(0);
        opacity: 0;
    }
}

/* SERPENTINAS */
.streamer {
    position: absolute;
    top: -30px;
    height: 35px;
    border-radius: 10px;
    z-index: 5;
    animation: streamerFall 5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

@keyframes streamerFall {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    100% {
        transform: translateY(115vh) rotate(1800deg) translateX(80px);
        opacity: 0;
    }
}

/* FUEGOS ARTIFICIALES MEJORADOS CON GLOW */
.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    z-index: 4;
}

.firework-flash {
    position: absolute;
    border-radius: 50%;
    z-index: 3;
    pointer-events: none;
    animation: flashFade 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes flashFade {
    0% {
        transform: scale(0.1);
        opacity: 0.9;
    }

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

.firework-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    filter: blur(0.5px);
    animation: fireworkBurst 1.6s cubic-bezier(0, 0.5, 0.2, 1) forwards;
}

@keyframes fireworkBurst {
    0% {
        transform: translate(0, 0) scale(1.5);
        opacity: 1;
    }

    60% {
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Upgraded Top Bar & Player Cards */
.top-bar {
    height: 95px !important;
    padding: 0.5rem 1.5rem !important;
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-sizing: border-box;
}

.horizontal-players-list {
    gap: 1.25rem !important;
}

.horizontal-players-list li.player-card {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    background: rgba(30, 41, 59, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    padding: 0.5rem 1rem !important;
    min-width: 220px;
    max-width: 280px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-sizing: border-box;
    height: 75px;
}

.horizontal-players-list li.player-card.active {
    background: rgba(30, 41, 59, 0.6) !important;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 2px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* foto con marco (/js/marcos.js) y nivel/burbuja de la tarjeta de arriba */
.pc-foto { display: flex; flex-shrink: 0; }
.player-card .tjm { --tjm-s: 40px; margin: 3px; }
.player-card .tjm > .player-avatar { border-width: 2px; }
.pc-nivel {
    flex-shrink: 0; padding: 1px 6px; border-radius: 100px; font-size: 0.66rem; font-weight: 800;
    color: #fde68a; background: rgba(251, 191, 36, 0.14); border: 1px solid rgba(251, 191, 36, 0.35);
}
.pc-burbuja {
    max-width: 96px; padding: 1px 7px; border-radius: 10px 10px 10px 2px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: 0.68rem; font-weight: 700; color: #111827; background: #fff;
}
@media (max-width: 600px) {
    .player-card .tjm { --tjm-s: 22px; margin: 2px; }
    .pc-nivel, .pc-burbuja { display: none !important; }
}

.player-card.active .player-avatar {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-grow: 1;
    min-width: 0;
}

.player-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.player-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.you-badge {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: normal;
}

.crown-icon {
    font-size: 0.95rem;
    color: #fbbf24;
    animation: crown-float 2s infinite ease-in-out;
}

@keyframes crown-float {

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

    50% {
        transform: translateY(-3px) rotate(5deg);
    }
}

.player-pv-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.pv-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: #cbd5e1;
    min-width: 32px;
}

.pv-bar-container {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.pv-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px currentColor;
}

.player-stats-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 1px;
}

.player-stats-row span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.badge-icon {
    font-size: 0.8rem;
}

/* Turn Phase Tracker Section */
.turn-phase-section {
    padding: 1rem !important;
    background: rgba(30, 41, 59, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px;
    margin-bottom: 1rem !important;
}

.turn-phase-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.phase-step {
    flex: 1;
    text-align: center;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    border: 1px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.phase-step.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transform: scale(1.03);
}

.phase-step.completed {
    color: rgba(255, 255, 255, 0.75);
}

.phase-arrow {
    color: rgba(255, 255, 255, 0.15);
    font-weight: 800;
    font-size: 0.8rem;
    margin: 0 0.15rem;
    user-select: none;
}

/* Upgraded Registro (Log Entries) */
#action-log {
    gap: 0.6rem !important;
    padding: 0.75rem !important;
    background: rgba(15, 23, 42, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.log-entry {
    display: grid !important;
    grid-template-columns: auto auto 1fr !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0.65rem 0.8rem !important;
    border-radius: 10px !important;
    background: rgba(30, 41, 59, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

.log-entry:hover {
    background: rgba(30, 41, 59, 0.45) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.log-time {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    min-width: 32px;
}

.log-icon {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.1));
}

.log-text {
    font-size: 0.82rem;
    color: #e2e8f0;
    line-height: 1.4;
    word-break: break-word;
}

/* Map status overlay floating badge */
.map-status-overlay {
    position: absolute;
    top: 15px;
    left: 20px;
    z-index: 100;
    display: flex;
    gap: 10px;
    pointer-events: none;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.status-badge.players-online {
    border-color: rgba(34, 197, 94, 0.35);
    color: #4ade80;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green {
    background-color: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.status-badge.game-leader {
    border-color: rgba(234, 179, 8, 0.35);
    color: #fef08a;
    display: none;
}

.leader-icon {
    font-size: 0.9rem;
}

/* Container for Map Confirmation */
.map-confirm-container {
    display: none;
}

.map-confirm-container:has(> button:not(.hidden)) {
    display: block;
}


/* ============================================================
   RESPONSIVE TABLET (max 900px)
   ============================================================ */
@media (max-width: 900px) {
    .middle-section .sidebar-left {
        width: 220px;
    }

    .middle-section .sidebar-right {
        width: 240px;
    }

    .horizontal-players-list li.player-card {
        min-width: 160px;
        max-width: 210px;
    }

    .die {
        width: 50px;
        height: 50px;
    }

    .resource-card {
        min-width: 64px;
        padding: 0.4rem 0.6rem;
    }

    .res-icon {
        width: 30px;
        height: 30px;
    }

    .res-count {
        font-size: 1.3rem;
    }
}

/* ============================================================
   RESPONSIVE MOBILE (max 600px)
   ============================================================ */
@media (max-width: 600px) {

    /* Pantallas de Inicio y Lobby Compactas en Móviles */
    .glass-panel {
        padding: 1.5rem 1.25rem !important;
        border-radius: 20px !important;
        max-width: 360px !important;
        width: 90% !important;
    }

    #login-screen .login-header {
        gap: 0.5rem !important;
        margin-bottom: 0.8rem !important;
    }

    #login-screen .app-logo {
        width: 48px !important;
        height: 48px !important;
    }

    #login-screen h1 {
        font-size: 1.6rem !important;
        line-height: 1.2 !important;
    }

    #login-screen p {
        font-size: 0.8rem !important;
        margin-bottom: 0.8rem !important;
    }

    #login-screen .form-group {
        margin-bottom: 0.75rem !important;
    }

    #login-screen .form-group label {
        font-size: 0.8rem !important;
        margin-bottom: 0.25rem !important;
    }

    #login-screen input[type="text"] {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }

    #login-screen .btn {
        padding: 0.65rem 1rem !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }

    #login-screen .divider {
        margin: 0.6rem 0 !important;
    }

    #login-screen .divider span {
        font-size: 0.75rem !important;
        padding: 0 0.75rem !important;
    }

    #login-screen .join-group {
        gap: 0.5rem !important;
    }

    #login-screen .input-wrapper {
        border-radius: 8px !important;
    }

    #login-screen .input-wrapper input {
        font-size: 0.9rem !important;
        padding: 0.6rem 0.8rem !important;
    }

    #login-screen .input-wrapper .btn-icon {
        font-size: 0.9rem !important;
        padding: 0.4rem !important;
    }

    .fullscreen-toggle.login-fs,
    .fullscreen-toggle.lobby-fs {
        top: 1rem !important;
        right: 1rem !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
    }

    .app-version {
        bottom: 1rem !important;
        font-size: 0.75rem !important;
        padding: 2px 8px !important;
    }

    /* Lobby Screen en Móviles */
    #lobby-screen h2 {
        font-size: 1.4rem !important;
        margin-bottom: 0.75rem !important;
    }

    #room-code-display-container p {
        font-size: 0.8rem !important;
        margin-bottom: 0.5rem !important;
    }

    #room-code-display-container div {
        margin-bottom: 1.25rem !important;
        gap: 8px !important;
    }

    #room-code-display {
        font-size: 1.6rem !important;
        padding: 0.5rem 1rem !important;
        letter-spacing: 2px !important;
        border-radius: 10px !important;
    }

    #btn-copy-code {
        padding: 0.5rem !important;
        border-radius: 8px !important;
        font-size: 1rem !important;
    }

    .players-list-container {
        margin: 1rem 0 !important;
    }

    .players-list-container h3 {
        font-size: 0.75rem !important;
        margin-bottom: 0.6rem !important;
    }

    #lobby-players-list {
        gap: 0.6rem !important;
    }

    #lobby-players-list li {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    .host-controls {
        gap: 0.6rem !important;
        margin-top: 0.75rem !important;
    }

    .host-controls .btn {
        padding: 0.65rem 1rem !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }

    #waiting-host-msg {
        font-size: 0.8rem !important;
        margin-top: 0.5rem !important;
    }

    /* Layout global */
    .game-layout.active {
        height: 100dvh;
        overflow: hidden;
    }

    /* Top bar compacto */
    .top-bar {
        height: auto !important;
        min-height: 56px !important;
        padding: 0.35rem 0.6rem !important;
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        /* IMPORTANTE: Desactivar backdrop-filter en móvil para permitir que .active-turn-banner (position: fixed) escape el containing block */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(15, 23, 42, 0.95) !important;
    }

    .horizontal-players-list {
        gap: 0.5rem !important;
        flex-shrink: 1;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    /* Tarjetas de jugador compactas */
    .horizontal-players-list li.player-card {
        min-width: 0 !important;
        max-width: 130px !important;
        height: auto !important;
        padding: 0.3rem 0.6rem !important;
        border-radius: 10px !important;
        flex-shrink: 0;
        gap: 7px;
    }

    .player-avatar {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.9rem !important;
    }

    .player-name {
        font-size: 0.78rem !important;
        max-width: 70px !important;
    }

    .player-pv-row {
        gap: 4px !important;
    }

    .pv-text {
        font-size: 0.65rem !important;
    }

    .pv-bar-container {
        height: 4px !important;
    }

    .player-stats-row {
        display: none !important;
    }

    /* Banner de turno compacto - flotante en la parte inferior del mapa */
    .active-turn-banner {
        position: fixed !important;
        bottom: 200px !important;
        left: 0 !important;
        right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: max-content !important;
        font-size: 0.8rem !important;
        padding: 0.45rem 1rem !important;
        border-radius: 20px !important;
        z-index: 4000 !important;
        text-align: center !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
        white-space: nowrap !important;
        background: rgba(15, 23, 42, 0.9) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        max-width: 90% !important;
        overflow: hidden;
        text-overflow: ellipsis;
        pointer-events: none !important;
    }

    .active-turn-banner.my-turn {
        border: 2px solid rgba(255, 255, 255, 0.25) !important;
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5) !important;
    }

    /* Fullscreen compacto */
    #btn-fullscreen {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
        margin-left: 2px !important;
        flex-shrink: 0;
    }

    /* Boton toggle registro */
    .btn-mobile-registro {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 8px;
        color: white;
        font-size: 0.95rem;
        cursor: pointer;
        flex-shrink: 0;
        transition: background 0.2s;
        margin-left: auto !important;
    }

    .btn-mobile-registro:hover {
        background: rgba(255, 255, 255, 0.16);
    }

    /* Boton toggle sonido */
    .btn-sound-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 32px !important;
        height: 32px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 8px !important;
        color: white !important;
        font-size: 0.95rem !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
        transition: background 0.2s !important;
        margin-left: 6px !important;
    }

    .btn-sound-toggle:hover {
        background: rgba(255, 255, 255, 0.16) !important;
    }

    /* Seccion media */
    .middle-section {
        flex-direction: column;
        position: relative;
        overflow: hidden;
    }

    /* Sidebar izquierdo: slide-in panel */
    .sidebar-left {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 80vw !important;
        max-width: 300px !important;
        height: 100dvh !important;
        z-index: 5000 !important;
        transform: translateX(-105%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
        background: rgba(15, 23, 42, 0.97) !important;
        backdrop-filter: blur(20px) !important;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6) !important;
        padding-top: 3rem !important;
    }

    .sidebar-left.mobile-open {
        transform: translateX(0) !important;
    }

    /* Boton cerrar registro */
    .btn-close-registro {
        display: flex !important;
        position: absolute !important;
        top: 0.75rem !important;
        right: 0.75rem !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: #94a3b8 !important;
        width: 30px !important;
        height: 30px !important;
        border-radius: 50% !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0.9rem !important;
        cursor: pointer !important;
        transition: all 0.2s !important;
        z-index: 10 !important;
    }

    .btn-close-registro:hover {
        background: rgba(239, 68, 68, 0.25) !important;
        color: #fca5a5 !important;
    }

    /* Overlay oscuro al abrir el registro */
    .sidebar-left.mobile-open::before {
        content: '';
        position: fixed;
        inset: 0;
        left: min(80vw, 300px);
        background: rgba(0, 0, 0, 0.45);
        z-index: -1;
    }

    /* Tablero ocupa todo el ancho */
    .board-container {
        min-width: 0 !important;
        width: 100% !important;
        flex-grow: 1;
        overflow: hidden;
    }

    /* Mover el mapa un poquito más arriba en móviles */
    #game-board svg {
        position: relative !important;
        top: -45px !important;
    }

    /* Sidebar derecho colapsado — dados flotan */
    /* IMPORTANTE: backdrop-filter y filter crean stacking contexts que rompen position:fixed de los hijos */
    .sidebar-right {
        width: 0 !important;
        min-width: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: none !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        filter: none !important;
        flex-shrink: 0;
    }

    .sidebar-right>*:not(.main-actions):not(.map-confirm-container):not(.trade-actions) {
        display: none !important;
    }

    /* Fase de turno oculta en movil */
    .turn-phase-section {
        display: none !important;
    }

    /* Dados flotantes abajo a la derecha — justo encima de la barra de cartas */
    .main-actions {
        display: flex !important;
        position: fixed !important;
        bottom: 96px !important;
        right: 8px !important;
        z-index: 4000 !important;
        background: rgba(15, 23, 42, 0.92) !important;
        backdrop-filter: blur(14px) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 14px !important;
        padding: 6px 8px !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 4px !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.15) !important;
        margin: 0 !important;
        pointer-events: auto !important;
    }

    /* Dados mas pequenos */
    .die {
        width: 40px !important;
        height: 40px !important;
        border-radius: 10px !important;
        padding: 5px !important;
    }

    .dice-section-wrapper {
        padding: 0 !important;
    }

    .dice-container {
        gap: 6px !important;
        padding: 0 !important;
    }

    /* Boton terminar turno compacto */
    .action-buttons-row {
        width: 100% !important;
    }

    #btn-end-turn {
        font-size: 0.7rem !important;
        padding: 0.35rem 0.5rem !important;
        border-radius: 8px !important;
        width: 100% !important;
        justify-content: center !important;
        gap: 4px !important;
    }

    #btn-end-turn span:last-child {
        font-size: 0.85rem !important;
    }

    /* Nudge oculto */
    .nudge-container {
        display: none !important;
    }

    .dice-tooltip {
        display: none !important;
    }

    /* Barra inferior compacta */
    .bottom-bar {
        min-height: 90px !important;
        height: auto !important;
        padding: 0.4rem 0.5rem !important;
        gap: 0.4rem !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
    }

    /* Grid de recursos: forzar una sola fila */
    .bottom-bar .resources-grid {
        flex-wrap: nowrap !important;
        flex-shrink: 0;
        align-items: stretch;
    }

    /* Hand-area: forzar una sola fila */
    #hand-area {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        justify-content: flex-start !important;
    }

    /* Cartas de recursos compactas */
    .resource-card {
        min-width: 52px !important;
        max-width: 64px !important;
        padding: 0.3rem 0.4rem !important;
        border-radius: 10px !important;
        flex-shrink: 0 !important;
    }

    .res-icon {
        width: 24px !important;
        height: 24px !important;
    }

    .res-label {
        font-size: 0.55rem !important;
    }

    .res-count {
        font-size: 1.1rem !important;
    }

    .btn-buy-small {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.7rem !important;
    }

    /* Info icon — debajo del status de jugadores online (top-left) */
    .info-icon-container {
        position: absolute !important;
        top: 38px !important;
        left: 8px !important;
        bottom: auto !important;
        right: auto !important;
        margin-left: 0 !important;
        display: block !important;
        pointer-events: auto !important;
        z-index: 1000 !important;
    }

    .info-icon {
        width: 30px !important;
        height: 30px !important;
        font-size: 1rem !important;
        border-width: 1px !important;
    }

    .info-tooltip {
        top: 34px !important;
        bottom: auto !important;
        left: 0 !important;
        right: auto !important;
    }

    /* Map overlay */
    .map-status-overlay {
        top: 8px !important;
        left: 8px !important;
        gap: 6px !important;
    }

    .status-badge {
        font-size: 0.7rem !important;
        padding: 4px 10px !important;
    }

    /* Action banner */
    .action-banner {
        font-size: 0.82rem !important;
        padding: 8px 18px !important;
        border-radius: 30px !important;
        top: 60px !important;
    }

    /* Modales */
    .modal-card {
        min-width: 0 !important;
        width: 92vw !important;
        padding: 1.2rem !important;
    }

    .trade-offer-inner {
        width: 94vw !important;
        padding: 1.2rem !important;
    }

    /* Trade action panel */
    .trade-action-panel {
        bottom: 105px !important;
        right: 4px !important;
        min-width: 160px !important;
        padding: 0.75rem !important;
    }

    /* Panel de Confirmación de Mapa flotante en móvil */
    .map-confirm-container:has(> button:not(.hidden)) {
        display: flex !important;
        position: fixed !important;
        top: 70px !important;
        right: 8px !important;
        z-index: 4000 !important;
        background: rgba(15, 23, 42, 0.92) !important;
        backdrop-filter: blur(14px) !important;
        -webkit-backdrop-filter: blur(14px) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 14px !important;
        padding: 8px 10px !important;
        flex-direction: column !important;
        gap: 6px !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.15) !important;
        margin: 0 !important;
        pointer-events: auto !important;
        width: 150px !important;
    }

    .map-confirm-container button {
        padding: 0.55rem 0.75rem !important;
        font-size: 0.78rem !important;
        border-radius: 10px !important;
        margin-top: 0 !important;
        width: 100% !important;
    }

    /* Panel de Intercambio (Trade options) flotante en móvil (izq) */
    .trade-actions {
        display: flex !important;
        position: fixed !important;
        bottom: 96px !important;
        left: 8px !important;
        z-index: 4000 !important;
        background: rgba(15, 23, 42, 0.92) !important;
        backdrop-filter: blur(14px) !important;
        -webkit-backdrop-filter: blur(14px) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 14px !important;
        padding: 8px 10px !important;
        flex-direction: column !important;
        gap: 6px !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.15) !important;
        margin: 0 !important;
        pointer-events: auto !important;
        width: 140px !important;
    }

    .trade-actions .section-title {
        font-size: 0.72rem !important;
        margin-bottom: 4px !important;
        text-align: center !important;
    }

    .trade-buttons-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
    }

    .trade-btn {
        padding: 6px 8px !important;
        font-size: 0.78rem !important;
        flex-direction: row !important;
        justify-content: center !important;
        gap: 6px !important;
        border-radius: 8px !important;
    }

    .trade-btn .icon {
        font-size: 0.9rem !important;
    }

    .sidebar-card {
        margin-bottom: 0 !important;
    }
}

/* ============================================================
   RESPONSIVE PANTALLAS MUY PEQUENAS (max 360px)
   ============================================================ */
@media (max-width: 360px) {
    .horizontal-players-list li.player-card {
        max-width: 100px !important;
        padding: 0.25rem 0.4rem !important;
    }

    .player-name {
        font-size: 0.7rem !important;
        max-width: 55px !important;
    }

    .player-avatar {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.75rem !important;
    }

    .resource-card {
        min-width: 46px !important;
        max-width: 56px !important;
    }

    .res-icon {
        width: 20px !important;
        height: 20px !important;
    }

    .res-count {
        font-size: 1rem !important;
    }

    .die {
        width: 34px !important;
        height: 34px !important;
        padding: 4px !important;
    }

    .active-turn-banner {
        font-size: 0.72rem !important;
        padding: 0.35rem 0.75rem !important;
        bottom: 190px !important;
    }
}

/* Ocultar toggle registro en desktop */
@media (min-width: 601px) {
    .btn-mobile-registro {
        display: none !important;
    }

    .btn-close-registro {
        display: none !important;
    }
}
/* ═══ v4: aura del jugador activo (antes pasaba desapercibida) ═══ */
.horizontal-players-list li.player-card.active {
    border-width: 2px !important;
    background: rgba(30, 41, 59, 0.85) !important;
    transform: translateY(-2px) scale(1.05);
    z-index: 2;
    animation: tj-active-pulse 1.5s ease-in-out infinite;
}

@keyframes tj-active-pulse {
    0%, 100% {
        box-shadow:
            0 0 10px 2px color-mix(in srgb, var(--pc, #3b82f6) 55%, transparent),
            inset 0 0 10px color-mix(in srgb, var(--pc, #3b82f6) 22%, transparent);
    }
    50% {
        box-shadow:
            0 0 28px 7px color-mix(in srgb, var(--pc, #3b82f6) 95%, transparent),
            inset 0 0 16px color-mix(in srgb, var(--pc, #3b82f6) 40%, transparent);
    }
}

.player-card.active .player-name {
    text-shadow: 0 0 14px var(--pc, #3b82f6);
}

.player-card.active .crown-icon {
    animation: tj-crown-bounce 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes tj-crown-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px) rotate(-8deg); }
}

@media (prefers-reduced-motion: reduce) {
    .horizontal-players-list li.player-card.active,
    .player-card.active .crown-icon { animation: none; }
    .horizontal-players-list li.player-card.active {
        box-shadow: 0 0 22px 5px color-mix(in srgb, var(--pc, #3b82f6) 80%, transparent);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   v4.5.1 · Celular: el intercambio quedaba tapado o recortado
   - La barra inferior tenía overflow-x:auto, y eso recortaba TODO lo que
     asoma fuera de ella: el título "Yo ofrezco / Yo pido" (que vive
     encima de la barra) y los badges +/− de las cartas seleccionadas.
   - El panel de trueke (Realizar Trueke / Intercambiar / Confirmar
     Descarte) era fijo en la misma esquina que los dados, con z-index
     100 contra 4000: quedaba detrás de los dados.
   - Con 6 cartas de 52–64px la del final (Desarrollo + 🛒) se salía de
     un iPhone de 390px y había que adivinar que se podía deslizar.
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    /* La barra ya no recorta lo que asoma por arriba (título y badges) */
    .bottom-bar {
        overflow: visible !important;
        padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Las 6 cartas se reparten el ancho: caben sin deslizar */
    .bottom-bar .resources-grid,
    #hand-area {
        width: 100%;
        overflow: visible !important;
        gap: 0.3rem !important;
    }

    #hand-area .resource-card {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0.3rem 0.15rem !important;
    }

    /* Título del modo de intercambio: pegado encima de la barra, a lo ancho */
    .trade-mode-title {
        left: 8px !important;
        right: 8px !important;
        top: -1.9rem !important;
        text-align: center;
        font-size: 0.8rem !important;
        padding: 0.35rem 0.7rem !important;
        border-radius: 8px 8px 0 0 !important;
        z-index: 4400 !important;
    }

    /* Panel de trueke: hoja de lado a lado sobre la barra, por ENCIMA
       de los dados (4000) */
    .trade-action-panel {
        left: 8px !important;
        right: 8px !important;
        bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
        min-width: 0 !important;
        z-index: 4500 !important;
        padding: 0.6rem 0.75rem !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem !important;
    }

    .trade-action-panel > div:not(.hidden) {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        min-width: 0;
    }

    .trade-action-panel .trade-close-btn {
        align-self: center;
        padding: 0.45rem 0.7rem !important;
    }

    .trade-action-panel .btn.small {
        padding: 0.55rem 0.9rem !important;
        font-size: 0.85rem !important;
    }

    /* Mientras el panel de trueke está abierto, los dados y los botones
       Puerto/Jugador se esconden para no pisarlo (se vuelven a ver al
       cerrar con ✕ o al completar el intercambio) */
    .game-layout:has(#trade-action-panel:not(.hidden)) .main-actions,
    .game-layout:has(#trade-action-panel:not(.hidden)) .trade-actions {
        display: none !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   v4.6.0 · Dados que ruedan + cabecera compacta en celular
   ═══════════════════════════════════════════════════════════════════ */
@keyframes dieRoll {
    0%   { transform: rotate(0deg) translateY(0) scale(1); }
    25%  { transform: rotate(-14deg) translateY(-9px) scale(1.06); }
    50%  { transform: rotate(10deg) translateY(2px) scale(0.98); }
    75%  { transform: rotate(-8deg) translateY(-6px) scale(1.04); }
    100% { transform: rotate(0deg) translateY(0) scale(1); }
}
.die.rolling { animation: dieRoll 0.32s ease-in-out infinite; }

@keyframes dieLand {
    0%   { transform: scale(1.28); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.6), 0 8px 20px rgba(0, 0, 0, 0.3); }
    60%  { transform: scale(0.94); }
    100% { transform: scale(1); }
}
.die.landed { animation: dieLand 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* Las herramientas del panel de registro solo existen en celular */
.registro-tools { display: none; }

@media (max-width: 600px) {
    /* Sonido / pantalla completa / salir se van al panel de registro */
    #btn-toggle-sound,
    #btn-fullscreen,
    #btn-exit-game { display: none !important; }

    .registro-tools {
        display: flex;
        gap: 6px;
        padding: 0 0.75rem 0.6rem;
    }
    .registro-tools button {
        flex: 1 1 0;
        min-width: 0;
        padding: 8px 4px;
        font-size: 0.72rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: #e2e8f0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Cabecera: todos los jugadores a la vez, tarjetas verticales de 54px */
    .top-bar {
        padding: 0.3rem 0.4rem !important;
        min-height: 50px !important;
        gap: 4px;
    }
    .btn-mobile-registro { margin-left: 4px !important; }

    .horizontal-players-list {
        flex: 1 1 auto;
        gap: 4px !important;
        justify-content: flex-start;
    }
    .horizontal-players-list li.player-card {
        flex-direction: column !important;
        align-items: center;
        justify-content: center;
        width: 54px;
        min-width: 0 !important;
        max-width: 54px !important;
        height: auto !important;
        padding: 3px 2px !important;
        gap: 1px;
        border-radius: 10px !important;
        backdrop-filter: none;
    }
    .horizontal-players-list li.player-card.active {
        transform: translateY(-1px) scale(1.04);
    }
    .player-avatar {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.7rem !important;
        border-width: 2px !important;
    }
    .player-details { align-items: center; width: 100%; gap: 0; }
    .player-name-row { justify-content: center; gap: 2px; width: 100%; }
    .player-name {
        font-size: 0.58rem !important;
        max-width: 44px !important;
    }
    .you-badge { display: none !important; }
    .crown-icon { font-size: 0.6rem !important; }
    .player-pv-row { justify-content: center; gap: 0 !important; }
    .pv-bar-container { display: none !important; }
    .pv-text { font-size: 0.6rem !important; min-width: 0 !important; }

    /* El resaltado del número que salió animaba un filter CSS sobre <g> que ya
       tienen un filter SVG: en iOS eso re-rasteriza y parpadea. En celular se
       resalta con el borde del hexágono. */
    .hex-highlight { animation: none !important; }
    .hex-highlight polygon.hex {
        stroke: #fbbf24 !important;
        stroke-width: 5 !important;
    }
}

@media (max-width: 380px) {
    .horizontal-players-list li.player-card { width: 48px; max-width: 48px !important; }
    .player-name { max-width: 40px !important; }
}

/* ── "¿Cómo se juega?" plegable en la portada ── */
.como-se-juega { margin-top: 1rem; text-align: left; font-size: 0.9rem; color: #cbd5e1; }
.como-se-juega summary { cursor: pointer; text-align: center; color: #94a3b8; font-weight: 600; }
.como-se-juega summary:hover { color: #e2e8f0; }
.como-se-juega .csj-cuerpo { max-height: 40vh; overflow-y: auto; margin-top: 0.6rem; padding-right: 4px; line-height: 1.5; }
.como-se-juega ol { padding-left: 1.2rem; margin: 0.5rem 0; }
.como-se-juega li { margin-bottom: 0.4rem; }
.como-se-juega p { margin: 0.4rem 0; }

/* ── Volver a TuJuegas (portada y sala de espera; en partida está el 🏠) ── */
.volver-tj {
    position: absolute; top: calc(1.4rem + env(safe-area-inset-top, 0px)); left: 1.4rem; z-index: 20;
    color: #cbd5e1; text-decoration: none; font-size: 0.9rem; font-weight: 600;
    padding: 0.4rem 0.85rem; border-radius: 999px;
    background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.volver-tj:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
@media (max-width: 768px) { .volver-tj { top: calc(0.9rem + env(safe-area-inset-top, 0px)); left: 0.9rem; font-size: 0.85rem; } }
/* tarjeta de jugador común dentro de la lista de la sala */
.lobby-player-item .tjj-colonos { flex: 1; background: transparent; border: none; padding: 0; }
