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

:root {
  --bg: #111214;
  --surface: #1c1e21;
  --surface2: #26292e;
  --surface3: #2f333a;
  --border: #363a42;
  --border2: #454a54;
  --text: #e2e4e9;
  --text-muted: #7a8090;
  --text-dim: #4a5060;
  --accent: #4f8fff;
  --accent-h: #6aa3ff;
  --accent-dim: rgba(79,143,255,0.15);
  --yellow: #f5c542;
  --green: #3ecf6e;
  --red: #ff5c5c;
  --radius: 8px;
  --header-h: 52px;
}

html, body { height: 100%; overflow: hidden; }
.hidden { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic UI', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Screens ─────────────────────────────────────── */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ── Setup ───────────────────────────────────────── */
#setup-screen {
  flex-direction: column;
  align-items: stretch;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, #1a2235 0%, var(--bg) 70%);
}

/* 上部ナビ */
.setup-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.setup-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.setup-nav-logo-img {
  height: 36px;
  width: auto;
  display: block;
}
.setup-nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}
.setup-nav-links a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.setup-nav-links a:hover { color: var(--text); }

/* カード中央エリア */
.setup-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  min-height: 0;
  overflow-y: auto;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 44px 36px 36px;
  width: 600px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}
.logo-img {
  height: 96px;
  width: auto;
  display: block;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: white;
}

.logo-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.logo-text span.q {
  color: var(--accent);
}

.tagline {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 32px;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.field input::placeholder { color: var(--text-dim); }

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 5px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}

.btn-primary:hover { background: var(--accent-h); }
.btn-primary:active { transform: scale(0.98); }

.privacy-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.privacy-note p {
  font-size: 11px;
  color: var(--text-dim);
  text-align: left;
  line-height: 1.7;
  margin: 0 0 4px;
}
.privacy-note p:last-child { margin-bottom: 0; }

/* ── Header ──────────────────────────────────────── */
.hd-logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.hd-logo-img { height: 28px; width: auto; display: block; opacity: 0.85; }
@media (max-width: 600px) { .hd-logo { display: none; } }

#app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}

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

.hd-left h1 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

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

.hd-right .btn-primary {
  width: auto;
  padding: 7px 14px;
  font-size: 13px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}

.btn-icon:hover { background: var(--surface2); color: var(--text); }

.btn-outline {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Subtle DL button (header right) ──────────────── */
.btn-dl-subtle {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-dl-subtle:hover { color: var(--text-muted); border-color: var(--border2); }

/* ── Review screen layout ────────────────────────── */
#review-screen { flex-direction: column; }

#app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Video Section ───────────────────────────────── */
.video-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 10px;
  min-width: 0;
  gap: 8px;
}

.video-wrapper {
  flex: 1;
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ── YouTube Wrapper ─────────────────────────────── */
.youtube-wrapper {
  flex: 1;
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}
.youtube-wrapper.hidden { display: none; }
.youtube-wrapper iframe,
#yt-player { width: 100%; height: 100%; display: block; }
.yt-mode-notice {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.72);
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  padding: 5px 14px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

/* ── Safe Margin Overlay ─────────────────────────── */
.safe-margin-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}
.safe-margin-overlay.hidden { display: none; }

.reels-img-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  opacity: 0.2;
  object-fit: contain;
}
.reels-img-overlay.hidden { display: none; }

/* ── Instagram Portrait Mode ─────────────────────── */
/* ig / ig-size 選択時に動画ラッパーを 9:16 縦型に切り替え */
.video-wrapper.ig-portrait-mode {
  flex: none;
  aspect-ratio: 9 / 16;
  width: auto;
  height: calc(100vh - 260px);
  max-height: 72vh;
  margin: 0 auto;
}

/* ── Comment Panel（動画下部固定） ─────────────────── */
.comment-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--surface);
  border-top: 1px solid var(--border2);
  padding: 12px 16px env(safe-area-inset-bottom, 16px);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
}

.comment-overlay.hidden { display: none; }

.overlay-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overlay-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.overlay-type-badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(79,143,255,0.35);
  border-radius: 20px;
  padding: 3px 12px;
  white-space: nowrap;
}

.overlay-ts {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: white;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  width: fit-content;
}

#comment-input {
  width: 100%;
  min-height: 72px;
  background: rgba(40,44,52,0.95);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

#comment-input:focus { border-color: var(--accent); }
#comment-input::placeholder { color: rgba(255,255,255,0.35); font-size: 12.5px; }

.overlay-actions {
  display: flex;
  gap: 8px;
}

.btn-small-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-small-primary:hover { background: var(--accent-h); }

