/* Web2APK — gaya "klasik modern": kertas gading, tinta gelap, judul serif, garis tipis.
   Tanpa framework. Tata letak cair dari 320 px sampai layar lebar. Gerak: lihat motion.css. */

@font-face {
  font-family: "Playfair Display";
  src: url("/assets/fonts/playfair-display.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #F7F3EA;
  --surface: #FFFDF8;
  --sunken: #EFE9DB;
  --ink: #1D1B17;
  --muted: #5F594D;
  --line: #DDD5C3;
  --line-strong: #8F8672;
  --accent: #1F3A33;
  --accent-strong: #142823;
  --on-accent: #F7F3EA;
  --gold: #9A7A32;
  --gold-ink: #73581C;
  --danger: #9E2B25;
  --shadow: 0 1px 0 rgb(29 27 23 / 4%), 0 12px 32px -18px rgb(29 27 23 / 28%);
  --glass: color-mix(in srgb, var(--surface) 82%, transparent);
  --glass-bar: color-mix(in srgb, var(--bg) 78%, transparent);
  --glass-edge: color-mix(in srgb, #FFFFFF 50%, transparent);
  --blur: blur(14px) saturate(1.3);
  --wash-a: color-mix(in srgb, var(--accent) 12%, transparent);
  --wash-b: color-mix(in srgb, var(--gold) 14%, transparent);
  --radius: 10px;
  --radius-sm: 6px;
  --gap: clamp(0.85rem, 0.55rem + 1vw, 1.35rem);
  --page: clamp(1rem, 0.25rem + 3.5vw, 2.75rem);
  --pad: clamp(1.1rem, 0.7rem + 1.6vw, 2rem);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110F;
    --surface: #1A1815;
    --sunken: #23201B;
    --ink: #EFE8D8;
    --muted: #A8A08F;
    --line: #322E26;
    --line-strong: #7A715F;
    --accent: #D8BC7A;
    --accent-strong: #E6CF96;
    --on-accent: #1A1608;
    --gold: #C9A65A;
    --gold-ink: #D8BC7A;
    --danger: #F08A80;
    --shadow: 0 1px 0 rgb(0 0 0 / 30%), 0 14px 34px -18px rgb(0 0 0 / 70%);
    --glass: color-mix(in srgb, var(--surface) 84%, transparent);
    --glass-bar: color-mix(in srgb, var(--bg) 80%, transparent);
    --glass-edge: color-mix(in srgb, #FFFFFF 10%, transparent);
    --wash-a: color-mix(in srgb, var(--accent) 10%, transparent);
    --wash-b: color-mix(in srgb, var(--gold) 9%, transparent);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.55 var(--font);
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

/* Kaca butuh sesuatu di belakangnya. Lapisan ini dipaint sekali dan tidak pernah berubah. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42rem 32rem at 12% -8%, var(--wash-a), transparent 60%),
    radial-gradient(38rem 30rem at 92% 8%, var(--wash-b), transparent 62%);
}

h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-strong); text-underline-offset: 0.2em; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }

.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Tipografi ---------- */

.h1 { font-family: var(--display); font-size: clamp(2.15rem, 1.15rem + 4.6vw, 4.25rem); line-height: 1.04; letter-spacing: -0.015em; font-weight: 600; text-wrap: balance; }
.h2 { font-family: var(--display); font-size: clamp(1.45rem, 1.2rem + 1.1vw, 2rem); line-height: 1.15; letter-spacing: -0.005em; font-weight: 600; text-wrap: balance; }
.h3 { font-family: var(--display); font-size: 1.15rem; line-height: 1.25; font-weight: 600; }
.eyebrow { font-size: 0.72rem; font-weight: 650; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-ink); }
.rule { width: 3rem; height: 1px; background: var(--gold); border: 0; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--mono); font-size: 0.875em; }
.stack { display: grid; gap: var(--gap); }
.stack.tight { gap: 0.35rem; }
.steps-list { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.35rem; color: var(--muted); }
.steps-list .mono { color: var(--ink); }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- Kerangka ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.5rem 1.5rem; flex-wrap: wrap;
  padding: calc(0.7rem + env(safe-area-inset-top)) max(var(--page), env(safe-area-inset-right)) 0 max(var(--page), env(safe-area-inset-left));
  background: var(--glass-bar);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--glass-edge);
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--display); font-weight: 650; font-size: 1.3rem; letter-spacing: 0; color: var(--ink); text-decoration: none; padding-bottom: 0.7rem; }
.brand img { width: 30px; height: 30px; border-radius: 6px; }

