/* 蜂蜜牛奶歌單查詢 — mobile first，無框架、無外部資源 */

:root {
    --bg: #f6f6f7;
    --fg: #17171a;
    --muted: #6b6b73;
    --card: #ffffff;
    --line: #e5e5ea;
    --field: #ffffff;
    --chip: #efeff2;
    --chip-on: #17171a;
    --chip-on-fg: #ffffff;
    --accent: #d7263d;
    --accent-soft: #fdecef;
    --shadow: 0 1px 2px rgba(16, 16, 20, .06), 0 4px 14px rgba(16, 16, 20, .05);
    --radius: 14px;
    --tap: 44px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0d0f;
        --fg: #f1f1f4;
        --muted: #9b9ba4;
        --card: #17171b;
        --line: #26262c;
        --field: #17171b;
        --chip: #202026;
        --chip-on: #f1f1f4;
        --chip-on-fg: #121216;
        --accent: #ff5d70;
        --accent-soft: #2b1216;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5);
    }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
                 "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ── 標題 ─────────────────────────────────────────── */

.topbar {
    padding: max(14px, env(safe-area-inset-top)) 16px 4px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.brand .mark {
    width: 22px;
    height: 22px;
    flex: none;
    color: var(--accent);
}

.brand h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: -4px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 18px;
    background: var(--chip);
}

.sub {
    margin: 2px 0 0;
    padding-left: 30px;
    font-size: 12.5px;
    color: var(--muted);
}

/* ── 搜尋列（固定在上方）──────────────────────────── */

.searchwrap {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 16px 6px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
}

.searchbar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 50px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--field);
    box-shadow: var(--shadow);
}

.searchbar:focus-within {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.glass {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--muted);
}

.searchbar input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--fg);
    font-size: 16.5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

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

.searchbar input::-webkit-search-cancel-button { display: none; }

.clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--chip);
    color: var(--muted);
}

.clear svg { width: 15px; height: 15px; }

/* 自動完成 */

.suggest {
    position: absolute;
    left: 16px;
    right: 16px;
    top: calc(100% - 2px);
    max-height: 46vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    z-index: 30;
}

.suggest button {
    display: flex;
    width: 100%;
    align-items: baseline;
    gap: 10px;
    padding: 12px 14px;
    border: 0;
    border-top: 1px solid var(--line);
    background: none;
    text-align: left;
}

.suggest button:first-child { border-top: 0; }
.suggest button:active { background: var(--chip); }

.suggest .s-name {
    font-size: 16px;
    font-weight: 600;
}

.suggest .s-meta {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.suggest .s-kind {
    flex: none;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--chip);
    color: var(--muted);
    font-size: 11px;
}

/* ── 篩選 chips ────────────────────────────────────── */

.chiprow {
    display: flex;
    gap: 8px;
    padding: 4px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.chiprow::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    height: 38px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--fg);
    font-size: 14px;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.chip[aria-pressed="true"] {
    background: var(--chip-on);
    border-color: var(--chip-on);
    color: var(--chip-on-fg);
    font-weight: 600;
}

.chip .n {
    margin-left: 5px;
    font-size: 11.5px;
    opacity: .65;
}

/* ── 結果 ──────────────────────────────────────────── */
.summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 2px 10px;
    font-size: 13px;
    color: var(--muted);
}

