@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-latin.woff2') format('woff2');
  font-weight: 500 800;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/figtree-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --tenda: #0a2d8f;
  --tenda-dark: #00237a;
  --langit: #29abe2;
  --langit-muda: #d3eefb;
  --lombok: #ec2029;
  --kunyit: #ffc21a;
  --pandan: #14a06a;
  --kertas: #f6f7fb;
  --putih: #ffffff;
  --tinta: #121633;
  --tinta-2: #4a5073;
  --garis: #d9dcea;
  --display: 'Bricolage Grotesque', 'Arial Black', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--tinta);
  background: var(--kertas);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; line-height: 1.05; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---- tenda warung (satu-satunya elemen dekoratif) ---- */
.awning {
  position: relative;
  height: 54px;
  filter: drop-shadow(0 4px 0 var(--tinta));
}
.awning::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, var(--tenda) 0 40px, var(--putih) 40px 80px);
  -webkit-mask:
    radial-gradient(circle at 20px calc(100% - 20px), #000 19.6px, transparent 20px) bottom left / 40px 40px repeat-x,
    linear-gradient(#000 0 0) top / 100% calc(100% - 20px) no-repeat;
  mask:
    radial-gradient(circle at 20px calc(100% - 20px), #000 19.6px, transparent 20px) bottom left / 40px 40px repeat-x,
    linear-gradient(#000 0 0) top / 100% calc(100% - 20px) no-repeat;
}

/* ---- layout peserta ---- */
.app { max-width: 560px; margin: 0 auto; padding: 0 18px 120px; }
.screen { padding-top: 34px; }
.brandbar { display: flex; align-items: center; gap: 14px; }
.logo { width: 76px; height: 76px; flex: none; display: block; }
.title { font-size: clamp(30px, 8.6vw, 42px); font-weight: 800; }
.by { margin: 4px 0 0; font-weight: 700; color: var(--tenda); font-size: 17px; }
.subtitle { color: var(--tinta-2); margin: 10px 0 0; font-size: 17px; max-width: 34ch; }

.field { margin-top: 26px; }
.field label, .field .label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 17px; }
.input {
  width: 100%;
  border: 2.5px solid var(--tinta);
  border-radius: 14px;
  background: var(--putih);
  padding: 14px 16px;
  font-size: 19px;
  font-weight: 600;
  outline: none;
}
.input:focus-visible { box-shadow: 0 0 0 4px rgba(10, 45, 143, 0.28); border-color: var(--tenda); }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; border: 0; }
.opt {
  display: flex; align-items: center; gap: 10px;
  text-align: left;
  border: 2.5px solid var(--garis);
  border-radius: 14px;
  background: var(--putih);
  padding: 12px 12px;
  min-height: 64px;
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.15;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.opt .emoji { font-size: 28px; line-height: 1; flex: none; }
.opt:active { transform: scale(0.97); }
.opt[aria-checked='true'] {
  border-color: var(--tinta);
  background: var(--langit-muda);
  box-shadow: 3px 3px 0 var(--tinta);
}
.opt:focus-visible { outline: 3px solid var(--tenda); outline-offset: 2px; }

.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--kertas) 70%, rgba(246, 247, 251, 0));
  z-index: 5;
}
.cta-bar .inner { max-width: 560px; margin: 0 auto; }
.btn {
  width: 100%;
  border: 2.5px solid var(--tinta);
  border-radius: 16px;
  background: var(--lombok);
  color: var(--putih);
  font-family: var(--display);
  font-weight: 800;
  font-size: 21px;
  padding: 15px 18px;
  box-shadow: 4px 4px 0 var(--tinta);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--tinta); }
.btn:disabled { opacity: 0.45; box-shadow: none; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--tenda); outline-offset: 3px; }
.btn.secondary { background: var(--putih); color: var(--tinta); font-size: 17px; padding: 11px 14px; box-shadow: 3px 3px 0 var(--tinta); }
.hint { margin: 10px 2px 0; color: var(--tinta-2); font-size: 14.5px; min-height: 1.3em; }
.error { color: var(--lombok); font-weight: 700; }

