:root {
    --bg-primary: #0f172a;
    --bg-card: #1e293b;
    --bg-card-elevated: #334155;
    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --tiktok-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #fe0979 100%);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body.mobile-app {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.app-wrapper {
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #111827;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 1.6rem;
}

.text-gradient {
    background: var(--tiktok-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-title h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.status-badge.connected {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.status-badge.disconnected {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
    box-shadow: 0 0 8px currentColor;
}

.pulse-button {
    animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.7); }
    70% { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(234, 179, 8, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}

/* App Body */
.app-body {
    flex: 1;
    padding: 16px 16px 85px 16px;
    overflow-y: auto;
}

.tab-pane-view {
    display: none;
    animation: fadeIn 0.25s ease-in-out;
}

.tab-pane-view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Player Card */
.player-card {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.video-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    max-height: 240px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-container video {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
}

.audio-disc-container {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

.vinyl-disc {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, #334155 0%, #0f172a 70%, #020617 100%);
    border: 4px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.vinyl-disc.spinning {
    animation: spinDisc 6s linear infinite;
}

@keyframes spinDisc {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.disc-center {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.gift-sender-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #a5b4fc;
}

.gift-icon-sm {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.track-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 4px 0;
}

.time-display {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-circle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.btn-circle.btn-lg {
    width: 58px;
    height: 58px;
    font-size: 1.35rem;
}

.btn-circle:hover {
    transform: scale(1.08);
}

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

/* Section Headings */
.section-heading {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Queue List */
.queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.queue-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.queue-item:active {
    background: var(--bg-card-elevated);
}

.queue-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.queue-index {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent-primary);
    min-width: 20px;
}

.queue-details {
    overflow: hidden;
}

.queue-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-sender {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Settings & Library Cards */
.settings-card, .library-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.upload-dropzone {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
    transition: all 0.2s ease;
}

.upload-dropzone:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.media-file-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.media-file-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.mapping-rule-item {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Bottom Navigation */
.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 520px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.nav-item-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.nav-item-btn i {
    font-size: 1.25rem;
}

.nav-item-btn.active {
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.12);
}

/* Responsive adjustments */
@media (min-width: 521px) {
    body.mobile-app {
        background-color: #0b0f19;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    .app-wrapper {
        border-radius: 28px;
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.1);
        min-height: calc(100vh - 40px);
    }
}
