@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2-variations');
}

/* Layout: HP satu kolom tiga kartu bernomor; desktop (>760px) foto di kiri, satu panel kontrol di kanan. */
:root {
  --bg: #f4f5f6;
  --panel: #ffffff;
  --ink: #15191c;
  --muted: #5b646b;
  --line: #e3e6e8;
  --ember: #c2410c;
  --ember-soft: #fbede4;
  --track: #dfe2e4;
  --stage: #d9d6cf;
  --font: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416; --panel: #1b1e21; --ink: #eceeef; --muted: #9aa3a9; --line: #2b3034;
    --ember: #f0874f; --ember-soft: #3a2418; --track: #343a3f; --stage: #26292b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121416; --panel: #1b1e21; --ink: #eceeef; --muted: #9aa3a9; --line: #2b3034;
  --ember: #f0874f; --ember-soft: #3a2418; --track: #343a3f; --stage: #26292b;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body {
  margin: 0;
  background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 32px;
}

/* ---------- dasar (HP) ---------- */
.wrap { max-width: 480px; margin: 0 auto; display: grid; gap: 18px; }

header { display: grid; gap: 6px; max-width: 62ch; padding: 0 4px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ember); }
h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; }
header p { margin: 0; color: var(--muted); }

.app, .panel { display: grid; gap: 18px; min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; display: grid; gap: 10px; min-width: 0;
}
.step1 { gap: 12px; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-head h2 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.badge {
  width: 26px; height: 26px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--ember-soft); color: var(--ember); font-size: 13px; font-weight: 800;
}
.levelNum { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

.stage {
  position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 10px; overflow: hidden;
  background: var(--stage); touch-action: none; cursor: grab; user-select: none;
}
.stage.dragging { cursor: grabbing; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage.drop { outline: 3px dashed var(--ember); outline-offset: -3px; }
.chip {
  position: absolute; left: 10px; top: 10px; padding: 4px 10px; border-radius: 999px;
  background: rgb(0 0 0 / .55); color: #fff; font-size: 12px; font-weight: 600; pointer-events: none;
}
.hint { margin: 0 2px; font-size: 13px; color: var(--muted); }

.label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.levelBlock, .zoomBlock { display: grid; gap: 10px; }
.levelName { font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
input[type=range] { width: 100%; accent-color: var(--ember); margin: 0; height: 28px; }

.presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.preset {
  font: inherit; font-size: 11px; font-weight: 700; line-height: 1.25; color: var(--muted);
  background: none; border: 0; padding: 0; cursor: pointer; display: grid; gap: 6px; text-align: left;
}
.preset i { display: block; height: 36px; border-radius: 6px; }
.preset:nth-child(1) i { background: #e6edf0; }
.preset:nth-child(2) i { background: #e3e1d8; }
.preset:nth-child(3) i { background: #d6cdb4; }
.preset:nth-child(4) i { background: #c3b694; }
.preset:nth-child(5) i { background: #a8987a; }
.preset:nth-child(6) i { background: #7d715c; }
.preset[aria-pressed="true"] { color: var(--ember); }
.preset[aria-pressed="true"] i { outline: 2px solid var(--ember); outline-offset: 2px; }
.preset:focus-visible { outline: none; }
.preset:focus-visible i { outline: 3px solid var(--ember); outline-offset: 2px; }

.thumbs { display: flex; align-items: flex-end; gap: 16px; }
.thumbs figure { margin: 0; display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.thumbs canvas { display: block; border-radius: 999px; background: var(--stage); }
.thumbs figure:nth-child(1) canvas { width: 80px; height: 80px; }
.thumbs figure:nth-child(2) canvas { width: 48px; height: 48px; }
.thumbs figure:nth-child(3) canvas { width: 32px; height: 32px; }

.btn {
  font: inherit; font-weight: 700; font-size: 15px; border-radius: 10px; padding: 11px 16px; min-height: 44px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn:focus-visible, input[type=range]:focus-visible, #file:focus-visible ~ .pick { outline: 3px solid var(--ember); outline-offset: 2px; }
.btn small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
#compare { flex-direction: column; gap: 0; line-height: 1.3; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tools .btn { font-size: 14px; padding: 9px 10px; }
.pick { width: 100%; }

.save { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.save .btn { min-height: 48px; }
.save:has(#share[hidden]) #save { grid-column: 1 / -1; }

.note { font-size: 13px; color: var(--muted); margin: 0; padding: 0 4px; }
.note b { color: var(--ink); }
.err { color: var(--ember); font-size: 13px; font-weight: 600; margin: 0; }

footer { font-size: 13px; color: var(--muted); padding: 0 4px; }
footer a { color: var(--ink); font-weight: 600; }

/* Khusus HP: tanpa preset, preview, hint, dan judul KADAR ASAP versi desktop. */
@media (max-width: 760px) {
  .hint, .presets, .previewBlock, .pick-d, .level-top { display: none; }
}

/* ---------- desktop ---------- */
@media (min-width: 761px) {
  body { padding-block: 28px 40px; }
  .wrap { max-width: 1100px; gap: 24px; }
  header { padding: 0; }
  h1 { font-size: 40px; }
  .app { grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }

  .step-head, .pick-m { display: none; }
  .step1 { background: none; border: 0; padding: 0; gap: 8px; }
  .stage { border-radius: 14px; }
  .chip { left: 12px; top: 12px; }

  /* Kartu 2 dan 3 melebur ke panel; anak-anaknya diurutkan ulang. */
  .panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
    padding: 20px; gap: 22px;
  }
  .step2, .step3 { display: contents; }
  .levelBlock { order: 1; gap: 12px; }
  .zoomBlock { order: 2; }
  .previewBlock { order: 3; display: grid; gap: 10px; }
  .pick-d { order: 4; }
  .tools { order: 5; margin-top: -14px; }
  .save { order: 6; grid-template-columns: 1fr; margin-top: -14px; }
  .note { order: 7; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .level-top { display: flex; justify-content: space-between; align-items: baseline; }
  .levelName { font-size: 26px; letter-spacing: -.02em; }
  .tools .btn { font-size: 15px; }
  footer { padding: 0; }
}
