html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    background: #f5f5f5ff;
    display: flex;
    flex-direction: column;
    
    /* padding: 0 0 80px 0; */
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

body.gap {
    gap: 20px;
}

:root{ --bg:#f6f7fb; --card:#fff; --ink:#0f172a; --muted:#64748b; --accent:#0b132b; --ring:#3b82f6; --radius:18px; }

/* >>> Kunci: Tidak ada scroll di level halaman <<< */
html, body { height: 100%; margin:0; overflow: hidden; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial; background: var(--bg); color:var(--ink); }


/* ===== FILM STRIPS ===== */
.strip-wrapper {
    position: relative;
    width: 120%;
    left: -10%;
    overflow: visible;
    will-change: transform;
    top: -15%;
}

.rotator {
    position: relative;
    transform-origin: center center;
}

.strip {
    display: flex;
    gap: 14px;
    will-change: transform, opacity;
}

.frame {
    width: 160px;
    height: 240px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e9e9e9ff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== OVERLAY (judul + tombol) ===== */
.overlay-box {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 20;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, .7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 24px 28px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .2), 0 0 0 1px rgba(0, 0, 0, .06);
    text-align: center;
    transition: opacity .45s ease, transform .45s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: fit-content;
    max-width: 90vw;
}

.overlay-box.hide {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.04);
}

.overlay-title.fancy {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    font-weight: 900;
    letter-spacing: -.02em;
    font-size: clamp(28px, 5.4vw, 56px);
    line-height: 1.03;
    margin: 0;
}

.kicker {
    flex-basis: 100%;
    display: block;
    font-weight: 700;
    font-size: clamp(10px, 1.4vw, 12px);
    letter-spacing: .22em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 8px;
}

.pair {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-width: 0;
}

.word-virtual {
    display: inline-block;
    line-height: 1;
    background: linear-gradient(90deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.accent {
    display: inline-flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    line-height: 1;
    padding: 6px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #111827 0%, #1f2937 40%, #0ea5e9 100%);
    color: #fff;
    box-shadow: 0 10px 24px rgba(2, 6, 23, .24), inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 1px rgba(255, 255, 255, .10);
}

.accent .shine {
    position: absolute;
    top: 0;
    left: -50%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, .65) 45%, transparent 70%);
    mix-blend-mode: screen;
    filter: blur(.4px);
    animation: shine-sweep 2.2s ease-in-out infinite;
}

@keyframes shine-sweep {
    from {
        transform: translateX(-100%);
        opacity: .35
    }

    60% {
        opacity: .6
    }

    to {
        transform: translateX(200%);
        opacity: .35
    }
}

.btn-start {
    appearance: none;
    border: 0;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(135deg, #111827, #1f2937);
    box-shadow: 0 10px 24px rgba(17, 24, 39, .22), inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .06);
    transition: transform .15s ease;
}

.btn-start:hover {
    transform: translateY(-1px);
}

.powered {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 10;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .10), 0 0 0 1px rgba(0, 0, 0, .06);
}

/* ===== GARMENT PICKER ===== */
.picker {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: none;
    place-items: center;
    background: radial-gradient(60% 50% at 50% 40%, rgba(255, 255, 255, .7), rgba(245, 245, 245, .95) 70%);
}

.picker.show {
    display: grid;
}

.picker-box {
    background: rgba(255, 255, 255, .8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .06);
    width: min(94vw, 920px);
    padding: 16px;
}

.picker-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.picker-title {
    font-weight: 800;
    font-size: clamp(18px, 2.8vw, 24px);
    color: #0f172a;
    margin: 0;
}

.gender-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, .05);
}

.btn-tab {
    appearance: none;
    border: 0;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    color: #334155;
    background: transparent;
    transition: background .2s ease;
}

.btn-tab.active {
    background: #111827;
    color: #fff;
}

.picker-main {
    margin-top: 6px;
}

.splide__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 260px;
}

.slide-card {
    width: 180px;
    height: 240px;
    border-radius: 14px;
    overflow: hidden;
    background: #e9e9e9;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.slide-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.splide__slide.is-active .slide-card {
    outline: 3px solid #0ea5e9;
    box-shadow: 0 10px 26px rgba(14, 165, 233, .35);
}

.picker-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.btn-continue {
    appearance: none;
    border: 0;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(135deg, #111827, #1f2937);
    box-shadow: 0 10px 24px rgba(17, 24, 39, .22), inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .06);
}

/* ===== CAMERA ===== */
.camera {
    /* position: fixed; */
    inset: 0;
    /* z-index: 15; */
    /* display: none; */
    /* max-width: 395px; */
    place-items: center;
    background: radial-gradient(60% 50% at 50% 40%, rgba(255, 255, 255, .6), rgba(245, 245, 245, .9) 70%);
}

.camera.show {
    display: grid;
}