.btn-small {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-small:hover { background: rgba(255,255,255,0.18); }

/* ── Progress Bar ────────────────────────────────── */
.progress-area { padding: 4px 0; }

.progress-track {
  position: relative;
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  cursor: pointer;
  transition: height 0.12s;
}

.progress-track:hover { height: 8px; }

.progress-buffer {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: rgba(255,255,255,0.18);
  border-radius: 3px;
  pointer-events: none;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--accent);
  border-radius: 3px;
  pointer-events: none;
  width: 0%;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.progress-track:hover .progress-thumb { opacity: 1; }

.progress-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.p-marker {
  position: absolute;
  top: -3px;
  width: 3px;
  height: calc(100% + 6px);
  background: var(--yellow);
  border-radius: 2px;
  transform: translateX(-50%);
}
.p-marker.review {
  background: var(--accent);
}

/* ── Controls ────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ctrl-left, .ctrl-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-play {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.ctrl-play:hover { background: var(--accent-h); }
.ctrl-play:active { transform: scale(0.93); }

.ctrl-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}

.ctrl-btn:hover { background: var(--surface2); color: var(--text); }

.time-display {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  white-space: nowrap;
}

.time-sep { margin: 0 2px; opacity: 0.4; }

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

#speed-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

#speed-select:focus { border-color: var(--accent); }

#safe-margin-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
#safe-margin-select:focus { border-color: var(--accent); }
#safe-margin-select.active { border-color: var(--yellow); color: var(--yellow); }

.kbd-hints {
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

/* ── Comments Panel ──────────────────────────────── */
.comments-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ph-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-marker {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.btn-marker:hover { background: var(--surface3); color: var(--text); }

/* コメントフィルター */
.comment-filter {
  display: flex;
  gap: 2px;
  padding-bottom: 8px;
}
.cf-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.cf-btn:hover { background: var(--surface2); color: var(--text-muted); }
.cf-btn.active { background: var(--surface2); color: var(--text); }

/* コメント種別スタイル */
.comment-item.type-report {
  border-left: 2px solid rgba(245,170,50,0.55);
  padding-left: 10px;
}
.comment-item.type-review {
  border-left: 2px solid rgba(79,143,255,0.5);
  padding-left: 10px;
}
.ci-type {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  letter-spacing: 0.2px;
}
.ci-type.report {
  background: rgba(245,170,50,0.18);
  color: rgba(245,170,50,1);
}
.ci-type.review {
  background: var(--accent-dim);
  color: var(--accent);
}

/* パネルフッター（ブランドリンク） */
.panel-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pf-link {
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}
.pf-link:hover { color: var(--accent); }
.pf-sep { font-size: 11px; color: var(--text-dim); opacity: 0.4; }

/* ── 編集者向けプロモカード ─────────────────────────────────── */
.editor-promo {
  margin: 4px 12px 8px;
  background: linear-gradient(135deg, rgba(79,143,255,0.07) 0%, rgba(110,72,255,0.05) 100%);
  border: 1px solid rgba(79,143,255,0.22);
  border-radius: 10px;
  padding: 12px 14px 13px;
  flex-shrink: 0;
}
.ep-eyebrow {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.ep-body {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 10px;
}
.ep-links {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ep-btn-trial {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 4px 11px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.ep-btn-trial:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.05);
}
.ep-btn-full {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.ep-btn-full:hover { opacity: 0.75; }

/* 汎用通知トースト */
.notif-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(28,31,38,0.97);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px;
  padding: 9px 22px;
  border-radius: 22px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
}
.notif-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── テキストインポートモーダル ────────────────── */
/* ── 報告コメント入力モーダル ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }

.rim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 480px;
  max-width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.rim-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.rim-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}
.rim-close:hover { color: var(--text); }

.rim-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.rim-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 8px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.rim-tab:hover { color: var(--text-muted); }
.rim-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.rim-panel {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rim-panel.hidden { display: none; }

.rim-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.rim-example {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.rim-example code {
  color: var(--accent);
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
}
.rim-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: 'SF Mono', 'Consolas', monospace;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  line-height: 1.7;
  min-height: 120px;
  box-sizing: border-box;
}
.rim-textarea:focus { border-color: var(--accent); }

.rim-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* CSV ドロップゾーン */
.rim-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.rim-drop-zone:hover,
.rim-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79,143,255,0.06);
}
.rdz-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.rdz-icon { font-size: 32px; line-height: 1; }
.rdz-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.rdz-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -2px;
}
.rdz-browse {
  margin-top: 6px;
  cursor: pointer;
}

.panel-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  background: var(--surface3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.empty-msg {
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
  padding: 40px 16px;
  line-height: 1.7;
}

.comment-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
  margin-bottom: 2px;
  position: relative;
}

.comment-item:hover {
  background: var(--surface2);
  border-color: var(--border);
}

.comment-item:hover .comment-del {
  opacity: 1;
}

.ci-ts {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ci-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  flex-shrink: 0;
}
.type-review .ci-dot {
  background: var(--accent);
}

.ci-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-del {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s, color 0.1s;
}

.comment-del:hover { background: var(--surface3); color: var(--red); }

/* ── Loading ─────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-overlay.hidden { display: none; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--surface3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* ── Expiry badge ─────────────────────────────────── */
.expiry-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--yellow);
  background: rgba(245,197,66,0.12);
  border: 1px solid rgba(245,197,66,0.3);
  border-radius: 20px;
  padding: 2px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.expiry-badge::before { content: '⏳'; font-size: 10px; }
.expiry-badge.hidden { display: none; }

