/* ==========================================================================
   LookLite Web — "Studio"
   Stylesheet khusus versi web (dist/). Tidak dipakai APK.
   HP: bilah atas · panggung foto · laci alat · rel alat di bawah
   Desktop (≥ 960px): rel alat kiri · panggung · laci kanan
   ========================================================================== */

:root {
  /* Palet "sage": hijau keabu-abuan yang lembut */
  --bg: #e4eadf;
  --stage: #d6ddd0;
  --panel: #f3f5ef;
  --panel-2: #e9ede4;
  --panel-3: #dbe2d4;
  --line: rgba(47, 62, 50, 0.10);
  --line-2: rgba(47, 62, 50, 0.18);
  --ink: #26322a;
  --ink-2: rgba(38, 50, 42, 0.70);
  --ink-3: rgba(38, 50, 42, 0.48);
  --accent: #5b7a5f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 122, 95, 0.18);
  --good: #3f7d4c;
  --on-photo: #ffffff;
  --shadow: rgba(38, 55, 42, 0.18);
  --radius: 14px;
  --top-h: 54px;
  --rail-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, label { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg .fill { fill: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Kerangka
   -------------------------------------------------------------------------- */
.studio {
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: calc(var(--top-h) + var(--safe-t)) minmax(0, 1fr) auto calc(var(--rail-h) + var(--safe-b));
  grid-template-areas: "top" "stage" "tray" "rail";
}

/* --------------------------------------------------------------------------
   Bilah atas
   -------------------------------------------------------------------------- */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--safe-t) calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 40;
}

.tb-btn {
  height: 40px;
  min-width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.tb-btn:hover, .tb-btn:active { background: var(--panel-2); }
.tb-icon { padding: 0; }
.tb-label { font-weight: 600; font-size: 13px; }

.brandmark {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.wordmark {
  font-size: 17px;
  letter-spacing: -0.03em;
  font-weight: 500;
  color: var(--ink-2);
}
.wordmark b { color: var(--accent); font-weight: 800; }
.now-look {
  max-width: 100%;
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.tb-right { display: flex; align-items: center; gap: 4px; }

.save-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13.5px;
}
.save-btn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.save-btn:active { transform: scale(0.97); }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  padding: 6px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  box-shadow: 0 18px 50px var(--shadow);
  z-index: 60;
}
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-size: 14px;
}
.menu-item svg { width: 18px; height: 18px; color: var(--ink-2); }
.menu-item:hover, .menu-item:active { background: var(--panel-3); }

/* --------------------------------------------------------------------------
   Panggung foto
   -------------------------------------------------------------------------- */
.stage {
  grid-area: stage;
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--stage);
  touch-action: none;
}

#gl {
  position: absolute;
  display: block;
  box-shadow: 0 0 0 1px rgba(38, 55, 42, 0.08), 0 20px 50px var(--shadow);
}

.status-line {
  position: absolute;
  left: 12px;
  bottom: 8px;
  margin: 0;
  max-width: calc(100% - 24px);
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.canvas-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
}

.before-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 8;
}
.before-badge.visible, .before-badge.active { opacity: 1; }

/* Split */
.split-overlay { position: absolute; inset: 0; display: none; pointer-events: none; z-index: 6; }
.split-overlay.active { display: block; }
.split-badge {
  position: absolute;
  top: 10px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.55);
  color: var(--on-photo);
}
.split-badge.sebelum { left: 10px; }
.split-badge.sesudah { right: 10px; background: var(--accent); color: var(--accent-ink); }
.split-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--on-photo);
  pointer-events: auto;
  touch-action: none;
}
.split-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--on-photo);
  color: var(--ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: ew-resize;
}
.split-handle svg { width: 20px; height: 20px; stroke-width: 2.4; }

