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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #fafafa;
    min-height: 100vh;
    color: #333;
    padding-bottom: 80px;
}

.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px; }

.header {
    background: #C20C0C;
    border-radius: 4px;
    padding: 28px 20px;
    margin-bottom: 20px;
}
.header h1 { color: #fff; font-size: 20px; font-weight: 500; letter-spacing: 1px; }
.header .subtitle { color: rgba(255,255,255,0.75); font-size: 12px; margin-top: 6px; }

.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}
.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    position: relative;
}
.tab:hover { color: #C20C0C; }
.tab.active { color: #C20C0C; font-weight: 500; }
.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #C20C0C;
}

.content { display: none; }
.content.show { display: block; }

.card {
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #eee;
}
.card-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

/* Settings */
.settings-row {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.setting-item { flex: 1; min-width: 200px; }
.setting-item label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}
.setting-item input[type=number] {
    width: 100px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 14px;
}
.setting-item input[type=number]:focus { outline: none; border-color: #C20C0C; }
.hint { font-size: 11px; color: #999; margin-left: 8px; }

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.preset-item {
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    text-align: center;
    transition: all 0.2s;
}
.preset-item:hover { border-color: #C20C0C; color: #C20C0C; }
.preset-item.selected {
    background: #C20C0C;
    border-color: #C20C0C;
    color: #fff;
}

.phase-card {
    background: #fff;
    border-radius: 4px;
    padding: 16px 20px;
    margin-bottom: 12px;
    border: 1px solid #eee;
}
.phase-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.phase-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}
.phase-time-row { display: flex; gap: 10px; flex-wrap: wrap; }
.phase-time-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}
.time-input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 13px;
}
.time-input:focus { outline: none; border-color: #C20C0C; }

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fafafa;
    border-radius: 2px;
    margin-bottom: 6px;
}
.activity-item .act-min {
    width: 50px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 13px;
    text-align: center;
    background: #fff;
}
.activity-item .act-name {
    flex: 1;
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 13px;
    background: #fff;
}
.activity-item input:focus { outline: none; border-color: #C20C0C; }
.activity-item .delete-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
}
.activity-item .delete-btn:hover { color: #C20C0C; }
.act-unit { font-size: 12px; color: #999; }

.primary-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: #C20C0C;
    border: none;
    border-radius: 2px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    margin-top: 16px;
    font-weight: 500;
}
.primary-btn:hover { background: #A30A0A; }

/* Filters */
.filter-row { margin-bottom: 14px; }
.filter-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}
.search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 14px;
}
.search-input:focus { outline: none; border-color: #C20C0C; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 6px 14px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    user-select: none;
}
.chip:hover { border-color: #C20C0C; color: #C20C0C; }
.chip.selected {
    background: #C20C0C;
    border-color: #C20C0C;
    color: #fff;
}

.filter-summary {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.filter-summary .chip {
    background: #fff5f5;
    color: #C20C0C;
    border-color: #fff5f5;
    cursor: default;
}

.song-list { margin-top: 8px; }
.song-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #f0f0f0;
    border-radius: 2px;
    margin-bottom: 6px;
    background: #fff;
}
.song-item:hover { background: #fafafa; }
.song-info { flex: 1; min-width: 0; }
.song-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}
.song-artist {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}
.song-tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.song-tag {
    background: #f0f0f0;
    color: #666;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 2px;
}
.song-tag.risk-1 { background: #fff3e0; color: #d4790d; }
.song-tag.risk-2 { background: #ffe5e5; color: #c00; }
.lang-tag {
    background: #fff5f5;
    color: #C20C0C;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 2px;
}
.micro-tag {
    background: #f5f5f5;
    color: #666;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 2px;
}

.play-btn {
    background: #C20C0C;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 2px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}
.play-btn:hover { background: #A30A0A; }
.play-btn.playing { background: #555; }
.play-btn.loading { background: #999; cursor: not-allowed; }

.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    align-items: center;
}
.page-btn {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #666;
    padding: 8px 16px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
}
.page-btn:hover:not(:disabled) { border-color: #C20C0C; color: #C20C0C; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-info { font-size: 13px; color: #999; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #ccc;
    font-size: 14px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 24px;
    margin-bottom: 16px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e8e8e8;
}
.timeline-phase {
    position: relative;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
}
.timeline-phase::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 18px;
    width: 10px;
    height: 10px;
    background: #C20C0C;
    border-radius: 50%;
    border: 2px solid #fff;
}
.phase-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.phase-meta-time {
    font-size: 12px;
    color: #C20C0C;
    font-weight: 500;
}
.phase-meta-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.timeline-act {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 2px;
    margin-bottom: 6px;
    padding: 10px 12px;
}
.timeline-act-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.timeline-act-time {
    font-size: 12px;
    color: #C20C0C;
    min-width: 40px;
    font-weight: 500;
}
.timeline-act-name {
    flex: 1;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}
.timeline-act-dur {
    font-size: 11px;
    color: #999;
}

/* Song rows (in timeline) */
.act-songs {
    margin-top: 6px;
    border-top: 1px dashed #e8e8e8;
    padding-top: 6px;
}
.song-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    background: #fafafa;
    cursor: grab;
    user-select: none;
    transition: all 0.15s;
}
.song-row:hover { background: #f0f0f0; }
.song-row.dragging { opacity: 0.4; }
.song-row.drag-over { border: 1px dashed #C20C0C; }

.drag-handle {
    color: #ccc;
    font-size: 14px;
    cursor: grab;
    user-select: none;
}
.song-num {
    color: #C20C0C;
    font-size: 12px;
    font-weight: 500;
    min-width: 18px;
    text-align: right;
}
.song-row .song-info { flex: 1; min-width: 0; }
.song-line {
    display: flex;
    gap: 6px;
    align-items: baseline;
}
.song-mini-title {
    color: #C20C0C;
    font-size: 13px;
    font-weight: 500;
}
.song-mini-artist {
    color: #888;
    font-size: 11px;
}
.song-meta-line {
    display: flex;
    gap: 3px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.row-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #666;
    padding: 4px 8px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 11px;
    flex-shrink: 0;
}
.row-btn:hover { border-color: #C20C0C; color: #C20C0C; }
.row-btn.delete-row:hover { border-color: #c00; color: #c00; }
.row-btn.play-row.playing { background: #555; color: #fff; border-color: #555; }

.add-song-btn {
    background: none;
    border: 1px dashed #ccc;
    color: #999;
    padding: 6px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 6px;
    width: 100%;
}
.add-song-btn:hover { border-color: #C20C0C; color: #C20C0C; }
.add-song-btn.primary {
    border-color: #C20C0C;
    color: #C20C0C;
    background: #fff5f5;
}

.timeline-summary {
    background: #fff5f5;
    border: 1px solid #ffdddd;
    border-radius: 4px;
    padding: 12px 16px;
    color: #C20C0C;
    font-size: 13px;
    text-align: center;
    margin-top: 16px;
}
.timeline-summary strong { font-size: 16px; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.show { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 4px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}
.modal-header button {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.modal-header button:hover { color: #C20C0C; }

.modal-search-row {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #eee;
}
.modal-search-row .search-input { flex: 1; }
.phase-select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 14px;
    background: #fff;
}
.phase-select:focus { outline: none; border-color: #C20C0C; }

.modal-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    min-height: 200px;
}

.modal-song-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.modal-song-item:hover {
    background: #fff5f5;
    border-color: #C20C0C;
}
.modal-song-info { flex: 1; min-width: 0; }
.modal-song-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}
.modal-song-artist {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}
.modal-song-tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.modal-pick-btn {
    background: #C20C0C;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
    flex-shrink: 0;
}
.modal-pick-btn:hover { background: #A30A0A; }

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    text-align: right;
}

/* Audio bar */
.audio-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    padding: 10px 16px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 100;
}
.audio-bar.show { display: flex; }
.audio-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333;
    min-width: 200px;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audio-icon {
    color: #C20C0C;
    font-size: 18px;
}
.audio-bar audio {
    flex: 1;
    height: 36px;
    max-width: 600px;
}
.audio-close {
    background: none;
    border: 1px solid #ddd;
    color: #999;
    padding: 6px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
}
.audio-close:hover { border-color: #C20C0C; color: #C20C0C; }

@media (max-width: 640px) {
    .preset-grid { grid-template-columns: 1fr; }
    .phase-head { flex-direction: column; align-items: flex-start; }
    .phase-time-row { width: 100%; }
    .audio-info { display: none; }
    .modal-box { width: 95%; }
    .settings-row { flex-direction: column; gap: 14px; }
}