@font-face {
  font-family: "Syne";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/syne-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Syne";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/syne-latin-700.woff2") format("woff2");
}

@font-face {
  font-family: "Syne";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/syne-latin-800.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/manrope-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/manrope-latin-500.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/manrope-latin-600.woff2") format("woff2");
}

:root {
  --ink: #102027;
  --ink-soft: #3d5160;
  --paper: #edf2f6;
  --paper-2: #f7fafc;
  --teal: #0f766e;
  --teal-deep: #115e59;
  --teal-soft: rgba(15, 118, 110, 0.12);
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --line: rgba(16, 32, 39, 0.12);
  --ok: #047857;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 18px;
  --shadow-soft: 0 18px 50px rgba(16, 32, 39, 0.08);
  --font-brand: "Syne", "Trebuchet MS", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 55% at 12% -10%, rgba(15, 118, 110, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 95% 8%, rgba(194, 65, 12, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(14, 116, 144, 0.1), transparent 55%),
    linear-gradient(165deg, #e8eef3 0%, #f4f7fa 45%, #e7eef2 100%);
  animation: atmosphere-shift 14s var(--ease) infinite alternate;
}

@keyframes atmosphere-shift {
  from {
    filter: hue-rotate(0deg) saturate(1);
  }
  to {
    filter: hue-rotate(8deg) saturate(1.08);
  }
}

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.15rem max(1.5rem, env(safe-area-inset-bottom));
  display: grid;
  gap: 1.15rem;
  min-height: 100dvh;
  align-content: start;
}

.brand {
  text-align: left;
  animation: rise 0.7s var(--ease) both;
}

.brand__mark {
  margin: 0;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 3.35rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--teal-deep);
}

.brand__headline {
  margin: 0.85rem 0 0.35rem;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: clamp(1.15rem, 3.6vw, 1.45rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand__lead {
  margin: 0;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.stage {
  display: grid;
  gap: 0.75rem;
  animation: rise 0.8s var(--ease) 0.08s both;
}

.viewfinder {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: min(62dvh, 560px);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.2)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 10px,
      rgba(15, 118, 110, 0.03) 10px,
      rgba(15, 118, 110, 0.03) 11px
    ),
    var(--paper-2);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
}

@media (min-width: 720px) {
  .viewfinder {
    aspect-ratio: 4 / 3;
    max-height: min(58dvh, 480px);
  }
}

.reader {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.reader,
.reader > *,
#reader__scan_region,
#reader__scan_region > * {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border: 0 !important;
}

.reader video,
.reader canvas,
.reader img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border: 0 !important;
}

/* Hide default html5-qrcode UI chrome */
#reader__dashboard_section,
#reader__header_message,
#reader__status_span,
#reader__scan_region > img,
#qr-shaded-region {
  display: none !important;
}

#reader__scan_region {
  position: absolute !important;
  inset: 0 !important;
  min-height: 100% !important;
}

.viewfinder__chrome {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
}

.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid var(--teal);
  opacity: 0.9;
}

.corner--tl {
  top: 14px;
  left: 14px;
  border-right: 0;
  border-bottom: 0;
}

.corner--tr {
  top: 14px;
  right: 14px;
  border-left: 0;
  border-bottom: 0;
}

.corner--bl {
  bottom: 14px;
  left: 14px;
  border-right: 0;
  border-top: 0;
}

.corner--br {
  bottom: 14px;
  right: 14px;
  border-left: 0;
  border-top: 0;
}

.scanline {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 2px;
  top: 18%;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  opacity: 0;
  box-shadow: 0 0 12px rgba(15, 118, 110, 0.45);
}

.viewfinder.is-scanning .scanline {
  opacity: 1;
  animation: scan-move 2.4s var(--ease) infinite;
}

@keyframes scan-move {
  0% {
    top: 16%;
  }
  50% {
    top: 78%;
  }
  100% {
    top: 16%;
  }
}

.viewfinder__idle {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  gap: 0.35rem;
  padding: 1.5rem;
  text-align: center;
  background: radial-gradient(circle at 50% 40%, rgba(15, 118, 110, 0.08), transparent 55%);
  transition: opacity 0.35s var(--ease);
}

.viewfinder.is-live .viewfinder__idle,
.viewfinder.is-busy .viewfinder__idle {
  opacity: 0;
  pointer-events: none;
}

.idle__title {
  margin: 0;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.2rem;
}

.idle__text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.status {
  margin: 0;
  min-height: 1.35em;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.25s ease;
}

.status.is-ok {
  color: var(--ok);
}

.status.is-warn {
  color: var(--warn);
}

.status.is-error {
  color: var(--danger);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  animation: rise 0.85s var(--ease) 0.14s both;
}

.controls .btn--primary {
  grid-column: 1 / -1;
}

/* Saat kamera diblokir portal: tonjolkan Ambil foto sebagai jalur utama */
body.is-restricted .controls .btn--primary {
  order: 2;
}

body.is-restricted #btn-capture {
  order: 1;
  grid-column: 1 / -1;
}

@media (min-width: 560px) {
  .controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .controls .btn--primary {
    grid-column: auto;
  }
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  text-align: center;
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--teal);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--teal-deep);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
  color: var(--ink);
}

.btn--secondary:hover:not(:disabled) {
  background: #fff;
  border-color: rgba(15, 118, 110, 0.35);
}

.btn--accent {
  background: var(--accent);
  color: #fff;
}

.btn--accent:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: rgba(16, 32, 39, 0.28);
}

.inapp {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.75rem 1rem 0;
  animation: rise 0.5s var(--ease) both;
}

.inapp__inner {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 1px solid rgba(194, 65, 12, 0.25);
  color: #7c2d12;
}

.inapp__title {
  margin: 0;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1rem;
}

.inapp__text {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

.inapp__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.inapp__hint {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  opacity: 0.9;
}

.foot {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-align: center;
  opacity: 0.85;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120%);
  z-index: 40;
  max-width: min(92vw, 420px);
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: var(--ink);
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 12px 40px rgba(16, 32, 39, 0.28);
  transition: transform 0.35s var(--ease);
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
