/* Player View Styles - Premium Design */
#player-view {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: radial-gradient(circle at 50% 20%, #1a1d2e, #0d1017);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
        visibility 0.5s;
    overflow: hidden;
    padding-bottom: 110px;
}

#player-view.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Header */
.player-header {
    padding: 40px 24px 20px;
    background: rgba(22, 25, 34, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.player-title {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 8px;
    background: linear-gradient(135deg, #fff 0%, #ffb066 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
}

.player-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

/* Content */
.player-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

/* Active Device Display with 3D Visual */
.active-device-container {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.active-device-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255, 122, 26, 0.15), transparent 70%);
    opacity: 0.5;
    pointer-events: none;
}

.device-visual {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-glow {
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, rgba(255, 122, 26, 0.2), transparent 70%);
    filter: blur(40px);
    animation: pulse 3s ease-in-out infinite;
    z-index: 1;
}

.device-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: hidden;
    /* Hide any overflow */
}

.device-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill the square */
    border-radius: 24px;
    /* Slight rounding for aesthetics, but square overall */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    /* No float animation for video to keep it stable */
}

/* Hide energy ring as requested for square video */
.device-energy-ring {
    display: none;
}

/* Energy Ring */
.device-energy-ring {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.device-energy-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.energy-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 4;
}

.energy-ring-fill {
    fill: none;
    stroke: url(#energy-gradient);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 282.74;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s ease;
    filter: drop-shadow(0 0 8px rgba(255, 122, 26, 0.8));
}

/* Device Info */
.device-info {
    text-align: center;
    position: relative;
    z-index: 3;
}

.device-name {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.device-rarity {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.device-type {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* Stats Grid */
.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: transform 0.2s ease;
}

.stat-card:active {
    transform: scale(0.98);
}

.stat-icon {
    font-size: 28px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.stat-info {
    text-align: center;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

/* Meters */
.meters-container {
    margin-bottom: 24px;
}

.meter {
    margin-bottom: 16px;
}

.meter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.meter-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.meter-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.meter-bar {
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff7a1a, #ffb066);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(255, 122, 26, 0.6);
    position: relative;
}

.meter-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(200%);
    }
}

.durability-fill {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    box-shadow: 0 0 12px rgba(79, 172, 254, 0.6);
}

.durability-fill.low {
    background: linear-gradient(90deg, #f54260, #ff8177);
    box-shadow: 0 0 12px rgba(245, 66, 96, 0.6);
}

/* Modules Section */
.modules-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 16px;
}

.module-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.module-slot {
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.module-slot:hover,
.module-slot:active {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 122, 26, 0.4);
    transform: translateY(-2px);
}

.slot-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.slot-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.slot-module {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.module-name {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.btn-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 122, 26, 0.4);
}

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

.btn-icon {
    font-size: 20px;
}

/* Device List */
.device-list-container {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.5s ease;
}

.device-list-container.visible {
    max-height: 800px;
    opacity: 1;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.device-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.device-card.active {
    border-color: rgba(255, 122, 26, 0.5);
    box-shadow: 0 0 20px rgba(255, 122, 26, 0.2);
}

.device-card-image {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-card-image img,
.device-card-image video,
.device-card-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.device-card-info {
    margin-bottom: 12px;
}

.device-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.device-card-rarity {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
    margin-bottom: 4px;
}

.device-card-level {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.btn-activate {
    width: 100%;
    background: linear-gradient(135deg, #ff7a1a, #ffb066);
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    color: #000;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-activate:active {
    transform: scale(0.95);
}

.active-badge {
    padding: 8px 16px;
    background: rgba(0, 255, 100, 0.1);
    border: 1px solid rgba(0, 255, 100, 0.3);
    border-radius: 12px;
    color: #0f7;
    font-size: 12px;
    font-weight: 700;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    z-index: 101;
    background: linear-gradient(160deg, rgba(30, 35, 50, 0.98), rgba(20, 25, 35, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    max-width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.4s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

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

.modal-small {
    max-width: 400px;
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.05);
}

.modal-body {
    padding: 16px 24px 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Module List in Modal */
.module-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.module-item.equipped {
    border-color: rgba(255, 122, 26, 0.3);
    background: rgba(255, 122, 26, 0.05);
}

.module-item.unequip {
    border-color: rgba(255, 66, 96, 0.3);
    background: rgba(255, 66, 96, 0.05);
}

.module-icon {
    font-size: 32px;
}

.module-info {
    flex: 1;
    min-width: 0;
}

.module-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin: 6px 0;
    line-height: 1.4;
}

.module-bonuses {
    font-size: 11px;
    color: #0f7;
    font-weight: 600;
}

.btn-select-module {
    background: linear-gradient(135deg, #ff7a1a, #ffb066);
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    color: #000;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s ease;
}

.btn-select-module:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

.btn-select-module:active:not(:disabled) {
    transform: scale(0.95);
}

/* Modal Actions */
.modal-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.btn-cancel,
.btn-confirm {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-confirm {
    background: linear-gradient(135deg, #ff7a1a, #ffb066);
    border: none;
    color: #000;
}

.btn-cancel:active,
.btn-confirm:active {
    transform: scale(0.95);
}

/* Rarity Colors */
.rarity-common {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.rarity-rare {
    background: rgba(66, 153, 225, 0.2);
    color: #63b3ed;
    box-shadow: 0 0 10px rgba(99, 179, 237, 0.2);
}

.rarity-epic {
    background: rgba(159, 122, 234, 0.2);
    color: #b794f4;
    box-shadow: 0 0 10px rgba(183, 148, 244, 0.2);
}

.rarity-legendary {
    background: rgba(246, 173, 85, 0.2);
    color: #fbd38d;
    box-shadow: 0 0 15px rgba(251, 211, 141, 0.3);
    animation: legendaryPulse 2s ease-in-out infinite;
}

@keyframes legendaryPulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(251, 211, 141, 0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(251, 211, 141, 0.6);
    }
}