/* ============================================================
   desktopchill — Studio (khách tự thiết kế màn hình)
   Cùng ngôn ngữ kính mờ nền tối với trang chủ (glass.css bản bf533da), nhưng là file riêng:
   trang Studio không nạp style.css / glass.css.
   Đặc tả: docs/superpowers/specs/2026-11-22-design-studio-design.md
   ============================================================ */

:root {
  --bg: #07080b;
  --bg-2: #0d0f14;
  --text: #f5f5f7;
  --text-dim: #b4b4bd;
  --text-faint: #8f8f99;
  --accent: #ff6a58;
  --accent-text: #ff8a73;
  --accent-grad: linear-gradient(135deg, #cf331c 0%, #d6402a 55%, #dc4a2c 100%);
  --accent-shadow: rgba(240, 80, 55, .38);
  --glass: rgba(22, 24, 30, .72);
  --glass-soft: rgba(255, 255, 255, .06);
  --glass-hover: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --blur: blur(24px) saturate(180%);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 50px rgba(0, 0, 0, .45);
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --top-h: 60px;
  --tools-w: 400px;
  --sheet-h: 0px;
  --guide: #4aa0ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.st {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.5; letter-spacing: -.006em; -webkit-font-smoothing: antialiased;
  overflow: hidden; overscroll-behavior: none;
}
body.st::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 45vw at 80% -10%, rgba(255, 106, 88, .10), transparent 60%),
    radial-gradient(55vw 45vw at -10% 40%, rgba(110, 120, 255, .09), transparent 60%),
    var(--bg);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.st-skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; color: #000; padding: 8px 12px; border-radius: 8px; }
.st-skip:focus { left: 8px; }

/* ---------- Thanh trên ---------- */
.st-top {
  position: fixed; inset: 0 0 auto; height: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: env(safe-area-inset-top) 16px 0;
  background: rgba(7, 8, 11, .72); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
}
.st-logo { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: -.02em; min-height: 44px; }
.st-logo span { font-size: 15px; }
.st-logo b { font-weight: 600; font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--glass-soft); border: 1px solid var(--line); color: var(--text-dim); letter-spacing: .02em; }
.st-top-mid { display: flex; gap: 4px; margin-left: 8px; }
.st-top-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.st-ico {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.st-ico:hover:not(:disabled) { background: var(--glass-hover); color: var(--text); }
.st-ico:active:not(:disabled) { transform: scale(.94); }
.st-ico:disabled { opacity: .35; cursor: default; }
.st-chip {
  min-width: 44px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--glass-soft); font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--text-dim);
}
.st-chip:hover { color: var(--text); background: var(--glass-hover); }
.st-primary {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--accent-grad); color: #fff; font-weight: 600; font-size: 14.5px; letter-spacing: -.01em;
  box-shadow: 0 8px 24px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
}
.st-primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 30px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.st-primary:active { transform: translateY(0) scale(.98); }
.st-primary svg { width: 18px; height: 18px; stroke-width: 2.4; }
.st-short { display: none; }
.st-primary, .st-primary span { white-space: nowrap; flex: none; }
/* điện thoại (kể cả iPhone Pro Max ~430px): nút chính dùng chữ ngắn — chữ dài từng bị xuống 4 dòng (báo lỗi 28/11) */
@media (max-width: 640px) {
  .st-primary .st-long { display: none; } .st-primary .st-short { display: inline; }
  .st-top { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .st-logo b { display: none; }
  .st-top-mid .st-ico, .st-top-end .st-ico { width: 38px; }
  .st-top .st-primary { padding: 0 14px; }
}
.st-menu {
  position: absolute; right: 16px; top: calc(var(--top-h) + env(safe-area-inset-top) - 6px); min-width: 260px; padding: 6px;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow);
  animation: st-pop .18s var(--ease);
}
.st-menu button {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; font-size: 14px; color: var(--text);
}
.st-menu button:hover { background: var(--glass-hover); }
.st-menu svg { color: var(--text-dim); }
@keyframes st-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- Bố cục chính ---------- */
.st-main { position: fixed; inset: calc(var(--top-h) + env(safe-area-inset-top)) 0 0; display: flex; }
.st-work { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 14px 74px 14px; }

