:root {
    /* Light Theme (Softer One UI-inspired colors) */
    --primary: #60A5FA; /* Soft Blue 400 */
    --primary-dark: #1E3A8A; /* Blue 900 */
    --primary-gradient: linear-gradient(135deg, #60A5FA, #A78BFA); /* Soft Blue to Lavender */
    --background: #F9FAFB; /* Gray 50 */
    --card-bg: #FFFFFF;
    --text: #1F2937; /* Gray 800 */
    --text-secondary: #6B7280; /* Gray 500 */
    --border: #E5E7EB; /* Gray 200 */
    --shadow: rgba(0, 0, 0, 0.05);
    --success: #34D399; /* Green 400 */
    --error: #F87171; /* Red 400 */
    --warning: #FBBF24; /* Amber 400 */
    --info: #60A5FA; /* Soft Blue 400 */
    /* Inset variables */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    /* Surface container variables for loaders */
    --surfaceContainer: #E5E7EB; /* Gray 200 */
    --surfaceContainerHigh: #D1D5DB; /* Gray 300 */

    /* Dark Theme (Matching One UI dark tones with detail) */
    --dark-bg: #111827; /* Gray 900 */
    --dark-card: linear-gradient(145deg, #1F2937, #374151); /* Gradient for detail */
    --dark-text: #F3F4F6; /* Gray 100 - Brighter for toggle text */
    --dark-text-secondary: #9CA3AF; /* Gray 400 */
    --dark-border: #4B5563; /* Gray 600 */
    --dark-shadow: rgba(0, 0, 0, 0.3);
    --dark-surfaceContainer: #4B5563; /* Gray 600 */
    --dark-surfaceContainerHigh: #6B7280; /* Gray 500 */
}

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--background);
    color: var(--text);
    padding: calc(var(--safe-area-inset-top) + 16px) calc(var(--safe-area-inset-left) + 16px) calc(var(--safe-area-inset-bottom) + 16px) calc(var(--safe-area-inset-right) + 16px);
    line-height: 1.5;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.1) 0%, transparent 70%);
    animation: bgPulse 8s infinite ease-in-out;
    z-index: -1;
    pointer-events: none;
}

@keyframes bgPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

body.dark-theme {
    background: var(--dark-bg);
}

body.dark-themeKILL::before {
    background: radial-gradient(circle, rgba(167, 139, 250, 0.15) 0%, transparent 70%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: calc(100% - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
}

/* Header */
.header {
    background: var(--primary-gradient);
    color: #fff;
    padding: 14px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s infinite ease-in-out;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 100%; }
    100% { left: 100%; }
}

.dark-theme .header {
    background: linear-gradient(135deg, #1E3A8A, #6B7280);
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.5px;
    z-index: 1;
}

.version {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 8px;
    border-radius: 12px;
    margin-left: 10px;
    line-height: 1.2;
    z-index: 1;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow);
    position: relative;
}

.dark-theme .tab-nav {
    background: var(--dark-card);
}

.tab-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0.05;
    border-radius: 16px;
    pointer-events: none;
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 1;
    padding: 12px 18px;
    background: none;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: tabShine 4s infinite ease-in-out;
}

@keyframes tabShine {
    0% { left: -100%; }
    10% { left: 100%; }
    100% { left: 100%; }
}

.tab-btn.active {
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 2px 8px var(--shadow);
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(96, 165, 250, 0.1);
}

.dark-theme .tab-btn {
    color: var(--dark-text-secondary);
}

.dark-theme .tab-btn.active {
    color: #fff;
    background: var(--primary-gradient);
}

.dark-theme .tab-btn:hover {
    color: var(--primary);
    background: rgba(96, 165, 250, 0.15);
}

/* Tab Container */
.tab-container {
    position: relative;
    overflow: hidden;
    flex: 1;
    z-index: 1;
}

.tab-content {
    display: none;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: translateX(0);
    transition: none;
    height: 100%;
}