/* ---- layar mewarnai ---- */
.color-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.color-head h2 { font-size: clamp(26px, 7.5vw, 34px); font-weight: 800; }
.color-head .who { color: var(--tinta-2); font-size: 15px; font-weight: 600; }
.stage {
  position: relative;
  margin-top: 16px;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2.5px solid var(--tinta);
  border-radius: 18px;
  overflow: hidden;
  background: var(--putih);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.stage svg, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage svg .fillable { cursor: pointer; }
.stage canvas { pointer-events: none; }
.stage-badge {
  position: absolute; top: 3%; right: 3%; width: 17%; aspect-ratio: 1 / 1;
  box-sizing: border-box; padding: 1.4%;
  border-radius: 50%; background: #fff; border: 1.5px solid var(--tinta);
  pointer-events: none; z-index: 2;
}
.stage-badge img { display: block; width: 100%; height: 100%; }
.stage.brush canvas { pointer-events: auto; touch-action: none; }
.stage.brush svg { pointer-events: none; }

.tools { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tool {
  flex: 1 1 0; min-width: 0;
  border: 2.5px solid var(--tinta);
  border-radius: 12px;
  background: var(--putih);
  padding: 9px 6px;
  font-weight: 700;
  font-size: 15px;
}
.tool[aria-pressed='true'] { background: var(--tenda); color: var(--putih); }
.tool:disabled { opacity: 0.4; }
.tool:focus-visible { outline: 3px solid var(--lombok); outline-offset: 2px; }

.sizes { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.sizes .lbl { font-weight: 700; font-size: 15px; margin-right: 2px; }
.size {
  width: 46px; height: 40px; border-radius: 10px;
  border: 2.5px solid var(--garis); background: var(--putih);
  display: grid; place-items: center;
}
.size i { display: block; border-radius: 50%; background: var(--tinta); }
.size[aria-pressed='true'] { border-color: var(--tinta); background: var(--langit-muda); }
.size:focus-visible { outline: 3px solid var(--tenda); outline-offset: 2px; }

.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-top: 14px; }
.swatch {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2.5px solid var(--tinta);
  padding: 0;
  position: relative;
}
.swatch[aria-checked='true']::after {
  content: ''; position: absolute; inset: -7px; border-radius: 50%;
  border: 3px solid var(--tenda);
}
.swatch:focus-visible { outline: 3px solid var(--lombok); outline-offset: 3px; }

/* ---- layar selesai ---- */
.done-art {
  margin-top: 22px;
  border: 2.5px solid var(--tinta);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--tinta);
  overflow: hidden;
  background: var(--putih);
  transform: rotate(-1.2deg);
}
.done-art img { display: block; width: 100%; height: auto; }
.done-note { margin-top: 26px; font-size: 18px; font-weight: 600; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.45); border-top-color: #fff;
  display: inline-block; vertical-align: -3px; margin-right: 8px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (max-width: 360px) {
  .options { grid-template-columns: 1fr; }
}

/* ---- alur 3 langkah ---- */
.steps { display: flex; gap: 6px; margin-top: 22px; }
.steps i { flex: 1; height: 8px; border-radius: 99px; background: var(--garis); }
.steps i.on { background: var(--tenda); }
.stepname { margin: 8px 0 0; font-weight: 700; font-size: 14.5px; color: var(--tinta-2); text-transform: uppercase; letter-spacing: 0.04em; }
.opt-label { font-weight: 600; color: var(--tinta-2); font-size: 14px; }
.ferr { margin: 6px 2px 0; color: var(--lombok); font-weight: 700; font-size: 14.5px; min-height: 0; }
.ferr:empty { display: none; }
.input[aria-invalid='true'] { border-color: var(--lombok); }
.select {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--tinta) 50%), linear-gradient(135deg, var(--tinta) 50%, transparent 50%);
  background-position: calc(100% - 22px) 55%, calc(100% - 16px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}
.note { margin: 22px 0 0; color: var(--tinta-2); font-size: 14px; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.menu-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 118px; padding: 14px 8px 12px;
  border: 2.5px solid var(--garis); border-radius: 16px; background: var(--putih);
  text-align: center; font-weight: 800; font-size: 15.5px; line-height: 1.15;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.menu-card .mi { font-size: 44px; line-height: 1; }
.menu-card:active { transform: scale(0.97); }
.menu-card[aria-checked='true'] { border-color: var(--tinta); background: var(--langit-muda); box-shadow: 4px 4px 0 var(--tinta); }
.menu-card[aria-checked='true']::after {
  content: '✓'; position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--tenda); color: var(--putih); border: 2px solid var(--tinta);
  font-size: 15px; font-weight: 800; line-height: 22px; text-align: center;
}
.menu-card:focus-visible { outline: 3px solid var(--tenda); outline-offset: 2px; }

.picked {
  margin-top: 22px; display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 2.5px solid var(--tinta); border-radius: 16px;
  background: var(--langit-muda); box-shadow: 4px 4px 0 var(--tinta);
}
.picked-emoji { font-size: 52px; line-height: 1; }
.picked-label { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.1; }
#s-choice .title { margin-top: 26px; }
.choice-actions { display: grid; gap: 14px; margin-top: 26px; }
.choice-actions .btn.secondary { font-size: 19px; padding: 14px 16px; }

.modal {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 20px;
  background: rgba(10, 20, 70, 0.62);
  animation: fade 0.2s ease both;
}
.modal-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--putih); border: 2.5px solid var(--tinta); border-radius: 22px;
  box-shadow: 8px 8px 0 var(--tinta); padding: 26px 22px 22px;
}
.modal-logo { display: block; margin: 0 auto 10px; width: 84px; height: 84px; }
.modal-card h2 { font-size: 28px; font-weight: 800; }
.modal-card p { color: var(--tinta-2); font-size: 17px; margin: 12px 0 22px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