.nav { display: flex; gap: 1.5rem; margin-inline: auto 0; align-self: stretch; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.1rem 0.7rem;
  color: var(--muted); text-decoration: none;
  font-size: 0.74rem; font-weight: 650; letter-spacing: 0.16em; text-transform: uppercase;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }

.me { display: flex; align-items: center; gap: 0.6rem; min-width: 0; padding-bottom: 0.7rem; }
.me .who { min-width: 0; line-height: 1.25; }
.me .who b { display: block; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; font-weight: 600; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sunken); box-shadow: 0 0 0 1px var(--line-strong); display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 0.95rem; flex: none; object-fit: cover; }

.page {
  width: min(1160px, 100%);
  margin-inline: auto;
  padding: clamp(1.5rem, 0.6rem + 3.4vw, 3.25rem) max(var(--page), env(safe-area-inset-right)) calc(6rem + env(safe-area-inset-bottom)) max(var(--page), env(safe-area-inset-left));
}

.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: var(--gap); border-bottom: 1px solid var(--line); }
.pagehead .titles { display: grid; gap: 0.35rem; min-width: 0; }

.center-page { min-height: 100dvh; display: grid; place-items: center; padding: var(--page); text-align: center; }
.center-page .card { display: grid; gap: 0.9rem; justify-items: center; max-width: 30rem; }

/* ---------- Komponen ---------- */

