/* Penlight Sequencer - スタイル
 * テーマ変数 (--bg / --surface / --accent / --text 等) は shell.css の :root[data-theme] で定義済。
 * ここでは sequencer 固有の変数のみ追加する。
 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --radius: 8px;
}

/* 未ログイン警告バナー (譜面エディタ上部、固定表示) */
.sequencer-login-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff7e6;
    color: #8a5a00;
    border-bottom: 1px solid #ffd599;
    padding: 8px 16px;
    font-size: 13px;
    z-index: 50;
}
[data-theme="dark"] .sequencer-login-banner {
    background: rgba(255, 200, 80, 0.12);
    color: #ffcc66;
    border-bottom-color: rgba(255, 200, 80, 0.25);
}
.sequencer-login-banner-icon { font-size: 14px; }
.sequencer-login-banner-text { flex: 1; }
.sequencer-login-banner-text a {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 600;
}
.sequencer-login-banner-close {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.6;
}
.sequencer-login-banner-close:hover {
    opacity: 1;
    background: rgba(0,0,0,0.08);
}

/* Scrollbars (統一) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--surface3);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dim);
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* (Header はShell に統合済。旧 header / header h1 のグローバル指定は他ページの <header> に
    意図せず適用されてしまうので削除。残置していたが Shell 統合で不要。)
    .back-link は他で使われていれば残す。 */

.back-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
}
.back-link:hover { color: var(--accent); }

.seq-removed-h1-style {
    /* 旧 header h1 のグラデ装飾。要なら .seq-foo h1 等に再付与すること。 */
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), #f0c060);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.header-score-name-display {
    font-size: 12px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    padding: 0 8px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-score-name-display:empty::before {
    content: "無題";
    opacity: 0.5;
}

#device-count { font-size: 12px; color: var(--text-dim); }

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.status-dot.connected { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.disconnected { background: #555; }

/* Main layout */
.seq-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top: YouTube + Settings */
.seq-top {
    display: flex;
    gap: 12px;
    padding: 12px;
    flex-shrink: 0;
    height: 600px;
}

/* YouTube area */
.seq-player-area {
    flex: 0 0 780px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.player-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.player-panel-header h2 {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.player-panel-header h2::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

/* ライブ演出タイトル (動画プレビュー領域 上端、YouTube ボタンの右隣) */
.score-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#seq-current-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 自動セーブ状態表示 */
.autosave-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
}
.autosave-status.is-saving {
    color: #f59e0b;
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.3);
}
.autosave-status.is-saved {
    color: var(--success, #10b981);
    background: rgba(16,185,129,0.10);
    border-color: rgba(16,185,129,0.3);
}
.autosave-status.is-error {
    color: var(--danger, #ef4444);
    background: rgba(239,68,68,0.10);
    border-color: rgba(239,68,68,0.3);
}

/* ファイル操作ボタン群 (新規/読込/保存) */
.score-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.score-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
}
.score-actions .btn svg {
    margin-right: 3px;
    vertical-align: -1px;
}

.youtube-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface3);
    color: var(--text-dim);
    border: 1px solid var(--surface3);
    font-family: 'JetBrains Mono', monospace;
    text-decoration: none;
    transition: all 0.15s;
}
.youtube-chip:hover {
    color: var(--text);
    border-color: #ff0000;
}

.required {
    color: var(--accent);
    margin-left: 2px;
}

textarea.setting-input {
    resize: vertical;
    min-height: 60px;
}

.url-bar {
    display: flex;
    gap: 8px;
}

.url-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--surface3);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text);
    font-size: 13px;
    outline: none;
}
.url-input:focus { border-color: var(--accent); }

#youtube-player-container {
    flex: 1;
    background: var(--surface2);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    min-height: 200px;
}

#youtube-player {
    width: 100%;
    height: 100%;
}

.player-placeholder {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 14px;
}

#existing-timelines {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.existing-label { color: var(--text-dim); }

#existing-list {
    display: flex;
    gap: 6px;
}

.existing-item {
    background: var(--surface2);
    border: 1px solid var(--surface3);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--accent);
}
.existing-item:hover { border-color: var(--accent); }

/* Settings panel */
/* セクション列（動画とキーフレームの間） */
.seq-sections-col {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    transition: flex-basis 0.2s ease;
}
.seq-sections-col.collapsed {
    display: none;
}

