:root {
    --primary-color: #5a0fbb;
    --secondary-color: #1f63ef;
    --dark-bg: #0a0a12; /* darker base */
    --card-bg: rgba(255, 255, 255, 0.04); /* slightly darker cards */
    --text-color: #f0f0f3; /* brighter text for contrast */
    --text-secondary: #9aa0ab; /* improved contrast */
    --glass-border: rgba(255, 255, 255, 0.12);
    --purple-gradient: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.55);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    /* Layout metrics */
    --nav-height: 72px;
    --reels-header-height: 64px;
    --reels-gap: 28px;
    /* Extended palette */
    --surface-1: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-3: rgba(255, 255, 255, 0.08);
    --glass-gradient: linear-gradient(180deg, rgba(106,17,203,0.18) 0%, rgba(37,117,252,0.12) 100%);
    --ring-color: rgba(158, 203, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--dark-bg);
    color: var(--text-color);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(106, 17, 203, 0.10) 0%, transparent 22%),
        radial-gradient(circle at 90% 80%, rgba(37, 117, 252, 0.08) 0%, transparent 22%);
    background-attachment: fixed;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    overflow-x: hidden;
}

/* Global improved focus for accessibility */
:focus-visible {
    outline: 2px solid var(--ring-color);
    outline-offset: 2px;
    border-radius: 10px;
}

/* Subtle scrollbars for dark theme */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}
*::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 10px;
    border: 2px solid rgba(0,0,0,0.2);
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navigation Bar - Bottom positioned */
.nav-bar {
    display: flex;
    background: var(--surface-1);
    background-image: var(--glass-gradient);
    backdrop-filter: saturate(140%) blur(18px);
    -webkit-backdrop-filter: saturate(140%) blur(18px);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.3);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 8px 0;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    border-radius: 16px;
    margin: 0 8px;
    position: relative;
    min-height: 48px;
}

.nav-item i {
    font-size: 1.6rem;
    transition: transform 0.2s ease;
}

.nav-item span {
    display: none; /* Hide text labels */
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(106, 17, 203, 0.15);
    transform: translateY(-2px);
}

.nav-item.active i {
    transform: scale(1.1);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.nav-item:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

/* Content Container */
.content-container {
    flex: 1;
    overflow: hidden;
    padding-bottom: 80px; /* Account for bottom navigation */
}

.view {
    display: none;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

.view.active {
    display: block;
}

/* Reels Section */
.reels-container {
    height: 100vh;
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
}

.reels-header {
    padding: 20px;
    text-align: center;
    background: var(--surface-1);
    background-image: var(--glass-gradient);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.reels-header h2 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin: 0;
}

.reels-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: y proximity; /* Changed from mandatory for smoother snapping */
    /* Improve scroll performance */
    will-change: scroll-position;
    /* Better momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    /* Prevent horizontal scroll */
    overflow-x: hidden;
    /* Add vertical breathing space */
    padding: var(--reels-gap) 0;
    /* Adjust scroll snap points */
    scroll-padding: calc(50vh - 50%);
    overscroll-behavior-y: contain; /* avoid browser bounce interfering */
}

.reels-reel {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--dark-bg);
    scroll-snap-align: center; /* Changed from start to center */
    scroll-snap-stop: always;
    /* Center the reel in viewport */
    margin: 0 auto;
    /* Add some vertical spacing between reels */
    padding: 20vh 0;
}

/* Add scroll observer target for each reel */
.reels-reel::after {
    content: '';
    position: absolute;
    top: 50%;
    height: 1px;
    width: 100%;
    pointer-events: none;
    opacity: 0;
}

.reels-reel-video {
    width: 100%;
    height: 100%;
    max-width: 560px; /* slightly wider for modern phones */
    background: #000;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

/* Desktop: allow a larger stage while staying centered */
@media (min-width: 1024px) {
  .reels-reel-video { max-width: 640px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .icon-btn, .clear-btn, .setting-btn, .save-btn { transition: none !important; }
  .notification { transition: none !important; }
}

.reels-reel-info {
    padding: 16px;
    text-align: center;
    max-width: 400px;
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.reels-reel-info h3 {
    color: var(--text-color);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}

/* Navigation buttons for reels */
.reels-nav {
    position: fixed;
    bottom: 100px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

.reels-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
}

.reels-nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    background: var(--purple-gradient);
    background-clip: text; /* standard */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--purple-gradient);
    background-clip: text; /* standard */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    position: absolute;
    top: 20px;
    right: 20px;
}

.header-actions .icon-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.header-actions .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Glass Card Effect */
.glass-card {
    background: var(--surface-1);
    background-image: var(--glass-gradient);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 26px;
    /* Optimize for mobile performance */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

/* Fallback if no backdrop-filter support */
@supports not ((backdrop-filter: blur(10px))) {
  .glass-card, .nav-bar, .reels-header {
    background: rgba(20, 20, 28, 0.9);
  }
}

/* Search Section */
.search-container h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.input-group {
    display: flex;
    gap: 0; /* ensure buttons connect */
    margin-bottom: 14px;
}

.input-group input {
    flex: 1;
    padding: 16px 20px;
    border-radius: 14px 0 0 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.3);
}

.input-group button {
    padding: 0 22px;
    background: var(--purple-gradient);
    color: white;
    border: none;
    border-radius: 0 14px 14px 0;
    cursor: pointer;
    font-size: 1.15rem;
    transition: transform 0.2s, filter 0.2s;
    box-shadow: var(--shadow-md);
}

.input-group button:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* Small icon buttons (Paste, Clear) placed between input and Load */
.input-group .icon-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    border-left: none; /* merge with previous element border */
    padding: 0 18px;
    font-size: 1.05rem;
    border-radius: 0; /* middle buttons shouldn't have round corners */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px; /* touch target */
    min-height: 44px; /* touch target */
}

