:root {
    --bg: #ffffff;
    --card-bg: #f8f9fa;
    --text: #1a1a1a;
    --sub-text: #555555;
    --accent: #000000;
    --accent-neon-green: #22c55e;
    --accent-gold: #fbbf24;
    --accent-amber: #f59e0b;
    --btn-text: #ffffff;
    --neon: #99FF00;
    --neon-cyan: #00e5ff;
    --yellow: #ffea00;
    --border: #e9ecef;
    --chip-bg: #f0f0f0;
    --legal-text: #868e96;
    --trust-color: #006064;
    --btn-shadow: rgba(0, 0, 0, 0.12);
    --player-bg: rgba(255, 255, 255, 0.94);
    --yt-color: #ff0000;
    --spotify-color: #1ed760;
    --apple-color: #fc3c44;
}

body.dark-mode {
    --bg: #000000;
    --card-bg: #141416;
    --text: #EAEAEA;
    --sub-text: #A8A8A8;
    --accent: #00e5ff;
    --accent-neon-green: #22c55e;
    --accent-gold: #fbbf24;
    --accent-amber: #f59e0b;
    --btn-text: #000000;
    --neon: #99FF00;
    --neon-cyan: #00e5ff;
    --border: #262626;
    --chip-bg: #1A1A1A;
    --legal-text: #B0B0B0;
    --trust-color: #00e5ff;
    --btn-shadow: rgba(0, 229, 255, 0.2);
    --player-bg: rgba(20, 20, 22, 0.94);
    --yt-color: #ff0000;
    --spotify-color: #1ed760;
    --apple-color: #fa243c;
}

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

html {
    overflow: hidden;
    height: 100svh;
    height: 100dvh;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body.ost-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.4s ease, color 0.4s ease;
    height: 100svh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    overflow: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body.ost-page::-webkit-scrollbar {
    display: none;
}

.app-container {
    width: 100%;
    max-width: 420px;
    height: 100svh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    padding-top: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* 1. Header (Centered, Exactly Aligned, 48px Fixed) */
header, .header, .site-header, .header-container {
    /* 노치/다이내믹 아일랜드 아래로 약 22px 추가 확보 */
    padding-top: calc(env(safe-area-inset-top, 0px) + 22px) !important;
    padding-bottom: 12px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    height: auto !important;
    min-height: calc(46px + env(safe-area-inset-top, 0px) + 22px) !important;
    max-height: none !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg);
}

.logo, .brand, a.logo {
    font-size: 17px !important;
    letter-spacing: -0.6px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    margin-right: 6px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    height: 24px !important;
    cursor: pointer;
    color: var(--text);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), text-shadow 0.2s ease;
    transform-origin: left center;
    user-select: none;
    -webkit-user-select: none;
}

.logo:hover {
    transform: scale(1.08) translateY(-1px);
    text-shadow:
        0 0 8px rgba(34, 197, 94, 0.9),
        0 0 20px rgba(34, 197, 94, 0.5);
    color: var(--text);
}

.controls, .nav-group, .header-right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    height: 24px !important;
    gap: 3.5px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.nav-btn, .header-btn,
header a[href="index.html"], header a[href="top10.html"], header a[href="mbti.html"], header a[href="ost.html"],
.controls a[href="index.html"], .controls a[href="top10.html"], .controls a[href="mbti.html"], .controls a[href="ost.html"],
.top10-header-btn, .mbti-header-btn, .ost-header-btn {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: -0.4px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9999px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.icon-btn, #lang-btn, #theme-toggle, .lang-toggle, .theme-toggle {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    font-size: 13.5px !important;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
    flex-shrink: 0 !important;
}

.top10-header-btn {
    text-decoration: none;
    color: #f3ce13;
    border: 1.5px solid #f3ce13;
    transition: all 0.2s;
    white-space: nowrap;
}

body:not(.dark-mode) .top10-header-btn,
body.light-mode .top10-header-btn,
body.light-theme .top10-header-btn {
    color: #1a1a1a;
    background-color: #FFE066;
    border-color: #eab308;
}

.top10-header-btn:hover {
    background-color: #f3ce13;
    color: #000;
}

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

.mbti-header-btn {
    text-decoration: none;
    color: var(--neon);
    border: 1.5px solid var(--neon);
    transition: all 0.2s;
    white-space: nowrap;
}

.mbti-header-btn:hover {
    background-color: var(--neon);
    color: #000;
}

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

