/* ============================================================================
   k-pop.rocks — unified responsive stylesheet
   Mobile-first. Breakpoints: ≥600px (tablet), ≥1024px (desktop).
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&family=Nanum+Gothic:wght@400;700&display=swap');

/* ---- Custom properties --------------------------------------------------- */
:root {
    --bg:           #1A1D27;
    --bg-elev:      #20232C;
    --bg-pane:      #171718;
    --bg-hover:     #26262A;
    --border:       #2A2A2F;
    --border-strong:#363636;
    --text:         #ffffff;
    --text-muted:   #BDBDD3;
    --text-dim:     #989898;

    --accent:       #DB3470;
    --accent-2:     #FF345B;

    --lang-ko:      #07A8F2;
    --lang-jp:      #EC1E50;
    --lang-cn:      #CE61CD;
    --lang-en:      #47BF2D;
    --lang-vn:      #FFBF00;

    --nav-w:        260px;
    --topbar-h:     52px;

    --easing:       cubic-bezier(.4,.0,.2,1);
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { padding: 0; margin: 0; outline: none; }

html {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100%;
    width: 100%;
    min-width: 320px;
    font-family: 'Nunito', 'Nanum Gothic', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
input, button, textarea { font: inherit; color: inherit; }

h1 { font-size: 20px; font-weight: 600; color: var(--text); }

/* ---- Scrollbar ----------------------------------------------------------- */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { box-shadow: inset 0 0 6px rgba(0,0,0,.3); border-radius: 10px; }
::-webkit-scrollbar-thumb        { background: #B1B1B1; border-radius: 10px; }
::-webkit-scrollbar-thumb:window-inactive { background: #B1B1B1; }
::placeholder                    { color: #000000; }

/* ---- Layout: container + drawer toggle ---------------------------------- */
.container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: row;
}

/* CSS-only mobile drawer. */
.nav-toggle { position: absolute; left: -9999px; }

.hamburger {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 30;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elev);
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
}
.hamburger::before,
.hamburger::after,
.hamburger > span {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s var(--easing), opacity .25s var(--easing);
}
.hamburger > span { margin: 4px 0; }

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-weight: 600;
    font-size: 16px;
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--easing);
    z-index: 18;
}

/* ---- Left navigation pane (drawer on mobile, sidebar on desktop) -------- */
.left-pane {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--nav-w);
    max-width: 85vw;
    background: var(--bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .28s var(--easing);
    padding: 12px 0;
    border-right: 1px solid var(--border);
}

.nav-toggle:checked ~ .container .left-pane,
.nav-toggle:checked ~ .left-pane {
    transform: translateX(0);
}
.nav-toggle:checked ~ .container .drawer-backdrop,
.nav-toggle:checked ~ .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
}
.nav-toggle:checked ~ .hamburger > span { opacity: 0; }
.nav-toggle:checked ~ .hamburger::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle:checked ~ .hamburger::after  { transform: translateY(-6px) rotate(-45deg); }

/* ---- Main content area -------------------------------------------------- */
.left {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    background: var(--bg);
    position: relative;
    overflow: visible;
    padding-top: var(--topbar-h);
}

/* ---- Sliding side panels (artist / drama / lyrics) ---------------------- */
.artist-pane,
.drama-pane,
.lyrics {
    display: none;
    background-color: var(--bg-pane);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 700px;
    z-index: 50;
    border-left: 1px solid #000000;
    box-shadow: -2px 2px 24px 0 rgba(0,0,0,.45);
    overflow: auto;
}

:fullscreen .lyrics,
:-webkit-full-screen .lyrics {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 60;
}

.highlight_match { color: #DBAE34; font-weight: 600; }

/* ---- Language tabs (uniform pill style) -------------------------------- */
.lang-tab {
    display: inline-block;
    font-size: 15px;
    background-color: #3C3B5F;
    color: #ccc;
    text-shadow: 0 1px 1px #28274B;
    border: 2px solid #1B1D23;
    padding: 7px 12px;
    margin-right: -4px;
    text-align: center;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background-color .2s var(--easing), color .2s var(--easing);
}
.lang-tab:first-of-type { border-radius: 18px 0 0 18px; border-left: 2px solid #1B1D23; }
.lang-tab:last-of-type  { border-radius: 0 18px 18px 0; }
.lang-tab.on            { background-color: var(--accent); color: var(--text); }

/* ---- Shared list items ------------------------------------------------- */
.drama,
.artist,
.song {
    padding: 10px;
    clear: both;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text);
    display: block;
    transition: border-color .15s var(--easing), background-color .15s var(--easing), box-shadow .15s var(--easing);
}
.drama  { height: 47px; }
.artist { height: 25px; }
.song   { height: 25px; }

.drama:hover,
.artist:hover,
.song:hover,
.artist.on,
.song.on {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--bg-hover) url(/k-pop.rocks/arrow.png) no-repeat center right 10px;
    box-shadow: inset 0 0 5px 0 rgba(0,0,0,.75);
}

