:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222c;
  --text: #e8eaed;
  --muted: #9aa0ab;
  --accent: #ff5a3c;
  --border: #2a2f3a;
  --radius: 12px;
  --max: 820px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Page loader ---------- */

#page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  animation: loader-spin 0.9s linear infinite;
}

.loader-title {
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  animation: loader-pulse 1.4s ease-in-out infinite;
}

@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .loader-ring { animation-duration: 2s; }
  .loader-title { animation: none; }
}

/* ---------- Public page ---------- */

.site-header {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
}
.site-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: -0.02em;
}

.stack {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.item { display: flex; flex-direction: column; gap: 0.75rem; }

.video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

.caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
  font-size: 0.85rem;
}

/* ---------- Admin ---------- */

.admin { background: #0c0e12; }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.bar a { margin-right: 1rem; text-decoration: none; }

.admin-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.card h2 { margin-top: 0; }

label {
  display: block;
  margin: 0.75rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
label.check { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }

input[type="text"],
input[type="url"],
input[type="password"],
input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.7rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}
input[type="file"] { padding: 0.45rem; }

button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}
button.link {
  background: none;
  color: var(--accent);
  padding: 0.2rem 0.4rem;
  font-weight: 500;
}
button.link[disabled] { color: var(--border); cursor: default; }
button.danger { background: #7a1f1f; }

.inline { display: inline; }
.row-edit button { margin-top: 0.5rem; }

.row-card { position: relative; }
.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.pos { font-weight: 700; color: var(--muted); }
.reorder button { font-size: 1rem; }

.preview { margin: 0.5rem 0; }
.preview img {
  max-width: 240px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.delete-form { display: none; }            /* holds hidden inputs; button lives in .row-actions */
.row-actions { display: flex; gap: 0.75rem; margin-top: 0.9rem; }

.notice, .error {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.notice { background: #14351f; color: #9fe6b4; }
.error  { background: #3a1414; color: #ff9c9c; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card h1 { margin: 0 0 0.25rem; }
.login-card p { margin-top: 0; }
.login-card label { text-align: left; }
.login-card button { width: 100%; margin-top: 0.5rem; }


/* ---------- Drag & drop upload ---------- */

.dropzone {
  margin-top: 0.35rem;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(255, 90, 60, 0.08);
}
.dz-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.dz-text strong { color: var(--text); font-weight: 600; }
.dropzone input[type="file"] { margin-top: 0; }
.dz-filename { margin-top: 0.5rem; color: var(--accent); font-size: 0.85rem; word-break: break-all; }
.dz-preview { margin-top: 0.6rem; }
.dz-preview img { max-width: 160px; width: 100%; border-radius: 8px; border: 1px solid var(--border); }