.tab-content.active {
    display: block;
    position: relative;
    opacity: 1;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px var(--shadow);
    border: none;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
}

.dark-theme .card {
    background: var(--dark-card);
    border-color: var(--dark-border);
}

/* Scroll Container */
.scroll-container {
    max-height: calc(90vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom) - 180px);
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 0;
    padding: 8px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    position: relative;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.scroll-container .loader {
    width: 100%;
    height: 40px;
    background: linear-gradient(90deg, var(--surfaceContainer), var(--surfaceContainerHigh), var(--surfaceContainer));
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
    border-radius: 8px;
    margin: 16px 0;
}

#device-picker-popup .scroll-container {
    min-height: 350px;
    height: 350px;
    flex: 1 0 auto;
    overflow-y: auto;
}

#device-modal .scroll-container {
    min-height: 350px;
    max-height: 350px;
    flex: 1 0 auto;
    overflow-y: auto;
    padding: 12px;
    border: none;
}

#device-picker-popup .scroll-container.no-scrollbar {
    overflow-y: hidden;
}

.dark-theme .scroll-container {
    background: var(--dark-card);
    border-color: var(--dark-border);
}

.scroll-container::-webkit-scrollbar {
    width: 6px;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 10px;
    margin: 8px 0;
}

.scroll-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 16px;
    margin: 8px 0;
}

.dark-theme .scroll-container::-webkit-scrollbar-thumb {
    background: var(--dark-text-secondary);
}

.dark-theme .scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

/* Search Container */
.search-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.search-container input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--background);
    color: var(--text);
}

.search-container input::placeholder {
    color: var(--text-secondary);
}

.dark-theme .search-container {
    background: var(--dark-card);
    border-color: var(--dark-border);
}

.dark-theme .search-container input {
    background: var(--dark-bg);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

.dark-theme .search-container input::placeholder {
    color: var(--dark-text-secondary);
}

/* Toggle Groups */
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    position: relative;
}

.toggle-group:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--border);
    opacity: 0.5;
}

.dark-theme .toggle-group:not(:last-child)::after {
    background: var(--dark-border);
}

.toggle-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    transition: color 0.3s ease;
}

.dark-theme .toggle-label {
    color: #F3F4F6;
}

/* Switches */
.switch {
    position: relative;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--text-secondary);
    border-radius: 24px;
    transition: all 0.2s ease;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

input:checked + .slider {
    background: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.toggle-group:hover .slider {
    transform: scale(1.05);
}

/* Button Group */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* Buttons */
.action-btn {
    background: var(--primary-gradient);
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: clamp(14px, 3.5vw, 15px);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 120px;
    transform: scale(1);
}

.shortcut-btn {
    background: var(--primary-gradient);
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: clamp(14px, 3.5vw, 15px);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transform: scale(1);
}

.shortcut-icon {
    width: 20px;
    height: 20px;
    fill: #fff;
    margin-right: 4px;
    transition: transform 0.3s ease;
}

.action-btn:hover, .shortcut-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px var(--shadow);
}

.shortcut-btn:hover .shortcut-icon {
    transform: scale(1.1);
}

.action-btn:active, .shortcut-btn:active {
    transform: scale(0.95);
}

.action-btn::after, .shortcut-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.action-btn:active::after, .shortcut-btn:active::after {
    width: 120px;
    height: 120px;
}

.action-btn.loading::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.action-btn.loading {
    padding-left: 32px;
    pointer-events: none;
    opacity: 0.8;
}

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

.dark-theme .action-btn, .dark-theme .shortcut-btn {
    background: linear-gradient(135deg, #1E3A8A, #6B7280);
}

.dark-theme .action-btn:hover, .dark-theme .shortcut-btn:hover {
    background: var(--primary-gradient);
}

.add-btn {
    background: var(--primary);
    color: #fff;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px var(--shadow);
}

.add-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05) translateX(2px);
}

.add-btn svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
}

.package-picker-btn {
    padding: 4px 8px;
    font-size: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 50px;
    justify-content: center;
    box-shadow: 0 3px 8px var(--shadow);
}

