:root {
  --bg-1: #0b1020;
  --bg-2: #121a33;
  --text: #eaf0ff;
  --muted: #a6b1d1;
  --accent: #6aa6ff;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 600px at 15% 10%, var(--bg-2), transparent 60%),
              radial-gradient(1200px 600px at 85% 90%, #0c1533, transparent 55%),
              linear-gradient(160deg, var(--bg-1), #0a0f1e 60%);
  overflow: hidden;
  transition: background 0.5s ease;
}

/* Background presets */
body.bg-dark {
  background: #0a0a0a;
}

body.bg-midnight {
  background: radial-gradient(1200px 600px at 15% 10%, #1a2332, transparent 60%),
              radial-gradient(1200px 600px at 85% 90%, #0f1820, transparent 55%),
              linear-gradient(160deg, #0d1520, #060a12 60%);
}

body.bg-purple {
  background: radial-gradient(1200px 600px at 15% 10%, #2d1b4e, transparent 60%),
              radial-gradient(1200px 600px at 85% 90%, #1a0f2e, transparent 55%),
              linear-gradient(160deg, #1e0f3a, #0f0520 60%);
}

body.bg-forest {
  background: radial-gradient(1200px 600px at 15% 10%, #1a2e1a, transparent 60%),
              radial-gradient(1200px 600px at 85% 90%, #0f1e0f, transparent 55%),
              linear-gradient(160deg, #152015, #0a120a 60%);
}

body.bg-sunset {
  background: radial-gradient(1200px 600px at 15% 10%, #4a2520, transparent 60%),
              radial-gradient(1200px 600px at 85% 90%, #2e1510, transparent 55%),
              linear-gradient(160deg, #3a1a15, #200a08 60%);
}

body.bg-custom {
  background: var(--custom-bg-color, #0b1020) !important;
}

body.bg-uploaded {
  background: var(--uploaded-bg-image, #0b1020) var(--uploaded-bg-position, center) / var(--uploaded-bg-size, cover) var(--uploaded-bg-repeat, no-repeat) var(--uploaded-bg-attachment, fixed) !important;
}

/* Fallback for when CSS variables don't work */
body.bg-uploaded[style*="background"] {
  background: var(--uploaded-bg-image, #0b1020) var(--uploaded-bg-position, center) / var(--uploaded-bg-size, cover) var(--uploaded-bg-repeat, no-repeat) var(--uploaded-bg-attachment, fixed) !important;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Lightbox (full-view) */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20000;
}
.lightbox[aria-hidden="false"] { display: block; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
}
.lightbox-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 98vw;
  max-height: 96vh;
  width: fit-content;
  height: auto;
  background: rgba(10, 13, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}
.lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 24px;
  width: 36px;
  height: 36px;
  line-height: 34px;
  border-radius: 8px;
  cursor: pointer;
}
.lightbox-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0f1e;
  padding: 5px;
  flex: 1 1 auto;
  min-height: 60vh;
  overflow: hidden;
}
.lightbox-media img {
  max-width: 98vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.lightbox-media video {
  max-width: 98vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.lightbox-media iframe {
  width: 90vw;
  height: 85vh;
  max-width: 1920px;
  max-height: 1080px;
  border: none;
  border-radius: 8px;
  display: block;
}
.lightbox-caption {
  display: block; /* show caption & date in full view */
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Dialog (Add Media) */
.dialog {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2100;
}
.dialog[aria-hidden="false"] { display: block; }
.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
.dialog-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 560px);
  max-height: 85vh;
  background: rgba(10, 13, 26, 0.95);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 16px;
  color: var(--text);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 126, 234, 0.5) transparent;
}

.dialog-content::-webkit-scrollbar {
  width: 6px;
}

.dialog-content::-webkit-scrollbar-track {
  background: transparent;
}

.dialog-content::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.5);
  border-radius: 3px;
}

.dialog-content::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.7);
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dialog-close {
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}
.form-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="file"] {
  width: 100%;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
.dialog-actions .primary {
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(80,140,255,0.35);
  color: #fff;
}

.controls {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 12px;
  border-radius: 12px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  /* Default visible state */
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.controls.hidden {
  transform: translateY(-120%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.controls.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.controls button,
.controls .btn-like {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.controls button:hover,
.controls .btn-like:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.controls button:active,
.controls .btn-like:active {
  transform: translateY(0);
}

.controls .speed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-width: 200px;
  justify-content: space-between;
}

/* Date filter */
.date-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  min-width: 280px;
}

.date-filter label {
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.date-filter label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}

.date-filter .date-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.date-filter input[type="text"] {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  padding: 8px 12px;
  flex: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.date-filter input[type="text"]:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.date-filter input[type="text"]:hover {
  border-color: rgba(102, 126, 234, 0.3);
  background: rgba(255, 255, 255, 0.12);
}

.date-filter button {
  background: rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(102, 126, 234, 0.5);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.date-filter button:hover {
  background: rgba(102, 126, 234, 0.5);
  border-color: rgba(102, 126, 234, 0.8);
  transform: translateY(-1px);
}

.date-filter button:active {
  transform: scale(0.95);
}

/* Date range picker overlay */
/* Timeline Navigation */
.timeline-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.timeline-nav label {
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.timeline-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 60px;
}

.btn-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.btn-toggle.active {
  background: rgba(76, 175, 80, 0.3);
  border-color: rgba(76, 175, 80, 0.5);
  color: #4CAF50;
}

.btn-toggle.active .timeline-status {
  color: #4CAF50;
}

.btn-today {
  background: rgba(255, 193, 7, 0.3);
  border: 1px solid rgba(255, 193, 7, 0.5);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.btn-today:hover {
  background: rgba(255, 193, 7, 0.5);
  border-color: rgba(255, 193, 7, 0.8);
  transform: translateY(-1px);
}

.btn-timeline-scroll {
  background: rgba(156, 39, 176, 0.3);
  border: 1px solid rgba(156, 39, 176, 0.5);
  border-radius: 8px;
  color: var(--text);
  font-size: 11px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.btn-timeline-scroll:hover {
  background: rgba(156, 39, 176, 0.5);
  border-color: rgba(156, 39, 176, 0.8);
  transform: translateY(-1px);
}











.date-range-picker {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(10, 13, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 16px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  display: none;
}

.date-range-picker.show {
  display: block;
}

.date-range-picker h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.date-range-picker .date-inputs {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.date-range-picker .date-input-group {
  flex: 1;
}

.date-range-picker .date-input-group label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.date-range-picker .date-input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  padding: 6px 8px;
}

.date-range-picker .date-input-group input:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(255, 255, 255, 0.15);
}

.date-range-picker .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.date-range-picker .btn {
  background: rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(102, 126, 234, 0.5);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.date-range-picker .btn:hover {
  background: rgba(102, 126, 234, 0.5);
  border-color: rgba(102, 126, 234, 0.8);
}

.date-range-picker .btn-primary {
  background: rgba(102, 126, 234, 0.6);
  border-color: rgba(102, 126, 234, 0.8);
}

.date-range-picker .btn-primary:hover {
  background: rgba(102, 126, 234, 0.8);
  border-color: rgba(102, 126, 234, 1);
}

.controls input[type="range"] {
  width: 140px;
}

/* Speed controls container */
.speed-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.speed-controls .speed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  min-width: 0;
}

.speed-controls .speed span:first-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.speed-controls .speed input[type="range"] {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}

.speed-controls .speed input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: rgba(102, 126, 234, 0.8);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.speed-controls .speed input[type="range"]::-webkit-slider-thumb:hover {
  background: rgba(102, 126, 234, 1);
  transform: scale(1.1);
}

.speed-controls .speed span:last-child {
  font-size: 10px;
  font-weight: 600;
  color: rgba(102, 126, 234, 0.8);
  text-align: center;
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 40px;
}

#speedValue {
  min-width: 40px;
  display: inline-block;
  text-align: right;
  color: var(--text);
}

.add-media {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.add-media .btn-like {
  background: rgba(80,140,255,0.35);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
}

.add-media .btn-like:hover {
  background: rgba(80,140,255,0.45);
  border-color: rgba(255,255,255,0.3);
}

/* Hide controls button */
.hide-controls-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hide-controls-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.hide-controls-btn:active {
  transform: translateY(0);
}

.hide-controls-btn .icon {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 12px;
}

/* Show controls button */
.show-controls-btn {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: var(--text);
  font-size: 11px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.show-controls-btn:hover {
  background: rgba(18, 26, 51, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.show-controls-btn .icon {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 12px;
}

/* Hide toggle button when controls are visible on mobile */
@media (max-width: 640px) {
  .toggle-controls-btn {
    top: 8px;
    padding: 6px 12px;
    font-size: 14px;
  }
  
  .show-controls-btn {
    bottom: 12px;
    left: 12px;
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* Help button */
.help-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  width: 50px;
  height: 50px;
  background: rgba(102, 126, 234, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-btn:hover {
  background: rgba(102, 126, 234, 1);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.help-btn .icon {
  line-height: 1;
}

/* Help overlay */
.help-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2200;
}

.help-overlay[aria-hidden="false"] {
  display: block;
}

.help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.help-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 700px);
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(135deg, rgba(18, 26, 51, 0.98), rgba(11, 16, 32, 0.98));
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 16px;
  padding: 30px;
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.help-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.help-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.help-content h2 {
  margin: 0 0 24px 0;
  font-size: 28px;
  color: var(--accent);
  font-weight: 600;
}

.help-section {
  margin-bottom: 28px;
}

.help-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
}

/* Keyboard shortcuts grid */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.shortcut-item kbd {
  min-width: 45px;
  padding: 6px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shortcut-item span {
  flex: 1;
  font-size: 14px;
  color: var(--muted);
}

/* Workflow steps */
.workflow-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: rgba(102, 126, 234, 0.08);
  border-radius: 8px;
  border-left: 3px solid rgba(102, 126, 234, 0.5);
}

.workflow-item .step {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  font-weight: bold;
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.workflow-item span:last-child {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.workflow-item kbd {
  padding: 4px 8px;
  background: rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(102, 126, 234, 0.5);
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
  font-weight: bold;
}

/* Tips list */
.tips-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tips-list li {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border-left: 2px solid rgba(106, 166, 255, 0.5);
  font-size: 14px;
  line-height: 1.6;
}

.tips-list li strong {
  color: var(--accent);
}

.tips-list li kbd {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}

/* Help footer */
.help-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dont-show-again {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}

.dont-show-again input[type="checkbox"] {
  cursor: pointer;
}

.btn-primary {
  padding: 10px 24px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 1), rgba(118, 75, 162, 1));
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transform: translateY(-1px);
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .stage {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* iOS: reduce heavy blur/dim overlays to prevent excessive darkening */
  .lightbox-backdrop,
  .dialog-backdrop,
  .help-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0.45) !important; /* was 0.55-0.75 */
  }
  
  .media-item {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  .media-item img,
  .media-item video {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Fix iOS image sizing */
    max-width: 100%;
    height: auto;
    object-fit: contain;
    /* Fix iOS viewport issues */
    width: auto;
    min-width: 0;
    min-height: 0;
    /* Fix iOS touch issues */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  /* Fix iOS stage sizing */
  .stage {
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    max-width: 100vw;
    max-height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
  }
  
  /* Fix iOS media item sizing */
  .media-item {
    max-width: 100vw;
    max-height: calc(var(--vh, 1vh) * 100);
    width: auto;
    height: auto;
  }
  
  /* Fix iOS viewport issues */
  body {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Fix iOS file input */
  input[type="file"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-size: 16px;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* iOS specific media queries */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
  .stage {
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    max-width: 100vw;
    max-height: calc(var(--vh, 1vh) * 100);
  }
  
  .media-item {
    max-width: 100vw;
    max-height: calc(var(--vh, 1vh) * 100);
  }
  
  .media-item img,
  .media-item video {
    max-width: 100vw;
    max-height: calc(var(--vh, 1vh) * 100);
    width: auto;
    height: auto;
  }
}

@media (max-width: 640px) {
  .help-content {
    padding: 20px;
    width: 95vw;
    max-height: 90vh;
  }
  
  .help-content h2 {
    font-size: 22px;
  }
  
  .shortcuts-grid {
    grid-template-columns: 1fr;
  }
  
  .help-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
    bottom: 15px;
    right: 15px;
  }
}

/* Background picker */
.bg-picker-content {
  padding: 10px 0;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

.bg-picker-content h3 {
  margin: 16px 0 12px 0;
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.bg-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.bg-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
  font-size: 13px;
}

.bg-preset:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(102, 126, 234, 0.5);
  transform: translateY(-2px);
}

.bg-preset.active {
  border-color: rgba(102, 126, 234, 0.8);
  background: rgba(102, 126, 234, 0.1);
}

.bg-preview {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bg-preview.bg-default {
  background: radial-gradient(circle at 30% 30%, #121a33, transparent 70%),
              radial-gradient(circle at 70% 70%, #0c1533, transparent 70%),
              linear-gradient(160deg, #0b1020, #0a0f1e 60%);
}

.bg-preview.bg-dark {
  background: #0a0a0a;
}

.bg-preview.bg-midnight {
  background: radial-gradient(circle at 30% 30%, #1a2332, transparent 70%),
              linear-gradient(160deg, #0d1520, #060a12);
}

.bg-preview.bg-purple {
  background: radial-gradient(circle at 30% 30%, #2d1b4e, transparent 70%),
              linear-gradient(160deg, #1e0f3a, #0f0520);
}

.bg-preview.bg-forest {
  background: radial-gradient(circle at 30% 30%, #1a2e1a, transparent 70%),
              linear-gradient(160deg, #152015, #0a120a);
}

.bg-preview.bg-sunset {
  background: radial-gradient(circle at 30% 30%, #4a2520, transparent 70%),
              linear-gradient(160deg, #3a1a15, #200a08);
}

.custom-color-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-color-picker input[type="color"] {
  width: 80px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.btn-apply {
  flex: 1;
  padding: 10px 16px;
  background: rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(102, 126, 234, 0.5);
  color: var(--text);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-apply:hover {
  background: rgba(102, 126, 234, 0.5);
  border-color: rgba(102, 126, 234, 0.8);
}

/* Upload background section */
.upload-bg-section {
  margin-top: 12px;
}

.upload-bg-area {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.upload-bg-area:hover {
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(102, 126, 234, 0.05);
}

.upload-bg-area.drag-over {
  border-color: rgba(102, 126, 234, 0.8);
  background: rgba(102, 126, 234, 0.1);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.upload-placeholder .upload-icon {
  font-size: 32px;
}

.upload-placeholder small {
  font-size: 12px;
  opacity: 0.7;
}

.bg-preview-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.bg-preview-container img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.remove-bg-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(255, 0, 0, 0.8);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-bg-btn:hover {
  background: rgba(255, 0, 0, 1);
  transform: scale(1.1);
}

/* Background adjustments */
.bg-adjustments {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: none; /* Hidden by default */
}

/* Background sync section */
.bg-sync-section {
  margin-top: 20px;
  padding: 16px;
  background: rgba(33, 150, 243, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.bg-sync-section h4 {
  margin: 0 0 8px 0;
  color: #2196F3;
  font-size: 14px;
  font-weight: 600;
}

.sync-description {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

.sync-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-sync, .btn-download {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-sync {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: white;
}

.btn-sync:hover {
  background: linear-gradient(135deg, #1976D2, #1565C0);
  transform: translateY(-1px);
}

.btn-sync:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

.btn-download {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  color: white;
}

.btn-download:hover {
  background: linear-gradient(135deg, #388E3C, #2E7D32);
  transform: translateY(-1px);
}

.btn-download:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

.sync-status {
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
}

.sync-status.success {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.sync-status.error {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.sync-status.info {
  background: rgba(33, 150, 243, 0.2);
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

/* Notification animations */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.bg-adjustments h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.adjust-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.adjust-group label {
  font-size: 12px;
  color: var(--muted);
  min-width: 60px;
}

.adjust-group select {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.adjust-group select option {
  background: rgba(10, 13, 26, 0.95);
  color: #ffffff;
  padding: 4px 8px;
  font-size: 12px;
}

.adjust-group select option:hover {
  background: rgba(102, 126, 234, 0.3);
  color: #ffffff;
}

.adjust-group select option:checked {
  background: rgba(102, 126, 234, 0.5);
  color: #ffffff;
}

.adjust-group select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(102, 126, 234, 0.5);
}

.adjust-group select:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.8);
  background: rgba(255, 255, 255, 0.15);
}

.media-item {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate3d(0, 0, 0) scale(1);
  will-change: transform;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.media-item:hover {
  transform: scale(1.07) translateZ(0);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

/* Orientation-specific styling */
.media-item.media-portrait {
  /* Portrait: taller shadow + subtle blue tint */
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(102, 126, 234, 0.1);
  border: 2px solid rgba(102, 126, 234, 0.15);
}

.media-item.media-portrait:hover {
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.3);
}

.media-item.media-landscape {
  /* Landscape: wider shadow + subtle orange tint */
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38), 0 0 0 2px rgba(255, 140, 66, 0.1);
  border: 2px solid rgba(255, 140, 66, 0.15);
}

.media-item.media-landscape:hover {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48), 0 0 0 2px rgba(255, 140, 66, 0.2);
  border-color: rgba(255, 140, 66, 0.3);
}

.media-item.media-square {
  /* Square: balanced shadow + subtle green tint */
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.38), 0 0 0 2px rgba(76, 175, 80, 0.1);
  border: 2px solid rgba(76, 175, 80, 0.15);
}

.media-item.media-square:hover {
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.48), 0 0 0 2px rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.3);
}

.media-item img,
.media-item video,
.media-item .video-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Modern form styles */
.modern-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
}

.form-section h3 {
  margin: 0 0 16px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.form-hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
}

/* File upload area */
.file-upload-area {
  position: relative;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  /* iOS Safari fix */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  /* iOS viewport fix */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.file-upload-area:hover {
  border-color: rgba(102, 126, 234, 0.4);
  background: rgba(102, 126, 234, 0.05);
}

.file-upload-area.dragover {
  border-color: rgba(102, 126, 234, 0.6);
  background: rgba(102, 126, 234, 0.1);
  transform: scale(1.02);
}

.file-upload-area input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  /* iOS Safari fix */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-size: 16px; /* Prevents zoom on iOS */
}

.file-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-icon {
  font-size: 48px;
  opacity: 0.6;
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-text strong {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.upload-text span {
  font-size: 14px;
  color: var(--muted);
}

.upload-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.upload-info small {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
}

.file-preview {
  display: none;
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.file-preview.show {
  display: block;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text);
}

.oauth-box button#driveSignInBtn {
  margin-top: 6px;
}

.file-preview-item:last-child {
  margin-bottom: 0;
}

.file-preview-icon {
  font-size: 16px;
}

.file-preview-name {
  flex: 1;
  font-weight: 500;
}

.file-preview-size {
  color: var(--muted);
  font-size: 11px;
}

/* Button states */
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Upload messages */
.upload-success {
  animation: slideInRight 0.3s ease-out;
}

.upload-error {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Dialog actions */
.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary {
  background: rgba(102, 126, 234, 0.6);
  border: 1px solid rgba(102, 126, 234, 0.8);
  color: var(--text);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: rgba(102, 126, 234, 0.8);
  border-color: rgba(102, 126, 234, 1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.btn-icon {
  font-size: 14px;
}
.media-item .tile-preview {
  display: block;
  width: 100%;
  height: 100%;
}

.placeholder {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  color: var(--muted);
}
.placeholder .icon {
  font-size: 24px;
  opacity: 0.9;
}
.placeholder .label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  font-size: 12px;
  color: #eaf0ff;
  opacity: 0.8;
}

.media-meta {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  color: #eaf0ff;
  display: none; /* hide caption & date on moving tiles (web + mobile) */
}

@media (max-width: 640px) {
  .controls {
    right: 16px;
    left: 16px;
    gap: 8px;
    padding: 8px 10px;
  }
  .controls input[type="range"] {
    width: 110px;
  }
}


