/* ...existing styles... */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Exo 2', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#app {
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    display: block;
}

.screen {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    overflow-x: hidden;
    overflow-y: hidden;
}

.screen.active {
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: static;
    min-height: calc(100vh - 40px);
}

#setup-screen .setup-content,
#sync-screen .sync-header,
#sync-screen .sync-workspace,
#sync-screen .sync-actions,
#player-screen .player-container {
    width: 100%;
    max-width: 480px;
}

/* Intro Screen */
.intro-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
    max-width: 100%;
    padding: 0 10px;
    position: relative;
}

/* center site title at the very top */
.intro-content .app-title {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    z-index: 120;
    font-size: 1.6rem;
    color: #00d4ff;
}

/* vertical stacked full width buttons in intro */
.intro-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.btn-primary.full-width, .btn-secondary.full-width {
    width: 100%;
    min-width: 0;
    border-radius: 12px;
    padding: 14px 18px;
}

/* fullscreen button positioned top-right of intro screen */
.btn-fullscreen {
    position: fixed;
    top: 6px; /* hug top edge */
    right: 6px; /* hug right edge */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    padding: 0;
}

/* make the icon inside the circle larger so it touches the circle edge */
.btn-fullscreen .material-symbols-outlined,
.btn-fullscreen {
    font-size: 1.6rem;
}
.btn-fullscreen .material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 48;
    font-size: 1.8rem;
    line-height: 1;
}

/* ensure home actions stack vertically and full-width */
.home-actions { padding: 0; margin: 0; }
.home-actions-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 480px;
}
.home-actions-vertical .full-width {
    width: 100%;
    border-radius: 12px;
}

/* remove gap hover rise for primary buttons on small circular controls to keep UI stable */
.player-controls { gap: 8px; }

/* Page Titles */
.page-title {
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 10px;
}

.page-title h2 {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    color: #00d4ff;
    margin: 0;
}

.navigation-arrows {
    display: flex;
    gap: 10px;
}

.nav-arrow {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(45deg, #00d4ff, #ff00de);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    transform: scale(1.1);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 120px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(45deg, #00d4ff, #ff00de);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 212, 255, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-secondary.full-width {
    width: 100%;
    margin-top: 1rem;
}

/* Material Symbols Icons */
.material-symbols-outlined {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24;
  font-size: 1.2em;
}

/* Setup Screen */
.setup-content {
    width: 100%;
    max-width: 480px;
    animation: slideInLeft 0.8s ease-out;
}

.setup-content h2 {
    font-family: 'Orbitron', monospace;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: #00d4ff;
}

.upload-section {
    margin-bottom: 2rem;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    border: 2px dashed #00d4ff;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 212, 255, 0.05);
    text-align: center;
}

.upload-label:hover {
    border-color: #ff00de;
    background: rgba(255, 0, 222, 0.05);
}

.upload-icon {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
    color: #00ff88;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-info {
    margin-top: 1rem;
    padding: 10px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    word-break: break-word;
}

.lyrics-section {
    margin-bottom: 2rem;
}

.lyrics-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: #00d4ff;
    font-weight: 600;
}

#lyrics-input {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

#lyrics-input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.font-section {
    margin-bottom: 2rem;
}

.font-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: #00d4ff;
    font-weight: 600;
}

#font-select {
    width: 100%;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1rem;
}

/* Sync Screen */
.sync-header {
    width: 100%;
    max-width: 480px;
    margin-bottom: 1rem;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
}

.control-btn {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(45deg, #00d4ff, #ff00de);
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    line-height: 1;
}

.control-btn .material-symbols-outlined {
     font-size: 1.8em;
     margin-bottom: 4px;
}

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

.progress-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: visible;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #ff00de);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 4px;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translate(50%, -50%);
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#time-display {
    font-size: 0.8rem;
    color: #b0b0b0;
    text-align: center;
}

.sync-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px 15px;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    font-size: 0.9rem;
}

.sync-controls label {
     color: #00d4ff;
     font-weight: 600;
}

.sync-controls input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.sync-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(45deg, #00d4ff, #ff00de);
    cursor: pointer;
}