.package-picker-btn:hover {
    transform: scale(1.05);
    background: var(--primary-dark);
}

.package-picker-btn svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
    transition: transform 0.3s ease;
}

.package-picker-btn:hover svg {
    transform: scale(1.1);
}

.dark-theme .package-picker-btn {
    background: linear-gradient(135deg, #1E3A8A, #6B7280);
}

.dark-theme .package-picker-btn:hover {
    background: var(--primary-gradient);
}

/* Section Headers */
.section-header {
    margin-bottom: 12px;
}

.section-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
}

/* List Wrapper */
.list-wrapper {
    padding: 8px;
    width: 100%;
}

/* Lists */
.device-list, .game-list, .device-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    margin: 0;
}

.device-card, .game-card, .picker-device-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    animation: cardEnter 0.3s ease forwards;
    margin: 0 4px;
    will-change: opacity, transform, max-height;
}

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

.device-card.fade-out, .game-card.fade-out, .picker-device-card.fade-out {
    animation: fadeOut 0.4s ease forwards;
    max-height: 200px;
    overflow: hidden;
}

@keyframes fadeOut {
    0% { 
        opacity: 1; 
        transform: translateY(0); 
        max-height: 200px; 
        margin: 0 4px; 
        padding: 16px; 
    }
    100% { 
        opacity: 0; 
        transform: translateY(10px); 
        max-height: 0; 
        margin: 0 4px; 
        padding: 0 16px; 
    }
}

.device-card:hover, .game-card:hover, .picker-device-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-4px);
}

.picker-device-card.selected {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid var(--primary);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.dark-theme .picker-device-card.selected {
    background: rgba(96, 165, 250, 0.15);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.dark-theme .device-card, .dark-theme .game-card, .dark-theme .picker-device-card {
    background: var(--dark-card);
}

.device-header, .game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.device-name, .game-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 80px);
}

.dark-theme .device-name, .dark-theme .game-name {
    color: var(--dark-text);
}

.game-name {
    font-family: monospace;
}

.device-actions, .game-actions {
    display: flex;
    gap: 4px;
}

.edit-btn, .delete-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-btn {
    color: var(--primary);
}

.edit-btn:hover {
    background: rgba(96, 165, 250, 0.1);
}

.delete-btn {
    color: var(--error);
}

.delete-btn:hover {
    background: rgba(248, 113, 113, 0.1);
}

.device-details, .game-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.dark-theme .device-details, .dark-theme .game-details {
    color: var(--dark-text-secondary);
}

/* Picker Device Card Specific Styles */
.picker-device-card h4 {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    color: var(--text);
}

.dark-theme .picker-device-card h4 {
    color: var(--dark-text);
}

.picker-device-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

.dark-theme .picker-device-card p {
    color: var(--dark-text-secondary);
}

