/* AR Lukis: AR Drawing & Sketch for Kasih4u. Same Fredoka/Nunito sky+paper design family. */
@font-face { font-family: "Fredoka"; src: url("/assets/fonts/fredoka-latin.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
:root {
  --paper: #fff7ec; --sky: #bfe9ff; --ink: #1f2347; --muted: #4a4f78;
  --blue: #4361ee; --yellow: #ffb703; --red: #e63946; --green: #2a9d8f;
  --line: rgba(31,35,71,.14); --line-strong: rgba(31,35,71,.28);
  --f-d: "Fredoka", ui-rounded, system-ui, sans-serif;
  --f-b: "Nunito", ui-rounded, system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; min-height: 100%; font-family: var(--f-b); color: var(--ink); background: linear-gradient(180deg, var(--sky) 0, #e8f7ff 320px, var(--paper) 620px); }
.hidden { display: none !important; }
button, label.btn { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

/* ---------- Gallery view ---------- */
.top { display: flex; align-items: center; gap: 10px; max-width: 980px; margin: 0 auto; padding: calc(10px + var(--safe-t)) 16px 8px; }
.brand { font-family: var(--f-d); font-weight: 700; font-size: 1.55rem; letter-spacing: -.02em; }
.brand b { color: var(--red); }
.spacer { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-family: var(--f-d); font-weight: 700; text-decoration: none; box-shadow: 0 3px 0 var(--ink); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.wrap { max-width: 980px; margin: 0 auto; padding: 8px 16px calc(36px + var(--safe-b)); display: grid; gap: 16px; }
.hero { text-align: center; display: grid; gap: 8px; justify-items: center; }
.hero h1 { margin: 0; font-family: var(--f-d); font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1.1; }
.hero p { margin: 0; color: var(--muted); max-width: 560px; font-weight: 700; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; font-family: var(--f-d); font-weight: 700; font-size: 1.05rem; box-shadow: 0 3px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-primary { background: var(--yellow); }
.btn-mint { background: #cdf0df; }

.cats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 42px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-family: var(--f-d); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.card { display: grid; justify-items: center; gap: 6px; padding: 12px 10px; border-radius: 22px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 4px 0 var(--ink); transition: transform 120ms ease; }
.card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.card svg { width: 108px; height: 108px; display: block; fill: none; stroke: var(--ink); stroke-width: 4.3; stroke-linecap: round; stroke-linejoin: round; }
.card b { font-family: var(--f-d); font-size: 1rem; text-align: center; line-height: 1.15; }
.card small { font-size: .78rem; color: var(--muted); font-weight: 700; }

/* ---------- Fullscreen Studio view ---------- */
.studio { position: fixed; inset: 0; z-index: 20; background: #101322; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.studio.screen-mode { background: #fffdf7; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #101322; }
.studio.screen-mode #cam { display: none; }

.paper-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(67,97,238,.18) 1px, transparent 1px), linear-gradient(to bottom, rgba(67,97,238,.18) 1px, transparent 1px); background-size: 33.333% 33.333%; }

#overlay-wrap { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; }
#overlay-box { width: min(82vw, 82vh, 520px); height: min(82vw, 82vh, 520px); display: grid; place-items: center; transform-origin: center center; pointer-events: none; }
#overlay-svg { width: 100%; height: 100%; fill: none; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 2px rgba(255,255,255,.55)); }
#overlay-svg .prev { opacity: .35; }
#overlay-svg .curr { stroke-width: 5.8; }
#overlay-photo { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

#draw-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: none; }
.studio.screen-mode.drawing #draw-canvas { display: block; }

/* ---------- Studio HUD ---------- */
.s-top { position: absolute; top: calc(8px + var(--safe-t)); left: 8px; right: 8px; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; pointer-events: none; }
.s-top > * { pointer-events: auto; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 42px; min-height: 42px; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--ink); background: rgba(255,255,255,.94); color: var(--ink); font-family: var(--f-d); font-weight: 700; font-size: .92rem; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.pill.on { background: var(--yellow); }
.pill.mint { background: #cdf0df; }

.steps-bar { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; border: 2px solid var(--ink); background: rgba(255,255,255,.94); }
.steps-bar button { min-width: 34px; min-height: 34px; padding: 0 9px; border: 0; border-radius: 999px; background: transparent; font-family: var(--f-d); font-weight: 700; font-size: .86rem; }
.steps-bar button.on { background: var(--ink); color: #fff; }

.tip-card { position: absolute; top: calc(62px + var(--safe-t)); left: 12px; right: 12px; max-width: 440px; margin: 0 auto; z-index: 28; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 18px; border: 2.5px solid var(--ink); background: rgba(255,247,236,.96); box-shadow: 0 6px 18px rgba(0,0,0,.22); font-size: .88rem; font-weight: 700; }
.tip-card button { flex: none; min-width: 36px; min-height: 36px; border-radius: 999px; border: 2px solid var(--ink); background: var(--yellow); font-family: var(--f-d); font-weight: 700; }

.cam-err { position: absolute; inset: 0; z-index: 25; display: grid; place-items: center; padding: 20px; background: rgba(16,19,34,.82); }
.cam-err-box { max-width: 380px; text-align: center; padding: 20px; border-radius: 24px; border: 3px solid var(--ink); background: var(--paper); display: grid; gap: 12px; justify-items: center; }
.cam-err-box h3 { margin: 0; font-family: var(--f-d); font-size: 1.25rem; }
.cam-err-box p { margin: 0; color: var(--muted); font-weight: 700; font-size: .95rem; }

/* ---------- Bottom Control Dock ---------- */
.dock { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); max-width: 640px; margin: 0 auto; z-index: 30; padding: 10px 12px; border-radius: 22px; border: 2.5px solid var(--ink); background: rgba(255,247,236,.95); box-shadow: 0 6px 20px rgba(0,0,0,.25); display: grid; gap: 8px; }
.dock-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.slider-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-weight: 800; font-size: .85rem; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--blue); height: 26px; }
.swatches { display: flex; gap: 7px; align-items: center; }
.dot { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid var(--ink); padding: 0; }
.dot.on { box-shadow: 0 0 0 3px var(--yellow); transform: scale(1.1); }
.dot.c-ink { background: #111428; }
.dot.c-red { background: #e63946; }
.dot.c-blue { background: #2563eb; }
.dot.c-green { background: #16a34a; }
.dot.c-purple { background: #9b5de5; }
.dot.c-orange { background: #ff8c42; }
.dot.c-white { background: #ffffff; }
.mini-btn { min-width: 38px; min-height: 38px; padding: 0 10px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; font-family: var(--f-d); font-weight: 700; font-size: .9rem; }
.mini-btn.on { background: var(--yellow); }

/* ---------- Lock Mode ---------- */
.studio.locked .s-top, .studio.locked .dock, .studio.locked .tip-card { display: none; }
.unlock-btn { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; z-index: 40; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 2px solid rgba(31,35,71,.7); background: rgba(255,255,255,.78); font-family: var(--f-d); font-weight: 700; font-size: .9rem; }

.toast { position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 60; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--f-d); font-weight: 600; font-size: .95rem; pointer-events: none; text-align: center; max-width: 90vw; }
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pill { padding: 4px 9px; font-size: .84rem; min-height: 38px; }
}