/* セクション列を閉じるボタン (列内に置く、ヘッダー行) */
.sections-collapse-btn {
    background: transparent;
    border: 1px solid var(--surface3);
    color: var(--text-dim);
    border-radius: 4px;
    padding: 2px 4px;
    cursor: pointer;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s;
}
.sections-collapse-btn:hover {
    background: var(--surface3);
    color: var(--text);
}

/* セクション列を再表示するボタン (閉じてるときだけ表示、縦長の細い帯) */
.sections-show-btn {
    flex: 0 0 18px;
    background: var(--surface);
    border: 1px solid var(--surface3);
    border-radius: var(--radius);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
}
.sections-show-btn:hover {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--accent);
}

/* カラーパレット列 */
.seq-color-palette {
    flex: 0 0 320px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--surface3);
    padding: 12px;
    overflow-y: auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.btn-live-preview {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 8px;
}
.btn-live-preview.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--success);
    color: var(--success);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35) inset;
}
.btn-live-preview.active::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 4px var(--success);
    margin-left: 2px;
}

.palette-header label {
    margin: 0;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(10, 24px);
    gap: 4px;
    margin-bottom: 8px;
    justify-content: start;
}

.color-grid .swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: grab;
    position: relative;
}

.swatch-dragging {
    opacity: 0.4;
}

.swatch-drop-target {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.color-grid .swatch-add {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.color-picker-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.color-wheel-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
}

.color-wheel-css {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, white 0%, transparent 60%),
        conic-gradient(from 0deg,
            hsl(0 100% 55%), hsl(30 100% 55%), hsl(60 100% 55%),
            hsl(90 100% 50%), hsl(120 100% 45%), hsl(150 100% 45%),
            hsl(180 90% 50%), hsl(210 100% 55%), hsl(240 100% 60%),
            hsl(270 100% 60%), hsl(300 100% 55%), hsl(330 100% 55%),
            hsl(360 100% 55%));
    cursor: crosshair;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.4);
    position: relative;
    max-height: 100%;
}

.brush-color-input {
    flex: 1;
    height: 28px;
    min-width: 0;
    border-radius: 6px;
    border: 1px solid var(--surface3);
}

.brush-color-row {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
    flex: 0 0 auto;
}

.brush-color-row .btn {
    background: var(--accent);
    color: #0b0d12;
    border-color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
}

.brush-color-row .btn:hover {
    filter: brightness(1.08);
}

.section-list-area {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--surface3);
    padding: 10px;
    flex: 0 0 auto;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section-edit-area {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--surface3);
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-track-area {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--surface3);
    padding: 10px;
    flex: 0 0 auto;
    max-height: 130px;
    overflow-y: auto;
}

.device-track-area h2 {
    margin-bottom: 6px;
}

.overlay-content-wide {
    min-width: 520px;
    max-width: 680px;
}

.device-tracks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
/* Bluetooth 利用不可警告バナー */
.device-bt-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 8px 0 12px;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 6px;
    color: #f59e0b;
}
.device-bt-warning svg { flex-shrink: 0; margin-top: 1px; }
.device-bt-warning-body { flex: 1; min-width: 0; }
.device-bt-warning-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #f59e0b;
}
.device-bt-warning-msg {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    white-space: pre-wrap;
}

.device-tracks-header h3 {
    margin: 0;
}
.device-header-buttons {
    display: flex;
    gap: 8px;
}
#btn-identify-all.active {
    background: var(--accent-dim);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}

.device-battery {
    font-size: 11px;
    color: var(--success);
    margin-left: 8px;
    font-weight: normal;
}

.latency-unit {
    font-size: 10px;
    color: var(--text-dim);
    margin-left: 2px;
}

#device-log-section {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

#device-connected-section hr,
#device-overlay hr {
    border: none;
    border-top: 1px solid var(--surface3);
    margin: 12px 0;
}

.connecting {
    opacity: 0.6;
    animation: pulse 1s infinite;
}

.device-track-row {
    display: flex;
    align-items: center;
    padding: 10px;
    font-size: 12px;
    gap: 8px;
    background: var(--surface2);
    border-radius: 6px;
    margin-bottom: 6px;
    flex-wrap: nowrap;
}

.device-track-row .setting-select {
    width: auto;
    min-width: 80px;
    padding: 4px 8px;
    font-size: 12px;
    flex: 0 0 auto;
    background-color: var(--surface3);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.1);
}