/* Log Section */
.log-section {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow);
    margin-top: 16px;
    max-height: calc(50% - var(--safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

.dark-theme .log-section {
    background: var(--dark-card);
}

.log-header {
    background: var(--primary-gradient);
    color: #fff;
    padding: 10px 12px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.dark-theme .log-header {
    background: linear-gradient(135deg, #1E3A8A, #6B7280);
}

.log-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.toggle-icon.expanded {
    transform: rotate(180deg);
}

.clear-text {
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.2s ease;
}

.clear-text:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.log-content {
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    transition: max-height 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    background: var(--background);
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--text-secondary) var(--background);
}

.log-content::-webkit-scrollbar {
    width: 4px;
}

.log-content::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 2px;
}

.log-content::-webkit-scrollbar-track {
    background: var(--background);
}

.dark-theme .log-content {
    background: var(--dark-bg);
    scrollbar-color: var(--dark-text-secondary) var(--dark-bg);
}

.dark-theme .log-content::-webkit-scrollbar-thumb {
    background: var(--dark-text-secondary);
}

.dark-theme .log-content::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

.log-content.collapsed {
    max-height: 0;
    padding: 0 12px;
    overflow: hidden;
}

#output {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Log Styles */
.log-info { color: var(--info); }
.log-success { color: var(--success); }
.log-error { color: var(--error); }
.log-warning { color: var(--warning); }
.log-green { color: var(--success); }
.log-red { color: var(--error); }

/* Log Icons */
.log-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    vertical-align: middle;
}

.icon-success {
    background: var(--success);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") no-repeat center;
}

.icon-error {
    background: var(--error);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") no-repeat center;
}

.icon-warning {
    background: var(--warning);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 19h20L12 2zm0 5v6m0 4h.01'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 19h20L12 2zm0 5v6m0 4h.01'/%3E%3C/svg%3E") no-repeat center;
}

.icon-info {
    background: var(--info);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4m0-4h.01'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4m0-4h.01'/%3E%3C/svg%3E") no-repeat center;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: var(--safe-area-inset-left);
    width: calc(100% - var(--safe-area-inset-left) - var(--safe-area-inset-right));
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: calc(var(--safe-area-inset-top) + 16px) 16px calc(var(--safe-area-inset-bottom) + 16px);
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px var(--shadow);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

#game-modal .modal-content {
    max-height: 600px;
}

#device-modal .modal-content {
    max-height: 600px;
    min-height: 400px;
}

.device-form-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
}

.modal-content.modal-enter {
    animation: modalEnter 0.3s ease forwards;
}

.modal-content.modal-exit {
    animation: modalExit 0.3s ease forwards;
}

@keyframes modalEnter {
    0% { transform: scale(0.9); opacity: 0; }
    70% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes modalExit {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0; }
}

.dark-theme .modal-content {
    background: var(--dark-card);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
}

.close-btn {
    font-size: 22px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--error);
}

/* Form Styles */
.form-group {
    margin-bottom: 12px;
    position: relative;
}

.form-group label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    display: block;
}

.dark-theme .form-group label {
    color: var(--dark-text);
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--background);
    color: var(--text);
    transition: all 0.3s ease;
}

.form-group input.error, .form-group textarea.error, .form-group select.error {
    border-color: var(--error);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

.error-message {
    color: var(--error);
    font-size: 12px;
    margin-top: 6px;
    display: block;
    padding: 4px 8px;
    background: rgba(248, 113, 113, 0.1);
    border-radius: 6px;
    transition: opacity 0.3s ease;
}

.dark-theme .error-message {
    background: rgba(248, 113, 113, 0.15);
}

.dark-theme .form-group input, .dark-theme .form-group textarea, .form-group select {
    background: var(--dark-bg);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

.dark-theme .form-group input.error, .dark-theme .form-group textarea.error, .dark-theme .form-group select.error {
    border-color: var(--error);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

.dark-theme .form-group input::placeholder,
.dark-theme .form-group textarea::placeholder,
.dark-theme .form-group select::placeholder {
    color: var(--dark-text-secondary);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.3);
}

#game-device {
    width: 100%;
    min-width: 250px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--background);
    color: var(--text);
    cursor: pointer;
}

#game-device.error {
    border-color: var(--error);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

#game-device.highlighted {
    border: 1px solid var(--primary);
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.05);
}

.dark-theme #game-device {
    background: var(--dark-bg);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

.dark-theme #game-device.error {
    border-color: var(--error);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

.dark-theme #game-device.highlighted {
    border: 1px solid var(--primary);
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.1);
}

.form-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-shrink: 0;
}

.cancel-btn {
    background: var(--border);
    color: var(--text);
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s ease;
}

.dark-theme .cancel-btn {
    background: var(--dark-border);
    color: var(--dark-text);
}

.cancel-btn:hover {
    background: var(--text-secondary);
}

/* Popup Styles */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: var(--safe-area-inset-left);
    width: calc(100% - var(--safe-area-inset-left) - var(--safe-area-inset-right));
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: calc(var(--safe-area-inset-top) + 16px) 16px calc(var(--safe-area-inset-bottom) + 16px);
}