body:not(.dark-mode) .mbti-header-btn,
body.light-mode .mbti-header-btn,
body.light-theme .mbti-header-btn {
    color: #1a1a1a;
    background-color: #d4ff33;
    border-color: #7acc00;
}

.ost-header-btn {
    text-decoration: none;
    color: #00e5ff;
    border: 1.5px solid #00e5ff;
    transition: all 0.2s;
    white-space: nowrap;
}

.ost-header-btn:hover {
    background-color: #00e5ff;
    color: #000;
}

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

body:not(.dark-mode) .ost-header-btn,
body.light-mode .ost-header-btn,
body.light-theme .ost-header-btn {
    color: #006064;
    background-color: #e0f7fa;
    border-color: #00acc1;
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--card-bg);
    min-width: 140px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    border-radius: 12px;
    z-index: 1000;
    margin-top: 8px;
    border: 1px solid var(--border);
}

.lang-menu.show {
    display: block;
}

.lang-item {
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    transition: background 0.15s ease;
}

.lang-item:hover,
.lang-item.active {
    background-color: var(--chip-bg);
    font-weight: 700;
}

/* 2. Main Container (100dvh Single Screen Flex Structure, No Scrolling) */
.ost-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

/* 3. Reconfigured Title Bar (Compact, Rich, Inline Shuffle Button) */
.ost-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 2px 6px;
    flex-shrink: 0;
    gap: 8px;
}