/* "Màn hình" 16:9 có viền máy mảnh */
.st-device {
  position: relative; width: min(100%, calc((100vh - var(--top-h) - 108px) * 16 / 9));
  padding: 6px; border-radius: 18px;
  background: linear-gradient(180deg, #1a1c22, #0f1115); border: 1px solid var(--line-strong);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.st-device::after { /* chân màn hình */
  content: ""; position: absolute; left: 50%; bottom: -14px; width: 16%; height: 8px; transform: translateX(-50%);
  border-radius: 0 0 10px 10px; background: linear-gradient(180deg, #15171c, #0c0d10); border: 1px solid var(--line); border-top: 0;
}
.st-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #000; touch-action: pan-y; outline: none; }
.st-screen { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; transform: scale(var(--k, .5)); }
.st-bg, .st-bg > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-bg > img, .st-bg > video { object-fit: cover; }
.st-bg > .st-bg-next { opacity: 0; transition: opacity .4s var(--ease); }
.st-bg > .st-bg-next.on { opacity: 1; }
.st-layer { position: absolute; inset: 0; }
.st-own-note {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); max-width: calc(100% - 24px); z-index: 2; pointer-events: none;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; text-align: center;
  background: rgba(10, 11, 14, .78); border: 1px solid var(--line-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}

/* Widget trên màn hình */
.st-w { position: absolute; left: 0; top: 0; transform-origin: 0 0; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.st-w.off { display: none; }
.st-w.dragging { cursor: grabbing; }
.st-w > .st-wi { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.st-w::after { /* khung mờ khi rê chuột */
  content: ""; position: absolute; inset: -6px; border-radius: 10px; border: calc(1.5px * var(--ik, 2)) dashed rgba(255, 255, 255, 0);
  transition: border-color .15s var(--ease);
}
@media (hover: hover) { .st-w:hover::after { border-color: rgba(255, 255, 255, .45); } }

/* Khung chọn + tay nắm */
.st-sel { position: absolute; left: 0; top: 0; pointer-events: none; border: calc(2px * var(--ik, 2)) solid var(--guide); border-radius: calc(6px * var(--ik, 2)); box-shadow: 0 0 0 calc(1px * var(--ik, 2)) rgba(0, 0, 0, .35); }
.st-h {
  position: absolute; width: calc(14px * var(--ik, 2)); height: calc(14px * var(--ik, 2)); border-radius: 50%;
  background: #fff; border: calc(2px * var(--ik, 2)) solid var(--guide); pointer-events: auto; touch-action: none;
  transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.st-h::before { content: ""; position: absolute; inset: calc(-15px * var(--ik, 2)); } /* vùng chạm ≥ 44px */
.st-h[data-h="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.st-h[data-h="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.st-h[data-h="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.st-h[data-h="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.st-guides i { position: absolute; background: var(--guide); box-shadow: 0 0 calc(4px * var(--ik, 2)) rgba(74, 160, 255, .8); }
.st-guides i.v { top: 0; bottom: 0; width: calc(1px * var(--ik, 2)); }
.st-guides i.h { left: 0; right: 0; height: calc(1px * var(--ik, 2)); }

/* Thanh chỉnh nhanh widget đang chọn */
.st-bar {
  position: absolute; left: 50%; bottom: -66px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow); animation: st-pop .18s var(--ease); white-space: nowrap;
}
.st-bar-name { font-size: 13px; font-weight: 600; padding: 0 8px 0 10px; color: var(--text); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.st-bar output { min-width: 44px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.st-swatch { position: relative; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.st-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.st-swatch::before { content: ""; width: 22px; height: 22px; border-radius: 50%; background: var(--sw, #fff); border: 2px solid rgba(255, 255, 255, .7); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }

.st-zoom-btn { display: none; }
.st-hint { margin: 26px 0 0; font-size: 13px; color: var(--text-faint); text-align: center; }

/* ---------- Bảng công cụ ---------- */
.st-tools {
  position: relative; z-index: 10; width: var(--tools-w); flex: none; display: flex; flex-direction: column; margin: 12px 0 74px 12px;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.st-grab { display: none; }
.st-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.st-tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 56px; padding: 8px 4px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text-faint); font-size: 12px; font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease);
}
.st-tabs button:hover { color: var(--text); background: var(--glass-soft); }
.st-tabs button[aria-selected="true"] { color: var(--text); background: var(--glass-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.st-tabs button[aria-selected="true"] svg { color: var(--accent-text); }
.st-panels { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.st-pn { padding: 14px 14px 24px; animation: st-fade .22s var(--ease); }
@keyframes st-fade { from { opacity: 0; transform: translateY(4px); } }
.st-h3 { margin: 6px 4px 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.st-h3:not(:first-child) { margin-top: 20px; }
.st-note { margin: 0 4px 12px; font-size: 13px; color: var(--text-dim); }

/* Thẻ layout */
.st-lays { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-lay {
  position: relative; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); overflow: hidden; text-align: left;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.st-lay:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.st-lay[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.st-lay-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.st-lay-thumb > .st-screen { pointer-events: none; }
.st-lay-name { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-size: 13px; font-weight: 600; }
.st-lay-name small { font-weight: 500; color: var(--text-faint); font-size: 12px; }

/* Lưới hình nền */
.st-up {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; margin-bottom: 14px; text-align: left;
  border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--glass-soft); transition: background .2s var(--ease), border-color .2s var(--ease);
}
.st-up:hover { background: var(--glass-hover); border-color: rgba(255, 255, 255, .3); }
.st-up b { display: block; font-size: 14px; font-weight: 600; }
.st-up span { font-size: 12.5px; color: var(--text-dim); }
.st-up svg { width: 24px; height: 24px; color: var(--accent-text); }
.st-cats { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.st-cats::-webkit-scrollbar { display: none; }
.st-cats button {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  font-size: 13px; color: var(--text-dim); transition: background .2s var(--ease), color .2s var(--ease);
}
.st-cats button[aria-pressed="true"] { background: var(--text); color: #0b0c10; border-color: var(--text); font-weight: 600; }
.st-walls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.st-wall {
  position: relative; aspect-ratio: 16 / 10; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.st-wall img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.st-wall:hover img { transform: scale(1.05); }
.st-wall span { position: absolute; left: 6px; bottom: 5px; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.st-wall .st-heart { position: absolute; right: 6px; top: 5px; color: #ff6b81; }
.st-wall .st-heart svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.st-wall[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1px var(--accent); }
.st-more { width: 100%; margin-top: 12px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--text-dim); font-size: 13.5px; }
.st-more:hover { background: var(--glass-soft); color: var(--text); }

/* Danh sách widget */
.st-wlist { display: flex; flex-direction: column; gap: 2px; }
.st-wrow {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 8px 6px 6px; border-radius: 12px; cursor: pointer;
  transition: background .2s var(--ease);
}
.st-wrow:hover { background: var(--glass-soft); }
.st-wrow-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--glass-soft); border: 1px solid var(--line); color: var(--text-dim); }
.st-wrow-t { flex: 1; min-width: 0; }
.st-wrow-t b { display: block; font-size: 14px; font-weight: 500; }
.st-wrow-t small { font-size: 12px; color: var(--text-faint); }
.st-switch { position: relative; width: 44px; height: 26px; flex: none; }
.st-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.st-switch i { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); transition: background .2s var(--ease); pointer-events: none; }
.st-switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform .2s var(--ease); }
.st-switch input:checked + i { background: #34c759; }
.st-switch input:checked + i::after { transform: translateX(18px); }

/* Tuỳ chỉnh */
.st-swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 4px; }
.st-sw {
  width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; position: relative; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.st-sw[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--text); }
.st-sw-label { display: block; font-size: 11px; color: var(--text-faint); text-align: center; margin-top: 4px; }
.st-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--glass-soft); border: 1px solid var(--line); margin: 0 4px; }
.st-seg button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--text-dim); font-size: 13.5px; font-weight: 500; }
.st-seg button[aria-pressed="true"] { background: rgba(255, 255, 255, .14); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }

/* ---------- Nút góc trái dưới (giống trang chủ) ---------- */
.st-fabs { position: fixed; left: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 25; display: flex; flex-direction: row; align-items: center; gap: 8px; }
.st-fab {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  color: var(--text); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); transition: transform .2s var(--ease), background .2s var(--ease);
}
.st-fab:hover { transform: translateY(-1px); background: rgba(34, 36, 44, .85); }
.st-fab-send svg { color: #4aa0ff; }
.st-fab-favs svg { color: #ff6b81; fill: currentColor; stroke: none; }
.st-fab-favs b { font-weight: 700; }

/* ---------- Hộp thoại + thông báo ---------- */
.st-dialog { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.st-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: st-fade .2s var(--ease); }
.st-dialog-box {
  position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 22px;
  background: rgba(20, 22, 28, .92); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: st-pop .22s var(--ease);
}
.st-dialog-box h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.st-dialog-body { font-size: 14.5px; color: var(--text-dim); }
.st-dialog-body p { margin: 0 0 10px; }
.st-dialog-body textarea, .st-dialog-body pre {
  width: 100%; margin: 6px 0 4px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .35);
  color: var(--text); font: 13.5px/1.5 Inter, system-ui, sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; resize: none;
}
.st-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.st-btn {
  height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass-soft);
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text);
}
.st-btn:hover { background: var(--glass-hover); }
.st-btn.pri { border: 0; background: var(--accent-grad); color: #fff; box-shadow: 0 8px 20px var(--accent-shadow); }
.st-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom) + var(--sheet-h)); z-index: 70; transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: rgba(245, 245, 247, .96); color: #111; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.st-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Máy tính bảng + điện thoại: công cụ thành tấm trượt từ đáy ---------- */
@media (max-width: 1023px) {
  :root { --top-h: 56px; }
  .st-logo span { display: none; }
  .st-primary { padding: 0 14px; font-size: 13.5px; }
  .st-work { justify-content: flex-start; padding: 14px 12px calc(var(--sheet-h) + 16px); overflow-y: auto; }
  .st-device { width: 100%; padding: 5px; border-radius: 14px; }
  .st-device::after { display: none; }
  .st-stage { border-radius: 9px; }
  .st-bar { position: relative; left: auto; bottom: auto; transform: none; margin: 10px auto 0; width: max-content; max-width: 100%; overflow-x: auto; }
  .st-hint { margin-top: 12px; }
  .st-zoom-btn { /* nút nổi ở góc dưới phải của màn hình thiết kế */
    position: absolute; right: 8px; bottom: 8px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
    border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(10, 11, 14, .62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    font-size: 13px; font-weight: 600; color: #fff;
  }
  .st-zoom-btn::before { content: ""; position: absolute; inset: -5px; } /* vùng chạm ≥ 44px */
  .st-zoom-btn svg { width: 16px; height: 16px; }
  .st-hint { display: none; }
  .st-tools {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; margin: 0; border-radius: 22px 22px 0 0; border-bottom: 0;
    height: var(--sheet-full, 70dvh); transform: translateY(calc(100% - var(--sheet-h))); transition: transform .32s var(--ease);
    padding-bottom: env(safe-area-inset-bottom); z-index: 20;
  }
  .st-tools.dragging { transition: none; }
  .st-grab { display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; }
  .st-grab span { width: 40px; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .3); }
  .st-tabs { padding-top: 0; }
  .st-tabs button { min-height: 52px; }
  .st-walls { grid-template-columns: repeat(3, 1fr); }
  .st-fabs { bottom: calc(var(--sheet-h) + 12px); left: 12px; flex-direction: row; }
  .st-fab { height: 44px; padding: 0 14px 0 12px; font-size: 13.5px; }
  .st-toast { bottom: calc(var(--sheet-h) + 70px); }
  .st-menu { right: 8px; }
}
@media (max-width: 420px) {
  .st-top { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .st-top-mid { margin-left: 0; }
  .st-top-mid .st-ico, .st-top-end .st-ico { width: 40px; }
  .st-chip { min-width: 40px; padding: 0 8px; }
  .st-logo b { display: none; }
  .st-walls { grid-template-columns: repeat(2, 1fr); }
}
/* điện thoại xoay ngang: màn hình chiếm gần hết, công cụ thu gọn */
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 500px) {
  .st-work { padding-top: 8px; }
  .st-device { width: min(100%, calc((100dvh - var(--top-h) - var(--sheet-h) - 24px) * 16 / 9)); }
  .st-hint, .st-zoom-btn { display: none; }
}

/* Chế độ phóng to trên điện thoại */
body.st-zoomed .st-top, body.st-zoomed .st-tools, body.st-zoomed .st-fabs, body.st-zoomed .st-hint, body.st-zoomed .st-zoom-btn { display: none; }
body.st-zoomed .st-main { inset: 0; }
body.st-zoomed .st-work { padding: 0; justify-content: center; overflow: hidden; background: #000; }
body.st-zoomed .st-device { padding: 0; border: 0; border-radius: 0; width: 100%; max-width: none; box-shadow: none; background: #000; transform-origin: 0 0; }
body.st-zoomed .st-device::after { display: none; }
body.st-zoomed .st-stage { border-radius: 0; touch-action: none; }
body.st-zoomed .st-bar { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; }
.st-zoom-exit {
  position: fixed; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 40; height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); color: var(--text); font-weight: 600;
}
body.st-shot .st-zoom-exit, body.st-shot .st-own-note { display: none; }
@media (orientation: landscape) { body.st-zoomed .st-device { width: min(100vw, calc(100dvh * 16 / 9)); } }

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

/* ---------- Mẫu 1–120: ghi chú "đã có layout sẵn" trên màn hình ---------- */
.st-own-note.is-baked {
  top: auto; bottom: 10px; left: 10px; transform: none; max-width: min(520px, calc(100% - 140px)); text-align: left;
  border-radius: 12px; padding: 8px 12px 8px 34px; font-size: 12.5px; line-height: 1.4; color: #fff;
}
.st-own-note.is-baked::before {
  content: "i"; position: absolute; left: 11px; top: 9px; width: 15px; height: 15px; border-radius: 50%; box-sizing: border-box;
  border: 1.5px solid #ffd25a; color: #ffd25a; font: 700 10px/12px Inter, sans-serif; text-align: center;
}

/* ---------- Tìm hình nền ---------- */
.st-search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; margin-bottom: 14px; border-radius: 12px;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line-strong); color: var(--text-faint); transition: border-color .2s var(--ease); }
.st-search:focus-within { border-color: rgba(255, 255, 255, .4); color: var(--text); }
.st-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 14px; color: var(--text); }
.st-search input::placeholder { color: var(--text-faint); }
.st-h3 small { font-weight: 500; letter-spacing: 0; text-transform: none; }
.st-note-baked { font-size: 12.5px; padding: 10px 12px; margin: 0 0 10px; border-radius: 10px; background: rgba(255, 210, 90, .08); border: 1px solid rgba(255, 210, 90, .22); color: #f3dfa6; }
.st-baked { position: absolute; right: 5px; bottom: 5px; font-style: normal; font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .62); color: #ffd25a; letter-spacing: .01em; }
.st-wall.is-baked img { filter: saturate(.9); }

/* ---------- Thay thế widget ---------- */
.st-rep-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; margin-bottom: 6px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(74, 160, 255, .16), rgba(74, 160, 255, .05)); border: 1px solid rgba(74, 160, 255, .35); }
.st-rep-head small { display: block; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: #9cc8ff; font-weight: 600; }
.st-rep-head b { font-size: 15px; font-weight: 600; }
.st-rep-row { width: 100%; border: 0; background: transparent; text-align: left; }
.st-rep-go { flex: none; height: 32px; padding: 0 14px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .12); }
.st-rep-row:hover .st-rep-go { background: var(--text); color: #0b0c10; }

/* ---------- Menu chuột phải ---------- */
.st-ctx {
  position: fixed; z-index: 65; min-width: 220px; padding: 6px; border-radius: 14px;
  background: rgba(24, 26, 32, .94); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: st-pop .14s var(--ease);
}
.st-ctx button { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; color: var(--text); text-align: left; }
.st-ctx button:hover, .st-ctx button:focus-visible { background: var(--glass-hover); outline: none; }
.st-ctx button svg { width: 18px; height: 18px; color: var(--text-dim); }
.st-ctx .danger, .st-ctx .danger svg { color: #ff7b72; }
.st-ctx hr { border: 0; height: 1px; background: var(--line); margin: 5px 6px; }
@media (pointer: coarse) { .st-ctx button { min-height: 46px; } }

@media (max-width: 1023px) {
  .st-own-note.is-baked { left: 6px; bottom: 6px; max-width: calc(100% - 130px); font-size: 10.5px; padding: 5px 8px 5px 24px; }
  .st-own-note.is-baked::before { left: 7px; top: 6px; width: 12px; height: 12px; font-size: 8px; line-height: 9px; }
}

/* Ảnh riêng → hình nền động 3D (live-photo.js) */
.st-live canvas, .st-live .st-live-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.st-live .st-live-img { object-fit: cover; }
.st-own { margin: 0 0 14px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--glass-soft); }
.st-own[hidden] { display: none; }
.st-own > .st-note { margin: 0; }
.st-own-head { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.st-own-head img { width: 104px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.st-own-head b { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.st-own-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.st-own-btns .st-chip { height: 32px; font-size: 12.5px; }
.st-own .st-live-row { padding-left: 0; padding-right: 0; }
.st-range { display: grid; grid-template-columns: 96px 1fr 30px; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; color: var(--text-dim); }
.st-range input { width: 100%; accent-color: var(--accent); height: 28px; }
.st-range output { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.st-fx { flex-wrap: wrap; overflow: visible; padding-bottom: 2px; }
.st-fx button { height: 32px; padding: 0 12px; font-size: 13px; }

/* hộp thoại trên điện thoại: nút xếp dọc, kéo đầy, nút chính lên trên */
@media (max-width: 640px) {
  .st-dialog-actions { flex-direction: column-reverse; align-items: stretch; }
  .st-dialog-actions .st-btn { width: 100%; justify-content: center; text-align: center; }
}

/* ===== Tải ảnh là trọng tâm (28/11/2026) ===== */
.st-hero-up {
  position: relative; margin: 0 0 16px; padding: 18px 16px 16px; border-radius: var(--r-md); text-align: left;
  background: linear-gradient(160deg, rgba(255, 106, 88, .16), rgba(255, 106, 88, .04) 55%, rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 106, 88, .38); box-shadow: 0 10px 30px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.st-hu-top { display: flex; align-items: center; gap: 12px; }
.st-hu-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-grad); color: #fff; box-shadow: 0 6px 16px var(--accent-shadow); }
.st-hu-ic svg { width: 22px; height: 22px; stroke-width: 2.2; }
.st-hu-t { font-size: 16.5px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.st-hu-s { margin: 10px 0 10px; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.st-hu-pts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.st-hu-pts li { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text); background: rgba(255, 255, 255, .07); border: 1px solid var(--line); }
.st-hu-btn { width: 100%; justify-content: center; }
.st-hu-or { display: block; margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--text-dim); }
@media (pointer: coarse) { .st-hu-or { display: none; } } /* điện thoại không kéo thả được */
.st-pn.has-own .st-hero-up { display: none; } /* đã có ảnh: điều khiển ảnh lên đầu, đổi ảnh bằng nút "Đổi ảnh" */
.st-h3.st-or { margin-top: 4px; }
.st-pulse { animation: st-pulse 1.4s var(--ease) 3; }
@keyframes st-pulse { 0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, .25), 0 0 0 0 rgba(255, 106, 88, .55); } 50% { box-shadow: 0 10px 30px rgba(0, 0, 0, .25), 0 0 0 10px rgba(255, 106, 88, 0); } }

/* nút nổi trên màn hình thiết kế */
.st-stage-up {
  position: absolute; left: 12px; bottom: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 12px;
  border: 0; border-radius: 999px; background: var(--accent-grad); color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  box-shadow: 0 8px 22px var(--accent-shadow); cursor: pointer; transition: transform .2s var(--ease);
}
.st-stage-up:hover { transform: translateY(-1px); }
.st-stage-up svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.st-stage-up[hidden] { display: none; }
body.st-shot .st-stage-up, body.st-zoomed .st-stage-up { display: none; }
@media (max-width: 640px) { .st-stage-up { left: 8px; bottom: 8px; height: 34px; padding: 0 12px 0 10px; font-size: 12.5px; } }

/* kéo thả ảnh vào trang */
.st-drop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(8, 9, 12, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none; }
.st-drop[hidden] { display: none; }
.st-drop > div { display: grid; justify-items: center; gap: 14px; padding: 44px 56px; border: 2px dashed rgba(255, 106, 88, .8); border-radius: 24px; background: rgba(255, 106, 88, .08); color: var(--text); font-size: 18px; }
.st-drop svg { width: 46px; height: 46px; fill: none; stroke: #ff6a58; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* đăng nhập / tạo tài khoản (dùng chung tài khoản với /learn) */
.st-acct { display: grid; gap: 12px; }
.st-acct p { margin: 0; font-size: 13.5px; }
.st-acct-seg { width: 100%; }
.st-acct label { display: grid; gap: 6px; font-size: 13px; color: var(--text-dim); }
.st-acct input[type=text], .st-acct input[type=password], .st-acct input[type=email], .st-acct input[type=tel] {
  height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, .3);
  color: var(--text); font: 15px/1 Inter, system-ui, sans-serif; outline: none;
}
.st-acct input:focus { border-color: rgba(255, 106, 88, .7); box-shadow: 0 0 0 3px rgba(255, 106, 88, .18); }
.st-acct .st-acct-rem { display: flex; align-items: center; gap: 8px; }
.st-acct-rem input { width: 18px; height: 18px; accent-color: #ff6a58; }
.st-acct-err { color: #ff8a7a !important; font-weight: 600; }
.st-btn:disabled { opacity: .6; cursor: progress; }

/* Dấu logo desktopchill trên hình khi xem trong Studio (chỉ là lớp phủ trên trang, không đổi file hình nền) */
.st-mark {
  position: absolute; right: 1.6%; bottom: 2.6%; z-index: 2; display: inline-flex; align-items: center; gap: .45em;
  font-size: clamp(11px, 1.05vw, 17px); font-weight: 700; letter-spacing: .01em; color: #fff; opacity: .72;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55); pointer-events: none; user-select: none; -webkit-user-select: none;
}
.st-mark img { width: 1.4em; height: 1.4em; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
@media (max-width: 1023px) { .st-mark { bottom: auto; top: 10px; right: 10px; font-size: 11px; } }

/* Ghi chú giá + chất lượng (giống ghi chú ở chế độ toàn màn hình trang chủ): khách biết cài có phí, hình web chỉ là bản nén */
.st-price {
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(760px, 100%); margin: 18px auto 0; padding: 11px 18px 11px 12px;
  border-radius: 16px; background: linear-gradient(120deg, rgba(211, 58, 44, .94), rgba(232, 137, 74, .94)); border: 1px solid rgba(255, 220, 180, .7);
  color: #fff; box-shadow: 0 10px 30px rgba(211, 58, 44, .35), 0 0 0 4px rgba(255, 170, 110, .14); text-align: left; animation: stPricePulse 1.6s ease-in-out 2;
}
.st-price-ic { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .22); }
.st-price-ic svg { width: 18px; height: 18px; }
.st-price-tx { display: grid; gap: 2px; min-width: 0; }
.st-price-tx b { font-size: 15px; font-weight: 800; line-height: 1.25; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.st-price-tx span { font-size: 13px; font-weight: 600; line-height: 1.35; color: rgba(255, 255, 255, .95); }
.st-price + .st-hint { margin-top: 12px; }
@keyframes stPricePulse { 50% { box-shadow: 0 10px 36px rgba(211, 58, 44, .6), 0 0 0 9px rgba(255, 170, 110, .28); } }
@media (prefers-reduced-motion: reduce) { .st-price { animation: none; } }
@media (max-width: 1023px) {
  .st-price { width: auto; margin-top: 12px; padding: 9px 12px 9px 10px; gap: 10px; border-radius: 14px; }
  .st-price-ic { width: 26px; height: 26px; } .st-price-ic svg { width: 16px; height: 16px; }
  .st-price-tx b { font-size: 13.5px; } .st-price-tx span { font-size: 12px; }
}
/* toàn màn hình: ghi chú nổi ở trên, không chặn thao tác */
body.st-zoomed .st-price {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 39; margin: 0;
  width: max-content; max-width: min(640px, calc(100vw - 150px)); pointer-events: none;
}
body.st-shot .st-price { display: none; }

/* Tuỳ chỉnh: chỉ đổi màu cả bộ (bộ màu chuẩn), không chỉnh tay từng widget */
.st-bar .st-swatch { display: none; }
.st-pals .st-sw { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), 0 4px 12px rgba(0, 0, 0, .25); }
.st-pals { gap: 12px 10px; }

/* site Studio 28/11: menu ⋯ có link sang các trang, nút Lưu, link "Xem 3 gói" */
.st-menu a { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
.st-menu a:hover { background: var(--glass-hover); }
.st-menu hr { border: 0; height: 1px; background: var(--line); margin: 6px 4px; }
.st-menu { max-height: calc(100dvh - var(--top-h) - 20px); overflow-y: auto; }
.st-price-link { justify-self: start; color: #fff; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 400px) { .st-top-mid .st-ico, .st-top-end .st-ico { width: 34px; } .st-top-end { gap: 4px; } }
/* hộp chọn gói + hộp "Đã copy lời nhắn" (module pack-ui.js dùng chung với site Studio) */
.ss-packpick { display: grid; gap: 8px; }
.ss-packpick-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .05); cursor: pointer; }
.ss-packpick-opt:has(input:checked) { background: #2a1712; }
.ss-packpick-opt input { width: 20px; height: 20px; margin-top: 2px; accent-color: #ff6a58; flex-shrink: 0; }
.ss-packpick-txt { display: grid; gap: 2px; }
.ss-packpick-txt b { color: var(--text); font-size: 15px; }
.ss-packpick-txt small { color: var(--text-dim); font-size: 13px; }
.ss-packpick-photo { display: block; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .05); font-weight: 600; color: #ff8a73; }
.ss-packpick-note { margin: 6px 0 0 !important; font-size: 12.5px; color: var(--text-faint); }
.ss-warn { color: #ffd9a8 !important; font-weight: 600; }
.ss-linkbtn { border: 0; background: none; padding: 6px 0; color: #ff8a73; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-align: left; }

/* hộp đăng nhập: "Quên mật khẩu?" cạnh "Ghi nhớ" */
.st-acct-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.st-acct-forgot { border: 0; background: none; padding: 6px 0; color: var(--accent-text, #ff8a75); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.st-acct-forgot:hover { text-decoration: underline; }
.st-acct-forgot[hidden] { display: none; }