.popup-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 12px var(--shadow);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

#device-picker-popup .popup-content {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.device-picker-content {
    max-width: 400px;
    max-height: calc(80vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 350px;
    flex: 1;
}

.device-picker {
    flex: 1 0 auto;
    width: 100%;
    overflow-y: visible;
    padding: 0 4px;
    min-height: 350px;
}

.device-picker::-webkit-scrollbar {
    display: none;
}

.popup-content:not(.popup-exit) {
    animation: modalEnter 0.3s ease forwards;
}

.popup-exit {
    animation: modalExit 0.3s ease forwards;
}

.dark-theme .popup-content {
    background: var(--dark-card);
}

.popup-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
}

.popup-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.dark-theme .popup-content p {
    color: var(--dark-text-secondary);
}

.popup-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Theme Button */
.theme-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    transition: transform 0.3s ease;
    z-index: 1;
}

.theme-btn:hover {
    transform: scale(1.2);
}

/* Snackbar Styles */
.snackbar {
    position: fixed;
    bottom: calc(var(--safe-area-inset-bottom) + 16px);
    left: calc(var(--safe-area-inset-left) + 16px);
    right: calc(var(--safe-area-inset-right) + 16px);
    background: var(--card-bg);
    color: var(--text);
    padding: 12px 16px 16px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1100;
    opacity: 0;
    transform: translateY(100px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 400px;
    margin: 0 auto;
    overflow: visible;
    will-change: transform, opacity;
    font-family: 'Roboto', sans-serif; 
}

.snackbar.show {
    opacity: 1;
    transform: translateY(0);
}

.snackbar-message {
    flex: 1;
    font-size: 12px; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
}

.snackbar::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 16px;
    right: 16px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    z-index: 1;
}

.snackbar.show-timer::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 16px;
    width: calc(100% - 32px);
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    transform-origin: left;
    animation: timer 5s linear forwards;
    z-index: 2;
}

@keyframes timer {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0); }
}

.dark-theme .snackbar {
    background: var(--dark-card);
    color: var(--dark-text);
    font-family: 'Roboto', sans-serif; 
}

.dark-theme .snackbar::before {
    background: var(--dark-border);
}

.dark-theme .snackbar.show-timer::after {
    background: var(--primary);
}

.snackbar-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px; 
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-family: 'Roboto', sans-serif; 
}

.snackbar-btn:hover {
    background: rgba(96, 165, 250, 0.1);
    border-radius: 6px;
}

.dark-theme .snackbar-btn {
    color: var(--primary);
    font-family: 'Roboto', sans-serif; 
}

.dark-theme .snackbar-btn:hover {
    background: rgba(96, 165, 250, 0.15);
}

/* App List Styles */
.app-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    width: 100%;
}

.app-card {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 6px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.dark-theme .app-card {
    background: var(--dark-card);
}

.app-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-2px);
}

.app-card.added-game {
    background: rgba(52, 211, 153, 0.1) !important;
}

.app-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-right: 12px;
    object-fit: contain;
    background: var(--background);
    transition: opacity 0.3s ease;
}

.dark-theme .app-icon {
    background: var(--dark-bg);
}

.app-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.dark-theme .app-name {
    color: var(--dark-text);
}

.app-package {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Roboto Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark-theme .app-package {
    color: var(--dark-text-secondary);
}

.loader {
    background: linear-gradient(90deg, var(--surfaceContainer), var(--surfaceContainerHigh), var(--surfaceContainer));
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Ignored game card styles */
.game-card.ignored {
    background: rgba(248, 113, 113, 0.1);
    border-left: 4px solid var(--error);
}

.dark-theme .game-card.ignored {
    background: rgba(248, 113, 113, 0.15);
}

.ignored-badge {
    display: inline-block;
    background: var(--error);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 500;
}

.dark-theme .ignored-badge {
    background: var(--error);
}

/* Ignore Popup Specific Styles */
#ignore-popup .popup-content {
    max-width: 320px;
    padding: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#ignore-popup .popup-header {
    padding: 16px;
    background: var(--card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.dark-theme #ignore-popup .popup-header {
    background: var(--dark-card);
}

#ignore-popup .popup-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}

#ignore-popup .close-popup-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

#ignore-popup .popup-body {
    padding: 20px 16px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#ignore-popup .popup-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
}

#ignore-popup .popup-icon.icon-remove {
    background: var(--error);
}

