/**
 * karaoke.css - Cyber Neon Karaoke Studio Theme
 */

:root {
    --bg-dark: #070913;
    --bg-card: rgba(18, 24, 38, 0.85);
    --border-neon: rgba(99, 102, 241, 0.35);
    --neon-blue: #38bdf8;
    --neon-pink: #ec4899;
    --neon-purple: #8b5cf6;
    --neon-gold: #fbbf24;
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
}

/* ===================================================
   Karaoke Screen Layout
   =================================================== */
.karaoke-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, #171c38 0%, #070913 80%);
}

/* Header */
.karaoke-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(7, 9, 19, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-neon);
    z-index: 20;
}

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

.song-badge {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

.song-title-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

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

/* ===================================================
   Main Stage & Visualizer
   =================================================== */
.stage-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
}

/* Visualizer Canvas */
.visualizer-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 160px;
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
}

/* Cheer Popup Animation */
.cheer-overlay {
    position: absolute;
    top: 20%;
    pointer-events: none;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cheer-bubble {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    font-size: 1.2rem;
    font-weight: 900;
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.8);
    animation: cheerPop 1.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-origin: center;
}

@keyframes cheerPop {
    0% { transform: scale(0.3) translateY(40px); opacity: 0; }
    20% { transform: scale(1.15) translateY(0); opacity: 1; }
    80% { transform: scale(1.0) translateY(-10px); opacity: 1; }
    100% { transform: scale(0.8) translateY(-40px); opacity: 0; }
}

/* ===================================================
   Karaoke Lyrics Display (Dual Mode: Scroll Book & Single Telop)
   =================================================== */
.lyrics-stage {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 800px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
}

/* 1. スクロール歌詞本ビュー (Apple Music / Spotify風) */
.lyrics-scroll-view {
    width: 100%;
    height: calc(100vh - 240px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 120px 20px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.lyrics-scroll-view::-webkit-scrollbar { display: none; }

.scroll-line-item {
    font-size: 1.35rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 1px;
    line-height: 1.4;
    text-align: center;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    transform: scale(0.95);
    max-width: 90%;
}

.scroll-line-item:hover {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.0);
}

.scroll-line-item.active {
    font-size: 1.9rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.9), 0 0 40px rgba(56, 189, 248, 0.5);
    transform: scale(1.08);
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* 2. 1行テロップビュー (クラシックカラオケ) */
.lyrics-telop-view {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    width: 100%;
    text-align: center;
}

.current-line-container {
    position: relative;
    display: inline-block;
    min-height: 70px;
}

.current-line-text {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.3;
    color: #475569;
    position: relative;
    display: inline-block;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.current-line-wipe {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    color: var(--neon-blue);
    overflow: hidden;
    white-space: nowrap;
    width: 0%;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.9), 0 0 30px rgba(56, 189, 248, 0.6);
    transition: width 0.08s linear;
}

.next-line-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 1px;
    min-height: 36px;
    transition: all 0.3s ease;
}

/* ===================================================
   Bottom Control Bar
   =================================================== */
.karaoke-controls {
    background: rgba(11, 15, 25, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-neon);
    padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
}

/* Progress bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.progress-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-pink));
    box-shadow: 0 0 8px var(--neon-blue);
    border-radius: 3px;
}

/* Buttons row */
.control-buttons-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-karaoke {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-light);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-karaoke:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--neon-blue);
    color: #fff;
}

.btn-karaoke.active {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.5);
}

.btn-play-main {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-blue), #2563eb);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
    transition: transform 0.2s ease;
}

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

/* Key Control Group */
.key-control-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-neon);
    border-radius: 20px;
    padding: 2px 6px;
}

.key-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 4px 8px;
    cursor: pointer;
    font-weight: 700;
}

.key-display {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--neon-gold);
    min-width: 24px;
    text-align: center;
}

/* ===================================================
   Denmoku (Song Selector Modal)
   =================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.denmoku-modal {
    background: #0f172a;
    border: 1px solid var(--border-neon);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

.denmoku-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.denmoku-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.denmoku-search-box {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.search-input:focus {
    border-color: var(--neon-blue);
}

.album-filter-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    scrollbar-width: none;
}

.album-filter-tabs::-webkit-scrollbar { display: none; }

.album-tab-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.album-tab-btn.active {
    background: var(--neon-purple);
    color: #fff;
    border-color: transparent;
}

.song-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.song-card-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
}

.song-card-item:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--border-neon);
    transform: translateX(4px);
}

.song-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.song-card-album {
    font-size: 0.72rem;
    color: var(--text-dim);
}

/* ===================================================
   Score Result Modal
   =================================================== */
.score-modal {
    background: #0f172a;
    border: 2px solid var(--neon-gold);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 0 50px rgba(251, 191, 36, 0.4);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.score-number {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 25px rgba(251, 191, 36, 0.8);
    margin: 10px 0;
    font-family: "Impact", var(--font-main);
}

.score-comment {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-light);
    margin-top: 14px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 640px) {
    .current-line-text {
        font-size: 1.5rem;
    }
    .next-line-text {
        font-size: 1.0rem;
    }
    .song-title-header {
        font-size: 0.95rem;
    }
}
