:root {
  --bg: #fff7ef; --card: #ffffff; --ink: #3d2633; --muted: #8a7480; --line: #f0dfd2;
  --accent: #e04f5f; --accent-dark: #b33645; --gold: #f5b83d; --ok: #2f9e6e; --warn: #e08a1e;
  --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Fredoka', system-ui, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
code { background: #fbeee4; padding: 2px 6px; border-radius: 6px; font-size: .9em; }
/* Satu aturan font: semua judul pakai Silkscreen (pixel), selain itu Fredoka. */
h1, h2, h3 { font-family: 'Silkscreen', monospace; font-weight: 400; line-height: 1.25; letter-spacing: .5px; }
h1 { font-size: 26px; margin: 0 0 8px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.big-emoji { font-size: 56px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: #fff; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.brand { font-family: 'Silkscreen', monospace; font-size: 18px; color: var(--ink); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.topbar nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.topbar nav form { margin: 0; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }

.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 6px 0 var(--line); }
.narrow { max-width: 440px; margin: 20px auto; }
.narrow-wide { max-width: 680px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 16px 'Fredoka', sans-serif;
  border: 0; border-radius: 12px; padding: 11px 20px; background: var(--accent); color: #fff; cursor: pointer;
  text-decoration: none; box-shadow: 0 4px 0 var(--accent-dark);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.danger { background: #fff; color: var(--accent); border: 2px solid #f3c4c9; box-shadow: 0 4px 0 #f3c4c9; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 2px 4px; }
.link-btn.danger { color: var(--accent); }
.link-btn:disabled { opacity: .3; cursor: not-allowed; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: #e3f6ec; color: #1d6b49; }
.flash.err { background: #fde7e9; color: #9c2633; }
.note { background: #fff4dc; padding: 10px 14px; border-radius: 10px; font-size: 15px; }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 15px; }
.field input:not([type=checkbox]):not([type=file]):not([type=color]), .field textarea, .field select {
  width: 100%; font: 16px 'Fredoka', sans-serif; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fffdfb; color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field input[type=color] { height: 44px; padding: 4px; width: 80px; }
.help { color: var(--muted); font-size: 13px; }
.group { border: 2px dashed var(--line); border-radius: 14px; padding: 14px 16px 16px; margin: 0; display: grid; gap: 14px; }
.group legend { font-weight: 700; padding: 0 6px; }
.list-items { display: grid; gap: 12px; }
.list-item { background: #fffaf5; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 12px; }
.list-head { display: flex; justify-content: space-between; align-items: center; }
.select-row { display: flex; gap: 10px; align-items: center; }
.sprite-preview { flex: none; width: 48px; height: 48px; background-size: 576px 528px; image-rendering: pixelated; border-radius: 8px; background-color: #e9f5d8; }
.image-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.image-inputs { display: grid; gap: 6px; flex: 1; min-width: 220px; }
.thumb { width: 110px; height: 82px; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); background: #fbeee4; }
.thumb.empty { display: grid; place-items: center; font-size: 12px; color: var(--muted); text-align: center; }
.editor { display: grid; gap: 18px; }
.save-bar { position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-top: 2px solid var(--line); }
.reset-form { margin-top: 14px; text-align: right; }

.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th, .table td { text-align: left; padding: 14px 16px; border-bottom: 2px solid var(--line); vertical-align: top; }
.table th { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.actions form { margin: 0; }
.access-row { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; background: #fbeee4; font-size: 13px; font-weight: 500; }
.badge.gold { background: #fff0c9; color: #8a5a00; margin-left: 6px; }
.badge.warn { background: #fff0dc; color: #9a5a00; }
.badge.ok { background: #e3f6ec; color: #1d6b49; }

.tpl-checks { display: grid; gap: 10px; }
.tpl-check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.tpl-check:has(input:checked) { border-color: var(--accent); background: #fff5f5; }
.tpl-check input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--accent); }
.tpl-check span { display: grid; }
.tpl-check small { color: var(--muted); }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.tpl-card { display: grid; gap: 8px; align-content: start; }
.tpl-card h2 { margin: 0; font-size: 22px; }
.tpl-card p { margin: 0; }
.tpl-icon { font-size: 40px; }
.copy-row { display: flex; gap: 8px; margin: 6px 0; }
.copy-row input { flex: 1; min-width: 0; font: 14px 'Fredoka', sans-serif; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; background: #fffaf5; color: var(--muted); }
.copy-row.wide { margin-bottom: 18px; }
