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

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: #1c2128;
  border: 1px solid #30363d;
  color: #e6edf3;
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 320px;
}
.toast.ok { border-color: #3fb950; }
.toast.info { border-color: #58a6ff; }
.toast.err { border-color: #f85149; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* Tooltips */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1c2128;
  color: #e6edf3;
  font-size: 0.7rem;
  font-weight: 400;
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  border: 1px solid #30363d;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
[data-tooltip]:hover::after {
  opacity: 1;
}
/* Language picker */
.lang-picker {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.35rem;
  z-index: 50;
}
.lang-btn {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-btn:hover {
  border-color: #6b7280;
  background: #1c2128;
}
.lang-btn.active {
  border-color: #a855f7;
  background: #a855f715;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15);
}
.lang-flag {
  font-size: 1.25rem;
  line-height: 1;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  background-image: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(120, 60, 200, 0.08) 0%, transparent 70%),
                    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(200, 100, 50, 0.04) 0%, transparent 60%);
  color: #e6edf3;
  min-height: 100vh;
  padding: 2rem;
}
h1 {
  text-align: center; margin-bottom: 0.3rem; font-size: 2.6rem; font-weight: 800;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #f0f0f0;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.5), 0 0 40px rgba(139, 92, 246, 0.25), 0 0 80px rgba(139, 92, 246, 0.1);
  letter-spacing: -0.04em;
}
.subtitle { text-align: center; color: #e6edf3; margin-bottom: 2rem; font-size: 0.9rem; }
.connections {
  max-width: 900px;
  margin: 0 auto 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
}
.connections.manager-mode {
  grid-template-columns: 1fr 1fr;
}
.connections .card {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.connections.no-transition .card {
  transition: none;
}
.connections.reversed #stremio-card {
  transform: translateX(calc(100% + 3rem + 40px));
}
.connections.reversed #nuvio-card {
  transform: translateX(calc(-100% - 3rem - 40px));
}
.direction-arrow {
  color: #e6edf3;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}
.direction-arrow svg {
  width: 24px;
  height: 24px;
}

/* Shared switch styles (mode switch + direction switch) */
.switch-wrap {
  max-width: 900px;
  margin: 0 auto 1.25rem;
  display: flex;
  justify-content: center;
  overflow: hidden;
  max-height: 200px;
  opacity: 1;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              margin 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch-wrap.hidden {
  display: flex;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  pointer-events: none;
}
.switch-bar {
  display: flex;
  align-items: center;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 4px;
  gap: 0;
  position: relative;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
}
.switch-bar .switch-option {
  position: relative;
  z-index: 1;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #c9d1d9;
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.25s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.switch-bar .switch-option.active {
  color: #e6edf3;
}
.switch-bar .switch-option:hover:not(.active) {
  color: #c9d1d9;
}
.switch-bar .switch-option .arrow-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
}
.switch-bar .switch-slider {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  border-radius: 7px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 1px 6px rgba(124, 58, 237, 0.3);
}
.mode-switch-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.mode-switch-wrap .switch-bar {
  border-radius: 10px 10px 0 0;
  border-bottom: none;
}
.switch-desc-row {
  display: flex;
  background: #161b22;
  border: 1px solid #30363d;
  border-top: none;
  border-radius: 0 0 10px 10px;
}
.mode-switch-wrap .switch-option {
  flex: 1;
  justify-content: center;
}
.switch-desc-row .switch-desc {
  flex: 1;
  text-align: center;
  text-wrap: balance;
  font-size: 0.75rem;
  color: #c9d1d9;
  font-weight: 400;
  line-height: 1.3;
  padding: 0.35rem 0.75rem 0.4rem;
  max-width: 200px;
  background: none;
  border: none;
  cursor: pointer;
}

.connect-action {
  max-width: 900px;
  margin: 0 auto 2rem;
  text-align: center;
}
.card {
  background: linear-gradient(160deg, #1a1f2e 0%, #161b22 100%);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.card h2 .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6b7280; display: inline-block;
}
.card h2 .dot.connected { background: #3fb950; }
.card h2 .dot.error { background: #f85149; }
label { display: block; font-size: 0.8rem; color: #e6edf3; margin-bottom: 0.25rem; }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%; padding: 0.6rem 0.75rem;
  background: #0d1117; border: 1px solid #444c56; border-radius: 7px;
  color: #e6edf3; font-size: 0.9rem; margin-bottom: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder { color: #6b7280; }
input:focus { outline: none; border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }
button {
  padding: 0.5rem 1rem; border: none; border-radius: 6px;
  font-size: 0.85rem; cursor: pointer; font-weight: 500;
  transition: opacity 0.15s;
}
button:hover { opacity: 0.9; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%); color: #fff; box-shadow: 0 1px 6px rgba(124, 58, 237, 0.25); }
.btn-blue { background: #1f6feb; color: #fff; }
.btn-transfer { background: linear-gradient(135deg, #7c3aed 0%, #c026d3 50%, #f59e0b 100%); color: #fff; font-size: 1rem; padding: 0.75rem 2rem; box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3); }
.btn-danger { background: #da3633; color: #fff; }
.status-msg { font-size: 0.8rem; margin-top: 0.5rem; min-height: 1.2em; }
.status-msg.ok { color: #3fb950; }
.status-msg.err { color: #f85149; }

.card-connect-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.main-panel {
  max-width: 900px; margin: 0 auto;
}
.step-section {
  background: linear-gradient(160deg, #1a1f2e 0%, #161b22 100%); border: 1px solid #30363d; border-radius: 10px;
  padding: 1.5rem; margin-bottom: 1.5rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.step-section h3 { margin-bottom: 1rem; font-size: 1rem; }
.library-stats {
  display: flex; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.stat { font-size: 0.85rem; color: #e6edf3; }
.stat strong { color: #e6edf3; }
.options { display: flex; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.options label {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; color: #e6edf3; cursor: pointer;
}
.options input[type="checkbox"] { accent-color: #a855f7; width: 16px; height: 16px; }

.tabs {
  display: flex; gap: 0; margin-bottom: 0; border-bottom: 1px solid #30363d;
}
.tab {
  padding: 0.5rem 1rem; font-size: 0.8rem; cursor: pointer;
  color: #b0b8c1; border-bottom: 2px solid transparent;
  background: none; border-radius: 0; font-weight: 500;
}
.tab:hover { color: #e6edf3; }
.tab.active { color: #e6edf3; border-bottom-color: #a855f7; }
.tab .tab-count {
  display: inline-block; background: #30363d; border-radius: 10px;
  padding: 0 0.4rem; font-size: 0.7rem; margin-left: 0.35rem;
  min-width: 1.2rem; text-align: center;
}
.library-table-wrap {
  max-height: 500px; overflow-y: auto; border: 1px solid #30363d; border-top: none;
  border-radius: 0 0 6px 6px; margin-bottom: 1rem;
}
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { position: sticky; top: 0; background: #21262d; text-align: left; padding: 0.5rem 0.75rem; color: #b0b8c1; font-weight: 600; }
td { padding: 0.5rem 0.75rem; border-top: 1px solid #21262d; vertical-align: middle; }
tr:hover td { background: #1c2128; }
.poster-cell { width: 40px; }
.poster-cell img { width: 32px; height: 44px; object-fit: cover; border-radius: 3px; background: #30363d; }
.type-badge {
  display: inline-block; padding: 0.1rem 0.4rem; border-radius: 3px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
}
.type-badge.movie { background: #1f6feb33; color: #58a6ff; }
.type-badge.series { background: #8957e533; color: #bc8cff; }
.type-badge.other { background: #30363d; color: #b0b8c1; }
.watched-icon { color: #3fb950; }
.detail { color: #b0b8c1; font-size: 0.75rem; }
.progress-pill {
  display: inline-block; background: #30363d; border-radius: 3px;
  height: 4px; width: 60px; position: relative; vertical-align: middle;
}
.progress-pill-fill {
  position: absolute; left: 0; top: 0; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
}
.progress-text { font-size: 0.7rem; color: #b0b8c1; margin-left: 0.4rem; }

.addon-list { margin-bottom: 1rem; }
.addon-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.75rem; border-top: 1px solid #21262d;
}
.addon-item:first-child { border-top: none; }
.addon-icon {
  width: 32px; height: 32px; border-radius: 6px; background: #30363d;
  object-fit: cover; flex-shrink: 0;
}
.addon-info { flex: 1; min-width: 0; }
.addon-name { font-size: 0.85rem; font-weight: 500; }
.addon-url { font-size: 0.7rem; color: #b0b8c1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addon-types { font-size: 0.7rem; color: #b0b8c1; }
.addon-skip { font-size: 0.7rem; color: #6b7280; font-style: italic; }

.progress-section { margin-top: 1rem; }
.progress-bar-wrap {
  height: 6px; background: #30363d; border-radius: 3px; overflow: hidden; margin-bottom: 0.75rem;
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg, #7c3aed, #c026d3); border-radius: 3px;
  transition: width 0.3s; width: 0%;
}
.log {
  background: #0d1117; border: 1px solid #30363d; border-radius: 6px;
  padding: 0.75rem; max-height: 200px; overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.75rem;
  line-height: 1.6;
}
.log-entry { color: #b0b8c1; }
.log-entry.ok { color: #3fb950; }
.log-entry.err { color: #f85149; }
.log-entry.info { color: #58a6ff; }

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
.status-msg .spinner {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
  border-color: rgba(139,148,158,0.3);
  border-top-color: #b0b8c1;
  margin-right: 0.4rem;
}
.status-msg.ok .spinner {
  border-color: rgba(63,185,80,0.3);
  border-top-color: #3fb950;
}
button .spinner {
  margin-right: 0.4rem;
}
.section-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 3rem 1rem;
  color: #b0b8c1;
  font-size: 0.95rem;
}
.section-loader .spinner {
  width: 20px;
  height: 20px;
  border-width: 2.5px;
  border-color: rgba(139,148,158,0.3);
  border-top-color: #b0b8c1;
}

.center { text-align: center; }
.hidden { display: none; }

/* --- Manager Mode --- */
.manager-columns {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  position: relative;
}
.manager-drag-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  align-self: center;
  color: #6b7280;
  flex-shrink: 0;
}
.manager-drag-hint svg {
  width: 28px;
  height: 28px;
}
.manager-drag-hint span {
  font-size: 0.7rem;
  white-space: nowrap;
}
.manager-columns.single-column {
  justify-content: center;
}
.manager-column {
  flex: 1;
  min-width: 0;
  background: linear-gradient(160deg, #111822 0%, #0d1117 100%);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.manager-columns.single-column .manager-column {
  max-width: 500px;
}
.manager-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #30363d;
}
.manager-column-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.manager-column-header .addon-count {
  font-size: 0.75rem;
  color: #b0b8c1;
  background: #30363d;
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
}
.manager-reorder-hint {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: #8b949e;
}
.manager-addon-list {
  min-height: 60px;
  margin-bottom: 0.75rem;
}
.manager-addon-item {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  margin-bottom: 0.4rem;
  cursor: grab;
  transition: background 0.15s, border-color 0.15s;
}
.manager-addon-item:hover {
  border-color: #6b7280;
  background: #1c2128;
}
.manager-addon-item:active {
  cursor: grabbing;
}
.manager-addon-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
}
/* Cinemeta card with embedded panel */
.manager-addon-item .cinemeta-settings {
  border: none;
  border-top: 1px solid #30363d;
  border-radius: 0;
  margin-bottom: 0;
}
.manager-addon-item .addon-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
}
.manager-addon-item .addon-info {
  flex: 1;
  min-width: 0;
}
.manager-addon-item .addon-name {
  font-size: 0.8rem;
}
.manager-addon-item .addon-url {
  font-size: 0.65rem;
}
.manager-addon-item .addon-meta {
  font-size: 0.65rem;
  color: #b0b8c1;
}
.manager-addon-item .btn-icon {
  background: none;
  border: none;
  color: #b0b8c1;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.manager-addon-item .btn-icon:hover {
  color: #f85149;
  background: #f8514922;
}
.manager-addon-item .btn-update:hover {
  color: #58a6ff;
  background: #58a6ff22;
}
.manager-addon-item .btn-update.is-checking {
  animation: spin 0.8s linear infinite;
  color: #58a6ff;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Update flash states */
.manager-addon-item.addon-updated {
  border-color: #3fb950;
  background: #3fb95015;
  transition: background 0.3s, border-color 0.3s;
}
.manager-addon-item.addon-current {
  border-color: #58a6ff;
  background: #58a6ff10;
  transition: background 0.3s, border-color 0.3s;
}
.manager-addon-item.addon-update-failed {
  border-color: #f85149;
  background: #f8514910;
  transition: background 0.3s, border-color 0.3s;
}

/* Manager header */
.manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.manager-header h3 { margin: 0; }
.manager-hint {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.manager-hint.hidden {
  display: none;
}
.speech-bubble {
  position: relative;
  background: #1e2430;
  border: 1px solid #363e4d;
  border-radius: 1rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: #e6edf3;
  max-width: 400px;
  text-align: center;
  line-height: 1.45;
  text-wrap-style: balance;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.speech-bubble-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke: #e0d6ff;
  filter: drop-shadow(0 0 4px #8b5cf6) drop-shadow(0 0 10px #8b5cf6);
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #1e2430;
}
.speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid #363e4d;
}
.btn-secondary {
  background: #30363d;
  color: #c9d1d9;
  border: 1px solid #484f58;
}
.btn-secondary:hover { background: #3a424b; }
.btn-sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}


/* SortableJS drag states */
.manager-addon-item.sortable-ghost {
  opacity: 0.4;
  border: 1px dashed #58a6ff;
  background: #1f6feb22;
}
.manager-addon-item.sortable-chosen {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: #58a6ff;
}
.manager-addon-item.sortable-drag {
  opacity: 0.9;
}

/* Hide add row and dim hint while dragging */
.manager-columns.is-dragging .manager-add-row {
  opacity: 0.2;
  pointer-events: none;
}
.manager-columns.is-dragging .manager-drag-hint {
  opacity: 0.3;
}
.manager-columns.is-dragging .manager-addon-list {
  border: 2px dashed #3fb950;
  border-radius: 10px;
  min-height: 80px;
  padding: 6px;
  box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.15), 0 0 20px rgba(63, 185, 80, 0.2), inset 0 0 16px rgba(63, 185, 80, 0.06);
  background: rgba(63, 185, 80, 0.03);
  transition: box-shadow 0.2s, border-color 0.2s, padding 0.2s;
}

.manager-add-row {
  display: flex;
  gap: 0.5rem;
}
.manager-add-row input[type="text"] {
  flex: 1;
  margin-bottom: 0;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
}
.manager-add-row button {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

/* Saving overlay on manager column */
.manager-column {
  position: relative;
}
.manager-column.is-saving::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(13, 17, 23, 0.5);
  border-radius: 8px;
  z-index: 10;
}
.manager-column.is-saving::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #3fb950;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  z-index: 11;
}

.manager-placeholder {
  margin: auto;
  color: #6b7280;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

/* --- Cinemeta Settings Panel --- */
.cinemeta-settings {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  margin-bottom: 0.4rem;
  overflow: hidden;
  animation: cinemetaSlideDown 0.2s ease;
  cursor: default;
}
.cinemeta-settings.hidden {
  display: none;
}
@keyframes cinemetaSlideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 300px; }
}
.cinemeta-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #30363d;
  font-size: 0.75rem;
  font-weight: 600;
  color: #b0b8c1;
}
.btn-cinemeta-reset {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: #b0b8c1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  transition: color 0.15s, background 0.15s;
}
.btn-cinemeta-reset:hover {
  color: #58a6ff;
  background: #58a6ff22;
}
.cinemeta-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #21262d;
}
.cinemeta-option:last-child {
  border-bottom: none;
}
.cinemeta-option-text {
  flex: 1;
  min-width: 0;
}
.cinemeta-option-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #e6edf3;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.cinemeta-option-desc {
  font-size: 0.68rem;
  color: #8b949e;
  margin-top: 0.15rem;
}
.cinemeta-patch-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #3fb95025;
  color: #3fb950;
  border: 1px solid #3fb95040;
}

/* Cinemeta toggle switch */
.cinemeta-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.cinemeta-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.cinemeta-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #30363d;
  border: 1px solid #484f58;
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
}
.cinemeta-toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: #b0b8c1;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.cinemeta-toggle input:checked + .cinemeta-toggle-slider {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  border-color: transparent;
}
.cinemeta-toggle input:checked + .cinemeta-toggle-slider::before {
  transform: translate(16px, -50%);
  background: #fff;
}

/* Cinemeta gear button */
.btn-cinemeta-settings {
  color: #b0b8c1;
  transition: color 0.15s, background 0.15s;
}
.btn-cinemeta-settings:hover,
.btn-cinemeta-settings.active {
  color: #a855f7;
  background: #a855f722;
}

/* Cinemeta restore row */
.cinemeta-restore-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.btn-cinemeta-restore {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #b0b8c1;
  background: none;
  border: 1px dashed #484f58;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.btn-cinemeta-restore:hover {
  color: #e6edf3;
  background: #58a6ff15;
  border-color: #58a6ff;
}
.btn-cinemeta-restore .spinner {
  margin-right: 0;
}

@media (max-width: 640px) {
  .connections { grid-template-columns: 1fr; }
  body { padding: 1rem; }
  .switch-bar .switch-option { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .manager-columns { flex-direction: column; }
  .manager-drag-hint { display: none; }
  .manager-columns.single-column .manager-column { max-width: none; }
  .lang-picker { top: 0.5rem; right: 0.5rem; }
  .lang-flag { font-size: 1.1rem; }
}
