:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* GLOBAL LAYOUT */

body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1200px;
  width: 100%;
  padding: 16px;
  box-sizing: border-box;
}

.card {
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.main-header {
  margin-bottom: 4px;
}

.subtext {
  font-size: 0.8rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

video {
  width: 100%;
  max-height: 400px;
  border-radius: 12px;
  background: black;
  object-fit: cover;
}

/* CONTROLS, FORMS, BUTTONS */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.controls-row .field {
  min-width: 160px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-right: 12px;
}

label {
  font-size: 0.8rem;
}

select,
input[type="number"] {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 4px 8px;
  font-size: 0.9rem;
  outline: none;
}

select:focus,
input[type="number"]:focus {
  border-color: #60a5fa;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: #2563eb;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.1s ease, opacity 0.1s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  white-space: nowrap;
}

.btn.secondary {
  background: #4b5563;
  box-shadow: none;
}

.btn.danger {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
}

#clearBtn {
  background: #0ea5e9;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

.btn:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* LANGUAGE SELECT */

.lang-select {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-right: 8px;
  cursor: pointer;
  border: 1px solid #374151;
  background: #1f2937;
  color: #e5e7eb;
}

/* PHOTOS LIST */

.photos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.photo-item {
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  background: rgba(0,0,0,0.1);
}

.photo-item img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.photo-actions {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.photo-actions .btn {
  flex: 1;
  font-size: 0.75rem;
  padding: 4px 6px;
}

.status {
  margin-top: 8px;
  font-size: 0.85rem;
  min-height: 1.1em;
}

.counter {
  font-size: 1.6rem;
  text-align: center;
  margin-top: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.strip-preview-container {
  margin-top: 12px;
}

.strip-preview-container img {
  max-width: 100%;
  border-radius: 10px;
  display: block;
  margin-top: 8px;
  background: #000;
}

.hint {
  font-size: 0.8rem;
  margin-top: 4px;
}

a.download-link {
  text-decoration: none;
}

/* AD SLOTS */

.ad-slot {
  min-height: 60px;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px dashed;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* EDITOR OVERLAY */

.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.editor-dialog {
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.editor-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

@media (max-width: 900px) {
  .editor-content {
    grid-template-columns: 1fr;
  }
}

#editorCanvas {
  width: 100%;
  max-height: 500px;
  border-radius: 12px;
  background: #000;
}

.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-sidebar h3 {
  margin: 0;
  font-size: 1rem;
}

/* STICKERS */

.sticker-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sticker-btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
  background: rgba(0,0,0,0.1);
}

.sticker-btn.active,
.sticker-btn.selected {
  border-color: #2563eb;
}

/* THEMES */

body.theme-dark {
  background: #111827;
  color: #e5e7eb;
}

body.theme-dark .card {
  background: #1f2937;
}

body.theme-dark .subtext {
  color: #9ca3af;
}

body.theme-dark select,
body.theme-dark input[type="number"] {
  background: #111827;
  color: #e5e7eb;
  border-color: #374151;
}

body.theme-dark .status,
body.theme-dark .hint {
  color: #9ca3af;
}

body.theme-dark .photo-item {
  background: #111827;
}

body.theme-dark .ad-slot {
  border-color: #374151;
  color: #6b7280;
}

body.theme-light {
  background: #f3f4f6;
  color: #111827;
}

body.theme-light .card {
  background: #ffffff;
}

body.theme-light .subtext {
  color: #6b7280;
}

body.theme-light select,
body.theme-light input[type="number"],
body.theme-light .lang-select {
  background: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

body.theme-light .status {
  color: #4b5563;
}

body.theme-light .hint {
  color: #6b7280;
}

body.theme-light .photo-item {
  background: #f9fafb;
}

body.theme-light .ad-slot {
  border-color: #e5e7eb;
  color: #9ca3af;
}

body.theme-light .btn.secondary {
  background: #e5e7eb;
  color: #111827;
}