/* ── Speed toast（動画wrapper内に absolute で配置） ── */
.speed-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 50;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.speed-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.speed-toast.hidden { display: none; }

/* ── File select modal ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px 24px;
  width: 520px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}
.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.file-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  max-height: 320px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  width: 100%;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.file-item:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.file-item-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.file-item-info {
  flex: 1;
  min-width: 0;
}
.file-item-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-cancel {
  align-self: flex-end;
  width: auto;
  padding: 8px 20px;
  font-size: 13px;
}

/* ── Title switcher ───────────────────────────────── */
.title-switcher {
  position: relative;
  display: flex;
  align-items: center;
}

.title-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text);
  cursor: default;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  font-family: inherit;
  text-align: left;
  max-width: 480px;
}
.title-btn:not([disabled]):hover {
  background: var(--surface2);
  cursor: pointer;
}
.title-btn h1 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}
.title-btn .chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.title-btn .chevron.open {
  transform: rotate(180deg);
}
.title-btn .chevron.hidden { display: none; }

/* switcher dropdown */
.switcher-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 300px;
  max-width: 480px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 500;
  padding: 6px;
}
.switcher-dropdown.hidden { display: none; }

.switcher-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.switcher-item:hover { background: var(--surface2); }
.switcher-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}
.switcher-item .si-check {
  flex-shrink: 0;
  width: 14px;
  color: var(--accent);
}
.switcher-item .si-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.switcher-item .si-comments {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface3);
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: auto;
}

/* ── Reverse badge ────────────────────────────────── */
.reverse-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 60, 60, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  pointer-events: none;
  letter-spacing: 0.03em;
  z-index: 50;
  animation: pulse-red 1.2s ease-in-out infinite;
}
.reverse-badge.hidden { display: none; }

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

/* ── Mobile responsive ────────────────────────────────────────────────── */
@media (max-width: 767px) {

  /* ヘッダー */
  #app-header {
    padding: 0 8px;
    gap: 4px;
    height: 48px;
  }
  .hd-left { gap: 4px; }
  .title-btn h1 { font-size: 13px; max-width: 130px; }
  .hd-right { gap: 4px; }
  .hd-right .btn-primary,
  .btn-outline {
    padding: 5px 9px;
    font-size: 12px;
  }
  .expiry-badge { display: none; } /* ヘッダー節約 */

  /* メインレイアウト：縦並び */
  #app-main {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* 動画セクション */
  .video-section {
    padding: 8px 8px 4px;
    gap: 6px;
    flex: none;
  }

  /* 動画ラッパー / YouTubeラッパー: 16:9 固定比率 */
  .video-wrapper,
  .youtube-wrapper {
    flex: none;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  /* Instagram縦型モード: モバイルでも9:16縦表示 */
  .video-wrapper.ig-portrait-mode {
    aspect-ratio: 9 / 16;
    height: 55vw;
    max-height: 50vh;
    width: auto;
  }

  /* プログレスバー：タップしやすく */
  .progress-track { height: 10px; }
  .progress-track:hover { height: 10px; }
  .progress-thumb {
    width: 18px;
    height: 18px;
    opacity: 1;
  }

  /* コントロール */
  .controls { gap: 4px; flex-wrap: wrap; }
  .ctrl-left { gap: 4px; }
  .ctrl-right { gap: 4px; }
  .ctrl-play { width: 42px; height: 42px; }
  .ctrl-btn { padding: 8px; font-size: 11px; }
  .time-display { font-size: 12px; padding: 0 2px; }
  .ctrl-label { display: none; }
  .sm-label { display: none; }
  #speed-select { padding: 5px 6px; font-size: 12px; }
  #safe-margin-select { padding: 5px 6px; font-size: 12px; }

  /* キーボードヒント：非表示 */
  .kbd-hints { display: none; }

  /* コメントパネル：全幅・下に配置 */
  .comments-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    height: 220px;
    flex-shrink: 0;
  }

  /* 削除ボタン：モバイルは常時表示 */
  .comment-del { opacity: 1; }

  /* コメントパネル */
  #comment-input {
    font-size: 16px; /* iOSズーム防止 */
    min-height: 72px;
  }
  .overlay-actions { gap: 6px; }
  .btn-small-primary,
  .btn-small { padding: 9px 14px; font-size: 13px; }

  /* セットアップ上部ナビ */
  .setup-nav { padding: 0 16px; height: 48px; }
  .setup-nav-logo-text { font-size: 15px; }
  .snl-hide-sp { display: none; }
  .setup-nav-links { gap: 14px; }

  /* セットアップカード */
  .setup-card { padding: 28px 20px 24px; }
  .setup-body { padding: 16px 12px; }
  .field input { font-size: 16px; } /* iOSズーム防止 */

  /* スピードトースト */
  .speed-toast { font-size: 22px; padding: 10px 22px; }

  /* スイッチャードロップダウン */
  .switcher-dropdown {
    min-width: 220px;
    max-width: calc(100vw - 16px);
    max-height: 60vh;
  }

  /* モーダル */
  .modal-card { padding: 20px 14px 16px; }
}
