/* ═══════════════════════════════════════════════════════════════════════════
   🎛️ STUDIO CONTROL ROOM - Professional Recording Studio Theme
   Inspired by: Analog mixing consoles, VU meters, DAW interfaces
   ═══════════════════════════════════════════════════════════════════════════ */

/* CSS Variables - Studio Color Palette */
:root {
    /* Background tones */
    --studio-black: #0d0d0d;
    --studio-dark: #141414;
    --studio-panel: #1a1a1a;
    --studio-surface: #222222;
    --studio-elevated: #2a2a2a;
    --studio-border: #333333;

    /* Accent colors - VU meter inspired */
    --vu-green: #00d4aa;
    --vu-green-glow: rgba(0, 212, 170, 0.4);
    --vu-amber: #f5a623;
    --vu-amber-glow: rgba(245, 166, 35, 0.4);
    --vu-red: #ff4757;
    --vu-red-glow: rgba(255, 71, 87, 0.3);

    /* Text */
    --text-primary: #e8e8e8;
    --text-secondary: #888888;
    --text-muted: #555555;

    /* Role colors */
    --role-male: #ff6b9d;
    --role-female: #7bed9f;
    --role-duet: #ffd93d;

    /* Spacing */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   🔷 Global Reset & Base
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    text-align: center;
    background: var(--studio-black);
    color: var(--text-primary);
    padding: 0;
}

/* Subtle noise texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎚️ Main Container - Console Frame
   ═══════════════════════════════════════════════════════════════════════════ */

.container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 12px 16px;
    background: linear-gradient(180deg, var(--studio-dark) 0%, var(--studio-black) 100%);
    overflow: hidden;
}

/* Console top bezel effect */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--vu-amber) 20%,
        var(--vu-green) 50%,
        var(--vu-amber) 80%,
        transparent 100%);
    opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎛️ Header Toolbar - Control Strip
   ═══════════════════════════════════════════════════════════════════════════ */

.header-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 8px;
    gap: 16px;
    flex-shrink: 0;
    padding: 8px 12px;
    background: var(--studio-panel);
    border: 1px solid var(--studio-border);
    border-radius: var(--radius-md);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

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

.header-left .logo {
    font-size: 14px;
    font-weight: 600;
    color: var(--vu-amber);
    white-space: nowrap;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 20px var(--vu-amber-glow);
}

.header-left .credits {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.header-left .credits a {
    color: var(--vu-green);
    text-decoration: none;
    transition: all 0.2s ease;
}

.header-left .credits a:hover {
    color: var(--vu-amber);
    text-shadow: 0 0 8px var(--vu-amber-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════
   🔘 Control Buttons - Hardware Button Style
   ═══════════════════════════════════════════════════════════════════════════ */

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

.ctrl-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--studio-border);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--studio-elevated) 0%, var(--studio-surface) 100%);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

.ctrl-btn:hover {
    background: linear-gradient(180deg, var(--studio-surface) 0%, var(--studio-elevated) 100%);
    border-color: var(--vu-amber);
    color: var(--vu-amber);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 12px var(--vu-amber-glow);
}

