/* Snap Studio web — © Syed Rizwan Ahmed, Rizwan's AI Agency. All rights reserved. */
:root {
  --bg: #071D17; --stage: #0A251E; --panel: #0D2C24; --panel-2: #12382E; --line: #1C4A3D; --line-2: #2A5E4F;
  --text: #F3EFE4; --muted: #A9C2B7; --dim: #7E9C90;
  --coral: #D9B45A; --pink: #E6C674; --grad: linear-gradient(120deg, #E6C674, #C99A2E); --on-gold: #1A1405;
  --danger: #F08A7A; --ok: #5FD3A2;
  --sans: "Manrope", ui-sans-serif, system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
body { display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* top bar */
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.brand img { border-radius: 7px; }
.meta { flex: 1; min-width: 0; font: 12px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: 10px; font-weight: 600; border: 1px solid var(--line-2); background: var(--panel-2); transition: border-color .15s, transform .1s, filter .15s; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--grad); border: 0; color: var(--on-gold); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }

/* layout */
.layout { flex: 1; min-height: 0; display: flex; }
.stage { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 32px; background: radial-gradient(60% 60% at 50% 40%, #0F3328, var(--stage)); overflow: hidden; }
.checker { position: relative; line-height: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45);
  background: repeating-conic-gradient(#183f34 0% 25%, #12332a 0% 50%) 0 0 / 18px 18px; }
#preview { display: block; }
.stage-note { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); font: 12px var(--mono); color: var(--dim); white-space: nowrap; }

/* panel */
.panel { width: 312px; flex: none; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 16px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.group { margin-bottom: 18px; }
.group[hidden] { display: none; }
.label { display: flex; justify-content: space-between; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .09em; color: var(--dim); margin-bottom: 8px; }
.val { color: var(--muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; }

.devices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dev.combo { background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--grad) border-box; border: 1px solid transparent; }
.dev.combo.on { background: linear-gradient(rgba(30,52,38,1), rgba(30,52,38,1)) padding-box, var(--grad) border-box; }
.dev { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 2px 7px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--muted); transition: border-color .15s, color .15s; }
.dev svg { width: 26px; height: 22px; }
.dev:hover { color: var(--text); }
.dev.on { border-color: var(--coral); color: var(--text); background: rgba(217,180,90,.10); }

.seg { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { flex: 1; padding: 6px 8px; border-radius: 6px; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg.small button { padding: 4px 10px; font: 500 12px var(--mono); }

input[type=range] { width: 100%; accent-color: var(--coral); }

.swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.sw { aspect-ratio: 1; border-radius: 9px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); transition: transform .1s; position: relative; }
.sw:hover { transform: scale(1.06); }
.sw.on { border-color: var(--text); }
.sw.none { background: repeating-conic-gradient(#2a5446 0% 25%, #1a3a31 0% 50%) 0 0 / 8px 8px; }
.sw.blur span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 8px var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
.custom-color { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.custom-color input { width: 28px; height: 22px; border: 0; background: none; padding: 0; cursor: pointer; }

.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sizes button { padding: 7px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font: 500 12px var(--mono); color: var(--muted); }
.sizes button.on { border-color: var(--coral); color: var(--text); }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }
.toggle input { display: none; }
.toggle span { width: 34px; height: 20px; border-radius: 20px; background: var(--line-2); position: relative; transition: background .2s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + span { background: var(--coral); }
.toggle input:checked + span::after { transform: translateX(14px); }

.recent { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.recent button { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2) center top / cover no-repeat; position: relative; }
.recent button.on { border-color: var(--coral); }
.recent button span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; font: 12px var(--mono); background: rgba(0,0,0,.6); color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .empty { grid-column: 1 / -1; color: var(--dim); font-size: 12px; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; background: var(--grad); color: var(--on-gold); padding: 8px 16px; border-radius: 999px; font-weight: 600; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  body { overflow: auto; }
  .layout { flex-direction: column; }
  .stage { min-height: 55vh; padding: 16px; }
  .panel { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .meta { display: none; }
}

/* video */
.video-group { padding: 12px; border-radius: 12px; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--grad) border-box; border: 1px solid transparent; }
.vid-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 10px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 8px; }
.modal { position: fixed; inset: 0; background: rgba(3,14,11,.78); display: grid; place-items: center; z-index: 50; backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-card { width: min(380px, 90vw); background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal-card h3 { font-size: 16px; }
.modal-card p { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.modal-card .bar { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.modal-card .bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.modal-card .btn { align-self: flex-end; }

/* phase 3: presets + watermark */
.link { font: 500 12px var(--mono); color: var(--coral); text-transform: none; letter-spacing: 0; }
.link:hover { text-decoration: underline; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12px; color: var(--muted); }
.preset:hover { color: var(--text); border-color: var(--muted); }
.preset .x { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: var(--dim); }
.preset .x:hover { background: var(--line-2); color: var(--text); }
.preset.mine { border-style: dashed; }
.save-row { display: flex; gap: 6px; margin-bottom: 8px; }
.save-row input, .text-in { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: 12px var(--sans); outline: none; }
.save-row input:focus, .text-in:focus { border-color: var(--coral); }
.text-in { width: 100%; margin: 10px 0 8px; }
.btn.small { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.wm-group .label .toggle { text-transform: none; }
.wm-logo { display: flex; gap: 10px; align-items: center; }
.wm-prev { width: 86px; height: 46px; border-radius: 8px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(#183f34 0% 25%, #12332a 0% 50%) 0 0 / 10px 10px; border: 1px solid var(--line); }
.wm-prev img { max-width: 78px; max-height: 38px; object-fit: contain; }
.wm-prev span { font: 12px var(--mono); color: var(--dim); }
.wm-btns { display: flex; flex-direction: column; gap: 5px; }
.wm-pos button { font-size: 14px; }
.label.sub { margin: 10px 0 4px; }
#wmBody.off { opacity: .45; }
.stage-tip { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #F3E3B5; background: rgba(217,180,90,.14); border: 1px solid rgba(217,180,90,.4); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.stage-tip[hidden] { display: none; }