.device-track-row .setting-select option {
    background-color: var(--surface3);
    color: var(--text);
}

.device-track-row .btn {
    white-space: nowrap;
    flex: 0 0 auto;
}

.device-track-row:last-child {
    margin-bottom: 0;
}

.device-track-info {
    flex: 1;
    min-width: 120px;
    overflow: hidden;
}

.device-track-name {
    color: var(--text);
    font-size: 14px;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-latency-input {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.latency-label {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
}

input.latency-input,
.device-track-row input.latency-input {
    width: 32px;
    min-width: 0;
    font-size: 12px;
    padding: 3px 4px;
    flex: 0 0 auto;
    text-align: right;
    box-sizing: content-box;
    background-color: var(--surface3);
    border: 1px solid rgba(255,255,255,0.1);
    -moz-appearance: textfield;
}
.latency-input::-webkit-outer-spin-button,
.latency-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.device-track-sub {
    color: var(--text-dim);
    font-size: 10px;
    font-family: monospace;
}

.seq-settings {
    flex: 1;
    min-width: 280px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--surface3);
    padding: 12px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    align-content: start;
}

.seq-settings h2 {
    grid-column: 1 / -1;
}

.kf-delete-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    margin-top: 4px;
    padding-top: 18px;
}

.kf-field-fullwidth {
    grid-column: 1 / -1;
}

.swatch-base {
    border: 2px solid var(--accent) !important;
}

.swatch.batch-target {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.pattern-color-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.pattern-color-track-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    color: var(--text-dim);
    letter-spacing: 0.02em;
    min-height: 10px;
}

.seq-settings hr {
    grid-column: 1 / -1;
}

.seq-settings .btn-row {
    grid-column: 1 / -1;
}

#kf-placeholder {
    grid-column: 1 / -1;
}

/* Color palette */
.color-palette-section {
    grid-column: 1 / -1;
}

.color-palette-section label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.smoothness-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.smoothness-row input[type="range"] {
    flex: 1;
}
.smoothness-end {
    font-size: 9px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.03em;
    white-space: nowrap;
    opacity: 0.8;
}
.smoothness-preset {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.smoothness-preset:hover {
    color: var(--accent);
    opacity: 1;
}

.palette-hint {
    font-size: 9px;
    color: var(--text-dim);
    opacity: 0.6;
    text-transform: none;
    letter-spacing: normal;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.swatch {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}

.swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(255,255,255,0.3);
}

.swatch.active {
    outline: 2px solid white;
    outline-offset: 2px;
}

.swatch-add {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px dashed var(--surface3);
    background: var(--surface2);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

.swatch-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.swatch-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}

.swatch:hover .swatch-remove {
    display: flex;
}

.seq-settings h2 {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.seq-settings h2::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

/* キーフレーム内のセクション */
.kf-section {
    grid-column: 1 / -1;
    margin: 0 0 10px;
    padding: 10px;
    background: var(--surface2);
    border: 1px solid var(--surface3);
    border-radius: 8px;
}
.kf-delete-row {
    grid-column: 1 / -1;
}
.kf-section-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--surface3);
    display: flex;
    align-items: center;
    gap: 6px;
}
.kf-section-title::before {
    content: "";
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.7;
}
.kf-section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
}
.kf-section-grid .kf-field-fullwidth {
    grid-column: 1 / -1;
}
.kf-delete-row {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.seq-settings hr {
    border: none;
    border-top: 1px solid var(--surface3);
    margin: 12px 0;
}

.setting-group {
    margin-bottom: 8px;
}

.setting-group label {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.setting-group label span { color: var(--text); font-weight: 500; text-transform: none; }

.setting-input {
    width: 100%;
    background: var(--surface3);
    border: 1px solid var(--surface3);
    border-radius: 6px;
    padding: 7px 10px;
    color: var(--text);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}
.setting-input:focus { border-color: var(--accent); }

.setting-select {
    width: 100%;
    background: var(--surface3);
    border: 1px solid var(--surface3);
    border-radius: 6px;
    padding: 7px 10px;
    color: var(--text);
    font-size: 11px;
    outline: none;
}

.setting-row {
    display: flex;
    gap: 6px;
}

.setting-row .setting-input { flex: 1; }

.color-input {
    width: 100%;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: var(--bg);
    border: 1px solid var(--surface3);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--surface);
}

.text-dim { color: var(--text-dim); font-size: 12px; }

/* Transport bar */
.seq-transport {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--surface);
    border-top: 1px solid var(--surface3);
    border-bottom: 1px solid var(--surface3);
    flex-shrink: 0;
}