.ctrl-btn:active {
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ctrl-btn.primary {
    background: linear-gradient(180deg, var(--vu-green) 0%, #00a888 100%);
    border-color: var(--vu-green);
    color: var(--studio-black);
    font-weight: 600;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 16px var(--vu-green-glow);
}

.ctrl-btn.primary:hover {
    background: linear-gradient(180deg, #00e8bb 0%, var(--vu-green) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 24px var(--vu-green-glow);
}

.ctrl-btn.danger {
    color: var(--vu-red);
}

.ctrl-btn.danger:hover {
    background: linear-gradient(180deg, #3a1a1a 0%, #2a1515 100%);
    border-color: var(--vu-red);
    box-shadow: 0 0 12px var(--vu-red-glow);
}

.ctrl-btn.help {
    color: var(--text-muted);
    font-weight: 700;
}

.ctrl-btn.help:hover {
    color: var(--vu-amber);
    border-color: var(--vu-amber);
}

/* ═══════════════════════════════════════════════════════════════════════════
   📋 Help Panel - LCD Display Style
   ═══════════════════════════════════════════════════════════════════════════ */

.help-panel {
    display: none;
    width: 100%;
    margin-bottom: 8px;
    padding: 12px 16px;
    background: var(--studio-surface);
    border: 1px solid var(--vu-amber);
    border-radius: var(--radius-md);
    animation: panelSlide 0.2s ease;
    flex-shrink: 0;
    box-shadow:
        inset 0 0 20px rgba(245, 166, 35, 0.05),
        0 0 16px var(--vu-amber-glow);
}

.help-panel.show {
    display: block;
}

@keyframes panelSlide {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.help-content {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}

.help-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.help-section strong {
    font-size: 10px;
    color: var(--vu-amber);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.help-section span {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎭 Role Selector - Channel Strip Style
   ═══════════════════════════════════════════════════════════════════════════ */

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.header-right .role-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-right: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-right .role-btn {
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--studio-border);
    border-radius: var(--radius-sm);
    background: var(--studio-surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.header-right .role-btn:hover {
    border-color: var(--vu-amber);
    color: var(--text-primary);
}

.header-right .role-btn.active {
    background: var(--vu-green);
    border-color: var(--vu-green);
    color: var(--studio-black);
    box-shadow: 0 0 12px var(--vu-green-glow);
}

.header-right .role-btn[data-role="1"].active {
    background: var(--role-male);
    border-color: var(--role-male);
    color: var(--studio-black);
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.4);
}

.header-right .role-btn[data-role="2"].active {
    background: var(--role-female);
    border-color: var(--role-female);
    color: var(--studio-black);
    box-shadow: 0 0 12px rgba(123, 237, 159, 0.4);
}

.header-right .role-btn[data-role="3"].active {
    background: var(--role-duet);
    border-color: var(--role-duet);
    color: var(--studio-black);
    box-shadow: 0 0 12px rgba(255, 217, 61, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   📊 Main Content Area - Mixer Layout
   ═══════════════════════════════════════════════════════════════════════════ */

.top-section {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    margin-bottom: 8px;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎬 Video Container - Monitor Section
   ═══════════════════════════════════════════════════════════════════════════ */

.video-container {
    flex: 6;
    min-width: 0;
    text-align: left;
    background: var(--studio-panel);
    padding: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--studio-border);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.02),
        0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.video-container:hover {
    border-color: var(--vu-green);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.02),
        0 4px 24px rgba(0, 0, 0, 0.5),
        0 0 20px var(--vu-green-glow);
}

.video-url-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.url-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--studio-border);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-family: inherit;
    background: var(--studio-surface);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.url-input::placeholder {
    color: var(--text-muted);
}

.url-input:focus {
    border-color: var(--vu-green);
    box-shadow: 0 0 0 2px var(--vu-green-glow);
}

.load-video-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: linear-gradient(180deg, var(--vu-green) 0%, #00a888 100%);
    color: var(--studio-black);
    transition: all 0.3s ease;
    box-shadow: 0 0 16px var(--vu-green-glow);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.load-video-btn:hover {
    background: linear-gradient(180deg, #00e8bb 0%, var(--vu-green) 100%);
    box-shadow: 0 0 24px var(--vu-green-glow);
    transform: translateY(-2px);
}

.load-video-btn:active {
    transform: translateY(0);
}

#player {
    width: 100%;
    max-width: 100%;
    flex: 1;
    min-height: 200px;
    max-height: 40vh;
    margin-top: 12px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    aspect-ratio: 16 / 9;
    background: var(--studio-black);
    border: 1px solid var(--studio-border);
}

#player iframe {
    width: 100% !important;
    height: 100% !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   📝 Lyrics Input - Channel Strip
   ═══════════════════════════════════════════════════════════════════════════ */

.lyrics-input-container {
    flex: 4;
    min-width: 0;
    background: var(--studio-panel);
    padding: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--studio-border);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.02),
        0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.lyrics-input-container:hover {
    border-color: var(--vu-amber);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.02),
        0 4px 24px rgba(0, 0, 0, 0.5),
        0 0 20px var(--vu-amber-glow);
}

.dual-textarea-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.textarea-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.textarea-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--vu-amber);
    font-size: 10px;
    flex-shrink: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#lyricsInput,
#pinyinInput {
    width: 100%;
    flex: 1;
    min-height: 60px;
    padding: 10px 12px;
    font-size: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--studio-border);
    background: var(--studio-surface);
    color: var(--text-primary);
    resize: none;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
}

#lyricsInput::placeholder,
#pinyinInput::placeholder {
    color: var(--text-muted);
}

#lyricsInput:focus,
#pinyinInput:focus {
    border-color: var(--vu-amber);
    box-shadow: 0 0 0 2px var(--vu-amber-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎚️ Pinyin Controls - Switch Panel
   ═══════════════════════════════════════════════════════════════════════════ */

.pinyin-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: var(--studio-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--studio-border);
    flex-shrink: 0;
    box-sizing: border-box;
}

.pinyin-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.pinyin-checkbox-label:hover {
    color: var(--text-primary);
}

.pinyin-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--vu-green);
}

