:root {
  --brand: #1a5b9e;
  --accent: #2b84e8;
  --accent-soft: #64b1ff;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --line: #d5d9e0;
  --text: #4f5661;
  --muted: #7a818c;
  --placeholder: #e2e5ea;
  --header-h: 56px;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.35 Roboto, "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button, select { font: inherit; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  flex: none;
  height: var(--header-h);
  padding: 0 16px;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { height: 28px; width: auto; aspect-ratio: 1768 / 568; display: block; }

.lang {
  display: flex;
  align-items: center;
  gap: 2px;
  color: rgba(255, 255, 255, .7);
}

.lang select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 6px;
  padding: 8px 20px 8px 6px;
  color: #fff;
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 4px center / 12px;
}

.lang select option { color: #222; }
.lang select:focus-visible { outline-color: #fff; }

/* Layout: handphone, area visual tetap terlihat saat opsi di-scroll */
.main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.visual {
  flex: 0 0 42%;
  min-height: 0;
  padding: 12px 16px 10px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.stage-wrap {
  grid-row: 1;
  min-height: 0;
  min-width: 0;
  container-type: size;
  display: grid;
  place-items: center;
}

.stage {
  position: relative;
  width: min(100cqw, 100cqh, 800px);
  height: min(100cqw, 100cqh, 800px);
  background: var(--placeholder);
  overflow: hidden;
}

.stage.has-image { background: transparent; }

.layers { position: absolute; inset: 0; }

.layers img,
.layers svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stage-angle {
  position: absolute;
  top: 10px;
  left: 12px;
  color: #333;
  font-size: clamp(13px, 2.4cqmin, 18px);
  font-weight: 500;
}

.stage-notice {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 16px);
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .85);
  color: #444;
  font-size: clamp(10px, 2cqmin, 12px);
  text-align: center;
}

.thumbs {
  grid-row: 2;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.thumb {
  position: relative;
  flex: 1 1 0;
  max-width: 96px;
  height: 64px;
  padding: 2px 2px 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  background: var(--placeholder);
  color: #111;
  font-size: 10.5px;
  line-height: 1.15;
  cursor: pointer;
}

.thumb[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.thumb.has-image { background: var(--surface); }
.thumb-art { position: relative; flex: 1; min-height: 0; display: block; }
.thumb-label { flex: none; }

/* Panel kanan */
.panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 14px 16px 20px;
}

.gates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.gate {
  height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}

.gate:hover { border-color: var(--accent-soft); }

.gate[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

.group { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
.group:last-child { margin-bottom: 0; }

.group legend { padding: 0; margin-bottom: 9px; }

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 55px;
  padding: 8px 10px 8px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: background-color .15s, color .15s, border-color .15s;
}

.option:last-child { margin-bottom: 0; }
.option:hover { border-color: var(--accent-soft); }

.option input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.option:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.option-name { min-width: 0; }

.option-price {
  margin-left: auto;
  padding-left: 8px;
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.option:has(input:checked) .option-price { font-weight: 500; }

/* Target sentuh 36px, ikon tetap kecil */
.info {
  position: relative;
  z-index: 2;
  flex: none;
  width: 36px;
  height: 36px;
  margin: -10px -12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  opacity: .75;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.info:hover, .info[aria-expanded="true"] { opacity: 1; }

.swatches {
  display: flex;
  gap: 15px;
  padding: 12px;
  min-height: 55px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.swatch {
  position: relative;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  border: 1px solid #8a9099;
}

.swatch input {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); border-color: transparent; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 5px; }

/* Bar total */
.totalbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--accent);
  color: #fff;
}

.total-text { display: flex; flex-direction: column; min-width: 0; }
.total-label { font-size: 13px; }
.total-label small { font-size: 11px; opacity: .9; }

.total-amount {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.total-amount.is-long { font-size: 20px; }

.next {
  flex: none;
  min-width: 103px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

.next:hover { color: var(--brand); }
.next:focus-visible { outline-color: #fff; }

/* Popover info */
.popover {
  position: fixed;
  z-index: 20;
  width: min(280px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 8px;
  background: #24303f;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}

.popover strong { display: block; font-weight: 500; margin-bottom: 2px; }

/* Ringkasan pesanan */
.summary {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 0;
  border-radius: 12px;
  color: var(--text);
}

.summary::backdrop { background: rgba(16, 32, 52, .55); }
.summary h2 { margin: 0 0 16px; font-size: 20px; font-weight: 500; color: #222; }
.summary h3 { margin: 0 0 6px; font-size: 14px; font-weight: 500; color: var(--brand); }
.summary-gate { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
}

.summary-line span:last-child { flex: none; font-variant-numeric: tabular-nums; }

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-weight: 500;
  color: #222;
}

.summary-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.summary-note { margin: 10px 0 18px; font-size: 12px; color: var(--muted); }
.summary-actions { display: flex; justify-content: flex-end; gap: 10px; }

.btn-ghost, .btn-solid {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.btn-solid { border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 500; }

/* Laptop & landscape: tiga kolom seperti mockup */
@media (min-width: 900px), (orientation: landscape) and (min-width: 640px) {
  :root { --header-h: 69px; }

  .header { padding: 0 42px 0 70px; }
  .logo { height: 30px; }

  .main { flex-direction: row; }

  .visual {
    flex: 1 1 0;
    min-width: 0;
    padding: clamp(12px, 3vh, 40px) clamp(12px, 2vw, 29px);
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: var(--thumb) minmax(0, 1fr);
    gap: clamp(12px, 3vw, 54px);
    --thumb: min(85px, calc((100dvh - var(--header-h) - 96px) / 4));
  }

  .stage-wrap { grid-column: 2; grid-row: 1; }

  .thumbs {
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 2vh, 20px);
  }

  .thumb {
    flex: none;
    width: var(--thumb);
    height: var(--thumb);
    max-width: none;
  }

  .panel { flex: 0 0 clamp(320px, 30vw, 386px); }
  .panel-scroll { padding: clamp(14px, 4vh, 39px) 29px 24px; }
  .gates { margin-bottom: clamp(16px, 3vh, 28px); }

  .totalbar {
    padding: clamp(10px, 3vh, 30px) 29px calc(clamp(10px, 3vh, 30px) + env(safe-area-inset-bottom));
  }

  .total-label { margin-bottom: 2px; }
  .total-amount { font-size: 30px; }
  .total-amount.is-long { font-size: 22px; }
  .next { height: 34px; }
}

/* HP landscape: tinggi layar sangat terbatas */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --header-h: 44px; }
  .header { padding: 0 16px; }
  .logo { height: 24px; }
  .option { min-height: 46px; }
  .total-amount { font-size: 22px; }
  .total-amount.is-long { font-size: 18px; }
  .next { min-width: 84px; height: 38px; }
}

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