.transport-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.transport-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transport-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: var(--surface3);
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
#btn-play {
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: #0b0d12;
    font-size: 14px;
}
#btn-play:hover { filter: brightness(1.08); }
#btn-play.active { background: var(--accent); }
#btn-metronome.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--success);
    color: var(--success);
}
.transport-btn:hover { color: var(--text); background: var(--surface2); }

/* REC indicator */
.rec-indicator {
    color: #ff3333;
    font-weight: bold;
    font-size: 13px;
    animation: rec-blink 1s infinite;
}

@keyframes rec-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#btn-analyze.active {
    background: var(--accent);
    color: white;
}

.transport-label {
    color: var(--text-dim);
    font-size: 12px;
    margin-right: 2px;
}

.setting-select-small {
    width: auto;
    padding: 3px 6px;
    font-size: 12px;
}

/* Section panel */
.section-panel {
    grid-column: 1 / -1;
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.section-header-row h2,
.section-edit-area h2,
.seq-color-palette h2 {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-header-row h2::before,
.section-edit-area h2::before,
.seq-color-palette h2::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

#section-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 150px;
    overflow-y: auto;
}

.section-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 9px;
    border-radius: 7px;
    background: var(--surface2);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.section-row:hover {
    background: var(--surface3);
    border-color: var(--surface3);
}

.section-row.active {
    background: linear-gradient(to right, rgba(255, 137, 59, 0.15), var(--surface3));
    border-color: rgba(255, 137, 59, 0.4);
}

.section-num {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--surface3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
}

.section-row.active .section-num {
    background: var(--accent);
    color: #0b0d12;
    font-weight: 600;
}

.section-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.section-row-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
}

.section-row.active .section-row-name {
    color: var(--text);
}

.section-row-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-dim);
    opacity: 0.7;
}

.section-del {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: all 0.15s;
}

.section-del:hover {
    opacity: 1;
    color: var(--danger);
}

.section-add {
    padding: 7px;
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    background: none;
    border: 1px dashed var(--surface3);
    border-radius: 7px;
    margin-top: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.section-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.chip {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--surface3);
    color: var(--text-dim);
    border: 1px solid var(--surface3);
    font-family: 'JetBrains Mono', monospace;
}

.time-display {
    font-family: monospace;
    font-size: 14px;
    color: var(--text);
}

.beat-display {
    font-family: monospace;
    font-size: 13px;
    color: var(--text-dim);
}

/* Bottom row (device monitor + transport + timeline) */
.seq-bottom-row {
    flex: 1;
    display: flex;
    min-height: 0;
}
.seq-bottom-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

/* Timeline row (内部用、残してるけど不要かも) */
.seq-timeline-row {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

/* デバイスモニター */
.monitor-toggle {
    flex: 0 0 14px;
    background: var(--surface2);
    border: none;
    border-right: 1px solid var(--surface3);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.monitor-toggle:hover {
    color: var(--accent);
    background: var(--surface);
}
.monitor-toggle.open svg {
    transform: rotate(180deg);
}

.device-monitor {
    flex: 0 0 260px;
    background: var(--surface);
    border-right: 1px solid var(--surface3);
    padding: 14px;
    display: none;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.device-monitor.open {
    display: flex;
}

.monitor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.monitor-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.monitor-title::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}
.monitor-live {
    font-size: 9px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #22c55e;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.2s;
}
.monitor-live.live-off {
    background: rgba(154, 159, 166, 0.1);
    border-color: rgba(154, 159, 166, 0.3);
    color: var(--text-dim);
    opacity: 0.6;
}

.monitor-count-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.monitor-count {
    font-size: 11px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
}
.monitor-penlights {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 12px;
    padding: 10px 4px 6px;
    background: linear-gradient(to bottom, var(--surface3), var(--surface2));
    border-radius: 8px;
    border: 1px solid var(--border);
}

.monitor-penlight {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.monitor-penlight svg {
    width: 100%;
    height: auto;
    max-height: 160px;
    overflow: visible;
}
.monitor-penlight-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-dim);
}

.monitor-tracks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}
.monitor-track {
    padding: 6px 8px;
    background: var(--surface2);
    border-radius: 6px;
    border: 1px solid var(--surface3);
}
.monitor-track-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 4px;
}
.monitor-track-count {
    color: var(--text-dim);
    font-weight: 400;
    opacity: 0.7;
}
.monitor-device-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 4px;
    font-size: 10px;
    color: var(--text-dim);
}
.monitor-device-row .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 8px;
}
.monitor-device-row .battery {
    color: var(--success);
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    flex-shrink: 0;
}
.monitor-track-empty {
    color: var(--text-dim);
    opacity: 0.5;
    font-style: italic;
    font-size: 10px;
    padding: 3px 4px;
}