.summary b {
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.card {
    display: grid;
    grid-template-columns: minmax(74px, auto) 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-tap-highlight-color: transparent;
}

.card:active { background: var(--chip); }

.num {
    padding: 2px 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-family: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
    font-size: 25px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    line-height: 1.1;
    text-align: left;
}


.card .body { min-width: 0; }

.song {
    display: block;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.song:active { opacity: .6; }

mark {
    padding: 0 1px;
    border-radius: 3px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: inherit;
}


.artist {
    margin-top: 2px;
    font-size: 13.5px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 載入中的骨架 */

.skel {
    display: grid;
    gap: 8px;
}

.skel div {
    height: 76px;
    border-radius: var(--radius);
    background: linear-gradient(100deg, var(--card) 30%, var(--chip) 50%, var(--card) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.1s linear infinite;
}

@keyframes shimmer {
    from { background-position: 180% 0; }
    to   { background-position: -20% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .skel div { animation: none; }
}

/* 空狀態／錯誤 */

.state {
    padding: 30px 8px;
    text-align: center;
    color: var(--muted);
    font-size: 14.5px;
}

.state strong {
    display: block;
    margin-bottom: 6px;
    color: var(--fg);
    font-size: 16px;
}

.state .chiprow {
    justify-content: center;
    flex-wrap: wrap;
    padding: 14px 0 0;
}

/* 載入更多 */

.morewrap {
    padding: 14px 16px 4px;
}

.more {
    width: 100%;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--fg);
    font-size: 15px;
    font-weight: 600;
}

.more:disabled { opacity: .5; }

/* ── 統計頁 ────────────────────────────────────────── */

.statgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 14px 0 6px;
}

.stat {
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat b {
    display: block;
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat span {
    font-size: 12.5px;
    color: var(--muted);
}

.panel {
    margin-top: 18px;
    padding: 16px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel h2 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
}

.ranklist,
.plainlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ranklist li,
.plainlist li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 14.5px;
}

.ranklist li:first-child,
.plainlist li:first-child { border-top: 0; }

.ranklist .rank {
    width: 20px;
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ranklist .term {
    min-width: 0;
    overflow-wrap: anywhere;
    text-decoration: none;
    font-weight: 600;
}

.ranklist .count,
.plainlist .count {
    margin-left: auto;
    flex: none;
    color: var(--muted);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.dim { color: var(--muted); font-size: 14px; }
.small { font-size: 12.5px; }

/* ── 頁尾／提示 ────────────────────────────────────── */

.foot {
    padding: 26px 16px 10px;
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
}

.foot p { margin: 4px 0; }

.foot a {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.foot-dim { opacity: .8; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(22px + env(safe-area-inset-bottom));
    transform: translate(-50%, 20px);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--chip-on);
    color: var(--chip-on-fg);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 50;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* 平板以上：置中、卡片再寬一點 */

@media (min-width: 720px) {
    .topbar,
    .searchwrap,
    .results,
    .morewrap,
    .foot {
        max-width: 680px;
        margin-left: auto;
        margin-right: auto;
    }

    .searchwrap { left: 0; right: 0; }

    .card { grid-template-columns: 96px 1fr; padding: 14px 18px; }

    .num { font-size: 28px; }

    .statgrid { grid-template-columns: repeat(4, 1fr); }
}

/* ─────────────────────────────────────────────────────────────
   大字版：主要使用者是長輩
   基準 18px、歌號 clamp(32→40px)、歌名 22px、歌手 17.5px；
   型態篩選與提示卡已移除，畫面只剩「搜尋 → 篩選語言 → 結果」。
   這一段放在檔案最後，才會蓋掉上面的尺寸。
   ───────────────────────────────────────────────────────────── */

body { font-size: 18px; }

.brand h1 { font-size: 21px; }
.brand .mark { width: 24px; height: 24px; }
.sub { padding-left: 32px; font-size: 14.5px; }

.searchbar { height: 62px; padding: 0 14px; }
.searchbar input { font-size: 20px; }
.glass { width: 22px; height: 22px; }
.clear { width: 34px; height: 34px; }
.clear svg { width: 17px; height: 17px; }

.chip { height: 46px; padding: 0 18px; font-size: 17px; }

.intro-lead { font-size: 21px; }
.intro-sub { font-size: 16.5px; }
.popular-label { font-size: 15px; }

.summary { font-size: 15.5px; padding-bottom: 12px; }

.card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
}

.num {
    font-size: clamp(32px, 10vw, 40px);
    line-height: 1.05;
    letter-spacing: 0;
    white-space: nowrap;
}


.song {
    font-size: 28px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.artist { margin-top: 4px; font-size: 17.5px; }

.more { height: 58px; font-size: 19px; }

.state { padding: 36px 8px; font-size: 17px; }
/* 統計頁 */
.stat b { font-size: 32px; }
.stat span { font-size: 14px; }
.panel h2 { font-size: 18px; }
.ranklist li,
.plainlist li { padding: 11px 0; font-size: 17px; }
.ranklist .rank { font-size: 14px; }
.ranklist .count,
.plainlist .count { font-size: 14.5px; }
.dim { font-size: 16px; }
.small { font-size: 14px; }

@media (min-width: 720px) {
    .num { font-size: 42px; }
    .song { font-size: 31px; }
}

/* ─────────────────────────────────────────────────────────────
   版面：最上面只剩搜尋框；中間是大 QR（搜尋後換成結果）；
   站名與版權聲明放在頁尾。footer 用 flex 釘在底部。
   ───────────────────────────────────────────────────────────── */

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main { flex: 1 0 auto; }

/* 標題移到頁尾後，搜尋列就是第一排：要留出瀏海／狀態列的空間 */
.searchwrap {
    top: 0;
    padding-top: calc(12px + env(safe-area-inset-top));
}

.home {
    padding: 14px 16px 4px;
    text-align: center;
}

.home-lead {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
}

.qrhero {
    display: block;
    width: min(76vw, 320px);
    height: auto;
    margin: 16px auto 0;
    padding: 8px;
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}

.home-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.foot {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.foot-brand {
    margin: 0 0 2px;
    color: var(--fg);
    font-size: 17px;
    font-weight: 700;
}


@media (min-width: 720px) {
    .home {
        max-width: 680px;
        margin: 0 auto;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* 首頁內容在「搜尋列」與「頁尾」之間垂直置中，高螢幕不會空一大塊 */
.main {
    display: flex;
    flex-direction: column;
}

.home {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ── 統計頁登入 ───────────────────────────────────── */

.loginbox {
    max-width: 360px;
    margin: 12vh auto 0;
    padding: 22px 20px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.loginbox h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.login-sub {
    margin: 4px 0 14px;
    color: var(--muted);
    font-size: 14px;
}

.loginbox label {
    display: block;
    margin: 12px 0 6px;
    color: var(--muted);
    font-size: 13.5px;
}

.loginbox input {
    width: 100%;
    height: 50px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--field);
    color: var(--fg);
    font-size: 17px;
}

.loginbox input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.loginbox button {
    width: 100%;
    height: 50px;
    margin-top: 18px;
    border: 0;
    border-radius: 12px;
    background: var(--chip-on);
    color: var(--chip-on-fg);
    font-size: 17px;
    font-weight: 600;
}

.loginerr {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 14px;
    line-height: 1.5;
}

.login-back {
    margin: 16px 0 0;
    text-align: center;
    font-size: 14px;
}

.login-back a { color: var(--muted); }

/* 歌手後面的語言／型態標註：低調的灰標籤，不搶主資訊 */
.tags {
    display: inline-flex;
    gap: 5px;
    margin-left: 8px;
    vertical-align: 1px;
}

.tag {
    padding: 1px 7px;
    border-radius: 6px;
    background: var(--chip);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: .02em;
}

@media (min-width: 720px) {
    .tag { font-size: 13.5px; }
}

/* 歌手列：名字可截斷、標籤永遠可見 */
.artist {
    display: flex;
    align-items: baseline;
    min-width: 0;
}

.artist-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artist .tags { flex: none; }

/* 自動完成下拉：字再放大一級（給長輩看），每一列也加高比較好點 */
.suggest button {
    padding: 16px 16px;
    min-height: 60px;
    gap: 12px;
}

.suggest .s-name {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
}

.suggest .s-meta {
    font-size: 15px;
}

.suggest .s-kind {
    padding: 2px 7px;
    font-size: 12.5px;
}

@media (min-width: 720px) {
    .suggest .s-name { font-size: 24px; }
    .suggest .s-meta { font-size: 16px; }
}

/* ─────────────────────────────────────────────────────────────
   Google 登入與最愛（2026-11-27）
   ───────────────────────────────────────────────────────────── */

/* 搜尋列右側的最愛入口 */
.favnav {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--chip);
    color: var(--muted);
}

.favnav .heart {
    width: 21px;
    height: 21px;
}

.favnav[aria-pressed="true"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.favnav[aria-pressed="true"] .heart path {
    fill: currentColor;
}

.favnav-n {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* 卡片右側的愛心 */
.card.has-fav {
    grid-template-columns: minmax(74px, auto) minmax(0, 1fr) 44px;
}

.heartbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted);
    -webkit-tap-highlight-color: transparent;
}

.heartbtn svg {
    width: 25px;
    height: 25px;
}

.heartbtn.on { color: var(--accent); }
.heartbtn.on svg path { fill: currentColor; }
.heartbtn:active { background: var(--accent-soft); }
.heartbtn:disabled { opacity: .45; }

/* 最愛清單的標題列 */
.favhead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 2px 10px;
}

.favhead h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.favhead .n {
    color: var(--muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

/* 未登入時的最愛畫面 */
.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 14px;
    padding: 0 22px;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.btn-login:active { opacity: .85; }

.state .fine {
    max-width: 30em;
    margin: 12px auto 0;
    font-size: 12.5px;
    line-height: 1.6;
    opacity: .8;
}

/* 頁尾的登入狀態 */
.acct-name {
    color: var(--fg);
}

.linkbtn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* 大字版：愛心與登入按鈕也跟著放大 */
.favnav { width: 42px; height: 42px; }
.favnav .heart { width: 24px; height: 24px; }
.card.has-fav { grid-template-columns: auto minmax(0, 1fr) 48px; }
.heartbtn { width: 48px; height: 48px; }
.heartbtn svg { width: 28px; height: 28px; }
.favhead h2 { font-size: 23px; }
.favhead .n { font-size: 15.5px; }
.btn-login { min-height: 54px; font-size: 18px; padding: 0 26px; }
.state .fine { font-size: 13.5px; }

/* 首頁 QR 上方的 Google 登入（主要入口，要顯眼） */
.home-login {
    width: min(86vw, 350px);
    margin: 20px auto 0;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    padding: 0 18px;
    border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
    border-radius: 15px;
    background: var(--card);
    color: var(--fg);
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 0 0 4px var(--accent-soft), 0 2px 4px rgba(16, 16, 20, .06), 0 10px 24px rgba(16, 16, 20, .08);
    -webkit-tap-highlight-color: transparent;
}

.btn-google .gicon {
    width: 22px;
    height: 22px;
    flex: none;
}

.btn-google:active {
    transform: translateY(1px);
    background: var(--chip);
}

.home-login-note {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
    text-align: center;
}

.home-login + .qrhero {
    margin-top: 20px;
}

/* 大字版：登入按鈕再放大一點 */
.btn-google { min-height: 58px; font-size: 19px; }
.home-login-note { font-size: 14.5px; }

/* 矮螢幕（例如 iPhone SE 667px）：縮一點 QR 與間距，讓登入按鈕＋QR＋頁尾一起放得下 */
@media (max-height: 720px) {
    .home { padding-top: 8px; }
    .home-lead { font-size: 16.5px; }
    .home-login { width: min(82vw, 330px); margin-top: 14px; }
    .btn-google { min-height: 52px; font-size: 17.5px; }
    .home-login-note { margin-top: 7px; font-size: 13px; }
    .home-login + .qrhero { margin-top: 14px; }
    .qrhero { width: min(62vw, 248px); }
    .home-note { margin-top: 4px; font-size: 13px; }
}

/* 首頁順序：登入按鈕 → QR → 掃描說明（原本的網址行已移除） */
.home-login { margin: 0 auto; }
.home-login + .qrhero { margin-top: 18px; }
.qrhero + .home-lead { margin: 18px 0 0; }

@media (max-height: 720px) {
    .home-login + .qrhero { margin-top: 12px; }
    .qrhero + .home-lead { margin-top: 12px; }
}

/* 我的最愛：搜尋列下方的演唱者標籤雲 */
.favtags {
    max-width: 680px;
    margin: 0 auto;
    padding: 2px 16px 8px;
}

.tagcloud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tagcloud .chip {
    height: 40px;
    max-width: 100%;
    padding: 0 13px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tagcloud .chip .n {
    margin-left: 6px;
    font-size: 11px;
}

.tagcloud .moretag {
    border-style: dashed;
    background: transparent;
    color: var(--muted);
}

/* 大字版 */
.tagcloud .chip { height: 44px; font-size: 16px; }
.tagcloud .chip .n { font-size: 13px; }

/* 歌號欄：YouTube 標誌放在歌號前面 */
.numcol {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.numcol .num { flex: none; }

.numcol .ytbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
}

.numcol .ytbtn svg {
    width: 24px;
    height: 17px;
}

.numcol .ytbtn:active { opacity: .65; }

.actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 大字版 */
.numcol { gap: 8px; }
.numcol .ytbtn { width: 34px; height: 34px; }
.numcol .ytbtn svg { width: 28px; height: 20px; }

/* 單曲卡片改為上下兩行：上行歌名＋愛心，下行歌號＋演唱者 */
.card {
    display: block;
    padding: 12px 14px;
}

.card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.card-top .song {
    flex: 1 1 auto;
    min-width: 0;
}

.card-top .heartbtn { flex: none; }

.card-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    min-width: 0;
}

.card-bottom .numcol { flex: none; }

.card-bottom .artist {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0;
}

/* 大字版 */
.card { padding: 14px 16px; }
.card-top { gap: 12px; }
.card-bottom { gap: 12px; margin-top: 4px; }

/* 兩行卡片：歌號稍微縮小（仍保持大字與紅色） */
.num { font-size: clamp(27px, 8.4vw, 34px); }

/* 長歌名必須在卡片內截斷，不能把卡片/畫面撐寬 */
.cards { grid-template-columns: minmax(0, 1fr); }
.card { min-width: 0; max-width: 100%; }
.card-top .song {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 演唱者名稱依性別上色：男＝綠、女＝紅（其他／團體維持灰色） */
:root {
    --male: #1f7a4d;
    --male-soft: #e4f3ea;
}

@media (prefers-color-scheme: dark) {
    :root {
        --male: #5ed68f;
        --male-soft: #12281b;
    }
}

.artist.male .artist-name {
    color: var(--male);
    font-weight: 600;
}

.artist.female .artist-name {
    color: var(--accent);
    font-weight: 600;
}

/* 搜尋字被 mark 標記時，男歌手也用綠色，不要變成紅底紅字 */
.artist.male mark {
    color: var(--male);
    background: var(--male-soft);
}

/* 歌號改用藍色，和紅色（YouTube／女歌手）區隔 */
:root { --num: #2456c4; }

@media (prefers-color-scheme: dark) {
    :root { --num: #8fb6ff; }
}

.num { color: var(--num); }

/* 語言標籤：每個語言一個色相（同一色相下用深字＋淡底） */
.tag[class*="lang-"] {
    color: hsl(var(--h, 220) 55% 36%);
    background: hsl(var(--h, 220) 70% 95%);
}

@media (prefers-color-scheme: dark) {
    .tag[class*="lang-"] {
        color: hsl(var(--h, 220) 80% 76%);
        background: hsl(var(--h, 220) 40% 18%);
    }
}

.tag.lang-guo      { --h: 222; }  /* 國 */
.tag.lang-tai      { --h: 20;  }  /* 台 */
.tag.lang-hakka    { --h: 95;  }  /* 客 */
.tag.lang-jp       { --h: 272; }  /* 日 */
.tag.lang-en       { --h: 190; }  /* 英 */
.tag.lang-yue      { --h: 45;  }  /* 粵 */
.tag.lang-mountain { --h: 165; }  /* 山 */
.tag.lang-music    { --h: 305; }  /* 樂 */
.tag.lang-kids     { --h: 330; }  /* 兒 */
.tag.lang-yaotou   { --h: 250; }  /* 搖頭音樂 */
.tag.lang-other    { color: var(--muted); background: var(--chip); } /* 其他 */

/* 性別標籤：男綠、女紅（和演唱者名稱一致） */
.tag.part-male {
    color: var(--male);
    background: var(--male-soft);
}

.tag.part-female {
    color: var(--accent);
    background: var(--accent-soft);
}

.tag.part-other {
    color: var(--muted);
    background: var(--chip);
}

/* 歌名右側的愛心加大 */
.heartbtn { width: 48px; height: 48px; }
.heartbtn svg { width: 32px; height: 32px; }

@media (min-width: 720px) {
    .heartbtn { width: 54px; height: 54px; }
    .heartbtn svg { width: 36px; height: 36px; }
}