.input-group .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.input-group .icon-btn.danger {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.5);
}

/* Keep only the final Load button rounded on the right side */
.input-group #loadBtn {
    border-radius: 0 14px 14px 0;
}

/* On mobile when stacked, make buttons full-width and rounded */
@media (max-width: 480px) {
    .input-group .icon-btn {
        border-left: 1px solid var(--glass-border);
        border-radius: 50px;
        padding: 12px 0;
        margin-bottom: 10px;
    }
}

.help-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Player Section */
.player-container {
    min-height: 400px;
    overflow-y: visible;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.save-btn {
    background: var(--purple-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: transform 0.2s;
}

.save-btn:hover {
    transform: scale(1.05);
}

.icon-btn, .clear-btn, .setting-btn {
    transition: transform 160ms ease, box-shadow 160ms ease;
}
.icon-btn:hover, .clear-btn:hover, .setting-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

/* Instagram embed styling (Home view) */
.embed-wrapper {
    position: relative;
    width: 100%;
    max-width: 560px; /* match reels stage */
    margin: 0 auto;
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

#embedContainer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Style for Instagram iframe */
#embedContainer iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    background: transparent !important;
    transform: scale(1); /* align with reels page (no crop) */
    transform-origin: center center;
}

/* Reels view: make the embedded iframe fill and zoom like the main player */
.reel-embed-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden; /* hide any Instagram outer chrome */
}

.reel-embed-container iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    background: transparent !important;
    transform: scale(1); /* no zoom so the full video is visible */
    transform-origin: center center;
}

/* Tweak zoom per screen size for best fit */
@media (max-width: 480px) {
  .reel-embed-container iframe {
    transform: scale(1);
  }
}

@media (min-width: 1024px) {
  .reel-embed-container iframe {
    transform: scale(1);
  }
}

/* Hide Instagram embed border */
.instagram-media {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    min-width: auto !important;
}

/* Do not override Instagram's iframe sizing; it sets inline width/height */

/* Ensure the Instagram blockquote centers and uses available width */
.instagram-media {
    margin: 0 auto !important;
    width: 100% !important; /* let it fill wrapper width */
    max-width: 540px !important; /* Instagram's recommended max width */
}

/* Instagram sometimes wraps the iframe; make wrappers full width */
#embedContainer > div {
    width: 100% !important;
}

/* Hide Instagram embed UI elements for clean video-only experience */
/* Hide Instagram's header overlay (creator info, follow button) */
.instagram-media .EmbedHeader {
    display: none !important;
}

/* Hide Instagram's footer overlay (likes, comments, share) */
.instagram-media .EmbedFooter {
    display: none !important;
}

/* Hide any Instagram branding or attribution */
.instagram-media .EmbedAttribution {
    display: none !important;
}

/* Hide caption overlay if present */
.instagram-media .EmbedCaption {
    display: none !important;
}

/* Hide any additional overlay elements */
.instagram-media .EmbedOverlay {
    display: none !important;
}

/* Ensure the video container is visible and properly sized */
.instagram-media .EmbedFrame {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
}

.loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10;
    font-size: 2rem;
    color: white;
}

/* Auto-Loaded Reels Section */
.auto-loaded-section {
    margin-bottom: 26px;
}

.auto-loaded-grid {
    display: flex;
    gap: 20px;
    max-height: 200px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 10px;
    scroll-snap-type: x mandatory;
}

.auto-loaded-grid::-webkit-scrollbar {
    width: 8px;
}

.auto-loaded-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.auto-loaded-grid::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.auto-loaded-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.auto-loaded-reel {
    background: rgba(255, 255, 255, 0.035);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    position: relative;
    flex: 0 0 200px;
    scroll-snap-align: start;
}

.auto-loaded-reel:hover {
    transform: translateY(-4px) translateZ(0);
    box-shadow: var(--shadow-lg);
}

.auto-loaded-reel.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.3);
}

.auto-loaded-reel-thumbnail {
    width: 100%;
    height: 150px;
    background: #000;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.auto-loaded-reel-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auto-loaded-reel-info {
    padding: 12px;
}