.validate-btn,
.group-mapping-btn {
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    background: var(--studio-elevated);
    border: 1px solid var(--studio-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.validate-btn:hover,
.group-mapping-btn:hover {
    background: var(--studio-surface);
    border-color: var(--vu-amber);
    color: var(--vu-amber);
}

.validate-btn.success {
    background: rgba(0, 212, 170, 0.15);
    border-color: var(--vu-green);
    color: var(--vu-green);
    box-shadow: 0 0 8px var(--vu-green-glow);
}

.validate-btn.error {
    background: rgba(255, 71, 87, 0.15);
    border-color: var(--vu-red);
    color: var(--vu-red);
    box-shadow: 0 0 8px var(--vu-red-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════
   📊 Timestamps - Data Display
   ═══════════════════════════════════════════════════════════════════════════ */

.timestamps-collapsible {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--studio-border);
    background: var(--studio-surface);
    flex-shrink: 0;
    box-sizing: border-box;
}

.timestamps-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--studio-elevated);
    cursor: pointer;
    transition: background 0.2s ease;
    gap: 10px;
}

.timestamps-summary:hover {
    background: var(--studio-panel);
}

.progress-indicator {
    font-size: 11px;
    font-weight: 600;
    color: var(--vu-green);
    flex: 1;
    text-shadow: 0 0 8px var(--vu-green-glow);
}

.last-record {
    font-size: 11px;
    color: var(--text-muted);
    font-family: inherit;
}

.summary-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.expand-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.timestamps-collapsible.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Download Button - LED Style */
.download-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--studio-border);
    background: var(--studio-surface);
    color: var(--text-muted);
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.download-icon-btn:disabled {
    opacity: 0.5;
}

.download-icon-btn.active {
    background: linear-gradient(180deg, var(--vu-amber) 0%, #d48f1a 100%);
    border-color: var(--vu-amber);
    color: var(--studio-black);
    cursor: pointer;
    opacity: 1;
    animation: ledPulse 2s infinite;
    box-shadow: 0 0 16px var(--vu-amber-glow);
}

.download-icon-btn.active:hover {
    transform: scale(1.1);
    box-shadow: 0 0 24px var(--vu-amber-glow);
}

@keyframes ledPulse {
    0%, 100% { box-shadow: 0 0 16px var(--vu-amber-glow); }
    50% { box-shadow: 0 0 24px var(--vu-amber-glow), 0 0 8px var(--vu-amber); }
}

/* Timestamps Details */
.timestamps-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.timestamps-collapsible.expanded .timestamps-details {
    max-height: 120px;
}

.timestamps-details .table-wrapper {
    max-height: 100px;
    overflow-y: auto;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--studio-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   📋 Table - Console Display
   ═══════════════════════════════════════════════════════════════════════════ */

.table-wrapper {
    min-height: 180px;
    max-height: 180px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--studio-border);
    background: var(--studio-surface);
}

#timestampsTable {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

#timestampsTable thead {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, var(--vu-green) 0%, #00a888 100%);
    color: var(--studio-black);
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    letter-spacing: 0.5px;
}

#timestampsTable thead th {
    padding: 10px 12px;
    text-align: center;
    border-bottom: none;
}

#timestampsTable td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--studio-border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 11px;
}

#timestampsTable tbody tr:hover {
    background: var(--studio-elevated);
}

#timestampsTable tbody tr:last-child td {
    border-bottom: none;
}

