:root {
  --red: #DB1514;
  --blue: #0090FF;
  --ink: #1d1d1f;
  --muted: #5f6368;
  --line: #e3e3e3;
  --bg: #fafafa;
  --card: #ffffff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

main { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 8px 0; }
h2 { font-size: 1.25rem; margin: 40px 0 12px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.tool { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.options { display: grid; gap: 12px; margin-bottom: 16px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; }
.chip input { accent-color: var(--red); margin: 0; }
.chip:has(input:checked) { border-color: var(--ink); font-weight: 600; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.swatch.merah { background: var(--red); }
.swatch.biru { background: var(--blue); }
.swatch.putih { background: #fff; box-shadow: inset 0 0 0 1px var(--muted); }
.chip input[type="color"] { width: 28px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; }
.hint { font-size: 0.9rem; color: var(--muted); }

.pick { display: block; position: relative; }
.pick input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pick span { display: block; text-align: center; background: var(--red); color: #fff; font-weight: 700; font-size: 1.1rem; padding: 16px; border-radius: 12px; cursor: pointer; }
.pick input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.pick input:disabled + span { opacity: 0.6; cursor: progress; }
.tip { font-size: 0.9rem; color: var(--muted); margin: 8px 0 0; }

.status { min-height: 1.5em; margin: 12px 0 0; }
.status.error { color: var(--red); font-weight: 600; }

.result { margin-top: 16px; display: grid; gap: 10px; justify-items: center; }
.result img { width: 177px; height: auto; border: 1px solid var(--line); }
/* Ganti background: foto bisa mendatar atau tegak, jadi pratinjau mengikuti bentuknya. */
.result.lebar img { width: auto; max-width: 100%; max-height: 60vh; }
.info { margin: 0; color: var(--muted); font-size: 0.95rem; text-align: center; }

.button { display: block; width: 100%; text-align: center; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 1rem; text-decoration: none; background: var(--ink); color: #fff; border: 1px solid var(--ink); cursor: pointer; text-wrap: balance; }
.button.secondary { background: #fff; color: var(--ink); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Layar sempit: tiap baris tabel jadi kartu supaya tidak perlu digeser ke samping. */
@media (max-width: 480px) {
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table-wrap td { border: 0; padding: 2px 0; display: grid; grid-template-columns: 5.5em 1fr; gap: 8px; }
  .table-wrap td:first-child { display: block; font-weight: 600; padding-bottom: 4px; }
  .table-wrap td:nth-child(2)::before { content: "Latar"; color: var(--muted); }
  .table-wrap td:nth-child(3)::before { content: "Ukuran"; color: var(--muted); }
  .table-wrap td:nth-child(4)::before { content: "Sumber"; color: var(--muted); }
}


.brand { margin: 0 0 4px; font-size: 0.9rem; font-weight: 700; }
.brand a { color: var(--red); text-decoration: none; }
.artikel ol, .artikel ul { padding-left: 1.3em; }
.artikel li { margin: 4px 0; }
.tabel-ukuran { max-width: 420px; }

.contoh { display: grid; gap: 20px; }
@media (min-width: 560px) { .contoh { grid-template-columns: 1fr 1fr; } }
.contoh figure { margin: 0; }
/* Kolom sebanding lebar asli (315 dan 354 px) supaya tinggi kedua foto sama. */
.contoh-pasangan { display: grid; grid-template-columns: 315fr 354fr; gap: 6px; }
.contoh-pasangan img { display: block; width: 100%; height: auto; border-radius: 6px; }
.contoh figcaption { margin-top: 6px; text-align: center; font-size: 0.9rem; color: var(--muted); }
.kredit { font-size: 0.8rem; color: var(--muted); }
.kredit a { color: inherit; }

.kebutuhan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.kebutuhan a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-size: 0.9rem; }

.donasi { margin-top: 40px; text-align: center; font-size: 0.9rem; color: var(--muted); }
.donasi summary { display: inline-block; list-style: none; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.donasi summary::-webkit-details-marker { display: none; }
.donasi-isi p { margin: 12px auto 0; max-width: 34em; }
.donasi-isi a { color: inherit; }
.qris { margin: 16px 0 0; display: grid; justify-items: center; gap: 8px; }
.qris figcaption { font-size: 0.85rem; }
/* Bingkai sudut ala jendela bidik kamera, senada dengan garis potong lembar 4R. */
.qris-frame {
  --c: var(--red); --len: 22px; --w: 3px;
  display: block; padding: 8px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--len) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--len) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--len) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--len) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--len) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--len) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--len) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--len) no-repeat,
    #fff;
}
.qris-frame img { display: block; width: 195px; height: 195px; }

footer { margin-top: 40px; color: var(--muted); font-size: 0.85rem; text-align: center; }