.preview_box {
    inset: 0;
    place-items: center;
    background: radial-gradient(60% 50% at 50% 40%, rgba(255, 255, 255, .6), rgba(245, 245, 245, .9) 70%);
}

.preview_box.show {
    display: grid;
}

.cam-box {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    align-items: center;
    /* gap: 12px; */
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .6);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .18);
    /* width: min(92vw, 520px); */
    /* max-width: 395px; */
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 6px;
}

.btn-capture,
.btn-stop {
    appearance: none;
    border: 0;
    cursor: pointer;
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    background: #111827;
    box-shadow: 0 10px 24px rgba(17, 24, 39, .22), inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .06);
}

.btn-stop {
    background: #334155;
}

.preview {
    min-height: 0;
    height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 14px;
    box-sizing: border-box;
    display: none;
    opacity: 0;
    grid-template-rows: auto 1fr auto;
    gap: 12px;
    background: radial-gradient(1200px 800px at 50% -10%, #ffffff 0%, var(--bg) 70%);
}

.preview.is-visible {
    display: grid;
    opacity: 1;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.preview-result{
    min-height: 0;
    height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 14px;
    box-sizing: border-box;
    display: none;
    opacity: 0;
    grid-template-rows: auto 1fr auto;
    gap: 12px;
    background: radial-gradient(1200px 800px at 50% -10%, #ffffff 0%, var(--bg) 70%);
}

.preview-result.is-visible {
    display: grid;
    opacity: 1;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.preview img {
    /* width: 49%; */
    border-radius: 14px;
    /* box-shadow: 0 6px 18px rgba(0, 0, 0, .18); */
    /* background-size: cover; */
}

.imagepreview{
  position: relative;
  width: 100%;
  /* aspect-ratio: 3 / 4; */
  border-radius: 0px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  /* background:#0b1220; */
  /* box-shadow:0 6px 18px rgba(0,0,0,.18); */
}

#shot{
    width: 100%;
    height: 80vh;       
    object-fit: contain; 
}


.preview2 {
    /* height: 100; */
    width: 100%;
    /* max-width: 480px; */
    display: none;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    /* margin-top: 30%; */
    padding: 16px;
}

#selected_garment{
    /* width: 40%; */
}

.imagepreview2{
    display: flow-root;
    align-items: center;
    padding: 10px;
}

.preview2.show {
    display: flex;
}

.preview-result2{
    width: 100%;
    /* max-width: 480px; */
    display: none;
}

.preview-result2.show{
    display: block;
}


canvas#captureCanvas {
    display: none;
}



/* Layout 3 baris: header / scroller / CTA */
.wrap {
    height: 100%;
    /* penuh 100% tinggi viewport */
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 14px;
    box-sizing: border-box;
    display: none;
    opacity: 0;
    grid-template-rows: auto 1fr auto;
    /* HANYA bagian tengah yang bisa mengembang */
    gap: 12px;
    background: radial-gradient(1200px 800px at 50% -10%, #ffffff 0%, var(--bg) 70%);
}

.wrap.is-visible {
    display: grid;
    /* Change display first */
    opacity: 1;
    /* Other visible styles, e.g., transform: scale(1); */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    /* Animate opacity and transform */
}

.wrap_camera {
    min-height: 0;
    height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 14px;
    box-sizing: border-box;
    display: none;
    opacity: 0;
    grid-template-rows: auto 1fr auto;
    gap: 12px;
    background: radial-gradient(1200px 800px at 50% -10%, #ffffff 0%, var(--bg) 70%);
}

.wrap_camera.is-visible {
    display: grid;
    opacity: 1;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.wrap_background {
    height: 100%;
    /* penuh 100% tinggi viewport */
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 14px;
    box-sizing: border-box;
    display: none;
    opacity: 0;
    grid-template-rows: auto 1fr auto;
    /* HANYA bagian tengah yang bisa mengembang */
    gap: 12px;
    background: radial-gradient(1200px 800px at 50% -10%, #ffffff 0%, var(--bg) 70%);
}

.wrap_background.is-visible {
    display: grid;
    /* Change display first */
    opacity: 1;
    /* Other visible styles, e.g., transform: scale(1); */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    /* Animate opacity and transform */
}

.grid_background {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 12px;
    /* width: 400px; */
}

.media_bg {
    width: 100%;
    display: grid;
    place-items: center;
    padding: 10px;
    position: relative;
}

.media_bg img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 14px;
}

#resultImage{
    display: none;
}

/*  */

.meta_bg {
  font-size: 18px;
  font-weight: 600;
  margin: 10px;
  /* position: absolute; */
  bottom: 0;
  left: 0;
  /* width: 380px; */
  padding: 8px 12px;
  /* background: rgba(0, 0, 0, 0.5); */
  /* color: #fff; */
  box-sizing: border-box;
  border-bottom-right-radius: 14px;
  border-bottom-left-radius: 14px
}

.header,
.panel,
.cta {
    background: var(--card);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: 0 8px 18px rgba(2, 8, 23, .06), inset 0 0 0 1px rgba(2, 8, 23, .04);
}

/* Header */
.header {
    padding: 12px 14px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.title {
    /* font-size: clamp(20px, 4.8vw, 26px); */
    font-weight: 800;
    font-size: clamp(18px, 2.8vw, 24px);
    color: #0f172a;
    margin: 0;
}

.segmented {
    display: inline-flex;
    background: #eef2f7;
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
}

.segmented button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    transition: .18s;
}

.segmented button[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 6px 14px rgba(11, 19, 43, .22);
}

/* Panel konten (TIDAK scroll) */
.panel {
    padding: 8px;
    overflow: hidden;
    /* sembunyikan scrollbar parent */
    display: grid;
    grid-template-rows: 1fr;
    /* biar child .scroller mengisi ruang */
}

/* >>> Scroll HANYA di sini <<< */
.scroller {
    overflow-y: auto;
    /* vertical scroll aktif hanya di grid gambar */
    overscroll-behavior: contain;
    padding: 6px 4px 8px;
    mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}

/* Grid 2 kolom */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Kartu gambar – gambar tidak terpotong */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 18px rgba(2, 8, 23, .06), inset 0 0 0 1px rgba(2, 8, 23, .05);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: .16s;
}

.card:active {
    transform: translateY(1px)
}

.media {
    width: 100%;
    /* background: #f1f5f9; */
    display: grid;
    place-items: center;
    padding: 10px;
}

.media img {
    width: 100%;
    max-height: 400px;
    height: 100%;
    /* tinggi konsisten */
    object-fit: contain;
    /* <<< gambar utuh, tidak terpotong */
    display: block;
}

.meta {
    padding: 0px 10px 10px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card.is-selected {
    box-shadow: 0 10px 24px rgba(37, 99, 235, .18), inset 0 0 0 3px var(--ring) !important;
}

.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(15, 23, 42, .8);
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    display: none;
    z-index: 999;
}

.card.is-selected .badge {
    display: inline-block
}

/* CTA (tetap, tidak scroll) */

.cta.cta-camera button {
    width: 49%;
    border: 0;
    border-radius: 16px;
    background: var(--accent);
    color: #fff;
    padding: 15px 16px;
    font-weight: 800;
    font-size: clamp(16px, 4vw, 18px);
    box-shadow: 0 14px 30px rgba(11, 19, 43, .28);
    cursor: pointer;
    transition: .12s;
}

.btn-capture{

}

.cta {
    padding: 10px;
}

.cta button {
    width: 100%;
    border: 0;
    border-radius: 16px;
    background: var(--accent);
    color: #fff;
    padding: 15px 16px;
    font-weight: 800;
    font-size: clamp(16px, 4vw, 18px);
    box-shadow: 0 14px 30px rgba(11, 19, 43, .28);
    cursor: pointer;
    transition: .12s;
}

.cta button:active {
    transform: translateY(1px)
}

.cta button[disabled] {
    opacity: .45;
    box-shadow: none;
    cursor: not-allowed
}

/* container kamera sudah portrait */
.video-wrap{
  /* height: 75vh; */
  height: 100%;
  position: relative;
  width: 100%;
  /* aspect-ratio: 3 / 4; */
  border-radius: 14px;
  overflow: hidden;
  background:#0b1220;
  box-shadow:0 6px 18px rgba(0,0,0,.18);
}

/* default: selfie mirror + cover */
#camVideo{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);             /* mirror untuk selfie */
  transform-origin: center center;
}

/* jika feed datang landscape → putar 90° supaya preview tetap portrait */
#camVideo.landscape {
  /* urutan transform: scaleY(-1) dijalankan dulu, lalu rotate(90deg),
     hasil akhirnya tetap “mirror horizontal” di layar */
  transform: rotate(90deg) scaleY(-1);
  /* agar tetap menutup (cover) wadah setelah rotasi, naikkan tinggi sedikit */
  width: auto;
  height: 140%;                       /* tweak 120–160% jika perlu */
}

/* loading-screen */
#wrap_loading-screen {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: #111;
    display: none;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

#wrap_loading-screen.show{
    display: flex;
}

.loading-screen {
    max-width: 600px;
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #eee;
    border-top: 6px solid #333;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.stream-text {
    font-size: 1.1em;
    line-height: 1.6em;
    color: #111;
    background: #eee;
    padding: 10px;
    white-space: pre-wrap; /* preserve line breaks */
    text-align: left;
    /*border-left: 3px solid #3278e2ff;*/
    padding-left: 12px;
    border-radius: 20px;
    max-width: 395px;
}