#ignore-popup .popup-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: white;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") no-repeat center;
}

#ignore-popup .popup-icon.icon-remove::before {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") no-repeat center;
}

#ignore-popup .popup-package {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
    word-break: break-all;
    user-select: auto;
    -webkit-user-select: auto;
    -webkit-touch-callout: default;
}

#ignore-popup .popup-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px;
    gap: 8px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Prevent text selection on game cards */
.game-card {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    padding: 12px;
}

/* Make sure buttons still work */
.game-actions button {
    pointer-events: auto;
    flex-shrink: 0;
}

/* Prevent text selection on text elements */
.game-header, .game-details {
    user-select: none;
    -webkit-user-select: none;
    gap: 8px; 
}

#ignore-popup .popup-content {
    max-width: 320px;
    padding: 0;
    overflow: hidden;
    z-index: 1001; /* Ensure popup content is above other elements */
}

.game-name-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.game-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px; 
    font-family: 'Poppins', sans-serif; 
}

.game-package {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Roboto Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.dark-theme .game-name {
    color: var(--dark-text);
}

.dark-theme .game-package {
    color: var(--dark-text-secondary);
}

.installed-badge {
    display: inline-block;
    background: var(--success);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 500;
}

.dark-theme .installed-badge {
    background: var(--success);
}

.game-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.game-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge-group {
    display: flex;
    gap: 6px;
    margin-left: 8px;
}

.dark-theme .game-details {
    color: var(--dark-text-secondary);
}

.game-name-popup {
    display: block;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    margin-bottom: 4px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.package-name-popup {
    display: block;
    font-size: 13px;
    font-family: 'Roboto Mono', monospace;
    color: var(--text-secondary);
    word-break: break-all;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.dark-theme .game-name-popup {
    color: var(--dark-text);
}

.dark-theme .package-name-popup {
    color: var(--dark-text-secondary);
}

#ignore-popup .popup-package {
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-top: 8px;
}

.dark-theme #ignore-popup .popup-package {
    background: rgba(255, 255, 255, 0.05);
}

/* Update Confirm Popup Icon Styles */
.popup-icon-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.popup-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.update-icon {
    background: var(--primary);
}

.update-icon::before {
    content: '';
    width: 20px;
    height: 20px;
    background: white;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M4 12a8 8 0 0 1 8-8V2.5M20 12a8 8 0 0 1-8 8v1.5M14 12h6m-6 0H4m0 0l3-3m-3 3l3 3'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M4 12a8 8 0 0 1 8-8V2.5M20 12a8 8 0 0 1-8 8v1.5M14 12h6m-6 0H4m0 0l3-3m-3 3l3 3'/%3E%3C/svg%3E") no-repeat center;
}

.popup-content h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.dark-theme .popup-content h3 {
    color: var(--dark-text);
}

/* App Icon Styles */
.app-icon-container {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    margin-right: 12px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.app-icon-placeholder {
    width: 100%;
    height: 100%;
    background: var(--surfaceContainer);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.app-icon-placeholder::after {
    content: '';
    width: 24px;
    height: 24px;
    background: var(--text-secondary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5'%3E%3C/path%3E%3Cpath d='M12 2v4'%3E%3C/path%3E%3Cpath d='M12 18v4'%3E%3C/path%3E%3Cpath d='M4.9 4.9l2.8 2.8'%3E%3C/path%3E%3Cpath d='M16.2 16.2l2.8 2.8'%3E%3C/path%3E%3Cpath d='M2 12h4'%3E%3C/path%3E%3Cpath d='M18 12h4'%3E%3C/path%3E%3Cpath d='M4.9 19.1l2.8-2.8'%3E%3C/path%3E%3Cpath d='M16.2 7.8l2.8-2.8'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5'%3E%3C/path%3E%3Cpath d='M12 2v4'%3E%3C/path%3E%3Cpath d='M12 18v4'%3E%3C/path%3E%3Cpath d='M4.9 4.9l2.8 2.8'%3E%3C/path%3E%3Cpath d='M16.2 16.2l2.8 2.8'%3E%3C/path%3E%3Cpath d='M2 12h4'%3E%3C/path%3E%3Cpath d='M18 12h4'%3E%3C/path%3E%3Cpath d='M4.9 19.1l2.8-2.8'%3E%3C/path%3E%3Cpath d='M16.2 7.8l2.8-2.8'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
}

.app-icon-loaded {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    background: var(--background);
}

.dark-theme .app-icon-loaded {
    background: var(--dark-bg);
}

.app-icon-container.load-failed .app-icon-placeholder::after {
    background: var(--error);
}

/* App Card Styles */
.app-card {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 6px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.app-card.added-game {
    background: rgba(52, 211, 153, 0.1);
}

.app-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.app-package {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Roboto Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Popup Styles */
.ignore-explanation-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.ignore-explanation-popup .popup-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 12px var(--shadow);
    text-align: left;
    direction: ltr;
    transform: scale(0.9);
    opacity: 0;
}

.dark-theme .ignore-explanation-popup .popup-content {
    background: var(--dark-card);
}

.ignore-explanation-popup .popup-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 16px;
}

.ignore-explanation-popup .explanation-text {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.5;
}

.dark-theme .ignore-explanation-popup .explanation-text {
    color: var(--dark-text);
}

.ignore-explanation-popup .explanation-text strong {
    color: var(--primary);
}

.ignore-explanation-popup .explanation-text ul {
    margin: 10px 0;
    padding-left: 20px;
}

.ignore-explanation-popup .action-btn {
    background: var(--primary-gradient);
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    width: 100%;
}

.ignore-explanation-popup .action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px var(--shadow);
}

.dark-theme .ignore-explanation-popup .action-btn {
    background: linear-gradient(135deg, #1E3A8A, #6B7280);
}

.dark-theme .ignore-explanation-popup .action-btn:hover {
    background: var(--primary-gradient);
}
/* Device Select Field Styles */
.device-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.device-select-wrapper input {
    padding-right: 32px; /* Space for the icon */
    width: 100%;
}

.dropdown-icon {
    position: absolute;
    right: 12px;
    pointer-events: none;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

#game-device.highlighted ~ .dropdown-icon {
    color: var(--primary);
}

.dark-theme .dropdown-icon {
    color: var(--dark-text-secondary);
}

.dark-theme #game-device.highlighted ~ .dropdown-icon {
    color: var(--primary);
}
.log-actions {
    display: flex;
    gap: 8px;
}

.copy-text {
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	padding: 4px 8px;
	transition: all 0.2s ease;
}

.copy-text:hover {
	background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.log-actions {
    display: flex;
    gap: 8px;
}

.logcat-text {
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.logcat-text:hover {
    background: rgba(96, 165, 250, 0.1);
    border-radius: 4px;
}

.dark-theme .logcat-text {
    color: var(--primary);
}

.dark-theme .logcat-text:hover {
    background: rgba(96, 165, 250, 0.15);
}

#start-logcat {
    color: var(--success); 
    background: rgba(52, 211, 153, 0.1); 
}

#start-logcat:hover {
    background: rgba(52, 211, 153, 0.2); 
}

#stop-logcat {
    color: var(--error); 
    background: rgba(248, 113, 113, 0.1); 
}

#stop-logcat:hover {
    background: rgba(248, 113, 113, 0.2); 
}

.dark-theme #start-logcat {
    background: rgba(52, 211, 153, 0.15); 
}