.card { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); }
.pad { padding: var(--pad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 46px; padding: 0 1.3rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: transparent; color: var(--ink);
  font-weight: 600; font-size: 0.95rem; letter-spacing: 0.01em; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { border-color: transparent; background: var(--sunken); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 44px; padding: 0 0.9rem; font-size: 0.875rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; cursor: progress; pointer-events: none; }

.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.5rem; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--muted); font-size: 0.7rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.badge.accent { border-color: var(--gold); color: var(--gold-ink); }
.badge.off { border-color: var(--danger); color: var(--danger); }

.field { display: grid; gap: 0.45rem; }
.field > label, .field > .label { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.field .hint { color: var(--muted); font-size: 0.85rem; }
.field .error { color: var(--danger); font-size: 0.85rem; font-weight: 600; }

.input {
  width: 100%; min-height: 48px; padding: 0 0.95rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--dur-fast) ease;
}
.input::placeholder { color: var(--muted); opacity: 0.75; }
.input:hover { border-color: var(--ink); }
.input:focus-visible { outline-offset: 1px; border-color: var(--gold); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled { background: var(--sunken); color: var(--muted); }
select.input { padding-right: 0.5rem; }

.color { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.color input[type="color"] { width: 48px; height: 48px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; flex: none; }
.color .input { width: 8.5rem; flex: none; font-family: var(--mono); text-transform: uppercase; }
.swatches { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--gold); }

.iconpick { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.iconpick img { width: 72px; height: 72px; border-radius: 16px; background: var(--sunken); box-shadow: 0 0 0 1px var(--line-strong); object-fit: cover; flex: none; }
.iconpick .picks { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.iconpick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.iconpick input[type="file"]:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 3px; }

details.more { border-top: 1px solid var(--line); padding-top: var(--gap); }
details.more summary { cursor: pointer; min-height: 32px; color: var(--muted); font-size: 0.72rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; }
details.more[open] summary { margin-bottom: var(--gap); }

.steps-big { list-style: none; counter-reset: langkah; margin: 0; padding: 0; display: grid; gap: var(--gap); }
.steps-big > li { counter-increment: langkah; display: grid; gap: 0.6rem; padding-top: var(--gap); border-top: 1px solid var(--line); }
.steps-big > li::before { content: counter(langkah); font-family: var(--display); font-size: 0.95rem; font-weight: 600; color: var(--on-accent); background: var(--accent); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.target { display: block; padding: 0.6rem 0.75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--sunken); font-size: 0.85rem; }
pre.code { margin: 0; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--sunken); color: var(--ink); font-family: var(--mono); font-size: 0.78rem; line-height: 1.5; max-height: 16rem; overflow: auto; white-space: pre-wrap; word-break: break-all; }

.switch { flex: none; position: relative; width: 52px; height: 30px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--sunken); cursor: pointer; display: block; transition: background-color var(--dur-base) ease, border-color var(--dur-base) ease; }
/* Pil tetap 52x30 secara visual; area sentuh dilebarkan jadi 52x44 untuk jempol. */
.switch::after { content: ""; position: absolute; inset: -7px 0; border-radius: inherit; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
/* Knob meluncur dengan transform, bukan berpindah lewat properti tata letak. */
.switch .knob { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform var(--dur-base) var(--ease-out), background-color var(--dur-base) ease; }
.switch[aria-checked="true"] .knob { background: var(--on-accent); transform: translateX(22px); }
@media (prefers-reduced-motion: reduce) { .switch .knob { transition: background-color var(--dur-base) ease; } }

/* Daftar keterangan: istilah tebal, penjelasan menjorok sedikit. */
.desc { display: grid; gap: 0.15rem; margin: 0; }
.desc dt { font-weight: 600; font-size: 0.9rem; }
.desc dd { margin: 0 0 0.7rem; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.desc dd:last-child { margin-bottom: 0; }

.notice { display: grid; gap: 0.3rem; padding: 0.8rem 1rem; border: 1px solid var(--line-strong); border-left-width: 3px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--ink); font-size: 0.9rem; }
.notice.good { border-left-color: var(--accent); }
.notice .mono { color: var(--muted); }

/* ---------- Halaman masuk ---------- */

.hero { display: grid; gap: clamp(2rem, 1rem + 4vw, 4.5rem); align-items: center; grid-template-columns: minmax(0, 1fr); min-height: 100dvh; width: min(1120px, 100%); margin-inline: auto; padding: clamp(2rem, 1rem + 4vw, 4rem) max(var(--page), env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(var(--page), env(safe-area-inset-left)); }
.hero .copy { display: grid; gap: 1.35rem; justify-items: start; }
.hero .copy > * { transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.hero .copy > :nth-child(2) { transition-delay: 50ms; }
.hero .copy > :nth-child(3) { transition-delay: 100ms; }
.hero .copy > :nth-child(4) { transition-delay: 150ms; }
.hero .copy > :nth-child(n + 5) { transition-delay: 200ms; }
@starting-style { .hero .copy > * { opacity: 0; transform: translateY(10px); } }
.hero .brand { padding-bottom: 0; }
.hero .lede { font-size: clamp(1.02rem, 0.92rem + 0.5vw, 1.2rem); color: var(--muted); max-width: 44ch; }
.hero form { display: grid; gap: 0.7rem; width: min(30rem, 100%); }
.hero .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; margin: 0.5rem 0 0; list-style: none; width: min(30rem, 100%); border-top: 1px solid var(--line); }
.hero .steps li { display: grid; gap: 0.15rem; padding: 0.85rem 0.75rem 0 0; font-size: 0.875rem; color: var(--muted); }
.hero .steps b { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--gold-ink); line-height: 1; }
.hero .art { display: none; justify-self: center; }

/* Bingkai ganda di belakang ponsel: satu-satunya hiasan di halaman. */
.frame { padding: clamp(1.5rem, 1rem + 2vw, 3rem); border: 1px solid var(--line-strong); outline: 1px solid var(--line); outline-offset: 7px; background: var(--surface); border-radius: 2px; }

@media (min-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
  .hero .art { display: block; }
}

/* ---------- Daftar aplikasi ---------- */

.apps { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.app { display: grid; gap: 1rem; padding: 1.25rem; align-content: start; }
.app .top { display: flex; gap: 0.9rem; align-items: center; min-width: 0; }
.app .top img { width: 54px; height: 54px; border-radius: 12px; flex: none; object-fit: cover; box-shadow: 0 0 0 1px var(--line-strong); }
.app .name { font-family: var(--display); font-weight: 600; font-size: 1.15rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app .host { color: var(--muted); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app .meta { padding-top: 0.9rem; border-top: 1px solid var(--line); }
/* Tiga tombol tidak muat di ponsel sempit; biarkan turun baris, jangan meluber. */
.app .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.app .actions .btn { flex: 1 1 7rem; min-width: 0; }
.app.new { place-items: center; align-content: center; text-align: center; border-style: dashed; border-color: var(--line-strong); box-shadow: none; background: transparent; min-height: 12rem; color: var(--muted); text-decoration: none; font-size: 0.74rem; font-weight: 650; letter-spacing: 0.16em; text-transform: uppercase; transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease; }
.app.new > span { display: grid; gap: 0.7rem; justify-items: center; }
.app.new:hover { border-color: var(--gold); color: var(--ink); }
.app.new .plus { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-family: var(--display); font-size: 1.5rem; line-height: 1; letter-spacing: 0; }

.empty { text-align: center; padding: clamp(2.5rem, 1rem + 7vw, 5rem) 1.25rem; display: grid; gap: 1rem; justify-items: center; }

/* ---------- Editor ---------- */

.editor { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.editor .preview { order: -1; }
@media (min-width: 900px) {
  .editor { grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); }
  .editor .preview { order: 0; position: sticky; top: 5.5rem; }
}

.two { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }

.preview { display: grid; gap: 1.1rem; justify-items: center; padding-block: 1.5rem; }

/* Ponsel tiruan: ukurannya mengikuti tinggi layar agar tidak pernah terpotong. */
.phone {
  --w: min(15rem, 62vw, 34dvh);
  width: var(--w); aspect-ratio: 9 / 18.5;
  border: calc(var(--w) * 0.032) solid #1D1B17; border-radius: calc(var(--w) * 0.13);
  background: #1D1B17; overflow: hidden; position: relative;
  box-shadow: 0 0 0 1px #3A362E, 0 22px 44px -22px rgb(29 27 23 / 55%);
  display: grid; grid-template-rows: auto 1fr;
}
.phone .status { height: calc(var(--w) * 0.1); display: flex; align-items: center; justify-content: space-between; padding-inline: 9%; font-size: calc(var(--w) * 0.045); font-weight: 650; }
.phone .status i { width: 22%; height: 34%; border-radius: 999px; background: currentColor; opacity: 0.85; }
.phone .screen { display: grid; place-items: center; }
.phone .screen img { width: 34%; aspect-ratio: 1; border-radius: 22%; object-fit: cover; box-shadow: 0 6px 16px rgb(0 0 0 / 18%); }
.phone .bar { position: absolute; bottom: 2.2%; left: 34%; right: 34%; height: 1.1%; border-radius: 999px; background: rgb(128 128 128 / 60%); }

@media (max-width: 899px) {
  .phone { --w: min(9.5rem, 40vw, 26dvh); }
  .preview { grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: start; gap: 1.25rem; padding: 1.1rem; }
}

.launcher { display: grid; justify-items: center; gap: 0.4rem; max-width: 100%; }
.launcher img { width: 56px; height: 56px; border-radius: 13px; object-fit: cover; box-shadow: 0 0 0 1px var(--line-strong); }
.launcher span:last-child { font-size: 0.8rem; max-width: 11ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 899px) { .launcher { justify-items: start; } }

.actionbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
  margin-inline: calc(-1 * var(--pad)); margin-bottom: calc(-1 * var(--pad));
  padding: 0.9rem var(--pad) calc(0.9rem + env(safe-area-inset-bottom));
  background: var(--glass);
  backdrop-filter: var(--blur);
  border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
}
.actionbar .btn.primary { flex: 1 1 9rem; }

.result { display: grid; gap: 0.85rem; border-color: var(--gold); background: var(--glass); backdrop-filter: var(--blur); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
@starting-style { .result { opacity: 0; transform: translateY(8px); } }
.result .ok { display: flex; align-items: center; gap: 0.7rem; font-family: var(--display); font-weight: 600; font-size: 1.25rem; line-height: 1.2; }
.result .tick { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; font-family: var(--font); font-size: 0.95rem; }

.list { display: grid; }
.list > * { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; padding-top: 0; }
.list > *:last-child { padding-bottom: 0; }

/* ---------- Pengguna ---------- */

.user { display: grid; gap: 0.75rem; grid-template-columns: minmax(0, 1fr); align-items: center; padding: 1rem 0; border-top: 1px solid var(--line); }
.user:first-child { border-top: 0; padding-top: 0; }
.user:last-child { padding-bottom: 0; }
.user > .row { flex-wrap: nowrap; align-items: flex-start; }
.user .controls { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.user .controls select { min-height: 44px; width: auto; }
@media (min-width: 720px) { .user { grid-template-columns: minmax(0, 1fr) auto; } }

/* ---------- Dialog dan toast ---------- */

dialog {
  border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink);
  background: var(--glass);
  backdrop-filter: var(--blur);
  padding: var(--pad); width: min(27rem, calc(100vw - 2rem)); box-shadow: var(--shadow);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
dialog > * + * { margin-top: 0.75rem; }
dialog::backdrop { background: rgb(18 17 15 / 45%); backdrop-filter: blur(3px); transition: opacity var(--dur-base) ease; }
@starting-style {
  dialog[open] { opacity: 0; transform: scale(0.97); }
  dialog[open]::backdrop { opacity: 0; }
}
dialog .row { justify-content: flex-end; margin-top: 1.5rem; }

.toasts { position: fixed; z-index: 60; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 0.5rem; width: min(26rem, calc(100vw - 2rem)); pointer-events: none; }
/* Toast memakai transition (bukan keyframes) supaya bisa diinterupsi, dan keluar lewat jalur masuknya. */
.toast { background: var(--ink); color: var(--bg); padding: 0.8rem 1.1rem; border-radius: var(--radius-sm); border-left: 3px solid var(--gold); box-shadow: var(--shadow); font-size: 0.925rem; font-weight: 550; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.toast.bad { border-left-color: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(8px); }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.skeleton { border-radius: var(--radius); background: var(--sunken); min-height: 12rem; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: 0.55; } }

/* ---------- Gerak: gerbang pointer dan gerak dikurangi ---------- */

@media (hover: hover) and (pointer: fine) {
  .app.new { transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-base) var(--ease-out); }
  .app.new:hover { transform: translateY(var(--lift, -2px)); }
}

/* Gerak dikurangi: warna dan opasitas tetap, perpindahan posisi dan skala dibuang. */
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
  .app.new { --lift: 0; }
  .toast.leaving, dialog[open] { transform: none; }
  .hero .copy > *, .result { transition-property: opacity; transition-delay: 0s; }
  .spinner { animation-duration: 1.6s; }
  .skeleton { animation: none; }
  @starting-style {
    .hero .copy > *, .result, .toast, dialog[open] { transform: none; }
  }
}

/* Peramban tanpa backdrop-filter: permukaan solid, bukan tembus pandang tanpa blur. */
@supports not (backdrop-filter: blur(1px)) {
  .topbar { background: var(--bg); }
  .card, .actionbar, dialog, .result { background: var(--surface); }
}

/* Permintaan sistem untuk mengurangi transparansi dihormati penuh. */
@media (prefers-reduced-transparency: reduce) {
  body::before { display: none; }
  .topbar { background: var(--bg); backdrop-filter: none; box-shadow: none; }
  .card, .actionbar, dialog, .result { background: var(--surface); backdrop-filter: none; }
  dialog::backdrop { backdrop-filter: none; background: rgb(18 17 15 / 70%); }
}

/* ---------- Penyesuaian ukuran layar ---------- */

@media (max-width: 520px) {
  .topbar { position: static; gap: 0.25rem 1rem; }
  .actionbar { gap: 0.5rem; }
  .actionbar .btn { padding-inline: 0.8rem; }
  .iconpick img { width: 64px; height: 64px; border-radius: 14px; }
  .me .who { display: none; }
  .me { margin-left: auto; }
  .nav { order: 3; width: 100%; margin: 0; gap: 0; }
  .nav a { flex: 1 1 0; justify-content: center; }
  .hero .steps li { padding-right: 0.4rem; }
}

/* Di bawah 360 px kedua tombol tidak muat sebaris; bilah aksi ikut menggulir agar tidak menutupi form. */
@media (max-width: 359px) {
  .actionbar { position: static; }
}

/* Layar pendek (ponsel mendatar): bilah tidak lagi menempel agar isi tetap terlihat. */
@media (max-height: 480px) {
  .topbar, .actionbar { position: static; }
  .editor .preview { position: static; }
  .hero { min-height: 0; }
}

/* Mode terpasang (standalone): beri ruang untuk area aman perangkat. */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(0.85rem + env(safe-area-inset-top)); }
}