.sync-workspace {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lyrics-list {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    overflow-y: auto;
    max-height: 300px;
}

.lyric-line {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    word-break: break-word;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lyric-time-badge {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: 'Space Mono', monospace;
    color: #00ff88;
    font-weight: 700;
    margin-left: 10px;
    min-width: 18px;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.95;
}

.lyric-line .lyric-text {
    flex: 1 1 auto;
    padding-right: 10px;
}

.lyric-line:hover {
    background: rgba(0, 212, 255, 0.1);
    border-left-color: #00d4ff;
}

.lyric-line.synced {
    background: rgba(0, 255, 136, 0.1);
    border-left-color: #00ff88;
}

.lyric-line.active {
    background: rgba(255, 0, 222, 0.2);
    border-left-color: #ff00de;
    transform: translateX(5px);
}

.preview-area {
    height: 180px;
    overflow-y: auto;
    align-items: flex-start;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 2px solid #333;
    flex-shrink: 0;
}

.preview-text {
    font-size: 1.2rem;
    line-height: 1.4;
    width: 100%;
    text-align: center;
    font-family: 'Orbitron', monospace; 
    opacity: 0.7;
    transition: all 0.3s ease;
    padding: 0 10px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.sync-actions {
    width: 100%;
    max-width: 480px;
    display: flex;
    gap: 15px;
    margin-top: 2rem;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.sync-actions button {
    flex: 1;
    min-width: 120px;
}

/* Nova visualização de versos sincronizados */
.synced-lyrics-container {
    width: calc(100% - 20px);
    margin: 10px auto;
    max-width: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    display: none;
    order: 2;
    position: relative;
}

.synced-lyrics-container.visible {
    display: block;
}

/* ...remaining CSS as provided... */
.synced-lyrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.synced-lyrics-header h3 {
    font-family: 'Orbitron', monospace;
    color: #00d4ff;
    font-size: 1.2rem;
}

.copy-btn {
    background: linear-gradient(45deg, #00d4ff, #ff00de);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.synced-lyrics-list {
    max-height: 250px;
    width: 100%;
    overflow-y: auto;
}

.synced-lyric-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.synced-lyric-item:hover {
    background: rgba(0, 212, 255, 0.1);
}

.synced-lyric-item.active {
    background: rgba(255, 0, 222, 0.2);
    border-left: 3px solid #ff00de;
    transform: translateX(5px);
}

.synced-lyric-time {
    color: #00ff88;
    font-weight: bold;
    min-width: 60px;
    margin-right: 15px;
    font-family: 'Space Mono', monospace;
}

.synced-lyric-text {
    flex: 1;
    color: #ffffff;
    line-height: 1.4;
}

.player-screen.active {
    padding: 10px 15px;
    justify-content: flex-start;
}

.player-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    padding: 0 10px;
    flex-grow: 1;
    min-height: calc(100vh - 150px - 40px);
    justify-content: center;
    margin-top: 0.5rem;
    position: relative;
}

.player-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 0 5px;
    margin-bottom: 1rem;
    overflow-x: visible;
    order: 1;
    position: sticky;
    top: 1px; /* move icons slightly higher */
    z-index: 30;
    margin-bottom: 12px;
}

.player-btn {
    width: 56px; /* ensure equal width/height for perfect circle */
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.player-btn.secondary-icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.player-btn .material-symbols-outlined,
.player-btn.secondary-icon-btn .material-symbols-outlined {
    font-size: 1.7em; /* increase inner icon size */
    line-height: 1;
}

@media (max-width: 480px) {
    .player-btn,
    .player-btn.secondary-icon-btn {
        width: 48px;
        height: 48px;
    }
    .player-btn .material-symbols-outlined {
        font-size: 1.4em;
    }
    .control-btn {
        width: 56px;
        height: 56px;
    }
    .control-btn .material-symbols-outlined { font-size: 1.6em; }
}

/* nudge player progress bar below controls and add spacing */
.player-progress {
    margin-top: 14px;
    width: 100%;
    box-sizing: border-box;
}

/* make synced lyrics view overlay-like when visible and easier to dismiss */
.synced-lyrics-container {
    width: calc(100% - 20px);
    margin: 10px auto;
    max-width: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    display: none;
    order: 2;
    position: relative;
}

.synced-lyrics-container.visible {
    display: block;
}

/* make three-line display touch-scrollable and lines clickable */
.three-line {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 6px;
}

.three-line .line {
    width: 100%;
    max-width: 100%;
    padding: 6px 12px;
    border-radius: 8px;
    color: inherit;
    background: transparent;
    transition: background 0.15s ease, transform 0.12s ease;
    word-break: break-word;
    cursor: pointer; /* each line clickable to jump */
}

.three-line .line.current {
    background: rgba(200,200,200,0.25);
    transform: translateY(0);
    font-weight: 700;
}

.three-line .line.prev,
.three-line .line.next {
    opacity: 0.85;
    font-weight: 500;
}

.advanced-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    display: none;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.advanced-controls.visible {
    display: flex;
    transform: translateY(0);
}

.copy-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(45deg, #00d4ff, #ff00de);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.copy-notification.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.save-notification {
    position: fixed;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: #111;
    color: #fff;
    padding: 18px 24px;
    border-radius: 12px;
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    z-index: 1100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.save-notification.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.save-notification .icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(90deg,#00ff88,#00d4ff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #062d1f;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

/* Player Buttons */
.player-btn {
    width: 56px; /* ensure equal width/height for perfect circle */
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.player-btn.secondary-icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.player-btn .material-symbols-outlined,
.player-btn.secondary-icon-btn .material-symbols-outlined {
    font-size: 1.7em; /* increase inner icon size */
    line-height: 1;
}

@media (max-width: 480px) {
    .player-btn,
    .player-btn.secondary-icon-btn {
        width: 48px;
        height: 48px;
    }
    .player-btn .material-symbols-outlined {
        font-size: 1.4em;
    }
    .control-btn {
        width: 56px;
        height: 56px;
    }
    .control-btn .material-symbols-outlined { font-size: 1.6em; }
}

/* style for the home-screen clear-server button */
#clear-server-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(255,59,59,0.12); }

/* ...remaining small helpers and font classes ... */
.font-orbitron { font-family: 'Orbitron', monospace; }
.font-exo2 { font-family: 'Exo 2', sans-serif; }
.font-rajdhani { font-family: 'Rajdhani', sans-serif; }
.font-spacemono { font-family: 'Space Mono', monospace; }
.font-arial { font-family: 'Arial', sans-serif; }
.font-verdana { font-family: 'Verdana', sans-serif; }
.font-timesnewroman { font-family: 'Times New Roman', serif; }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes gradientShift {
    0%,100%{ background-position: 0% 50%; } 50% { background-position: 100% 50%; }
}
@keyframes anim-pulsation {0%{opacity:.8}50%{opacity:1}100%{opacity:.8}}
@keyframes anim-neon {0%,100%{text-shadow:0 0 5px #fff,0 0 10px #fff,0 0 15px #fff,0 0 20px #00d4ff,0 0 30px #00d4ff,0 0 40px #00d4ff}50%{text-shadow:0 0 2px #fff,0 0 5px #fff,0 0 8px #fff,0 0 10px #ff00de,0 0 15px #ff00de,0 0 20px #ff00de,0 0 25px #ff00de}}
@keyframes anim-brightness {0%{filter:brightness(1)}50%{filter:brightness(1.5)}100%{filter:brightness(1)}}
@keyframes anim-scale-bounce {0%{opacity:0;transform:scale(.8)}50%{opacity:1;transform:scale(1.1)}100%{opacity:1;transform:scale(1)}}
@keyframes anim-flash {0%,100%{opacity:1}50%{opacity:0}}
@keyframes anim-slide-right {from{opacity:0;transform:translateX(-50px)}to{opacity:1;transform:translateX(0)}}
@keyframes anim-blur-in {from{opacity:0;filter:blur(10px)}to{opacity:1;filter:blur(0)}}
@keyframes anim-color-pulse {0%,100%{color:white}50%{color:#00ff88}}
@keyframes anim-glow {0%,100%{text-shadow:0 0 5px rgba(255,255,255,.5),0 0 10px rgba(255,255,255,.3)}50%{text-shadow:0 0 8px rgba(0,212,255,.7),0 0 15px rgba(0,212,255,.5)}}

/* ...existing styles... */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 10px;
}

.project-title {
    flex: 1;
    font-weight: 600;
    color: #ffffff;
}

.project-meta {
    font-size: 0.8rem;
    color: #b0b0b0;
}

/* Modal basic layout */
.modal { position: fixed; inset: 0; display:flex; align-items:center; justify-content:center; background: rgba(0,0,0,0.55); z-index:1200; padding: 20px; }
.modal.hidden { display:none; }
.modal-card { width: 100%; max-width:420px; background:#0f0f10; border-radius:12px; padding:16px; box-shadow:0 10px 30px rgba(0,0,0,0.6); border:1px solid rgba(255,255,255,0.04); color:#fff; display:flex; flex-direction:column; gap:10px; }

/* modal actions layout */
.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:8px; }

/* media list / player container */
.media-card .media-actions layout and larger upload button
.media-card .media-actions { display:flex; gap:10px; margin-bottom:8px; align-items:center; }
#media-upload-btn {
    padding: 12px 18px;
    font-size: 1.05rem;
    border-radius: 10px;
    min-width: 120px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* remove any leftover styles targetting media-view-btn (if present) */
#media-view-btn { display: none !important; }
.media-list { max-height:320px; overflow:auto; display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.media-item { display:flex; gap:10px; align-items:center; padding:8px; border-radius:8px; background:rgba(255,255,255,0.03); }
.media-item .media-meta { flex:1; }
.media-player { width:100%; max-width:100%; margin-top:8px; }

/* settings popup tidy */
#settings-popup .modal-card { gap:8px; }

/* ensure gear icon popup appears neat - adjust existing controls grid minimal */
.player-controls .player-btn.settings { background: rgba(255,255,255,0.04); }
/* remove two pre-save circles if any (ensure save button is single circle) */
.player-btn.secondary-icon-btn:nth-last-child(3),
.player-btn.secondary-icon-btn:nth-last-child(2) { display:none; }

/* improve media modal viewer layout and buttons */
.media-card { gap:12px; }
#media-viewer {
    max-height: 70vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.media-item .media-open-btn, .media-item .media-edit-btn, .media-item .media-delete-btn { border-radius:8px; }
/* ensure media list buttons stack nicely on small screens */
@media (max-width:480px) {
  .media-item { flex-direction: column; align-items:flex-start; }
  .media-item > div:last-child { margin-top:8px; }
}

/* compact media item buttons for portrait mobile */
.media-item { display:flex; gap:8px; align-items:center; padding:8px; border-radius:8px; background:rgba(255,255,255,0.03); }
.media-item .media-meta { flex:1; min-width:0; }
.media-item .media-actions { display:flex; gap:6px; align-items:center; }
.media-item .media-open-btn, .media-item .media-edit-btn, .media-item .media-delete-btn, .media-item .media-lyrics-btn {
    padding:6px 8px;
    font-size:0.9rem;
    border-radius:8px;
    height:34px;
    min-width:34px;
}
/* upload name / lyrics modal */
#media-name-modal, #media-lyrics-modal {
    position: fixed; inset:0; display:none; align-items:center; justify-content:center; z-index:1300;
    background: rgba(0,0,0,0.6); padding:16px;
}
.media-modal-card { width:100%; max-width:420px; background:#0f0f10; border-radius:12px; padding:12px; box-shadow:0 10px 30px rgba(0,0,0,0.6); color:#fff; }
.media-modal-card h3 { margin:0 0 8px 0; color:#00d4ff; font-family:'Orbitron',monospace; font-size:1.05rem; }
.media-modal-card input[type="text"], .media-modal-card textarea { width:100%; padding:8px; border-radius:8px; background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.04); color:#fff; }
.media-modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:8px; }
.media-modal-actions .btn-primary, .media-modal-actions .btn-secondary { padding:8px 12px; height:36px; border-radius:8px; font-size:0.95rem; }
/* ensure viewer stops media on close */
#media-modal .modal-card { max-width:720px; }
/* responsive adjustments */
@media (max-width:480px){
  .media-item { flex-direction: row; }
  .media-item .media-meta { font-size:0.95rem; }
  .media-modal-card { padding:10px; }
}

/* adjust media modal title row to align icons on same line and centered vertically */
#media-viewer .modal-card h3 { margin:0; }
#media-viewer .media-wrapper { margin-top:8px; }

/* style for inline lyrics within viewer */
#viewer-inline-lyrics { color: #fff; font-size: 0.98rem; line-height: 1.4; }

/* make media title row icons aligned to the right, centered vertically */
#media-viewer .modal-card > div:first-child { display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:6px; }
/* icons row under title */
#media-viewer .modal-card .media-title-icons { display:flex; gap:8px; align-items:center; margin-top:6px; }
/* small sizing for the inline icons placed under title */
.media-lyrics-toggle-icon, .media-lyrics-edit-icon, .media-close-x {
    padding:6px 8px;
    border-radius:8px;
    background: rgba(255,255,255,0.03);
    border: none;
    color: #fff;
    cursor: pointer;
    min-width:40px;
    height:34px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
/* ensure the modal-level close button remains at top-right and closes the whole modal (existing #media-close remains) */
#media-modal .modal-actions .btn-secondary#media-close { position: absolute; top: 12px; right: 12px; z-index: 1400; }

/* ensure page nav keeps synced lyrics visible when returning to results */
.synced-lyrics-container.visible { display:block; }

/* ensure media edit/name/lyrics modals float above media modal and cover center of screen */
#media-edit-modal, #media-name-modal, #media-lyrics-modal, .media-modal-card {
    z-index: 1600;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
/* ensure full-screen overlay for these modals when displayed so they are above everything */
#media-edit-modal, #media-name-modal, #media-lyrics-modal {
    width: calc(100% - 32px);
    max-width: 720px;
    background: linear-gradient(180deg,#0b0b0c,#0f0f12);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* ensure the inner gear icon is dark on white */
.player-controls .player-btn.settings .material-symbols-outlined { color: #000; }

/* elevate and restyle the settings popup to look professional */
#settings-popup { z-index: 1450; }
#settings-popup .modal-card {
    max-width: 520px;
    padding: 20px;
    border-radius: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    background: linear-gradient(180deg,#0b0b0c,#111214);
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 18px 50px rgba(2,6,23,0.7);
}

/* nicer inputs inside settings */
#settings-popup .modal-card input[type="number"],
#settings-popup .modal-card select,
#settings-popup .modal-card input[type="color"] {
    padding: 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
}

/* make modal actions visually distinct */
#settings-popup .modal-actions { justify-content: space-between; gap:10px; }
#settings-popup .modal-actions .btn-secondary { background: transparent; border:1px solid rgba(255,255,255,0.06); }
#settings-popup .modal-actions .btn-primary { padding:10px 16px; border-radius:10px; }

/* Top-right "X" close styling (no surrounding container) */
.media-close-x {
    position: relative;
    background: transparent;
    color: #ff4d4d; /* make X red */
    border: 3px solid #ff4d4d; /* 3px red border */
    font-size: 1.05rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}

/* ensure modal-level top-right X also uses same red border style */
#media-modal .modal-actions .media-close-x {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1400;
    background: transparent;
    color: #ff4d4d;
    border: 3px solid #ff4d4d;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    box-shadow: none;
}

/* compact inline lyrics container improvements */
#viewer-inline-lyrics {
    transition: max-height 0.18s ease, opacity 0.12s ease;
    overflow: auto;
    max-height: 180px; /* default compact height */
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

/* resize handle bottom-right inside inline lyrics */
#viewer-inline-lyrics .lyrics-resize-handle {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg,#00d4ff,#ff00de);
    border-radius: 6px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    z-index: 50;
}
#viewer-inline-lyrics .lyrics-resize-handle::after {
    content: '↕';
    color: #062d1f;
    font-weight: 700;
    font-size: 12px;
    transform: translateY(-1px);
}

/* compact toggle behavior: hidden by default */
#viewer-inline-lyrics[style*="display: none"] { opacity: 0; pointer-events: none; }
#viewer-inline-lyrics[style*="display: block"] { opacity: 1; pointer-events: auto; }

/* ensure the edit icon and close X align to the media title row top-right */
#media-viewer .modal-card > div:first-child { align-items: center; }

/* remove the lyrics icon spacing in media list (we removed the button) */
.media-item .media-actions { gap:6px; }

/* ensure the edit icon retains expected appearance */
.media-lyrics-edit-icon .material-symbols-outlined { font-size:1.05rem; }

/* ensure that clicking the edit button long-press toggles lyrics but short click opens editor:
   visual affordance for long-press */
.media-lyrics-edit-icon { position: relative; }

/* move media modal close to top-right as red X without container underneath */
#media-modal .modal-actions .media-close-x {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1400;
    background: transparent;
    color: #ff4d4d;
    border: 3px solid #ff4d4d;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    box-shadow: none;
}

/* ensure media-list is scrollable and fills modal nicely */
.media-list {
    max-height: 44vh; /* allow vertical scrolling in portrait */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 6px;
}

/* upload progress bar inside media-list items / transient upload row */
.upload-progress-row {
    display:flex;
    align-items:center;
    gap:10px;
    padding:8px;
    background: rgba(255,255,255,0.02);
    border-radius:8px;
    margin-bottom:8px;
}
.upload-progress-bar {
    flex:1;
    height:10px;
    background: rgba(255,255,255,0.06);
    border-radius:6px;
    overflow:hidden;
}
.upload-progress-bar .fill {
    height:100%;
    width:0%;
    background: linear-gradient(90deg,#00d4ff,#ff00de);
    transition: width 120ms linear;
    border-radius:6px;
}
.upload-percent {
    min-width:48px;
    text-align:right;
    color:#bfbfbf;
    font-size:0.9rem;
}

/* enable pinch-zoom and natural pan behavior; allow containers to scroll */
html, body {
    touch-action: pan-y pinch-zoom;
    -ms-touch-action: pan-y;
    -webkit-text-size-adjust: 100%;
    -webkit-user-select: text;
}

/* make all modal and popup containers scrollable and allow pinch-zoom inside them */
.modal, #media-modal, #media-name-modal, #media-edit-modal, #media-lyrics-modal, #media-viewer, #media-viewer .modal-card, #lyrics-editor-overlay, #viewer-inline-lyrics {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: auto; /* allow pinch & pan inside overlays */
}

/* ensure inner scrollable panels have max-height and can scroll independently */
.modal-card, .media-card, .media-list, .media-wrapper, .lyrics-list, .synced-lyrics-list, .three-line, .preview-area {
    max-height: calc(80vh);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* when a modal is open, allow body zooming and scrolling (avoid preventing pinch in overlays) */
.modal:not(.hidden) {
    touch-action: auto;
}

/* full-screen media player overlay */
.media-fullscreen-overlay {
    /* keep existing layout but allow controls to be anchored to bottom */
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(6,15,25,0.95), rgba(3,8,15,0.98));
    padding: 18px;
    gap: 12px;
    height: 100vh;
    box-sizing: border-box;
    align-items: stretch; /* let internal areas expand to full width */
}
/* ensure header area is compact and title centered */
.media-fullscreen-overlay .fs-header {
    position: relative;
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    padding:4px 48px; /* room for close button at top-right */
    box-sizing:border-box;
}
.media-fullscreen-overlay .fs-header .fs-title {
    font-weight: 800;
    color: #00d4ff;
    text-align:center;
    font-size:1.15rem;
}
/* place close button at top-right and visually centered within its area */
.media-fullscreen-overlay .fs-close {
    position: absolute;
    right: 12px;
    top: 12px;
    color:#ff4d4d;
    border:3px solid #ff4d4d;
    background:transparent;
    padding:6px 10px;
    border-radius:8px;
    font-size:1.1rem;
    cursor:pointer;
    z-index: 2100;
}

/* make lyrics area expand to take most of the screen while leaving space for header and bottom controls */
.media-fullscreen-overlay .fs-lyrics-area {
    /* expand lyrics area to take most of the screen while leaving space for header and bottom controls */
    width: 100%;
    padding: 18px;
    border-radius: 10px;
    overflow: auto;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
    /* reserve smaller space so lyrics container is larger on screen */
    height: calc(100vh - 140px); /* increased to bring lyrics closer to bottom controls */
    max-height: calc(100vh - 140px);
    font-size: 1.05rem; /* slightly larger default text for readability */
    line-height: 1.5;
}

/* ensure player area sits above lyrics and layout uses full vertical space */
.media-fullscreen-overlay .fs-player-area {
    width: 100%;
    display: block;
    z-index: 2020;
}

/* pin controls to the bottom of the overlay (footer) */
.media-fullscreen-overlay .fs-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom, 12px) + 40px);
    display:flex;
    gap:18px;
    justify-content:center;
    align-items:center;
    padding:10px 12px;
    background: transparent;
    box-sizing: border-box;
    z-index: 2050;
    border: none;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 6px 8px;
}

/* ensure player area remains above controls and doesn't overlap */
.media-fullscreen-overlay .fs-player-area { z-index: 2020; }

/* reduce size of the four main control buttons and nudge them slightly downwards */
.media-fullscreen-overlay .fs-controls .fs-prev,
.media-fullscreen-overlay .fs-controls .fs-next,
.media-fullscreen-overlay .fs-controls .fs-play,
.media-fullscreen-overlay .fs-controls .fs-edit {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: linear-gradient(45deg, #00d4ff, #ff00de);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    border: none;
    transform: translateY(12px);
}

/* give the fs-controls container a subtle white outline so it stands out */
.media-fullscreen-overlay .fs-controls {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
}

/* make prev/next visually separated (left/right) when possible on wider screens */
@media (min-width: 720px) {
    .media-fullscreen-overlay .fs-controls { justify-content: center; gap: 28px; }
    .media-fullscreen-overlay .fs-prev { margin-right: 12px; }
    .media-fullscreen-overlay .fs-next { margin-left: 12px; }
}

/* ensure close X remains prominent and red with same border */
.media-fullscreen-overlay .fs-close {
    position: absolute;
    right: 6px;
    top: 6px;
    color:#ff4d4d;
    border:3px solid #ff4d4d;
    background:transparent;
    padding:6px 10px;
    border-radius:8px;
    font-size:1.1rem;
    cursor:pointer;
    z-index:2100;
}

/* ensure media-lyrics-modal appears above the fullscreen overlay and is visibly prominent */
#media-lyrics-modal {
    z-index: 4001; /* increased so editor floats above all overlays */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 32px);
    max-width: 900px;
    max-height: calc(100vh - 80px);
    overflow: auto;
    display: flex; /* ensure center alignment when shown */
    align-items: center;
    justify-content: center;
    padding: 12px;
}

/* make inner card stretch vertically so textarea can grow close to bottom controls */
#media-lyrics-modal .media-modal-card {
    width: 100%;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    box-sizing: border-box;
}

/* enlarge fullscreen overlay lyrics area so lyrics fill more vertical space up to the controls */
.media-fullscreen-overlay .fs-lyrics-area {
    height: calc(100vh - 220px);
    max-height: calc(100vh - 220px);
    padding: 18px;
    font-size: 1.05rem;
    line-height: 1.5;
}

/* ensure modal textarea is easy to focus and sits above overlay */
#media-lyrics-modal textarea#media-lyrics-text {
    z-index: 4002;
    min-height: calc(100vh - 140px); /* larger so lyrics reach close to bottom controls */
    max-height: calc(100vh - 140px);
    resize: vertical;
    overflow: auto;
}

.student-folders { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 14px; }
.student-folders.two-column .folder-wrap { width: calc(50% - 8px); display:flex; gap:6px; align-items:center; }
/* add white border around each student folder container */
.student-folders.two-column .folder-wrap {
    border: 1px solid #ffffff;
    padding: 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
}
.folder-btn { flex:1; padding:8px 10px; border-radius:10px; background:rgba(255,255,255,0.04); color:#fff; border:1px solid rgba(255,255,255,0.03); text-align:left; cursor:pointer; }
.folder-btn.active { background: linear-gradient(90deg,#00d4ff,#7cffc7); color:#062d1f; font-weight:700; }
.folder-paste-btn { padding:8px 10px; border-radius:10px; background:transparent; border:1px dashed rgba(255,255,255,0.06); color:#fff; cursor:pointer; }
.media-item .media-action-hidden { display:flex; gap:6px; align-items:center; }
.media-item .media-actions { display:flex; gap:8px; align-items:center; }
/* show owner small badge */
.media-owner { font-size:0.78rem; color:#bfbfbf; margin-top:4px; }
/* make hidden actions visually compact */
.media-action-hidden button { padding:6px 8px; height:34px; border-radius:8px; }

/* Chat bubble & panel */
.chat-bubble {
    /* default fixed variant remains for legacy placements */
    position: fixed;
    right: 16px;
    bottom: 36px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(45deg,#00d4ff,#ff00de);
    color: #062d1f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 8px 22px rgba(0,0,0,0.45);
    border: none;
    z-index: 900; /* sit beneath modals/popups (modals use z-index >=1200) */
    cursor: pointer;
}
/* when used inline inside intro buttons stack, render as full-width inline control */
.intro-buttons-vertical .chat-bubble.inline {
    position: static;
    width: 100%;
    height: auto;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #062d1f;
    background: linear-gradient(90deg,#00d4ff,#7cffc7);
    box-shadow: none;
    margin-top: 8px;
}
.intro-buttons-vertical .chat-bubble.inline .material-symbols-outlined { font-size: 1.1rem; }

/* ...existing styles... */
.chat-panel {
    position: fixed;
    right: 16px;
    bottom: 16px; /* adjusted so panel can span vertically */
    width: 320px;
    height: calc(100vh - 40px); /* full-height-like container */
    max-height: none;
    background: #0f0f10;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.04);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    z-index: 900; /* keep panel under popups */
}
.chat-panel.hidden { display:none; }
.chat-header { padding:10px 12px; background:linear-gradient(90deg,#070708,#0f0f10); color:#00d4ff; font-weight:700; display:flex; justify-content:space-between; align-items:center; }
.chat-close { background:transparent;border:none;color:#ff4d4d; font-size:1rem; cursor:pointer; padding:6px 8px; border-radius:8px; border:2px solid #ff4d4d; }
.chat-messages { padding:10px; overflow-y:auto; flex:1; display:flex; flex-direction:column; gap:8px; }
.chat-msg { padding:8px 10px; border-radius:10px; max-width:85%; word-break:break-word; background:rgba(255,255,255,0.04); color:#fff; }
.chat-msg.me { background: linear-gradient(90deg,#00d4ff,#7cffc7); color:#062d1f; align-self:flex-end; }
.chat-msg.other { background: rgba(255,255,255,0.03); align-self:flex-start; }
.chat-input-row { display:flex; gap:8px; padding:10px; border-top:1px solid rgba(255,255,255,0.04); transform: translateY(-8px); }
#chat-input { flex:1; padding:8px 10px; border-radius:8px; border:1px solid rgba(255,255,255,0.06); background:rgba(255,255,255,0.02); color:#fff; }
#chat-send {
    min-width:44px;
    padding:8px;
    border-radius:8px;
    height:44px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
/* link styling inside chat messages */
.chat-msg a {
    color: #2ea6ff;
    text-decoration: underline;
}
/* ...existing styles... */
.chat-clear {
    background: transparent;
    color: #ff4d4d;
    border: 3px solid #ff4d4d;
    font-size: 1.05rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    /* match modal-level red X appearance and size */
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* make media modal use the full viewport width and sit above the chat bubble */
#media-modal .modal-card {
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    z-index: 2301; /* above chat bubble (chat z-index:2200) */
    box-sizing: border-box;
    padding: 18px;
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
    overflow: auto;
}

/* move primary audio control clusters slightly up so controls appear 20px higher */
.audio-controls {
    position: relative;
    top: -20px;
}

.media-fullscreen-overlay .fs-controls {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 12px) + 40px);
}

.splash {
    position: fixed;
    inset: 0;
    background: #0b0b0c;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:99999;
    transition: opacity .35s ease, visibility .35s;
}
.splash.hidden { opacity:0; visibility:hidden; pointer-events:none; }
.splash-card {
    width: min(760px,92%);
    max-width:760px;
    padding:24px;
    border-radius:12px;
    background: linear-gradient(180deg,#071018,#0b0b0c);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    color:#fff;
    text-align:center;
    font-family: 'Exo 2', sans-serif;
}
.splash-title { font-weight:800; color:#00d4ff; font-size:1.25rem; margin-bottom:6px; }
.splash-sub { color:#bdbdbd; font-size:0.95rem; margin-bottom:14px; }
.splash-progress {
    width:100%;
    height:14px;
    background: rgba(255,255,255,0.04);
    border-radius:10px;
    overflow:hidden;
    position:relative;
    margin-bottom:10px;
}
.splash-progress-fill {
    height:100%;
    background: linear-gradient(90deg,#00d4ff,#ff00de);
    width:0%;
    transition: width 220ms linear;
}
.splash-percent { font-weight:700; color:#fff; margin-bottom:8px; font-family:'Orbitron',monospace; }
.splash-note { color:#9aa; font-size:0.9rem; }
