:root {
  --bg-main: #ffeef5;
  --bg-card: #fff8fb;
  --bg-white: #ffffff;
  --bg-input: #fffbfd;
  --bg-hover: #ffe0ed;
  --bg-soft: #fff0f6;

  --text-main: #4a2538;
  --text-muted: #8c5872;

  --accent-pink: #ff5c93;
  --accent-hover: #ff387b;
  --accent-light: #ffd6e6;
  --border-pink: #f3bfd4;

  --success-bg: #ecfdf5;
  --success-border: #34d399;
  --success-text: #065f46;
  --success-btn: #10b981;
  --success-btn-hover: #059669;

  --error-bg: #fff1f2;
  --error-border: #fda4af;
  --error-text: #9f1239;

  --ref-green: #16a34a;
  --orig-pink: #fb7185;
  --sync-indigo: #6366f1;
  --highlight-gold: #f59e0b;
  --ignored-gray: #cbd5e1;

  --shadow-card: 0 6px 22px rgba(255, 92, 147, 0.1);
  --shadow-btn: 0 3px 10px rgba(255, 92, 147, 0.25);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Shared Utilities */
.mono {
  font-family: 'Consolas', 'Courier New', monospace;
}

.text-center {
  text-align: center;
}

.muted-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

.muted-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Shared Top Header Bar */
.top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

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

.brand-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

.nav-pill-btn {
  text-decoration: none;
  background: var(--bg-white);
  color: var(--accent-hover);
  border: 1.5px solid var(--accent-pink);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(255, 92, 147, 0.14);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.nav-pill-btn:hover {
  background: var(--accent-pink);
  color: #ffffff;
  transform: translateY(-1px);
}

.nav-pill-btn:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

/* Shared Card & Surface Containers */
.card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-pink);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
}

.panel-white {
  background: var(--bg-white);
  border: 1.5px solid var(--border-pink);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.panel-soft {
  background: var(--bg-soft);
  border: 1.5px solid var(--border-pink);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

/* Shared Form Inputs */
.field-input {
  border: 1.5px solid var(--border-pink);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-input);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.field-input:focus:not(:disabled) {
  outline: none;
  border-color: var(--accent-pink);
  background: var(--bg-white);
  box-shadow: 0 0 0 2px rgba(255, 92, 147, 0.2);
}

.field-input:disabled {
  background: #f1e4ea;
  color: #a68495;
  border-color: #e2c5d3;
  cursor: not-allowed;
  opacity: 0.65;
}

.field-num {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13.5px;
  width: 135px;
}

/* Buttons */
.btn {
  background: var(--accent-light);
  color: var(--text-main);
  border: 1.5px solid var(--border-pink);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: #ffc2dc;
  transform: translateY(-1px);
}

.btn:active:not(:disabled),
.btn.is-pressed:not(:disabled) {
  background: var(--accent-pink);
  color: #ffffff;
  border-color: var(--accent-hover);
  transform: translateY(1px) scale(0.97);
  box-shadow: inset 0 2px 5px rgba(74, 37, 56, 0.22);
  transition: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-cancel-icon {
  min-width: 28px;
  min-height: 28px;
  padding: 2px 7px;
  font-size: 12px;
  line-height: 1;
  border-radius: 999px;
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}

.btn-cancel-icon:hover:not(:disabled) {
  background: #fecdd3;
}

.progress-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.progress-inline-row .progress-track {
  flex: 1;
}

.btn-primary {
  background: var(--accent-pink);
  color: #ffffff;
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled),
.btn-primary.is-pressed:not(:disabled) {
  background: var(--accent-hover);
  border-color: #c2185b;
}

.btn-lg {
  font-size: 15px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
}

.btn-download {
  background: var(--success-btn);
  color: #ffffff;
  border-color: var(--success-btn-hover);
  width: 100%;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}

.btn-download:hover:not(:disabled) {
  background: var(--success-btn-hover);
}

.btn-download:active:not(:disabled),
.btn-download.is-pressed:not(:disabled) {
  background: #047857;
  border-color: #065f46;
}

/* Shared Downward-Opening Custom Dropdown */
.custom-dropdown {
  position: relative;
  display: inline-block;
  min-width: 175px;
}

.custom-dropdown-btn {
  width: 100%;
  background: var(--bg-white);
  border: 1.5px solid var(--border-pink);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
  text-align: left;
  transition: border-color 0.15s ease;
}

.custom-dropdown-btn:hover:not(:disabled) {
  border-color: var(--accent-pink);
}

.custom-dropdown-btn:disabled {
  background: #f1e4ea;
  color: #a68495;
  border-color: #e2c5d3;
  cursor: not-allowed;
  opacity: 0.65;
}

.custom-dropdown-btn:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  min-width: 210px;
  max-height: 230px;
  overflow-y: auto;
  background: var(--bg-white);
  border: 1.5px solid var(--accent-pink);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 26px rgba(74, 37, 56, 0.18);
  z-index: 2000;
  display: none;
  padding: 4px 0;
}

.custom-dropdown.open .custom-dropdown-menu {
  display: block;
}

.custom-dropdown-item {
  padding: 8px 14px;
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.custom-dropdown-item:hover {
  background: var(--bg-hover);
}

.custom-dropdown-item.selected {
  background: var(--accent-light);
  font-weight: 700;
  color: var(--accent-hover);
}

/* Custom Pink Checkbox */
.pink-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
  user-select: none;
}

.pink-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.check-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--accent-pink);
  background: var(--bg-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.pink-check input:checked + .check-box {
  background: var(--accent-pink);
  color: #ffffff;
}

.pink-check input:focus-visible + .check-box {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.pink-check:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.58;
}

.pink-check input:disabled + .check-box {
  background: #f1e4ea;
  border-color: #d6b6c6;
}

/* Shared Progress Bar */
.progress-track {
  width: 100%;
  height: 12px;
  background: var(--accent-light);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-pink), #ff85b3);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* Shared Error / Notice Banner */
.error-box {
  display: none;
  background: var(--error-bg);
  border: 1.5px solid var(--error-border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  color: var(--error-text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.error-box.visible {
  display: flex;
}

/* Shared Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-gap {
  background: #dcfce7;
  color: #15803d;
}

.badge-cut {
  background: #ffe4e6;
  color: #be123c;
}

.badge-base {
  background: #e0e7ff;
  color: #4338ca;
}

/* Shared Video Track Picker Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(74, 37, 56, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window {
  background: var(--bg-card);
  border: 2px solid var(--accent-pink);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 35px rgba(74, 37, 56, 0.28);
  overflow: hidden;
  animation: popIn 0.16s ease-out;
}

@keyframes popIn {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  background: var(--accent-light);
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--border-pink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-header h3 {
  font-size: 15px;
  color: var(--text-main);
  word-break: break-word;
}

.modal-body {
  padding: 14px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-footer {
  padding: 10px 18px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-pink);
  display: flex;
  justify-content: flex-end;
}

.track-card {
  background: var(--bg-white);
  border: 1.5px solid var(--border-pink);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.track-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent-pink);
  transform: translateY(-1px);
}

.track-card.active-track {
  background: var(--bg-soft);
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 2px rgba(255, 92, 147, 0.24);
}

.track-card-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.track-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

/* Shared Footer Copyright */
.site-footer {
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .brand-title {
    font-size: 17px;
  }

  .nav-pill-btn {
    padding: 6px 12px;
    font-size: 12.5px;
  }

  .btn {
    min-height: 40px;
  }

  .btn-sm {
    min-height: 34px;
  }

  .btn-cancel-icon {
    min-height: 28px;
    width: auto;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 12px 14px;
  }
}
