:root {
  --bg: #0a0a0f;
  --card: #15151f;
  --border: #262633;
  --text: #e8e8f0;
  --muted: #9a9aad;
  --accent: #4f8cff;
  --accent-hover: #6fa0ff;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win over display rules below
   (.modal, .file-link set display and would otherwise stay visible). */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 20px 24px 8px;
}

.brand { font-size: 1.6rem; font-weight: 800; }
.brand span { color: var(--accent); }
.tagline { color: var(--muted); font-size: 0.85rem; }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card h1 { margin: 0 0 4px; font-size: 1.4rem; }
.card h2 { margin: 0 0 8px; font-size: 1.1rem; }
.muted { color: var(--muted); margin: 4px 0 12px; }

form { display: flex; gap: 8px; }

input[type="url"], input[type="text"], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
}

button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 20px;
  white-space: nowrap;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

#downloadBtn { width: 100%; margin-top: 8px; }

.field { display: block; margin: 10px 0; font-size: 0.9rem; color: var(--muted); }
.field select, .field input { margin-top: 4px; }
.field.checkbox { display: flex; align-items: center; gap: 8px; color: var(--text); }

.trim-row { display: flex; gap: 12px; }
.trim-row .field { flex: 1; }

.cookies-box {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 10px;
  font-size: 0.9rem;
}
.cookies-box summary { cursor: pointer; color: var(--accent); }
.cookies-box a { color: var(--accent); }
.cookies-hint {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px;
  animation: cookies-pulse 1.6s ease-in-out 3;
}
@keyframes cookies-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(79, 140, 255, 0); }
}
.cookies-upload { display: flex; gap: 8px; align-items: center; }
.cookies-upload input[type="file"] {
  color: var(--muted);
  font-size: 0.85rem;
}
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
}
button.ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.info-row { display: flex; gap: 14px; margin-bottom: 12px; }
.info-row img { width: 160px; border-radius: 8px; }

.error { color: var(--danger); margin: 10px 0 0; }

.progress-wrap { margin-top: 14px; }
.progress-bar {
  background: var(--bg);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}
.progress-fill {
  background: var(--accent);
  height: 100%;
  width: 0%;
  transition: width 0.4s;
}

.file-link {
  display: block;
  margin-top: 14px;
  text-align: center;
  background: #1f3a24;
  border: 1px solid #2f5a38;
  color: #7ddb90;
  border-radius: 8px;
  padding: 12px;
  font-weight: 700;
  text-decoration: none;
}

.ad-slot {
  max-width: 640px;
  margin: 8px auto;
  padding: 0 16px;
  min-height: 90px;
}
.ad-slot .ad-placeholder {
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 24px;
}

.upsell { border-color: var(--accent); }
.cta {
  display: inline-block;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  margin-top: 8px;
  padding: 10px 18px;
  text-decoration: none;
}
.cta:hover { background: var(--accent-hover); }

footer {
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 640px;
  margin: 8px auto 32px;
  padding: 0 24px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 440px;
  padding: 24px;
}
.modal-box button { width: 100%; margin-top: 8px; }