/* Crop */
.crop-overlay { position: absolute; inset: 0; display: none; z-index: 5; }
.crop-overlay.active { display: block; }
.crop-scrim { position: absolute; background: rgba(0, 0, 0, 0.62); pointer-events: none; }
.crop-box { position: absolute; border: 1.5px solid var(--on-photo); cursor: move; touch-action: none; }
.crop-grid-line { position: absolute; background: rgba(255, 255, 255, 0.28); pointer-events: none; }
.crop-grid-line.v1, .crop-grid-line.v2 { top: 0; bottom: 0; width: 1px; }
.crop-grid-line.h1, .crop-grid-line.h2 { left: 0; right: 0; height: 1px; }
.crop-grid-line.v1 { left: 33.33%; }
.crop-grid-line.v2 { left: 66.66%; }
.crop-grid-line.h1 { top: 33.33%; }
.crop-grid-line.h2 { top: 66.66%; }
.crop-corner { position: absolute; width: 18px; height: 18px; border: 3px solid var(--on-photo); pointer-events: none; }
.crop-corner.tl { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.crop-corner.tr { top: -3px; right: -3px; border-left: 0; border-bottom: 0; }
.crop-corner.bl { bottom: -3px; left: -3px; border-right: 0; border-top: 0; }
.crop-corner.br { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.crop-hint-badge {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--on-photo);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

/* Drop */
.stage.drop-active::after {
  content: "Lepaskan foto di sini";
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: rgba(91, 122, 95, 0.12);
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
  z-index: 30;
  pointer-events: none;
}

/* Sambutan */
.welcome {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.55), transparent 65%), rgba(214, 222, 208, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.studio[data-welcome="off"] .welcome { display: none; }
.welcome-card { width: min(360px, 100%); text-align: center; }
.welcome-mark { width: 72px; height: 72px; margin: 0 auto 18px; color: var(--accent); }
.welcome-mark svg { width: 72px; height: 72px; stroke-width: 2.4; }
.welcome h1 { font-size: 24px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 10px; }
.welcome p { margin: 0 0 22px; color: var(--ink-2); font-size: 14px; }
.welcome-primary {
  width: 100%;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 16px;
}
.welcome-primary svg { stroke-width: 2.6; }
.welcome-secondary {
  width: 100%;
  height: 46px;
  margin-top: 10px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
}
.welcome .welcome-drop { margin: 16px 0 0; font-size: 12px; color: var(--ink-3); }
@media (hover: none) { .welcome .welcome-drop { display: none; } }

/* --------------------------------------------------------------------------
   Rel alat
   -------------------------------------------------------------------------- */
.rail {
  grid-area: rail;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 calc(6px + var(--safe-r)) var(--safe-b) calc(6px + var(--safe-l));
  background: var(--bg);
  border-top: 1px solid var(--line);
  z-index: 30;
}
.rail-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
}
.rail-btn svg { width: 24px; height: 24px; }
.rail-btn.is-current { color: var(--ink); }
.rail-btn.is-current svg { color: var(--accent); }
.rail-btn.is-current::after {
  content: "";
  position: absolute;
  bottom: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* --------------------------------------------------------------------------
   Laci alat
   -------------------------------------------------------------------------- */
.tray {
  grid-area: tray;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 44dvh;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 0 var(--safe-r) 0 var(--safe-l);
  z-index: 20;
}
.studio[data-tray="closed"] .tray { display: none; }

.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 0 16px;
  min-height: 40px;
}
.tray-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tray-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
}
.tray-close:active { background: var(--panel-3); }

.tool-panel { display: none; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 10px; }
.studio[data-tool="filter"] [data-panel="filter"],
.studio[data-tool="adjust"] [data-panel="adjust"],
.studio[data-tool="crop"] [data-panel="crop"],
.studio[data-tool="compare"] [data-panel="compare"] { display: flex; }

.tool-hint { margin: 4px 16px 12px; color: var(--ink-2); font-size: 13px; }

