:root {
    --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card: #ffffff;
    --ink: #2d3142;
    --muted: #6c757d;
    --accent: #667eea;
    /* 兜底值；真实高度由 JS 实测后写进这个变量 —— 播放条在窄屏会换行，
       写死数字会把最后一张卡片压在底下点不到 */
    --bar-h: 190px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding-bottom: var(--bar-h);
    font-family: 'PingFang SC', 'Segoe UI', system-ui, sans-serif;
    font-size: 17px;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
}

.topbar { padding: 14px 20px; }
.topbar h1 { margin: 0; font-size: 1.4em; color: #fff; }

.layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    padding: 0 20px;
    align-items: start;
}

.units {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--card);
    border-radius: 12px;
    padding: 12px;
}

.unit-btn {
    min-height: 48px;
    border: none;
    border-radius: 10px;
    background: #f1f3f9;
    color: var(--ink);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

.unit-btn.is-on { background: var(--accent); color: #fff; }

.tracks {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
}

.tracks h2 { margin: 0 0 12px; font-size: 1.3em; }

.track {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 64px;
    padding: 10px 16px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    background: #f8f9fa;
    text-align: left;
    font-size: 17px;
    color: var(--ink);
    cursor: pointer;
}

.track:hover { background: #eef0fb; }
.track.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.track-icon { font-size: 1.8em; }
.track-text { flex: 1; }
.track-title { display: block; font-weight: 600; }
/* 中文副标题是不认识英文的小朋友用来认卡片的那行，不能比正文小 */
.track-sub { display: block; font-size: 16px; opacity: 0.8; }
.track-dur { font-variant-numeric: tabular-nums; opacity: 0.75; }

/* display:flex 会盖掉 hidden 属性的默认 display:none，必须显式还原 */
.playbar[hidden] { display: none; }

.playbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #ffffff;
    border-top: 2px solid #e9ecef;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.playbar-main { display: flex; align-items: center; gap: 14px; }

.btn-play {
    width: 56px; height: 56px;
    border: none; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 24px; cursor: pointer;
}

.btn-step {
    width: 48px; height: 48px;
    border: 1px solid #d7dbe8; border-radius: 50%;
    background: #f8f9fa; color: var(--ink);
    font-size: 20px; cursor: pointer;
}

.now { flex: 1; min-width: 0; }
.now-title { font-weight: 600; margin-bottom: 4px; }
.seek { display: flex; align-items: center; gap: 12px; }

/* 进度条：小朋友用手指拖，滑块必须够大 */
#seek {
    flex: 1;
    height: 44px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}
#seek::-webkit-slider-runnable-track {
    height: 10px; border-radius: 5px; background: #d7dbe8;
}
#seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 44px; height: 44px; margin-top: -17px;
    border: none; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}
#seek::-moz-range-track {
    height: 10px; border-radius: 5px; background: #d7dbe8;
}
#seek::-moz-range-thumb {
    width: 44px; height: 44px;
    border: none; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}
.time { font-variant-numeric: tabular-nums; color: var(--muted); }

.playbar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.playbar-tools button, .rate {
    min-height: 44px; min-width: 56px;
    border: 1px solid #d7dbe8; border-radius: 10px;
    background: #f8f9fa; color: var(--ink);
    font-size: 16px; cursor: pointer;
}
.playbar-tools button.is-on, .rate.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rate-group { display: flex; align-items: center; gap: 6px; }

.status {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 24px;
    text-align: center;
    font-size: 20px;
    background: #fff3cd;
    cursor: pointer;
}

@media (max-width: 700px) {
    .layout { grid-template-columns: 1fr; }
    .units { flex-direction: row; overflow-x: auto; }
    .unit-btn { flex: 0 0 auto; padding: 0 16px; }

    /* 窄屏下让工具行横向滚动，而不是换行成两三行 ——
       换行会让播放条吃掉三分之一个手机屏幕 */
    .playbar-tools {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .playbar-tools button, .rate { flex: 0 0 auto; }
    .playbar { padding: 8px 12px; }
}