.dark-theme #start-logcat:hover {
    background: rgba(52, 211, 153, 0.25); 
}

.dark-theme #stop-logcat {
    background: rgba(248, 113, 113, 0.15); 
}

.dark-theme #stop-logcat:hover {
    background: rgba(248, 113, 113, 0.25); 
}


.backup-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(96, 165, 250, 0.05);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.backup-row:hover {
    background: rgba(96, 165, 250, 0.1);
    transform: translateY(-1px);
}

.dark-theme .backup-row {
    background: rgba(96, 165, 250, 0.08);
}

.dark-theme .backup-row:hover {
    background: rgba(96, 165, 250, 0.12);
}

.backup-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.backup-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.dark-theme .backup-title {
    color: var(--dark-text);
}

.backup-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.dark-theme .backup-desc {
    color: var(--dark-text-secondary);
}

.small-btn {
    padding: 6px 8px;
    min-width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.small-btn svg {
    margin: 0;
}

/* Button Group Adjustment */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 16px;
}

.button-group .action-btn {
    flex: 1;
    min-width: 140px;
}

/* Popup Body Adjustment */
.popup-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Popup Footer Adjustment */
.popup-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.dark-theme .popup-footer {
    border-color: var(--dark-border);
}

.backup-btn.loading::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.backup-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.backup-btn.loading svg {
    opacity: 0;
}