/* Filter: tab merek bergaris bawah */
.brand-tabs {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 16px 0;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.brand-tabs::-webkit-scrollbar { display: none; }
.brand-chip {
  position: relative;
  flex-shrink: 0;
  padding: 10px 0 11px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.brand-chip.active { color: var(--ink); }
.brand-chip.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

/* Filter: strip thumbnail foto */
.look-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 14px 16px 10px;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
  flex-shrink: 0;
}
.look-strip::-webkit-scrollbar { display: none; }
.preset-card {
  flex: 0 0 78px;
  width: 78px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  scroll-snap-align: start;
}
.preset-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.15s, transform 0.12s;
}
.preset-swatch canvas, .preset-swatch img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preset-card:active .preset-swatch { transform: scale(0.95); }
.preset-card.active .preset-swatch { outline-color: var(--accent); }
.preset-card-name {
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-card.active .preset-card-name { color: var(--ink); }
.preset-card-sub { display: none; }

/* Filter: kekuatan */
.strength {
  display: grid;
  grid-template-columns: auto 34px 1fr 34px 44px;
  align-items: center;
  gap: 8px;
  margin: 0 16px;
  padding: 6px 0 2px;
  flex-shrink: 0;
}
.strength-label { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.strength-val { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.step {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--panel-3);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}
.step:active { background: var(--line-2); }

/* Slider */
.range, .slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  touch-action: pan-y;
}
.range::-webkit-slider-runnable-track, .slider-input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: var(--panel-3);
}
.range::-moz-range-track, .slider-input::-moz-range-track { height: 4px; border-radius: 4px; background: var(--panel-3); }
.range::-webkit-slider-thumb, .slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 2px 8px var(--shadow);
}
.range::-moz-range-thumb, .slider-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
}

/* Atur: grup + chip parameter + satu slider besar */
.adjust-groups {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 4px 16px 0;
  padding: 3px;
  border-radius: 12px;
  background: var(--panel-2);
  flex-shrink: 0;
}
.group-btn {
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 700;
}
.group-btn.active { background: var(--panel-3); color: var(--ink); }

.param-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 12px 16px 4px;
  flex-shrink: 0;
}
.param-chips::-webkit-scrollbar { display: none; }
.param-chip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}
.param-chip small { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.param-chip.changed small { color: var(--accent); }
.param-chip.is-current { border-color: var(--ink); color: var(--ink); background: var(--panel-2); }

.param-deck { padding: 6px 16px 0; }
.slider-row {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  grid-template-areas: "label label val" "minus wrap plus";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
}
.slider-label { grid-area: label; font-size: 13px; font-weight: 700; }
.slider-val { grid-area: val; justify-self: end; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.slider-row .slider-step-btn:first-of-type { grid-area: minus; }
.slider-control-wrap { grid-area: wrap; min-width: 0; }
.slider-row .slider-step-btn:last-of-type { grid-area: plus; }
.slider-step-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--panel-3);
  color: var(--ink);
  font-size: 18px;
}
.slider-step-btn:active { background: var(--line-2); }
/* HP: hanya parameter terpilih yang tampil */
.param-deck .slider-row { display: none; }
.param-deck .slider-row.is-current { display: grid; }