.artist.on,
.song.on { background-image: none; }

.song.off, .artist.off { color: var(--text-dim); }

.artist-pane .song,
.drama-pane .song { border-color: var(--bg-pane); }

/* ---- Lyrics text -------------------------------------------------------- */
.lyrics-text {
    display: none;
    width: 100%;
    max-width: 720px;
    margin: 12px auto 0;
    padding: 10px;
    clear: both;
    font-size: 16px;
    color: var(--text);
    text-align: center;
    overflow: auto;
}
.lyrics-text.on { display: block; }

.close-lyrics {
    position: absolute;
    cursor: pointer;
    display: none;
    background: no-repeat url(/k-pop.rocks/sprites.png) -15px -49px;
    width: 30px;
    height: 30px;
}

/* ---- Search & notifications ------------------------------------------- */
.search-section {
    cursor: pointer;
    float: left;
    padding: 5px 5px 5px 30px;
    margin-right: 5px;
    background: no-repeat url(/k-pop.rocks/check-off.png) left center;
}
.search-section.on { background-image: url(/k-pop.rocks/check-on.png); }

.get-notifications .mark {
    position: absolute;
    width: 25px;
    height: 25px;
    padding: 7px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    color: #511436;
    text-shadow: 0 1px 1px #F55C94;
    border: 2px solid #441123;
    background: url(/k-pop.rocks/receive-notifications-off.png) no-repeat center var(--accent);
}
.get-notifications.on .mark { background-image: url(/k-pop.rocks/receive-notifications-on.png); }

.site-switch {
    cursor: pointer;
    position: absolute;
    right: 0;
    top: 4px;
    height: 55px;
    width: 50px;
    margin: 9px;
    padding-bottom: 20px;
    background: no-repeat url(/k-pop.rocks/arrow-bottom.png) bottom center;
}
.site-switch.on { height: 150px; background-image: url(/k-pop.rocks/arrow-up.png); }
.site.j { background: url(/k-pop.rocks/j-switch.png) no-repeat; width: 31px; height: 52px; margin: 6px auto; display: none; }
.site.c { background: url(/k-pop.rocks/c-switch.png) no-repeat; width: 31px; height: 44px; margin: 6px auto; display: none; }

.drama .fav,
.artist .fav,
.song .fav,
.caption .fav {
    float: left;
    width: 24px;
    height: 27px;
    margin-right: 10px;
    background: no-repeat url(/k-pop.rocks/sprites.png) -147px -27px;
    display: block;
}
.caption .fav { cursor: pointer; }
.drama .fav.on,
.artist .fav.on,
.song .fav.on,
.caption .fav.on { background-position: -147px 0; }

.count {
    float: right;
    display: block;
    padding: 0 4px;
    margin-right: 20px;
    background-color: #141B21;
    font-size: 14px;
    color: var(--text-muted);
    border-radius: 16px;
    border: 3px solid #1C2A46;
}

.menu-item {
    color: #dfdfdf;
    overflow: hidden;
    font-weight: 500;
    font-size: 16px;
    padding: 5px 0 0 25px;
    height: 22px;
    display: block;
}
.menu-item.sub { font-weight: normal; font-size: 14px; padding: 0 0 0 35px; }
.menu-item.sub .count { font-size: 13px; }
.menu-item.on {
    color: var(--text);
    background: no-repeat url(/k-pop.rocks/green-arrow.png) 0 5px;
}
.menu-item.sub.chinese     .count { color: var(--lang-cn); }
.menu-item.sub.korean      .count { color: var(--lang-ko); }
.menu-item.sub.english     .count { color: var(--lang-en); }
.menu-item.sub.japanese    .count { color: var(--lang-jp); }
.menu-item.sub.vietnamese  .count { color: var(--lang-vn); }
.menu-item.sub.boy-groups  .count { color: var(--lang-ko); }
.menu-item.sub.girl-groups .count { color: var(--lang-cn); }
.menu-item.sub.coed        .count { color: var(--lang-vn); }

[data-aload] { background-image: none !important; }