/* Timeline area */
.seq-timeline-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
}

.seq-timeline-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--surface);
    display: flex;
}

.timeline-track-labels {
    flex: 0 0 50px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--surface3);
    z-index: 2;
}

.track-label-spacer {
    height: 20px;  /* シーク領域分 */
    flex: 0 0 20px;
}

.track-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: bold;
}

.track-ms-row {
    display: flex;
    gap: 2px;
}

.track-ms {
    width: 22px;
    height: 18px;
    border: 1px solid var(--surface3);
    background: var(--surface2);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: bold;
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.track-ms:hover {
    border-color: var(--accent);
}

.track-ms.track-mute.active {
    background: #c4372c;
    color: white;
}

.track-ms.track-solo.active {
    background: #d4a017;
    color: white;
}

/* ALL トラックは他より広く (timeline.js の TRACK_WEIGHTS と同じ比率) */
.track-label-all {
    flex: 1.5;
    color: var(--accent);
    background: rgba(168, 85, 247, 0.1);
}

.track-label span {
    font-size: 14px;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 6px rgba(168, 85, 247, 0.5);
}
/* トラック1〜4は識別色に合わせた文字色 */
.timeline-track-labels > .track-label:nth-child(3) span {
    color: #ff6b6b;
    text-shadow: 0 0 6px rgba(255, 107, 107, 0.5);
}
.timeline-track-labels > .track-label:nth-child(4) span {
    color: #5c9cff;
    text-shadow: 0 0 6px rgba(92, 156, 255, 0.5);
}
.timeline-track-labels > .track-label:nth-child(5) span {
    color: #5cdd7b;
    text-shadow: 0 0 6px rgba(92, 221, 123, 0.5);
}
.timeline-track-labels > .track-label:nth-child(6) span {
    color: #ffd93d;
    text-shadow: 0 0 6px rgba(255, 217, 61, 0.5);
}

.timeline-scrollbar-wrap {
    height: 14px;
    flex-shrink: 0;
    background: var(--surface);
    margin-left: 51px;
}

#timeline-scrollbar {
    width: 100%;
    height: 100%;
    overflow-x: scroll;
    overflow-y: hidden;
    scrollbar-width: auto; /* Firefox */
}
/* タイムラインスクロールバーは常に表示（サムを目立つ色に） */
#timeline-scrollbar::-webkit-scrollbar {
    -webkit-appearance: none;
    height: 12px;
    display: block;
    background: var(--surface3);
}
#timeline-scrollbar::-webkit-scrollbar-track {
    background: var(--surface3);
    border-radius: 6px;
}
#timeline-scrollbar::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 6px;
    min-width: 30px;
}
#timeline-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

#timeline-scrollbar-inner {
    height: 1px;
}

#timeline-canvas {
    flex: 1;
    height: 100%;
    display: block;
    min-width: 0;
}

.zoom-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    z-index: 5;
    box-shadow: var(--shadow-card);
}