#file-picker-popup .popup-content {
    max-width: 400px;
    width: 90%;
}

#file-picker-popup .scroll-container {
    min-height: 200px;
    max-height: 300px;
    padding: 8px;
}

#file-picker-popup .app-card {
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#file-picker-popup .app-card:hover {
    background: rgba(96, 165, 250, 0.1);
    transform: translateY(-1px);
}

.dark-theme #file-picker-popup .app-card:hover {
    background: rgba(96, 165, 250, 0.12);
}

#file-picker-popup .app-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.dark-theme #file-picker-popup .app-name {
    color: var(--dark-text);
}

.breadcrumb-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px var(--shadow);
}

.dark-theme .breadcrumb-container {
    background: var(--dark-card);
}

.breadcrumb-path {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.dark-theme .breadcrumb-path {
    color: var(--dark-text);
}

.back-btn {
    padding: 6px;
    min-width: auto;
    background: var(--primary-gradient);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-theme .back-btn {
    background: linear-gradient(135deg, #1E3A8A, #6B7280);
}

.back-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px var(--shadow);
}

.folder-icon::after {
    content: '';
    width: 24px;
    height: 24px;
    background: var(--text-secondary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
}

.file-icon::after {
    content: '';
    width: 24px;
    height: 24px;
    background: var(--text-secondary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'%3E%3C/path%3E%3Cpolyline points='13 2 13 9 20 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'%3E%3C/path%3E%3Cpolyline points='13 2 13 9 20 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
}

.dark-theme .folder-icon::after,
.dark-theme .file-icon::after {
    background: var(--dark-text-secondary);
}

.popup-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary); 
    margin-bottom: 12px;
}


#device-picker-popup .popup-content h3 {
    color: var(--primary); 
}

#backup-popup .popup-content h3 {
    color: var(--primary); 
}

#file-picker-popup .popup-content h3 {
    color: var(--primary); 
}

#package-picker-popup .popup-content h3 {
    color: var(--primary); 
}

.dark-theme .popup-content h3 {
    color: var(--primary); 
}

#backup-popup .popup-content h3 {
    text-align: left; 
}

#file-picker-popup .popup-content h3 {
    text-align: left; 
}

#save-log-popup .popup-content {
    max-width: 350px;
    padding: 20px;
    text-align: center;
}

#save-log-popup .popup-content h3 {
    margin-bottom: 12px;
    color: var(--primary);
}

#save-log-popup .popup-content p {
    margin-bottom: 12px;
    color: var(--text);
    line-height: 1.5;
}

#save-log-filename {
    display: block;
    margin-top: 8px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
}

.dark-theme #save-log-filename {
    background: rgba(255, 255, 255, 0.05);
}

#save-log-popup .popup-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}