/* Potong: ubin rasio dengan bentuk */
.ratio-grid { padding: 6px 16px 0; }
.ratio-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ratio-list::-webkit-scrollbar { display: none; }
.ratio-chip {
  flex: 0 0 72px;
  height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--ink-2);
}
.ratio-chip b { font-size: 13px; color: var(--ink); }
.ratio-chip small { font-size: 10.5px; color: var(--ink-3); }
.ratio-chip .shape {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
}
.ratio-chip .shape::before {
  content: "";
  display: block;
  height: 26px;
  aspect-ratio: var(--w) / var(--h);
  max-width: 40px;
  max-height: 34px;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.ratio-chip .shape.free::before { aspect-ratio: 4 / 3; border-style: dashed; }
.ratio-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Banding */
.hold-btn {
  margin: 0 16px 6px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--panel-2);
  font-weight: 700;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.hold-btn.holding, .hold-btn:active { background: var(--ink); color: var(--bg); }

/* --------------------------------------------------------------------------
   Dialog (sheet bawah di HP)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(38, 50, 42, 0.38);
}
.modal-backdrop.active { display: flex; }
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding-bottom: var(--safe-b);
  animation: sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 8px 20px; }
.sheet-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.sheet-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--panel-3);
  font-size: 22px;
  line-height: 1;
}
.sheet-body { padding: 4px 16px 8px; overflow-y: auto; }
.sheet-desc { margin: 0 4px 10px; color: var(--ink-2); }
.sheet-foot { padding: 8px 16px 16px; }
.primary-btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 16px;
}
.primary-btn:active { transform: scale(0.99); }

.res-list { display: flex; flex-direction: column; gap: 8px; }
.res {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  cursor: pointer;
}
.res input { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; flex-shrink: 0; }
.res-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.res-main b { font-size: 15px; }
.res-main small { color: var(--ink-3); font-size: 12px; }
.res-tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--panel-3); color: var(--ink-2); }
.res-tag.alt { background: var(--accent-soft); color: var(--accent); }
.res:has(input:checked) { border-color: var(--accent); }

.debug-log {
  max-height: 40dvh;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--stage);
  color: var(--ink-2);
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

/* --------------------------------------------------------------------------
   Toast & layar fallback (dibuat oleh app.js)
   -------------------------------------------------------------------------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(var(--rail-h) + var(--safe-b) + 12px);
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 16px 40px var(--shadow);
  animation: toast-in 0.2s ease;
}
.toast-error { background: #ffdfd6; color: #4a1103; }
.toast-success { background: var(--ink); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
.toast-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.toast-btn { height: 36px; padding: 0 14px; border: 1px solid rgba(128, 128, 128, 0.4); border-radius: 10px; background: transparent; color: inherit; font-weight: 700; }
.toast-btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.fatal-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.fatal-card { max-width: 400px; text-align: center; }
.fatal-logo { font-size: 20px; font-weight: 800; color: var(--accent); margin-bottom: 12px; }
.fatal-card h1 { font-size: 20px; margin: 0 0 10px; }
.fatal-card p { margin: 0; color: var(--ink-2); line-height: 1.55; }

/* --------------------------------------------------------------------------
   HP kecil
   -------------------------------------------------------------------------- */
/* Teks status hanya di desktop; di HP pesan penting tampil lewat toast */
@media (max-width: 959px) {
  .status-line { display: none; }
}

@media (max-width: 380px) {
  .tb-label { display: none; }
  #file-label { padding: 0; width: 40px; }
  .preset-card { flex-basis: 70px; width: 70px; }
  .save-btn { padding: 0 12px; }
}

/* HP mendatar: laci di kanan, rel tetap di bawah panggung */
@media (orientation: landscape) and (max-height: 520px) {
  .studio {
    grid-template-columns: minmax(0, 1fr) min(360px, 46vw);
    grid-template-rows: calc(var(--top-h) + var(--safe-t)) minmax(0, 1fr) calc(56px + var(--safe-b));
    grid-template-areas: "top top" "stage tray" "rail tray";
  }
  .studio[data-tray="closed"] { grid-template-columns: minmax(0, 1fr) 0; }
  .tray { max-height: none; border-top: 0; border-left: 1px solid var(--line); }
  .welcome h1 { font-size: 20px; }
  .welcome p { display: none; }
}

/* --------------------------------------------------------------------------
   Desktop: rel kiri · panggung · laci kanan
   -------------------------------------------------------------------------- */
@media (min-width: 960px) {
  :root { --top-h: 60px; }
  .studio,
  .studio[data-tray="closed"] {
    grid-template-columns: 88px minmax(0, 1fr) 380px;
    grid-template-rows: var(--top-h) minmax(0, 1fr);
    grid-template-areas: "top top top" "rail stage tray";
  }
  .topbar { padding: 0 16px; }
  .brandmark { flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 12px; padding-left: 12px; }
  .now-look { margin: 0; font-size: 12px; }
  .tb-right { margin-left: auto; }
  #file-label { order: 0; }

  .rail {
    grid-template-columns: 1fr;
    grid-auto-rows: 76px;
    align-content: start;
    padding: 10px 8px;
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .rail-btn { border-radius: 14px; }
  .rail-btn:hover { background: var(--panel); color: var(--ink-2); }
  .rail-btn.is-current { background: var(--panel-2); }
  .rail-btn.is-current::after { left: 0; top: 22px; bottom: 22px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }

  .tray,
  .studio[data-tray="closed"] .tray {
    display: flex;
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .tray-head { padding: 18px 16px 6px 20px; }
  .tray-close { display: none; }

  .look-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 10px;
    overflow: visible;
    padding: 16px;
  }
  .preset-card { width: auto; }
  .preset-card:hover .preset-swatch { outline-color: var(--line-2); }
  .preset-card.active:hover .preset-swatch { outline-color: var(--accent); }
  #panel-presets { flex-direction: column; }
  #panel-presets .strength { order: -1; margin: 12px 16px 0; padding: 12px; border-radius: 14px; background: var(--panel-2); }
  #panel-presets .brand-tabs { order: -2; flex-wrap: wrap; row-gap: 0; }

  /* Desktop: semua slider tampil dalam daftar, chip tidak perlu */
  .param-chips { display: none; }
  .param-deck { padding-top: 14px; }
  .param-deck .slider-row,
  .param-deck .slider-row.is-current {
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    padding: 10px 0 12px;
    border-bottom: 1px solid var(--line);
  }
  .slider-val { font-size: 14px; }
  .slider-step-btn { width: 32px; height: 32px; border-radius: 9px; }

  .ratio-list { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
  .ratio-chip { height: 100px; }

  .modal-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--line-2); }

  .toast-host { left: auto; right: 400px; bottom: 20px; transform: none; }
  .canvas-hint { top: 16px; }
}

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

/* --------------------------------------------------------------------------
   Gerbang akses (login / menunggu persetujuan) — src/gate.js
   -------------------------------------------------------------------------- */
.gate { display: none; }
html[data-gate="loading"] .studio,
html[data-gate="locked"] .studio { display: none; }
html[data-gate="loading"] .gate,
html[data-gate="locked"] .gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b));
  overflow-y: auto;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.7), transparent 60%), var(--bg);
}
.gate-card {
  width: min(400px, 100%);
  padding: 28px 24px 24px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px var(--shadow);
  text-align: center;
}
.gate-brand { font-size: 20px; letter-spacing: -0.02em; color: var(--ink-2); margin-bottom: 18px; }
.gate-brand b { color: var(--accent); font-weight: 800; }
.gate-brand span { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; vertical-align: 3px; }
.gate-icon { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.gate-card h1 { margin: 0 0 8px; font-size: 21px; letter-spacing: -0.01em; color: var(--ink); }
.gate-card p { margin: 0 0 18px; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
.gate-user { display: flex; align-items: center; gap: 10px; margin: 0 auto 18px; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); text-align: left; max-width: 300px; }
.gate-user img, .gate-avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; }
.gate-avatar { display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.gate-user div { display: flex; flex-direction: column; min-width: 0; }
.gate-user b { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gate-user span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gate-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.gate-btn {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.gate-btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.gate-btn.google { background: #fff; border-color: rgba(38, 50, 42, 0.18); color: #1f1f1f; }
.gate-btn:disabled { opacity: 0.6; }
.gate-link { color: var(--ink-3); font-size: 13px; }
.gate-wait { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13.5px; }
.gate-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); animation: gate-spin 0.9s linear infinite; }
@keyframes gate-spin { to { transform: rotate(360deg); } }

.site-tag { font-style: normal; margin-left: 5px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.55em; font-weight: 700; vertical-align: 0.35em; letter-spacing: 0; }
.site-tag:empty { display: none; }
.menu-account { display: flex; flex-direction: column; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-account b { font-size: 13.5px; color: var(--ink); }
.menu-account span { font-size: 12px; color: var(--ink-3); word-break: break-all; }

/* Logo brand di samping nama */
.brand-logo { display: inline-block; width: 1.3em; height: 1.3em; border-radius: 0.3em; vertical-align: -0.3em; margin-right: 0.4em; object-fit: cover; }
.brand-logo + b { color: inherit; font-weight: 800; letter-spacing: -0.01em; }