.zoom-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--surface2);
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: var(--accent);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* F キーヒント表示 */
.btn-hint {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    color: var(--text-dim, #888);
    border: 1px dashed var(--border, #444);
    border-radius: 4px;
    height: 24px;
    user-select: none;
}

/* Buttons */
.btn {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--surface3);
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}
.btn:hover { color: var(--text); border-color: var(--accent); background: var(--surface2); }
.btn-primary { background: var(--accent); color: #0b0d12; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-small { font-size: 12px; padding: 5px 10px; }
.btn-tiny { font-size: 11px; padding: 4px 8px; border-radius: 6px; }

.btn-row { display: flex; gap: 6px; }

/* Release スワッチ（パレット末尾に配置） */
.color-grid .swatch-release {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--surface3);
    border: 1px dashed var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    color: var(--text-dim);
    transition: all 0.15s;
}
.color-grid .swatch-release:hover {
    border-color: var(--accent);
    color: var(--text);
}
.color-grid .swatch-release.active {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Releaseキーフレーム選択時: 基本/パターン設定を完全非表示 */
.seq-settings.release-mode .kf-section {
    display: none !important;
}
/* Release 説明ボックス（release-mode時のみ表示） */
#kf-release-desc { display: none; }
.seq-settings.release-mode #kf-release-desc {
    display: block !important;
}
.release-desc-box {
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 8px;
}
.release-desc-box .palette-hint {
    font-size: 11px;
    font-weight: 400;
    color: #ef4444;
    opacity: 0.7;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.overlay-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    min-width: 350px;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--surface3);
}

.overlay-content h3 { margin-bottom: 12px; }

.scan-item, .load-item {
    background: var(--surface2);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.load-item .name { font-size: 13px; flex: 1; }
.load-item .meta { font-size: 11px; color: var(--text-dim); }

.load-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.load-item-name {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.load-item-meta {
    font-size: 11px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scan item profile display */
.scan-item-main { flex: 1; min-width: 0; }
.scan-item-name { font-size: 13px; color: var(--text); }
.scan-item-rssi { color: var(--text-dim); font-size: 11px; margin-left: 6px; }
.scan-item-profile { font-size: 11px; margin-top: 2px; }
.scan-profile-confirmed { color: var(--success); }
.scan-profile-ambiguous { color: #f5b041; }
.scan-profile-unknown { color: var(--text-dim); font-style: italic; }

/* Device tracks - profile display */
.device-track-profile {
    font-size: 10px;
    color: var(--text-dim);
    font-family: monospace;
}

/* Analyze dialog */
.analyze-dialog-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
}
.analyze-dialog-title svg {
    flex-shrink: 0;
    color: var(--accent);
}
.analyze-dialog-experimental {
    font-size: 11px;
    font-weight: 500;
    color: var(--warn, #f59e0b);
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.4);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 4px;
}

.analyze-mode-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

label.radio-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 0;
}

label.checkbox-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    font-size: 11px;
    color: var(--text-dim);
    cursor: pointer;
    margin-bottom: 0;
    flex-wrap: wrap;
    text-transform: none;
    letter-spacing: normal;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
}
label.checkbox-row input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex: 0 0 auto;
}
.scatter-label-text {
    font-weight: 400;
    color: var(--text-dim);
}
.scatter-hint {
    margin-left: 2px;
}
.kf-scatter-field {
    margin-top: 6px;
}

.radio-row input[type="radio"] {
    accent-color: var(--accent);
}

.analyze-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--surface3);
}

.analyze-section h4 {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* ========= ライブ演出投稿モーダル (Phase C-3 Stage B) ========= */
.publish-modal {
    max-width: 540px;
    width: 92%;
}
.publish-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.publish-subtitle {
    margin: 0 0 18px;
    font-size: 12px;
    color: var(--text-dim);
}
.publish-error {
    background: rgba(239,68,68,0.12);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
}
.publish-section {
    background: var(--surface3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.publish-section-title {
    font-size: 12px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 4px;
}
.publish-section-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 0 10px;
    line-height: 1.5;
}
.publish-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.publish-field:last-child { margin-bottom: 0; }
.publish-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.publish-required {
    color: var(--accent);
    margin-left: 2px;
}
.publish-input {
    padding: 7px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.1s;
    width: 100%;
    box-sizing: border-box;
}
.publish-input:focus { border-color: var(--accent); }
.publish-textarea { resize: vertical; min-height: 50px; }
.publish-row {
    display: flex;
    gap: 10px;
}
.publish-field-half { flex: 1; }
.publish-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}
@media (max-width: 540px) {
    .publish-row { flex-direction: column; gap: 0; }
}

/* スタイル選択 (オリジナル / ライブ再現) */
.publish-style-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

/* 投稿先動画 URL の確認表示 */
.publish-current-video {
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--surface2);
    border: 1px solid var(--surface3);
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}
.publish-current-video-label {
    color: var(--text-dim);
    flex-shrink: 0;
}
.publish-current-video-url {
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
