/* Phạm Trường Studio — giao diện dựng lại theo số đo của trang tham chiếu (xem docs/REVERSE-ENGINEERING.md) */
:root {
  color-scheme: dark;
  --bg: #141414;
  --panel: #202020;
  --border: #303030;
  --muted: #909090;
  --accent: #08c5e8;
  --action-bg: #e8e5de;
  --action-hover: #faf7ef;
  --action-text: #252b2d;
  --action-focus: #c5d2d7;
  --sidebar: 232px;
  --topbar-h: 40px;
  --content-width: 1400px;
  --gutter: 32px;
  --nav-highlight: #a8e0e8;
  --nav-selected: #87d7e512;
  --nav-line: #ffffff0d;
  --cyan-300: #67e8f9;
  --cyan-200: #a5f3fc;
  --cyan-400: #22d3ee;
  --dark-900: #181818;
  --dark-400: #a3a3a3;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: #fff; min-height: 100dvh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input { font: inherit; border: 0; }
img { display: block; max-width: 100%; }
svg.ic { display: block; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:is(a, button, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.app { color: #f5f5f5; font-size: 14px; line-height: 1.5; min-height: 100dvh; }
.app.collapsed { --sidebar: 76px; }

/* ---------- Thanh bên ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  width: var(--sidebar); background: #171717; border-right: 1px solid #292929;
  display: flex; flex-direction: column; padding: 0 16px 16px; transition: width .2s;
}
.brand-row { flex-shrink: 0; display: flex; align-items: center; gap: 4px; min-height: 66px; padding: 10px 0; }
.brand { flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 17px; font-weight: 700; letter-spacing: -.6px; }
.brand img { flex-shrink: 0; width: 31px; height: 30px; object-fit: contain; }
.brand span { line-height: 1.2; white-space: nowrap; }
.icon-btn { color: #aaa; border-radius: 7px; padding: 6px; display: inline-flex; align-items: center; justify-content: center; transition: color .15s, background-color .15s; }
.icon-btn:hover { color: #fff; background: #303030; }
.mobile-close, .mobile-menu { display: none; }
.collapse-btn svg { transition: transform .2s; }
.collapsed .collapse-btn svg { transform: scaleX(-1); }

.sidebar nav { display: flex; flex-direction: column; gap: 5px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #ffffff18 transparent; }
.sidebar nav > * { flex-shrink: 0; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; height: 42px; padding: 0 12px;
  color: #b9bec6; border-radius: 9px; font-size: 13px; font-weight: 400; white-space: nowrap; width: 100%; text-align: left;
  transition: color .16s, background-color .16s, box-shadow .16s;
}
.nav-item > svg { color: #8f98a3; stroke-width: 1.65; transition: color .16s; }
.nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { color: #f0f3f5; background: #ffffff07; }
.nav-item:hover > svg { color: #d4dee3; }
.nav-item.is-active { background: var(--nav-selected); color: var(--nav-highlight); box-shadow: inset 0 0 0 1px #a8e0e811; }
.nav-item.is-active > svg { color: var(--nav-highlight); }
.nav-group-heading { display: flex; align-items: center; border-radius: 9px; transition: background-color .16s; }
.nav-group-heading:hover { background: #ffffff07; }
.nav-group-heading > .nav-item { flex: 1; min-width: 0; background: none; padding-right: 2px; font-weight: 500; }
.nav-group-heading.is-current-section > .nav-item { color: #ecf1f3; }
.nav-group-heading.is-current-section > .nav-item > svg { color: var(--nav-highlight); }
.nav-group-heading > button { flex: 0 0 30px; height: 30px; margin-right: 4px; display: grid; place-items: center; color: #7d8790; border-radius: 7px; transition: background-color .16s, color .16s; }
.nav-group-heading > button:hover { color: #d7e1e5; background: #ffffff0a; }
.nav-group-heading > button svg { transition: transform .16s; }
.nav-group-heading > button[aria-expanded="false"] svg { transform: rotate(-90deg); }
.nav-children { display: grid; gap: 3px; margin: 4px 0 8px 21px; padding-left: 12px; border-left: 1px solid var(--nav-line); }
.nav-children[hidden] { display: none; }
.nav-children .nav-item { height: 36px; padding: 0 10px; gap: 10px; color: #9da6b0; border-radius: 7px; font-size: 12px; }
.nav-children .nav-item:hover { color: #e7edf0; }
.nav-section { display: grid; gap: 5px; margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--nav-line); }
.sidebar-bottom { flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 14px; }
.help-menu { position: relative; }
.help-trigger[aria-expanded="true"] { color: #fff; background: #303030; }
.help-chevron { margin-left: auto; transition: transform .18s; }
.help-trigger[aria-expanded="true"] .help-chevron { transform: rotate(180deg); }
.help-popover {
  position: absolute; bottom: 0; left: calc(100% + 20px); z-index: 90; width: 210px; max-width: calc(100vw - 24px);
  background: #202327; border: 1px solid #3a4148; border-radius: 10px; padding: 6px; box-shadow: 0 18px 44px #000a;
  animation: pop-in .16s ease-out;
}
.help-popover[hidden] { display: none; }
.help-links { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: #d2d2d2; }
.help-links button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 32px; padding: 0 9px; border-radius: 7px; text-align: left; }
.help-links button:hover, .help-support:hover { color: #fff; background: #30353a; }
.help-support { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 34px; margin-top: 4px; padding: 0 9px; border-top: 1px solid #353b42; border-radius: 7px; color: #d2d2d2; font-size: 11px; }
.sidebar-foot { padding: 10px 6px 0; color: #6f747a; font-size: 11px; line-height: 1.45; white-space: nowrap; overflow: hidden; }

.collapsed .brand, .collapsed .nav-item span, .collapsed .help-chevron, .collapsed .sidebar-foot, .collapsed .nav-children, .collapsed .nav-group-heading > button { display: none; }
.collapsed .brand-row { justify-content: center; }
.collapsed .nav-item { justify-content: center; padding: 0; }
.collapsed .nav-group-heading.is-current-section { background: var(--nav-selected); }

/* ---------- Khung chính ---------- */
.main { margin-left: var(--sidebar); min-width: 0; transition: margin-left .2s; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); background: var(--bg); display: flex; align-items: center; gap: 14px; padding: 0 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lang { position: relative; }
.lang-btn { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 4px 8px; border-radius: 8px; color: #d4d4d4; font-size: 12px; transition: color .15s, background-color .15s; }
.lang-btn:hover { background: #262626; color: #fff; }
.lang-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 140px; padding: 4px; background: #1e1e1e; border: 1px solid #333; border-radius: 10px; box-shadow: 0 14px 34px #0008; z-index: 60; animation: pop-in .14s ease-out; }
.lang-menu[hidden] { display: none; }
.lang-menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 12px; color: #cfcfcf; }
.lang-menu button:hover { background: #2a2a2a; color: #fff; }
.lang-menu button.is-active { color: var(--nav-highlight); }
.login-btn { height: 32px; padding: 8px 15px; border-radius: 7px; background: #fff; color: #171717; font-size: 12px; font-weight: 500; line-height: 16px; transition: background-color .15s; }
.login-btn:hover { background: #e9e9e9; }

.content { max-width: calc(var(--content-width) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter) 32px; }

/* ---------- Hero / Studio ---------- */
.home-intro { display: grid; grid-template-columns: minmax(0, 1fr); margin-bottom: 32px; }
.studio { min-width: 0; overflow: hidden; border: 1px solid #ffffff14; border-radius: 20px; background: linear-gradient(115deg, #202326, var(--studio-background, #161b1e)); }
.studio-welcome { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; min-height: 236px; }
.studio-copy { min-width: 0; padding: 28px 36px; }
.eyebrow { display: flex; align-items: center; gap: 6px; color: #9aabb1; font-size: 10px; font-weight: 500; letter-spacing: 1px; }
.studio-copy h1 { max-width: 530px; margin-top: 16px; font-size: clamp(27px, 2.25vw, 36px); font-weight: 500; line-height: 1.45; letter-spacing: -.6px; text-wrap: balance; color: #f5f5f5; }
.studio-copy > p { margin-top: 10px; color: #acb1b7; font-size: 13px; line-height: 1.7; }
.studio-start {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; margin-top: 22px; padding: 9px 16px;
  background: var(--action-bg); color: var(--action-text); border: 1px solid #fff4; border-radius: 9px; font-size: 13px; font-weight: 500; transition: background-color .15s;
}
.studio-start:hover { background: var(--action-hover); }
.studio-start > svg:last-child { margin-left: 12px; }
.studio-start:focus-visible { outline-color: var(--action-focus); }

/* 3 ảnh xếp lớp: trái nghiêng -9°, giữa +2° cao hơn & nổi trên cùng, phải +9° */
.studio-gallery { isolation: isolate; display: grid; grid-template-columns: 1fr 1.12fr 1fr; align-items: center; min-width: 0; height: 232px; padding: 22px 40px 22px 20px; }
.studio-gallery > div { position: relative; z-index: 1; width: calc(100% + 28px); min-width: 0; height: 166px; margin-inline: -14px; overflow: hidden; border: 1px solid #fff2; border-radius: 10px; box-shadow: 0 12px 28px #0006; }
.studio-gallery > div:nth-child(1) { transform: translateY(8px) rotate(-9deg); }
.studio-gallery > div:nth-child(2) { z-index: 3; height: 194px; transform: translateY(-4px) rotate(2deg); }
.studio-gallery > div:nth-child(3) { z-index: 2; transform: translateY(10px) rotate(9deg); }
.studio-gallery img { width: 100%; height: 100%; object-fit: cover; }

.studio-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 14px; background: #ffffff03; border-top: 1px solid #ffffff12; }
.studio-tool { display: flex; align-items: center; gap: 12px; min-width: 0; margin: 6px 0; padding: 10px 16px; border-radius: 9px; transition: background-color .15s; }
.studio-tool:hover { background: #ffffff08; }
.tool-icon { flex: 0 0 36px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #a8c6d2; background: #a8c6d210; }
.is-image .tool-icon { color: #c3b6d5; background: #c3b6d510; }
.is-canvas .tool-icon { color: #b9c9b0; background: #b9c9b010; }
.is-human .tool-icon { color: #d4c0a4; background: #d4c0a410; }
.tool-copy { flex: 1; min-width: 0; }
.tool-copy strong { display: block; color: #e0e2e6; font-size: 13px; font-weight: 500; }
.tool-copy small { display: block; margin-top: 5px; color: #929aa3; font-size: 11px; line-height: 1.5; }
.tool-arrow { color: #7a868e; flex-shrink: 0; }

/* ---------- Tiêu đề khối ---------- */
.home-section { margin: 0 0 34px; scroll-margin-top: 56px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 7px 20px; }
.section-heading h2 { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 600; letter-spacing: -.4px; line-height: 1.5; color: #f5f5f5; }
.section-heading > a { display: flex; align-items: center; gap: 8px; color: #d3d3d3; font-size: 11px; transition: color .15s; }
.section-heading > a:hover { color: var(--accent); }

/* ---------- Dải danh mục + ô tìm ---------- */
.showcase-toolbar { display: flex; align-items: center; gap: 24px; }
.tpl-toolbar { margin-bottom: 20px; }
.category-strip { position: relative; flex: 1 1 0%; min-width: 0; }
.category-tabs { display: flex; gap: 8px; padding: 4px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; scroll-behavior: smooth; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs button { flex-shrink: 0; padding: 8px 16px; border-radius: 9999px; color: #989898; font-size: 13px; line-height: 20px; transition: color .15s, background-color .15s; }
.category-tabs button:hover { color: #fff; background: #202020; }
.category-tabs button.is-active { color: #f5f5f5; background: #272727; }
.category-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 34px; display: grid; place-items: center; color: #bbb; background: var(--bg); border: 1px solid #78818b; border-radius: 9px; transition: color .15s, border-color .15s; }
.category-arrow:hover { color: #fff; border-color: #a6b0ba; }
.category-arrow.prev { left: 0; box-shadow: 8px 0 10px var(--bg); }
.category-arrow.next { right: 0; box-shadow: -8px 0 10px var(--bg); }
.category-arrow:disabled { visibility: hidden; }
.search { flex: 0 0 26%; min-width: 180px; display: flex; align-items: center; gap: 7px; padding: 10px 16px; color: #888; border: 1px solid #323232; border-radius: 9999px; transition: border-color .15s; cursor: text; }
.search:focus-within { border-color: #5d7477; }
.search input { flex: 1; min-width: 0; width: 100%; background: none; color: #ddd; font-size: 12px; outline: none !important; }
.search input::placeholder { color: #888; }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.inline-empty { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; padding: 25px; color: #9da7ae; border: 1px dashed #ffffff18; border-radius: 12px; font-size: 12px; }
.inline-empty a { display: inline-flex; align-items: center; gap: 7px; color: #c1e3ec; transition: color .15s, gap .15s; }
.inline-empty a:hover { color: #e3f7fb; gap: 10px; }

/* ---------- Tab Tác phẩm ---------- */
.home-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.home-tabs button { padding: 7px 12px; color: #a8adb2; border: 1px solid transparent; border-radius: 7px; font-size: 12px; line-height: 18px; transition: background-color .15s, color .15s; }
.home-tabs button:is(:hover, :focus-visible) { color: #effcff; background: #ffffff0a; }
.home-tabs button.is-active { color: #c6f4fb; background: #c4eaf00f; border-color: #91c7d12e; }
[data-panel][hidden] { display: none !important; }

/* Thẻ tác phẩm nổi bật (lưới 1 → 2 → 4 cột) */
.works-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.work-card {
  display: block; overflow: hidden; text-align: left; width: 100%;
  background: var(--dark-900); border: 1px solid #ffffff1a; border-radius: 16px;
  transition: transform .15s cubic-bezier(.4,0,.2,1), border-color .15s cubic-bezier(.4,0,.2,1);
}
.work-card:hover { transform: translateY(-4px); border-color: #22d3ee59; }
.work-card:focus-visible { outline: 2px solid var(--cyan-400); }
.work-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(to bottom right, #1e293b, #181818, #083344); }
.work-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.4,0,.2,1); }
.work-card:hover .work-media img { transform: scale(1.05); }
.work-shade { position: absolute; inset: 0; background: linear-gradient(to top, #000000a6, transparent, #0000001a); }
.work-play { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 9999px; color: #fff; background: #ffffff26; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background-color .15s, color .15s; }
.work-card:hover .work-play { background: var(--cyan-400); color: #141414; }
.work-body { padding: 16px; }
.work-body h3 { font-size: 16px; font-weight: 600; line-height: 24px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-body p { margin-top: 4px; min-height: 40px; color: var(--dark-400); font-size: 12px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work-meta { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--dark-400); font-size: 12px; line-height: 16px; }
.work-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Phong cách & preset */
.showcase-header { position: sticky; top: var(--topbar-h); z-index: 20; background: var(--bg); margin-bottom: 18px; padding: 12px 0 16px; }
.showcase-header::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; background: inherit; pointer-events: none; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(250px, 25% - 12px)), 1fr)); gap: 24px 16px; }
.style-card { display: block; min-width: 0; text-align: left; align-self: start; animation: card-in .35s ease-out both; }
.style-image { position: relative; aspect-ratio: 1.4; overflow: hidden; background: #242424; border-radius: 12px; }
.style-image > img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s, opacity .3s; }
.style-card:hover .style-image > img { opacity: .85; transform: scale(1.04); }
.image-tag { position: absolute; top: 9px; left: 9px; padding: 3px 6px; color: #eee; background: #0007; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 4px; font-size: 9px; line-height: 14px; }
.card-action {
  position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  background: #171717aa; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid #ffffff30; border-radius: 7px; font-size: 11px;
  opacity: 0; transform: translateY(5px); transition: opacity .2s, transform .2s;
}
.style-card:is(:hover, :focus-visible) .card-action { opacity: 1; transform: translateY(0); }
.style-copy { padding: 11px 2px; }
.style-copy h3 { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; overflow: hidden; }
.style-name { flex-shrink: 0; }
.style-sub { min-width: 0; color: #7f7f7f; font-size: 10px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.gallery-empty { padding: 40px 0; text-align: center; color: #8a8a8a; font-size: 12px; }

/* ---------- Hộp xem trước ---------- */
.preview-dialog {
  margin: auto; width: calc(100% - 32px); max-width: 860px; max-height: 90dvh; padding: 0; overflow: auto;
  color: #f5f5f5; background: #1e1e1e; border: 1px solid #454545; border-radius: 18px; box-shadow: 0 30px 100px #0009;
}
.preview-dialog[open] { animation: modal-zoom-in .22s cubic-bezier(.2,.8,.2,1); }
.preview-dialog::backdrop { background: #000b; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: modal-fade-in .2s ease-out; }
.dialog-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: #0008; color: #ddd; }
.preview-media { aspect-ratio: 16 / 9; background: #111; }
.preview-media img { width: 100%; height: 100%; object-fit: cover; }
.preview-body { padding: 22px 24px 26px; }
.preview-tag { display: inline-block; padding: 3px 8px; border-radius: 5px; background: #ffffff10; color: #c6f4fb; font-size: 11px; }
.preview-tag:empty { display: none; }
.preview-body h3 { margin-top: 10px; font-size: 20px; font-weight: 600; }
.preview-body p { margin-top: 8px; color: #b3b3b3; font-size: 13px; line-height: 1.75; }
.primary-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; padding: 10px 16px; border-radius: 8px; background: var(--action-bg); color: var(--action-text); font-size: 12px; font-weight: 500; transition: background-color .15s; }
.primary-btn:hover { background: var(--action-hover); }
.login-dialog { max-width: 420px; }
.login-dialog .preview-body { padding: 30px 28px; text-align: center; }
.login-dialog img { margin: 0 auto 6px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 120; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: #262a2e; border: 1px solid #3a4148; color: #e6eef1; font-size: 12px; box-shadow: 0 14px 34px #0009; animation: toast-in .2s ease-out; }
.toast[hidden] { display: none; }

@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-zoom-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Điểm ngắt (giống trang tham chiếu) ---------- */
@media (min-width: 640px) { .works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .works-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1600px) { :root { --gutter: 42px; } .style-image { aspect-ratio: 1.5; } }

@media (max-width: 1150px) {
  .studio-copy { padding: 26px; }
  .studio-gallery { padding-right: 32px; }
  .studio-tools { padding: 4px 8px; }
  .studio-tool { gap: 9px; padding: 10px; }
  .tool-arrow { display: none; }
}
@media (max-width: 960px) {
  .app { --sidebar: 76px; }
  .sidebar { padding: 0 12px 14px; }
  .brand-row { justify-content: center; }
  .brand, .collapse-btn, .nav-item span, .help-chevron, .sidebar-foot, .nav-children, .nav-group-heading > button { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-group-heading.is-current-section { background: var(--nav-selected); }
  .help-popover { left: calc(100% + 12px); }
}
@media (max-width: 760px) {
  .studio-welcome { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .studio-copy { padding: 24px; }
  .studio-copy h1 { max-width: 460px; font-size: 28px; }
  .studio-gallery { display: none; }
  .studio-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; }
  .studio-tool { align-items: flex-start; }
  .tool-copy small { font-size: 10px; }
}
@media (max-width: 640px) {
  .app, .app.collapsed { --sidebar: 0px; --topbar-h: 44px; }
  :root { --gutter: 16px; }
  .content { padding-bottom: 20px; }
  .sidebar { z-index: 80; width: 230px; padding: 0 16px 16px; transform: translateX(-100%); transition: transform .2s; visibility: hidden; }
  .sidebar.is-open { transform: none; visibility: visible; }
  .sidebar.is-open .brand { display: flex; }
  .sidebar.is-open .nav-item span, .sidebar.is-open .sidebar-foot { display: initial; }
  .sidebar.is-open .help-chevron { display: block; }
  .sidebar.is-open .nav-children { display: grid; }
  .sidebar.is-open .nav-children[hidden] { display: none; }
  .sidebar.is-open .nav-group-heading > button { display: grid; flex-basis: 36px; height: 36px; }
  .sidebar.is-open .nav-item { justify-content: flex-start; padding-left: 12px; }
  .sidebar.is-open .nav-children .nav-item { height: 40px; padding: 0 10px; }
  .sidebar.is-open .nav-group-heading.is-current-section { background: none; }
  .sidebar.is-open .brand-row { justify-content: flex-start; }
  .mobile-close, .mobile-menu { display: flex; }
  .mobile-backdrop { position: fixed; inset: 0; z-index: 75; background: #0009; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
  .mobile-backdrop[hidden] { display: none; }
  .help-popover { left: auto; right: 0; bottom: calc(100% + 8px); }
  .topbar { gap: 8px; padding: 0 16px; }
  .topbar-actions { gap: 7px; }
  .lang-btn span { display: none; }
  .login-btn { padding: 7px 10px; font-size: 10px; height: auto; }
  .section-heading { flex-wrap: wrap; gap: 8px; margin-left: 0; margin-right: 0; }
  .section-heading h2 { font-size: 17px; }
  .section-heading > a { font-size: 10px; }
  .category-tabs button { padding: 8px 12px; font-size: 11px; line-height: 17px; }
  .showcase-toolbar { gap: 12px; }
  .search { flex-basis: 38%; min-width: 0; padding: 9px 10px; }
  .search input { font-size: 10px; }
  .showcase-header { margin-bottom: 12px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 10px; }
  .style-image { aspect-ratio: 1.1; border-radius: 9px; }
  .image-tag { font-size: 8px; top: 7px; left: 7px; }
  .card-action { display: none; }
  .style-copy h3 { font-size: 11px; }
  .style-sub { display: none; }
}
@media (max-width: 560px) {
  .studio { border-radius: 16px; }
  .home-section { margin-bottom: 28px; }
  .section-heading { gap: 10px; margin-bottom: 15px; }
  .section-heading h2 { font-size: 16px; }
  .home-tabs { gap: 2px; }
  .home-tabs button { padding: 6px 8px; font-size: 11px; line-height: 17px; }
  .studio-copy { padding: 24px 20px; }
  .studio-copy h1 { font-size: 26px; }
  .studio-tool { gap: 8px; padding: 8px; }
  .tool-icon { flex-basis: 30px; height: 34px; }
  .tool-copy strong { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