.auto-loaded-reel-info h4 {
    font-size: 0.95rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auto-loaded-reel-info p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.loading-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Saved Reels Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

/* Saved toolbar (search/filter) */
.saved-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.saved-toolbar .searchbox {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 12px;
}

.saved-toolbar .searchbox i {
    color: var(--text-secondary);
}

.saved-toolbar .searchbox input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 0.95rem;
}

.clear-btn {
    background: transparent;
    color: #ff5757;
    border: 1px solid rgba(255, 87, 87, 0.7);
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}

.clear-btn:hover {
    background: rgba(255, 77, 77, 0.1);
}

.saved-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.saved-reel {
    background: rgba(255, 255, 255, 0.035);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    position: relative;
}

.saved-reel:hover {
    transform: translateY(-4px) translateZ(0);
    box-shadow: var(--shadow-lg);
}

/* Per-card action overlay */
.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    background: rgba(12, 12, 18, 0.45);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 6px;
    border-radius: 999px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s;
}

.saved-reel:hover .card-actions {
    opacity: 1;
    transform: translateY(0);
}

.card-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.card-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
}

.card-btn.play { color: #8fd17f; }
.card-btn.copy { color: #9ecbff; }
.card-btn.delete { color: #ff6b6b; }

/* On touch devices, keep actions visible for usability */
@media (hover: none) and (pointer: coarse) {
    .card-actions { opacity: 1; transform: none; }
}

.saved-reel-thumbnail {
    width: 100%;
    height: 150px;
    background: #000;
    position: relative;
    overflow: hidden;
}

.saved-reel-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.saved-reel-info {
    padding: 12px;
}

.saved-reel-info h4 {
    font-size: 0.95rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-reel-info p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--purple-gradient);
    color: white;
    padding: 14px 22px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 1000;
    max-width: 300px;
}

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

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 40px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    max-width: 650px;
    width: 95%;
    max-height: 95vh;
    padding: 0;
}

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

.modal-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 24px;
}

.setting-group h4 {
    margin-bottom: 10px;
    color: var(--text-color);
}

.setting-btn {
    background: var(--purple-gradient);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.setting-btn:hover {
    transform: translateY(-1px);
}

.setting-btn.danger {
    background: #ff5757;
}

.setting-btn.danger:hover {
    background: #ff6b6b;
}

.shortcuts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shortcuts-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.shortcuts-list li:last-child {
    border-bottom: none;
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    color: var(--text-color);
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: background 0.3s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.about-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Modal responsive */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        width: 95%;
    }

    .modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 2rem;
    }

    .logo i {
        font-size: 2rem;
    }

    .auto-loaded-grid {
        gap: 15px;
        max-height: 180px;
    }

    .auto-loaded-reel {
        flex: 0 0 150px;
    }

    .saved-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .saved-reel-thumbnail {
        height: 120px;
    }

    .notification {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right: calc(20px + env(safe-area-inset-right));
        left: calc(20px + env(safe-area-inset-left));
        max-width: none;
    }

    /* No fixed min-height on mobile either */
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
        padding-left: calc(15px + env(safe-area-inset-left));
        padding-right: calc(15px + env(safe-area-inset-right));
    }
    
    .glass-card {
        padding: 20px;
    }
    
    .input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .input-group input {
        border-radius: 14px;
        margin-bottom: 0;
    }
    
    .input-group button {
        border-radius: 14px;
        padding: 14px 0;
    }
    
    .player-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    iframe {
        border: none;
    }
    
    /* Darken theme */
    :root {
        --background: #1a1a1a;
        --text-primary: #fff;
        --text-secondary: #ccc;
        --glass-border: rgba(255, 255, 255, 0.1);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
        --purple-gradient: linear-gradient(90deg, #7a0bc0, #bb86fc);
    }
    
    /* Improve mobile design and touch targets */
    .clear-btn {
        padding: 12px 18px;
        font-size: 1rem;
    }
    
    .saved-reel-thumbnail {
        height: 180px;
    }
    
    .saved-reel-info {
        padding: 18px;
    }
    
    .saved-reel-info h4 {
        font-size: 1.1rem;
    }
    
    /* Add safe-area support */
    .container {
        padding-top: calc(20px + env(safe-area-inset-top));
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    /* Adjust contrasts and shadows */
    .saved-reel {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--glass-border);
        box-shadow: var(--shadow-md);
    }

    .saved-reel:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }
}

/* Desktop Layout */
@media (min-width: 1024px) {
    .nav-bar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 80px;
        flex-direction: column;
        border-top: none;
        border-right: 1px solid var(--glass-border);
        border-bottom: none;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .nav-item {
        padding: 20px 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
        border-radius: 0;
    }

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

    .nav-item span {
        display: none;
    }

    .nav-item.active {
        transform: none;
        border-left: 3px solid var(--primary-color);
    }

    .content-container {
        margin-left: 80px;
        width: calc(100vw - 80px);
        padding-bottom: 0;
    }

    .container {
        max-width: none;
        padding: 40px;
    }

    .reels-container {
        height: 100vh;
    }

    .reels-nav {
        bottom: 120px;
        right: calc(20px + (100vw - 80px - 400px) / 2);
    }
}