.marker {
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 5px;
    display: inline-block;
    margin-left: 8px;
    font-weight: bold;
    font-size: 16px;
}
.marker.ko { color: #070F57; background-color: var(--lang-ko); text-shadow: 0 1px 1px #7FE6FF; }
.marker.jp { color: #4C0A1A; background-color: var(--lang-jp); text-shadow: 0 1px 1px #EC7A97; }
.marker.cn { border: 2px solid var(--lang-cn); }
.marker.en { border: 2px solid var(--lang-en); }
.marker.vn { border: 2px solid var(--lang-vn); }

.search-lang {
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    padding: 3px;
    width: 20px;
    display: block;
    margin-left: 8px;
    float: left;
    font-weight: bold;
    font-size: 15px;
    border: 2px solid #535353;
    color: #676767;
}
.search-lang.on    { color: var(--text); }
.search-lang.on.ko { border-color: var(--lang-ko); }
.search-lang.on.jp { border-color: var(--lang-jp); }
.search-lang.on.cn { border-color: var(--lang-cn); }
.search-lang.on.en { border-color: var(--lang-en); }
.search-lang.on.vn { border-color: var(--lang-vn); }

.app-download-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    height: 50px;
    background: #111;
    text-align: center;
    color: var(--text);
    z-index: 15;
    transition: transform .5s var(--easing);
}
.app-download-bar.hidden { transform: translateY(100%); }

.fb_edge_widget_with_comment span.fb_edge_comment_widget iframe.fb_ltr {
    position: absolute;
    bottom: -70px;
}

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
    width: 100%;
    background: var(--bg);
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding: 32px 16px 80px;
}
.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
.footer-col { text-align: center; }
.footer-title {
    color: #8faed4;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .08em;
    margin-bottom: 12px;
}
.footer-apps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.app-badge {
    display: inline-block;
    width: 44px;
    height: 44px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
.footer-share { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; align-items: flex-start; }
.footer-subscribe {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}
.footer-subscribe .email_subscription {
    flex: 1 1 160px;
    max-width: 240px;
    padding: 8px 12px;
    border-radius: 16px;
    border: 2px solid #441123;
    background: var(--bg-elev);
    color: var(--text);
    font-size: 15px;
}
.btn-primary {
    border-radius: 16px;
    background-color: #0693D4;
    color: var(--text);
    text-shadow: 0 1px 1px #023952;
    border: 2px solid #441123;
    padding: 6px 14px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
}
.notify-btn {
    display: inline-block;
    border-radius: 16px;
    background-color: #0693D4;
    color: var(--text);
    text-shadow: 0 1px 1px #023952;
    border: 2px solid #441123;
    padding: 6px 14px 6px 36px;
    font-weight: bold;
    font-size: 15px;
    margin-left: 8px;
}
.get-notifications {
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
}
.footer-network { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.net-pill {
    border-radius: 16px;
    font-size: 15px;
    color: #8E8E8E;
    border: 2px solid #666666;
    background-color: #131315;
    padding: 7px 14px;
    font-weight: bold;
}
.btn-more {
    display: inline-block;
    border-radius: 16px;
    background-color: #ED524F;
    color: #612120;
    border: 2px solid #441123;
    padding: 7px 18px;
    font-size: 15px;
    font-weight: bold;
    text-shadow: 0 1px 1px #FF9390;
}
.footer-tw-loader { display: none; }

.content {
    width: 100%;
    max-width: 100%;
    padding: 16px;
}
#content_wrapper div#amzn-native-ad-0 ul { margin: 0; }

/* ============================================================================
   Song page — lyrics layout (mobile-first: stacked)
   ============================================================================ */
.song-page .lyrics-cols {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 12px;
}
.song-page .lyrics-col { width: 100%; text-align: center; }

.song-page .lyrics-col .lyrics-text {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 8px 4px;
    text-align: center;
    color: var(--text);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* ============================================================================
   TABLET — ≥600px
   ============================================================================ */
@media (min-width: 600px) {
    .lyrics-text { font-size: 17px; }
    .content     { padding: 20px; max-width: 760px; margin: 0 auto; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================================
   DESKTOP — ≥1024px
   ============================================================================ */
@media (min-width: 1024px) {
    .hamburger,
    .topbar,
    .drawer-backdrop { display: none !important; }

    .song-page .lang-tabs { display: none; }
    .song-page .lyrics-col .lyrics-text { display: block !important; }

    .left-pane {
        position: relative;
        transform: none;
        flex: 0 0 var(--nav-w);
        width: var(--nav-w);
        max-width: var(--nav-w);
        height: auto;
        min-height: 100vh;
        border-right: 1px solid var(--border);
    }

    .left { padding-top: 0; }

    .content {
        max-width: 900px;
        padding: 24px;
    }

    .footer-grid { grid-template-columns: repeat(5, 1fr); }

    .artist-pane,
    .drama-pane,
    .lyrics { width: 700px; }

    .song-page .lyrics-cols {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        max-width: 1100px;
        gap: 24px;
    }
    .song-page .lyrics-col { flex: 1 1 0; }
}

@media (min-width: 1280px) {
    .content                  { max-width: 1040px; }
    .song-page .lyrics-cols   { max-width: 1240px; gap: 32px; }
}

@media (min-width: 1600px) {
    .content                  { max-width: 1280px; }
    .song-page .lyrics-cols   { max-width: 1440px; }
}

/* ============================================================================
   Mobile overrides for legacy inline styles in page-body templates.
   Each rule targets a known inline-style pattern in home/search/artists/etc.
   so we can make the existing markup responsive WITHOUT editing every template.
   ============================================================================ */

/* Catch-all: no element should force horizontal scroll on phones */
@media (max-width: 1023px) {
    .left, .left * { max-width: 100%; }
    .left img      { height: auto; }

    /* The shared list items (.song / .artist / .drama in lists, not panels)
       have a hardcoded 25-47px height from the base. On mobile, let them grow
       to fit wrapped content. The artist-pane/drama-pane override below
       intentionally keeps the original behavior inside panels. */
    .left > div > .song,
    .left > div > .artist,
    .left > div > .drama,
    .left .song,
    .left .artist,
    .left .drama {
        height: auto !important;
        min-height: 44px;
        padding: 10px !important;
        overflow: hidden;
    }
    .left .song .fav,
    .left .artist .fav,
    .left .drama .fav { flex: 0 0 24px; }

    /* Fixed-position caption bars (search/popular/artists/dramas/etc.)
       overlap the mobile topbar — flatten them on phones */
    .left > .caption[style*="position:fixed"],
    .left > .caption[style*="position: fixed"] {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        padding: 12px !important;
    }
    .left > .caption > div { float: none !important; margin: 8px 0 !important; }
    .left > .caption .search,
    .left > .caption input[type="text"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* The big margin-top:100px / margin-bottom:100px outer wrapper
       (compensates for fixed caption that no longer exists on mobile) */
    .left > div[style*="margin-top:100px"] {
        margin-top: 12px !important;
        margin-bottom: 12px !important;
    }

    /* Any inline width:inherit or fixed-position absolute on top-level
       chrome under .left becomes harmless */
    .left [style*="width:inherit"]   { width: 100% !important; }

    /* Song-list item rows (home / popular / favourites / etc.) — anchor wrappers
       hard-coded to width:500px;height:80px */
    .left a[style*="width:500px"][style*="height:80px"] {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 80px;
        display: flex !important;
        align-items: center;
        gap: 10px;
        padding: 8px !important;
    }
    .left a[style*="width:500px"][style*="height:80px"] > img {
        flex: 0 0 auto;
        width: 64px !important;
        height: 64px !important;
    }
    .left a[style*="width:500px"][style*="height:80px"] > span {
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Caption rows: float:left;width:500px;padding-top:3px */
    .left [style*="float:left"][style*="width:500px"] {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Outer page wrapper: float:left;margin-left:15px present in home/etc. */
    .left > div[style*="margin-bottom:100px"][style*="float:left"] {
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        padding: 0 12px;
    }

    /* About / contacts text columns */
    .left [style*="width:600px"],
    .left [style*="width: 600px"],
    .left [style*="width:500px;padding-top:40px"] {
        width: 100% !important;
        max-width: 600px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Square image tiles that were displayed as 220x220 inline-block grids */
    .left a[style*="width:220px"][style*="height:220px"] {
        width: 47% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        margin: 4px !important;
    }
    .left a[style*="width:220px"][style*="height:220px"] > img {
        width: 100% !important;
        height: auto !important;
    }

    /* Category button row (home page: K-POP / K-DRAMA OST / APPS / ARTISTS / GROUPS) */
    .left > div > div[style*="display: inline-block"][style*="margin: 15px auto"] {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center;
        gap: 6px;
        margin: 12px auto !important;
        position: static !important;
    }

    /* Sliding side panels become full-screen on mobile (already covered, reinforced) */
    .artist-pane, .drama-pane, .lyrics {
        width: 100% !important;
        max-width: 100% !important;
    }
    .artist-pane .title,
    .drama-pane .title,
    .lyrics .title {
        width: calc(100% - 80px) !important;
        font-size: 18px !important;
    }
    .artist-pane .filter,
    .drama-pane .filter {
        width: calc(100% - 32px) !important;
        box-sizing: border-box;
    }

    /* Search section / lang pills wrap nicely on small screens */
    .search-section, .search-lang { float: none !important; display: inline-block; vertical-align: middle; margin: 4px; }

    /* Caption headers (artist / drama / search) — wrap title and search input */
    .left .caption {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        padding: 12px !important;
    }
    .left .caption > div { float: none !important; width: 100% !important; }
    .left .caption .search { width: 100% !important; box-sizing: border-box; }
}

/* Smooth scrolling for long pages */
html { scroll-behavior: smooth; }

/* Better focus states for keyboard navigation */
a:focus-visible, button:focus-visible, input:focus-visible, [class*="lang-tab"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

