/* ===== BASE STYLES ===== */

body {
    font-family: 'Outfit', sans-serif;
    background-color: #050508;
    color: #e2e8f0;
    overflow-x: hidden;
}

.font-title {
    font-family: 'Cinzel', serif;
}

/* ===== AMBIENT ANIMATED BACKGROUND ===== */

.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: #050508;
}

.ambient-blob {
    position: absolute;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
    border-radius: 50%;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: rgba(245, 158, 11, 0.2);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: rgba(251, 191, 36, 0.15);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: rgba(255, 107, 53, 0.1);
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(5%, 10%) scale(1.1);
    }
    66% {
        transform: translate(-5%, -5%) scale(0.9);
    }
}

/* ===== GLASS PANEL ===== */

.glass-panel {
    background: rgba(15, 15, 20, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-field: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ===== CHARACTER SILHOUETTE ===== */

.character-silhouette {
    position: absolute;
    inset: 0;
    background-image: url('assets/char.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.character-silhouette:hover {
    filter: drop-shadow(0 0 3px #ffffff) drop-shadow(0 0 6px #ffffff) drop-shadow(0 0 10px #ffffff);
}

/* ===== MODAL STYLES ===== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(145deg, rgba(20, 20, 28, 0.95), rgba(10, 10, 15, 0.98));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.1);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-title {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 12px;
}

.modal-label {
    font-size: 0.95rem;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 16px;
}

.modal-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    color: #fff;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.modal-input:focus {
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.modal-input::placeholder {
    color: #64748b;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.modal-btn-primary {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 180, 0, 0.8));
    color: #000;
}

.modal-btn-primary:hover {
    background: linear-gradient(135deg, rgba(255, 230, 50, 1), rgba(255, 200, 50, 0.9));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-btn-clear {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-btn-clear:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== HELP TOOLTIP ===== */

#helpTooltip {
    transition: all 0.2s ease;
}

#helpTooltip.visible {
    opacity: 1;
    visibility: visible;
}

#helpTooltip.invisible {
    opacity: 0;
    visibility: hidden;
}

/* ===== CUSTOM SCROLLBAR ===== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== DRAG AND DROP STYLES ===== */

/* Gates group container */
.gates-group {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

/* Horizontal player row */
.players-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

/* Player cell */
.player-cell {
    position: relative;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
    user-select: none;
    -webkit-user-drag: element;
}

.player-cell:active {
    cursor: grabbing;
}

/* Cell inner container */
.player-cell-inner {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    backdrop-filter: blur(12px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 24px;
}

/* Fixed width for 10 characters */
.player-name {
    font-size: 0.625rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 10ch;
    min-width: 10ch;
    width: 10ch;
    text-align: center;
    display: inline-block;
    letter-spacing: 0.02em;
}

/* Player number */
.player-num {
    font-size: 0.625rem;
    font-weight: 700;
    color: #fbbf24;
    min-width: 0.875rem;
    text-align: right;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* Drag icon */
.player-drag-icon {
    font-size: 0.75rem;
    color: #64748b;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
    line-height: 1;
}

.player-cell:hover .player-drag-icon {
    opacity: 1;
    color: #fbbf24;
}

/* Hover effect */
.player-cell:hover .player-cell-inner {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
    transform: translateY(-1px);
}

/* Dragging state */
.player-cell.dragging {
    opacity: 0.4;
    transform: scale(1.05);
}

.player-cell.dragging .player-cell-inner {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 12px 30px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.2);
}

/* Drop position indicator */
.drop-indicator {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    transform: translateY(-50%) scaleX(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

/* Before indicator */
.player-cell.drop-indicator-active.drop-before .drop-indicator,
.player-cell.drop-indicator-active.drop-before .player-cell-inner {
    border-left-color: #ffd700;
    box-shadow: -2px 0 10px rgba(255, 215, 0, 0.3), 0 4px 12px rgba(255, 215, 0, 0.1);
}

.player-cell.drop-indicator-active.drop-before::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 10%;
    bottom: 10%;
    width: 3px;
    background: #ffd700;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    animation: pulse-indicator 1s ease-in-out infinite;
}

/* After indicator */
.player-cell.drop-indicator-active.drop-after .drop-indicator,
.player-cell.drop-indicator-active.drop-after .player-cell-inner {
    border-right-color: #ffd700;
    box-shadow: 2px 0 10px rgba(255, 215, 0, 0.3), 0 4px 12px rgba(255, 215, 0, 0.1);
}

.player-cell.drop-indicator-active.drop-after::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 10%;
    bottom: 10%;
    width: 3px;
    background: #ffd700;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    animation: pulse-indicator 1s ease-in-out infinite;
}

/* Pulse animation for indicator */
@keyframes pulse-indicator {
    0%, 100% {
        opacity: 0.6;
        transform: scaleY(1);
    }
    50% {
        opacity: 1;
        transform: scaleY(1.1);
    }
}

/* State during drag hover */
.player-cell.drop-indicator-active .player-cell-inner {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.5);
}

/* Success animation on drop */
.player-cell.drop-success {
    animation: drop-success 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes drop-success {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }
    100% {
        transform: scale(1);
    }
}

/* Mobile responsiveness */
@media (max-width: 640px) {
    .players-row {
        gap: 0.25rem;
    }

    .player-cell-inner {
        padding: 0.2rem 0.375rem;
        min-height: 20px;
    }

    .player-name {
        font-size: 0.5625rem;
        max-width: 9ch;
        min-width: 9ch;
        width: 9ch;
    }

    .player-num {
        font-size: 0.5rem;
        min-width: 0.75rem;
    }

    .player-drag-icon {
        font-size: 0.5rem;
    }
}
