:root {
  --bg: #0b0e14;
  --panel: #121722;
  --panel-2: #181f2e;
  --border: #252f42;
  --text: #e6ecf5;
  --muted: #8b9bb4;
  --primary: #3b82f6;
  --accent: #8b5cf6;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 410px 1fr;
  height: 100vh;
}

/* Left Panel */
.left-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  height: 100vh;
  overflow: hidden;
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.brand-title h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-pill {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.btn-icon {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
}
.btn-icon:hover { border-color: var(--primary); }

.search-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#searchInput {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
#searchInput:focus { border-color: var(--primary); }

.filter-tabs {
  display: flex;
  gap: 6px;
}

.filter-btn {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.filter-btn.active {
  background: rgba(59, 130, 246, 0.16);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.explorer-section {
  flex: 1 1 auto;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
}

.crumb {
  cursor: pointer;
  color: #93c5fd;
}
.crumb:hover { text-decoration: underline; }

.explorer-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  border: 1px solid transparent;
}
.list-item:hover { background: var(--panel-2); }
.list-item.selected {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
}

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

.item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-badge {
  flex-shrink: 0;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-sub-ok { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.badge-sub-no { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.badge-dir { background: rgba(139, 155, 180, 0.15); color: var(--muted); }

/* Bottom Left Movie Info Panel */
.movie-info-panel {
  height: 270px;
  flex-shrink: 0;
  background: var(--panel-2);
  padding: 12px;
  overflow-y: auto;
}

.info-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.info-card {
  display: flex;
  gap: 12px;
}

.info-poster {
  width: 96px;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.info-body {
  flex: 1;
  min-width: 0;
}

.info-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.info-sub {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.info-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.info-tag {
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: #cbd5e1;
}

.info-summary {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-top: 6px;
}

.info-tech {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* Right Panel */
.right-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #07090d;
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

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

.player-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-weight: 600;
}

.player-meta {
  font-size: 12px;
  color: var(--muted);
}

.video-stage {
  position: relative;
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#videoPlayer {
  width: 100%;
  height: 100%;
  max-height: 100%;
  outline: none;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #121826 0%, #07090d 100%);
  z-index: 2;
}
.video-overlay.hidden { display: none; }

.overlay-card {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.overlay-icon { font-size: 42px; margin-bottom: 10px; }
.overlay-card p { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.overlay-card small { font-size: 12px; }

.transcode-seek {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  background: #101520;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.transcode-seek.hidden { display: none; }
#transcodeSlider { flex: 1; cursor: pointer; }
.seek-label { font-variant-numeric: tabular-nums; color: #cbd5e1; }
.seek-hint { color: var(--muted); font-size: 11px; }

/* Subtitle Control Bar */
.subtitle-bar {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

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

.sub-label { font-size: 12px; font-weight: 700; color: var(--muted); }

.sub-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.sub-badge.ok { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.sub-badge.warn { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.sub-badge.none { background: rgba(139, 155, 180, 0.2); color: var(--muted); }

.sub-msg {
  font-size: 12px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.success { background: var(--success); border-color: var(--success); color: #052e16; }

.sub-offset-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.offset-title { font-size: 12px; color: var(--muted); }

.offset-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.btn-sm {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
}
.btn-sm:hover:not(:disabled) { border-color: var(--primary); }
.btn-sm.accent { background: rgba(139, 92, 246, 0.25); border-color: var(--accent); }
.btn-sm:disabled { opacity: 0.45; cursor: not-allowed; }

.offset-val {
  min-width: 54px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
}

.empty-msg {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.hidden { display: none !important; }

@media (max-width: 900px) {
  body { overflow: auto; height: auto; }
  .app-shell { grid-template-columns: 1fr; height: auto; }
  .left-panel { height: 65vh; }
  .right-panel { height: 75vh; }
}
