:root {
  --bg: #0e1116;
  --bg-soft: #161b22;
  --card: #1c232d;
  --line: #2a3542;
  --text: #e8eef5;
  --muted: #93a1b1;
  --brand: #1e6ff2;
  --brand-2: #7c3aed;
  --ok: #16a34a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2a4a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  min-height: 100vh;
}

.topbar {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 17, 22, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.admin-link:hover { color: var(--text); border-color: var(--brand); }

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
}
.logo-img {
  width: 52px; height: 52px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  box-shadow: var(--shadow);
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; }
.brand p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.layout {
  max-width: 1120px;
  margin: 24px auto;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

/* Stage / canvas */
.stage { display: flex; flex-direction: column; gap: 12px; }
.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(45deg, #10151c 25%, transparent 25%) -10px 0,
    linear-gradient(-45deg, #10151c 25%, transparent 25%) -10px 0,
    linear-gradient(45deg, transparent 75%, #10151c 75%),
    linear-gradient(-45deg, transparent 75%, #10151c 75%);
  background-size: 20px 20px;
  background-color: #0c1017;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  touch-action: none;
  cursor: grab;
}
.canvas-wrap:active { cursor: grabbing; }
#canvas { width: 100%; height: 100%; display: block; }

.empty-hint {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: var(--muted); pointer-events: none;
}
.empty-hint span { font-size: 48px; }
.empty-hint p { margin: 0; font-size: 15px; }

.stage-tip { text-align: center; color: var(--muted); font-size: 13px; margin: 0; }

/* Panel */
.panel { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.section-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.frames {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.frame-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #0c1017 center/cover no-repeat;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.1s;
}
.frame-thumb:hover { transform: translateY(-2px); }
.frame-thumb.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,111,242,0.25); }

.upload-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  background: var(--bg-soft);
  transition: border-color 0.15s, background 0.15s;
}
.upload-btn:hover { border-color: var(--brand); background: #10151c; }

.control { margin-bottom: 14px; }
.control:last-child { margin-bottom: 0; }
.control-head {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted); margin-bottom: 6px;
}
.control-head output { color: var(--text); font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 6px;
  background: var(--line); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); cursor: pointer;
  border: 3px solid #0c1017;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); cursor: pointer; border: 3px solid #0c1017;
}

.btn-row { display: flex; gap: 10px; }
.btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost:hover { background: #10151c; }
.btn.primary {
  width: 100%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  color: #fff;
  font-size: 15px;
  padding: 14px;
}
.btn.primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.note { margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    margin-top: 12px;
    gap: 12px;
  }
  .panel { order: 2; }
  /* Header ikut tergulung agar preview bisa menempel di atas. */
  .topbar { position: static; }
  /* Preview menempel di atas saat menggulir ke kontrol penyesuaian. */
  .stage {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    padding: 8px 0 10px;
    gap: 8px;
  }
  /* Perkecil sedikit agar kontrol muat terlihat bersama preview. */
  .canvas-wrap { max-width: 56vh; margin: 0 auto; }
  .stage-tip { font-size: 12px; }
}

/* Footer strip logo peringkat & akreditasi */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(14, 17, 22, 0.6);
  padding: 22px 20px 30px;
  margin-top: 10px;
}
.footer-cap {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.ranking-strip {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ranking-strip img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.95;
  filter: brightness(1.5);
}
@media (max-width: 860px) {
  .site-footer { padding: 16px 12px 22px; }
}