.title-text-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.ost-badge-sub {
    font-size: 11.5px;
    letter-spacing: 1.5px;
    font-weight: 800;
    color: var(--accent-neon-green, #22c55e);
    text-transform: uppercase;
    line-height: 1.1;
}

.ost-main-heading {
    font-size: 21px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ost-guide-desc {
    font-size: 12px;
    opacity: 0.7;
    color: var(--sub-text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inline Compact Shuffle Button */
.btn-shuffle {
    background: var(--chip-bg);
    border: 1.5px solid var(--accent-neon-green, #22c55e);
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    padding: 5px 11px;
    border-radius: 100px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.btn-shuffle:hover {
    background: var(--accent-neon-green, #22c55e);
    color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.btn-shuffle:active {
    transform: scale(0.96);
}

body:not(.dark-mode) .btn-shuffle {
    border-color: #16a34a;
    color: #16a34a;
}

body:not(.dark-mode) .btn-shuffle:hover {
    background: #16a34a;
    color: #ffffff;
}

.dice-icon {
    display: inline-block;
    transform: rotate(0deg);
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
    user-select: none;
    -webkit-user-select: none;
}

.btn-shuffle.is-shuffling {
    animation: shuffleGlow 0.45s ease;
}

@keyframes shuffleGlow {
    0% {
        box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 16px rgba(34, 197, 94, 0.75);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
        transform: scale(1);
    }
}

/* 4. Fixed 8-Track Single-Screen Inline List (Space-Evenly Distributed) */
.ost-track-list {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    flex: 1;
    min-height: 0;
    gap: 4px;
    overflow: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.ost-track-list.is-fading {
    opacity: 0.22;
    transform: translateY(3px);
}

/* Track Card: height: 46px~48px; padding: 4px 12px; gap: 8px; border-radius: 14px; */
.ost-track-row {
    display: flex;
    align-items: center;
    height: 48px;
    min-height: 46px;
    max-height: 48px;
    padding: 4px 12px;
    gap: 8px;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.ost-track-row:hover {
    transform: translateY(-1px);
    border-color: rgba(34, 197, 94, 0.45);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.ost-track-row.is-playing {
    border-color: var(--accent-neon-green, #22c55e);
    background: rgba(34, 197, 94, 0.08);
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.22);
}

body:not(.dark-mode) .ost-track-row.is-playing {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
    box-shadow: 0 0 12px rgba(22, 163, 74, 0.2);
}

/* Left: 38x38 Thumbnail with Equalizer Overlay */
.track-thumb-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
    background: #111;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.track-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.track-equalizer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.ost-track-row.is-playing .track-equalizer-overlay {
    display: flex;
}

.eq-bar {
    width: 2.5px;
    height: 14px;
    background: var(--accent-neon-green, #22c55e);
    border-radius: 2px;
    animation: eqBounce 0.8s ease-in-out infinite alternate;
}
.eq-bar:nth-child(1) { animation-duration: 0.6s; animation-delay: 0.1s; }
.eq-bar:nth-child(2) { animation-duration: 0.85s; animation-delay: 0.25s; }
.eq-bar:nth-child(3) { animation-duration: 0.55s; animation-delay: 0s; }

@keyframes eqBounce {
    0% { height: 3px; }
    100% { height: 16px; }
}

/* Center: Typography & Metadata (2 Lines) */
.track-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.track-title-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    line-height: 1.2;
}

.track-title-name {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 175px;
}

.track-movie-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-neon-green, #22c55e);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.95;
}

body:not(.dark-mode) .track-movie-tag {
    color: #15803d;
}

.track-artist-row {
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.1;
}

.track-artist-name {
    font-size: 11px;
    color: var(--sub-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.track-year-tag {
    font-size: 9.5px;
    color: var(--sub-text);
    opacity: 0.7;
    flex-shrink: 0;
}

/* Right Actions: Red YT Music + 30s Play (Separated by 15px gap to prevent touch collision) */
.track-action-side {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.track-yt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #ff0000;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.25);
    text-decoration: none;
    transition: transform 0.18s ease, background 0.18s ease;
    flex-shrink: 0;
}

.track-yt-btn:hover {
    transform: scale(1.12);
    background: rgba(255, 0, 0, 0.2);
    border-color: #ff0000;
}

.track-yt-btn:active {
    transform: scale(0.92);
}

.track-yt-btn svg {
    display: block;
}

.track-row-play-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-neon-green, #22c55e);
    background: transparent;
    color: var(--accent-neon-green, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
    padding: 0;
}

.ost-track-row:hover .track-row-play-btn,
.track-row-play-btn:hover {
    background: var(--accent-neon-green, #22c55e);
    color: #000000;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.ost-track-row.is-playing .track-row-play-btn {
    background: var(--accent-neon-green, #22c55e);
    color: #000000;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
}

body:not(.dark-mode) .track-row-play-btn {
    border-color: #16a34a;
    color: #16a34a;
}

body:not(.dark-mode) .ost-track-row:hover .track-row-play-btn,
body:not(.dark-mode) .track-row-play-btn:hover,
body:not(.dark-mode) .ost-track-row.is-playing .track-row-play-btn {
    background: #16a34a;
    color: #ffffff;
}

/* Card Bottom 30s Progress Bar */
.track-card-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-neon-green, #22c55e), #00e5ff);
    border-radius: 0 0 14px 14px;
    transition: width 0.1s linear;
    pointer-events: none;
    display: none;
}

.ost-track-row.is-playing .track-card-progress {
    display: block;
}

/* 5. Bottom Capsule CTA Bar (Cinema Gold Solid Theme) */
.ost-bottom-cta-wrap {
    flex-shrink: 0;
    padding: 6px 0;
    margin-bottom: max(14px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: center;
    width: 100%;
}

.ost-capsule-cta-btn {
    width: 100%;
    max-width: 440px;
    height: 46px;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #000000 !important;
    border: none;
    border-radius: 9999px;
    font-size: 14.5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 16px;
    user-select: none;
    -webkit-user-select: none;
}

.ost-capsule-cta-btn:hover {
    transform: translateY(-1.5px) scale(1.01);
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    color: #000000 !important;
}

.ost-capsule-cta-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

body:not(.dark-mode) .ost-capsule-cta-btn {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #000000 !important;
    border: none;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

body:not(.dark-mode) .ost-capsule-cta-btn:hover {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #000000 !important;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* Mobile Responsiveness Fine-Tuning */
@media (max-width: 400px) {
    .ost-main-heading {
        font-size: 19px;
    }
    .btn-shuffle {
        font-size: 10.5px;
        padding: 4px 9px;
    }
    .ost-capsule-cta-btn {
        font-size: 13.5px;
        height: 44px;
    }
    .track-title-name {
        max-width: 140px;
        font-size: 13px;
    }
    .track-artist-name {
        max-width: 130px;
        font-size: 10.5px;
    }
    .track-action-side {
        gap: 14px;
    }
}

@media (max-width: 360px) {
    .ost-main-heading {
        font-size: 17px;
    }
    .ost-capsule-cta-btn {
        font-size: 12.5px;
        height: 42px;
    }
    .track-title-name {
        max-width: 110px;
        font-size: 12px;
    }
    .track-artist-name {
        max-width: 100px;
        font-size: 10px;
    }
    .track-thumb-wrap {
        width: 34px;
        height: 34px;
    }
    .track-yt-btn,
    .track-row-play-btn {
        width: 26px;
        height: 26px;
    }
    .track-action-side {
        gap: 12px;
    }
}