/* Custom Scrollbar - Studio Style */
.table-wrapper::-webkit-scrollbar {
    width: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--studio-surface);
    border-radius: var(--radius-md);
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--studio-border);
    border-radius: var(--radius-md);
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--vu-amber);
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎤 Lyrics Display - Stage Monitor
   ═══════════════════════════════════════════════════════════════════════════ */

#lyricsContainer {
    width: 100%;
    max-width: 100%;
    min-height: 90px;
    padding: 16px 24px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    background: var(--studio-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--studio-border);
    box-shadow:
        inset 0 2px 20px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 212, 170, 0.1);
}

#lyricsDisplay {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    white-space: pre-wrap;
    font-size: 28px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    width: 100%;
    max-width: 100%;
}

.word {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 3px;
    margin: 2px;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
}

.word.highlight {
    color: var(--vu-green);
    font-weight: 600;
    transform: scale(1.08);
    text-shadow: 0 0 16px var(--vu-green-glow);
}

.word.highlight .pinyin-preview {
    color: var(--vu-green);
}

.pinyin-preview {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 2px;
}

.main-word {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎵 Pinyin Sync Interface
   ═══════════════════════════════════════════════════════════════════════════ */

.lyrics-vertical-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    align-items: center;
}

.pinyin-line {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.pinyin-syllable {
    font-size: 1em;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    cursor: default;
    white-space: nowrap;
    flex-shrink: 1;
}

.pinyin-syllable.highlight {
    color: var(--vu-green);
    font-weight: 700;
    text-shadow: 0 0 12px var(--vu-green-glow);
    transform: scale(1.1);
}

.pinyin-syllable.recorded {
    color: var(--text-secondary);
    opacity: 0.5;
}

.main-lyric-preview {
    font-size: 0.65em;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ✨ Completion Message
   ═══════════════════════════════════════════════════════════════════════════ */

.completion-message {
    font-size: 36px;
    font-weight: 700;
    color: var(--vu-green);
    text-shadow: 0 0 20px var(--vu-green-glow);
    animation: completionPulse 2s ease-in-out infinite;
    text-align: center;
    letter-spacing: 2px;
}

@keyframes completionPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

#lyricsDisplay.completed {
    padding: 40px 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   🔘 Load Lyrics Button - Master Control
   ═══════════════════════════════════════════════════════════════════════════ */

.lyrics-button-container {
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    gap: 12px;
}

.load-lyrics-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: linear-gradient(180deg, var(--vu-amber) 0%, #d48f1a 100%);
    color: var(--studio-black);
    transition: all 0.3s ease;
    box-shadow: 0 0 20px var(--vu-amber-glow);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.load-lyrics-btn:hover {
    background: linear-gradient(180deg, #ffb84d 0%, var(--vu-amber) 100%);
    box-shadow: 0 0 32px var(--vu-amber-glow);
    transform: translateY(-2px);
}

.load-lyrics-btn:active {
    transform: translateY(0);
}

.reset-all-btn {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: linear-gradient(180deg, #ff4444 0%, #cc0000 100%);
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.reset-all-btn:hover {
    background: linear-gradient(180deg, #ff6666 0%, #ff4444 100%);
    box-shadow: 0 0 32px rgba(255, 68, 68, 0.5);
    transform: translateY(-2px);
}

.reset-all-btn:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   📊 Progress Bar - VU Meter Style
   ═══════════════════════════════════════════════════════════════════════════ */

.progress-container {
    width: 100vw;
    max-width: 100%;
    height: 4px;
    background: var(--studio-surface);
    border-radius: 0;
    overflow: hidden;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
        var(--vu-green) 0%,
        var(--vu-green) 60%,
        var(--vu-amber) 80%,
        var(--vu-red) 100%);
    border-radius: 0;
    transition: width 0.3s ease;
    box-shadow: 0 0 12px var(--vu-green-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎆 Fireworks - Celebration Effects
   ═══════════════════════════════════════════════════════════════════════════ */

#fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.firework {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--vu-amber);
    border-radius: 50%;
    opacity: 1;
    animation: explode 1.2s ease-out forwards;
    box-shadow: 0 0 8px var(--vu-amber-glow);
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: var(--vu-green);
    border-radius: 50%;
    opacity: 1;
    animation: particle-explode 1.2s ease-out forwards;
}

@keyframes explode {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 1; transform: scale(3); }
    100% { opacity: 0; transform: scale(5); }
}

@keyframes particle-explode {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--x), var(--y)) scale(0.5);
    }
}

#fireworks-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    z-index: 9998;
    transition: background 1s ease-in-out;
    pointer-events: none;
}

#fireworks-overlay.active {
    background: rgba(0, 0, 0, 0.7);
}

/* ═══════════════════════════════════════════════════════════════════════════
   🎛️ Group Mapping Dialog - Modal Console
   ═══════════════════════════════════════════════════════════════════════════ */

.group-mapping-dialog {
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    padding: 0;
    border: 1px solid var(--vu-amber);
    border-radius: var(--radius-lg);
    box-shadow:
        0 8px 48px rgba(0, 0, 0, 0.6),
        0 0 40px var(--vu-amber-glow);
    overflow: hidden;
    background: var(--studio-dark);
}

.group-mapping-dialog[open] {
    display: flex;
    flex-direction: column;
}

.group-mapping-dialog::backdrop {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.dialog-header {
    padding: 16px 24px;
    background: linear-gradient(180deg, var(--vu-amber) 0%, #d48f1a 100%);
    color: var(--studio-black);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.dialog-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.close-dialog-btn {
    background: transparent;
    border: none;
    color: var(--studio-black);
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-dialog-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.info-bar {
    padding: 12px 24px;
    background: var(--studio-surface);
    border-bottom: 1px solid var(--studio-border);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.info-bar strong {
    color: var(--vu-amber);
}

.dialog-content {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    background: var(--studio-panel);
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════════════════
   📋 Mapping Section Styles
   ═══════════════════════════════════════════════════════════════════════════ */

.mapping-section {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--vu-amber);
    margin-bottom: 10px;
    padding: 8px 12px;
    background: var(--studio-surface);
    border-radius: var(--radius-sm);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.pinyin-list-horizontal,
.lyrics-list-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
    background: var(--studio-surface);
    border: 1px solid var(--studio-border);
    border-radius: var(--radius-md);
    min-height: 70px;
    max-height: 180px;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
}

.pinyin-item,
.lyric-item {
    padding: 10px 16px;
    border: 2px solid var(--studio-border);
    border-radius: var(--radius-md);
    background: var(--studio-elevated);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    min-width: 50px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.pinyin-item:hover:not(.selected):not(.mapped):not(.focused),
.lyric-item:hover:not(.selected):not(.mapped):not(.focused) {
    border-color: var(--vu-green);
    transform: translateY(-3px);
    box-shadow: 0 4px 16px var(--vu-green-glow);
}

.pinyin-item.focused {
    border-color: var(--vu-amber);
    border-width: 3px;
    box-shadow: 0 0 16px var(--vu-amber-glow);
    transform: scale(1.05);
}

.lyric-item.focused {
    border-color: var(--role-male);
    border-width: 3px;
    box-shadow: 0 0 16px rgba(255, 107, 157, 0.4);
    transform: scale(1.05);
}

.pinyin-item.selected {
    background: var(--vu-green);
    color: var(--studio-black);
    border-color: var(--vu-green);
    box-shadow: 0 0 20px var(--vu-green-glow);
}

.lyric-item.selected {
    background: var(--role-male);
    color: var(--studio-black);
    border-color: var(--role-male);
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.5);
}

.pinyin-item.mapped,
.lyric-item.mapped {
    background: var(--studio-surface);
    border-color: var(--vu-green);
    color: var(--vu-green);
    cursor: default;
    opacity: 0.6;
}

.lyric-pinyin-annotation {
    font-size: 11px;
    color: var(--vu-green);
    font-weight: 500;
    margin-bottom: 3px;
    line-height: 1.1;
}

.lyric-char {
    font-size: 18px;
    font-weight: 700;
    color: inherit;
}

/* Mappings Display */
.mappings-display {
    padding: 16px;
    background: var(--studio-surface);
    border-radius: var(--radius-md);
    min-height: 60px;
    border: 1px solid var(--studio-border);
}

.mappings-display-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    font-style: italic;
    font-size: 12px;
}

.mapping-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin: 6px 0;
    background: var(--studio-elevated);
    border: 1px solid var(--studio-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.mapping-entry .pinyin-part {
    color: var(--vu-green);
    font-weight: 600;
    font-size: 16px;
}

.mapping-entry .arrow {
    color: var(--text-muted);
    margin: 0 12px;
}

.mapping-entry .lyric-part {
    color: var(--role-male);
    font-weight: 700;
    font-size: 18px;
}

.mapping-entry .delete-btn {
    background: var(--vu-red);
    color: var(--studio-black);
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mapping-entry .delete-btn:hover {
    background: #ff6b7a;
    box-shadow: 0 0 12px var(--vu-red-glow);
}

.mapping-progress {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--studio-surface);
    border: 1px solid var(--vu-amber);
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-align: center;
    color: var(--vu-amber);
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Dialog Footer */
.dialog-footer {
    padding: 16px 24px;
    background: var(--studio-surface);
    border-top: 1px solid var(--studio-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.mapping-navigation {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.mapping-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-footer button {
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

#prevLineBtn,
#nextLineBtn {
    background: var(--studio-elevated);
    border: 1px solid var(--studio-border);
    color: var(--text-secondary);
    flex: 1;
}

#prevLineBtn:hover,
#nextLineBtn:hover {
    background: var(--studio-panel);
    border-color: var(--vu-green);
    color: var(--vu-green);
}

.save-btn {
    background: linear-gradient(180deg, var(--vu-green) 0%, #00a888 100%);
    color: var(--studio-black);
    box-shadow: 0 0 12px var(--vu-green-glow);
}

.save-btn:hover {
    box-shadow: 0 0 24px var(--vu-green-glow);
    transform: translateY(-2px);
}

.cancel-btn {
    background: var(--studio-elevated);
    border: 1px solid var(--studio-border);
    color: var(--text-secondary);
}

.cancel-btn:hover {
    border-color: var(--vu-red);
    color: var(--vu-red);
}

/* ═══════════════════════════════════════════════════════════════════════════
   📱 Responsive Design
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .top-section {
        flex-direction: column;
        width: 100%;
        gap: 16px;
    }

    .video-container,
    .lyrics-input-container {
        flex: none;
        width: 100%;
    }

    #player {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 8px 12px;
    }

    .header-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px;
    }

    .header-left {
        order: 1;
        flex: 1;
    }

    .header-left .logo {
        font-size: 12px;
    }

    .header-left .credits {
        display: none;
    }

    .header-center {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .header-right {
        order: 2;
    }

    .ctrl-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    #player {
        max-width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .url-input {
        font-size: 16px;
        padding: 12px 14px;
    }

    #lyricsInput,
    #pinyinInput {
        height: 100px;
        font-size: 14px;
    }

    .pinyin-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .validate-btn,
    .group-mapping-btn {
        width: 100%;
        padding: 10px 14px;
    }

    #lyricsContainer {
        width: 100%;
        height: 80px;
        padding: 12px 16px;
    }

    #lyricsDisplay {
        font-size: 24px;
        gap: 6px;
    }

    .word {
        padding: 3px 2px;
        font-size: 24px;
    }

    .help-content {
        flex-direction: column;
        gap: 12px;
    }

    .help-section {
        text-align: center;
    }

    /* Dialog responsive */
    .group-mapping-dialog {
        width: 98vw;
        height: 95vh;
    }

    .dialog-footer {
        padding: 12px 16px;
    }

    .mapping-navigation,
    .mapping-actions {
        flex-direction: column;
    }

    .dialog-footer button {
        width: 100%;
    }

    .pinyin-item,
    .lyric-item {
        font-size: 16px;
        padding: 8px 12px;
        min-width: 40px;
    }
}

@media (max-width: 480px) {
    #lyricsDisplay {
        font-size: 20px;
    }

    .word {
        padding: 2px 1px;
        font-size: 20px;
    }

    .timestamps-summary {
        padding: 8px 10px;
        flex-wrap: wrap;
    }

    .progress-indicator {
        font-size: 10px;
    }

    .last-record {
        font-size: 10px;
        width: 100%;
        order: 3;
        margin-top: 4px;
    }

    .download-icon-btn {
        width: 28px;
        height: 28px;
    }
}
