@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Flex:opsz,wght@6..144,300..800&display=swap');

:root {
  --font-ui: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --bg-app: #f4f6f8;
  --bg-surface: #ffffff;
  --bg-sidebar: #eef1f4;
  --bg-panel: #f8f9fb;
  --bg-subtle: #edf1f5;
  --bg-hover: #e5ecf1;
  --bg-active: #dff0f5;
  --bg-canvas: #e2e7ec;
  --bg-welcome: linear-gradient(135deg, #eaf0f4 0%, #e4eef2 100%);
  --bg-input: #ffffff;
  --bg-code: #1d2b36;
  --text-code: #dff0fb;

  --ink: #1e2a35;
  --ink-secondary: #4a5b6b;
  --muted: #687989;
  --line: #d8e0e7;
  --line-strong: #c2ced8;

  --accent: #087d9c;
  --accent-bright: #1cb7cc;
  --accent-ink: #ffffff;
  --accent-soft: #e0f3f8;
  --accent-text: #06637d;
  --web-card-bg: #123348;
  --web-card-ink: #4ee1f2;
  --web-card-sub: #b6edf2;

  --danger: #c43e2d;
  --danger-bg: #fff2f0;
  --danger-border: #f3c4bd;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --success: #15803d;

  --shadow-sm: 0 2px 8px rgba(18, 35, 50, 0.06);
  --shadow-md: 0 10px 28px rgba(18, 35, 50, 0.1);
  --shadow-lg: 0 24px 64px rgba(10, 24, 38, 0.22);
  --radius: 12px;

  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-app);
  font-synthesis: none;
}

[data-theme="dark"] {
  --bg-app: #0f1419;
  --bg-surface: #161d26;
  --bg-sidebar: #131922;
  --bg-panel: #161d26;
  --bg-subtle: #1d2632;
  --bg-hover: #253040;
  --bg-active: #163746;
  --bg-canvas: #0b0f14;
  --bg-welcome: linear-gradient(135deg, #16222d 0%, #132934 100%);
  --bg-input: #11171f;
  --bg-code: #0b1016;
  --text-code: #cbe6f7;

  --ink: #e8eef5;
  --ink-secondary: #b7c5d3;
  --muted: #8b9db0;
  --line: #273241;
  --line-strong: #37475b;

  --accent: #22c1d6;
  --accent-bright: #34d5eb;
  --accent-ink: #07222b;
  --accent-soft: #133946;
  --accent-text: #6de6f5;
  --web-card-bg: #102a3d;
  --web-card-ink: #57e6f7;
  --web-card-sub: #a8dce3;

  --danger: #f87171;
  --danger-bg: #35181a;
  --danger-border: #6b2b2f;
  --warn: #fbbf24;
  --warn-bg: #36280d;
  --success: #4ade80;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 24px 72px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-app); color: var(--ink); font-family: var(--font-ui); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
button:disabled { opacity: .38; cursor: not-allowed; }
button, a { touch-action: manipulation; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
input:focus, textarea:focus, select:focus, [contenteditable]:focus { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
input, textarea, select { min-width: 0; }
svg { flex-shrink: 0; vertical-align: middle; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-ui); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 15px; border: 1px solid var(--line);
  background: var(--bg-surface); color: var(--ink); border-radius: 8px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--bg-subtle); }
.btn.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 650; box-shadow: var(--shadow-sm);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.btn.text-btn { background: transparent; border-color: transparent; color: var(--ink-secondary); }
.btn.text-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--ink); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; color: var(--ink-secondary);
}
.icon-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--ink); }
.flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.boot {
  height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 46px; font-weight: 800; letter-spacing: -2px; color: var(--ink);
}
.boot span { font-size: 15px; letter-spacing: 0; font-weight: 500; margin-top: 14px; color: var(--muted); }

/* ======================== HOME SHELL ======================== */
.app-shell { display: flex; min-height: 100dvh; position: relative; }
.sidebar {
  width: 248px; background: var(--bg-sidebar); border-right: 1px solid var(--line);
  padding: 24px 14px 18px; position: fixed; inset: 0 auto 0 0; height: 100dvh;
  display: flex; flex-direction: column; z-index: 30; overflow-y: auto;
}
.sidebar-backdrop { display: none; }
.logo {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  letter-spacing: -1.4px; font-size: 28px; font-weight: 800; margin: 0 10px 22px; color: var(--ink);
}
.logo img { width: 32px; height: 32px; border-radius: 8px; }
.logo > span { font-size: 11px; align-self: flex-start; margin-top: 6px; letter-spacing: 0; font-weight: 600; color: var(--muted); }

.workspace {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; margin: 0 0 22px;
  background: var(--bg-surface); width: 100%; text-align: left;
}
.workspace:hover { border-color: var(--line-strong); }
.workspace > div { min-width: 0; flex: 1; }
.workspace strong { display: block; font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 36px; height: 36px; background: var(--accent-soft); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  font-weight: 700; font-size: 16px; flex-shrink: 0; overflow: hidden;
}
.avatar.has-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.small { width: 34px; height: 34px; font-size: 15px; border: 2px solid var(--bg-surface); box-shadow: 0 0 0 1px var(--line); }
.avatar-btn { padding: 0; border-radius: 50%; display: inline-flex; }

.nav-label { font-size: 11px; letter-spacing: .8px; color: var(--muted); font-weight: 700; padding: 0 12px; margin: 0 0 8px; }
.sidebar nav { display: grid; gap: 4px; margin-bottom: 22px; }
.sidebar nav button {
  display: flex; align-items: center; text-align: left; gap: 11px; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--ink-secondary); min-height: 42px;
}
.sidebar nav button.active { background: var(--bg-active); color: var(--accent-text); font-weight: 650; }
.sidebar nav button:hover:not(.active) { background: var(--bg-hover); color: var(--ink); }
.sidebar nav button > span { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.sidebar nav button i {
  font-size: 10px; font-weight: 700; letter-spacing: .5px; font-style: normal;
  border: 1px solid var(--line-strong); color: var(--accent-text);
  padding: 2px 6px; border-radius: 99px; margin-left: auto;
}

.sidebar-bottom { margin-top: auto; padding-top: 12px; }
.local-note {
  font-size: 12px; font-weight: 600; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink-secondary); background: var(--bg-surface);
}
.dot { display: inline-block; width: 7px; height: 7px; background: #10b981; border-radius: 50%; margin-right: 6px; }
.local-note small { display: block; font-size: 11px; font-weight: 400; line-height: 1.5; color: var(--muted); margin-top: 5px; }
.sidebar-bottom > button {
  display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500;
  padding: 12px 10px; width: 100%; color: var(--ink-secondary); border-radius: 8px; margin-top: 6px;
}
.sidebar-bottom > button:hover { background: var(--bg-hover); color: var(--ink); }
.sidebar-bottom > small { display: block; font-size: 11px; color: var(--muted); padding: 4px 10px 0; }

.home-main { margin-left: 248px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-top {
  height: 64px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; padding: 0 32px;
  background: var(--bg-surface); position: sticky; top: 0; z-index: 10;
}
.home-top-left { display: flex; align-items: center; gap: 10px; }
.mobile-menu-btn { display: none; }
.crumb { font-size: 14px; font-weight: 600; color: var(--ink-secondary); }
.crumb > span { margin: 0 8px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }

.home-content { max-width: 1480px; width: 100%; margin: 0 auto; padding: 28px 32px 48px; }
.welcome {
  background: var(--bg-welcome); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px 36px; display: flex; align-items: center; justify-content: space-between;
}
.welcome h1 { font-size: 36px; line-height: 1.18; font-weight: 700; letter-spacing: -0.9px; color: var(--ink); }
.welcome h1 em { font-style: normal; color: var(--accent); }
.welcome p { font-size: 15px; color: var(--ink-secondary); margin-top: 10px; max-width: 620px; line-height: 1.6; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.welcome-actions .btn { min-height: 44px; padding: 10px 18px; font-size: 14px; }

.project-section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; letter-spacing: -.4px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.count { font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); padding: 3px 9px; border-radius: 99px; }
.section-actions { display: flex; align-items: center; gap: 8px; }

.library-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 20px; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 8px;
  color: var(--ink-secondary); background: var(--bg-subtle); min-height: 38px;
}
.tabs button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.library-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search {
  border: 1px solid var(--line); display: flex; align-items: center; gap: 8px;
  border-radius: 8px; height: 40px; padding: 0 12px; background: var(--bg-input); color: var(--muted);
}
.search input { border: 0; background: none; font-size: 14px; width: 170px; outline: 0; color: var(--ink); }
.library-controls select {
  height: 40px; border: 1px solid var(--line); background: var(--bg-input); color: var(--ink);
  border-radius: 8px; padding: 0 12px; font-size: 13px; max-width: 170px;
}

.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.project-card {
  background: var(--bg-surface); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; transition: transform .2s, box-shadow .2s; min-width: 0; display: flex; flex-direction: column;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.project-preview {
  display: block; height: 230px; width: 100%; overflow: hidden; position: relative;
  background: var(--bg-subtle); text-align: initial;
}
.project-preview iframe {
  width: 640px; height: 960px; border: 0; pointer-events: none;
  transform: scale(.36); transform-origin: top left; position: absolute;
  left: calc(50% - 115px); top: 18px; box-shadow: 0 5px 20px rgba(0,0,0,0.12); background: white;
}
.preview-open {
  opacity: 0; position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: var(--bg-surface); color: var(--ink); padding: 8px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow-md);
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
}
.project-preview:hover .preview-open { opacity: 1; }

/* HTML5 badge on top-right corner of eMagazine thumbnails */
.html5-badge {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  background: linear-gradient(135deg, #e44d26, #f16529);
  color: #ffffff; font-size: 11px; font-weight: 800; letter-spacing: .7px;
  padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(228, 77, 38, 0.4);
  pointer-events: none; line-height: 1.2;
}

.card-info { padding: 15px 16px 13px; flex: 1; display: flex; flex-direction: column; }
.type-label { display: inline-flex; align-items: center; gap: 5px; letter-spacing: .6px; font-size: 11px; font-weight: 700; color: var(--accent-text); }
.card-info h3 { font-size: 15px; font-weight: 650; line-height: 1.4; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info h3 button { padding: 0; font: inherit; text-align: left; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; font-size: 12px; color: var(--muted); gap: 6px; }
.card-meta > div { display: flex; gap: 2px; }
.card-meta .icon-btn { height: 32px; width: 32px; }

.project-card--web { border-color: var(--web-card-bg); }
.project-card--web .card-info { background: var(--web-card-bg); color: var(--web-card-ink); }
.project-card--web .card-info h3, .project-card--web .card-info h3 button { color: var(--web-card-ink); }
.project-card--web .type-label, .project-card--web .card-meta { color: var(--web-card-sub); }
.project-card--web .icon-btn { color: var(--web-card-sub); }
.project-card--web .icon-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

.new-card {
  border: 2px dashed var(--line-strong); border-radius: 12px; min-height: 320px;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: var(--ink-secondary); background: var(--bg-panel); padding: 20px;
}
.new-card > span {
  background: var(--accent-soft); color: var(--accent-text); border-radius: 50%;
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.new-card > strong { font-size: 15px; font-weight: 650; }
.new-card small { font-size: 13px; margin-top: 6px; color: var(--muted); }
.new-card:hover { background: var(--bg-active); border-color: var(--accent); }

/* ======================== EDITOR ======================== */
.editor.stampix-light {
  display: grid;
  grid-template-columns: 256px minmax(280px, 1fr) 310px;
  grid-template-rows: 66px minmax(0, 1fr) 36px;
  height: 100dvh; background: var(--bg-canvas); overflow: hidden;
}
.editor-header {
  grid-column: 1 / -1; grid-row: 1; height: 66px; padding: 0 18px;
  background: var(--bg-surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.studio-brand { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.studio-brand img { width: 34px; height: 34px; border-radius: 8px; }
.studio-brand .wordmark { font-size: 24px; font-weight: 800; letter-spacing: -1.3px; color: var(--ink); text-decoration: none; }
.editor-identity { flex: 1; min-width: 140px; display: flex; align-items: center; gap: 10px; }
.editor-identity > div { min-width: 0; flex: 1; max-width: 300px; }
.editor-identity input {
  display: block; width: 100%; font-size: 14px; font-weight: 650; color: var(--ink);
  background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px;
  text-overflow: ellipsis;
}
.editor-identity input:hover, .editor-identity input:focus { border-color: var(--line); background: var(--bg-input); }
.editor-identity small { display: block; color: var(--muted); font-size: 11px; padding: 0 6px; }
.mode-tag {
  background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700;
  letter-spacing: .5px; padding: 4px 9px; border-radius: 99px; white-space: nowrap;
}
.editor-actions { display: flex; align-items: center; gap: 6px; }

.editor-left, .editor-right { background: var(--bg-panel); overflow-y: auto; scrollbar-width: thin; min-height: 0; }
.editor-left { grid-row: 2; grid-column: 1; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.editor-right { grid-row: 2; grid-column: 3; border-left: 1px solid var(--line); }

.section-title {
  display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .9px;
  color: var(--muted); font-weight: 700; padding: 13px 16px; min-height: 46px;
}
.section-title > span { color: var(--accent-text); }
.section-title > .icon-btn { margin-left: auto; width: 28px; height: 28px; }

.panel-tabs {
  display: flex; background: var(--bg-subtle); margin: 0 12px; padding: 4px;
  border-radius: 8px; gap: 3px; position: sticky; top: 0; z-index: 2;
}
.panel-tabs button {
  flex: 1; border: 0; font-size: 12px; font-weight: 600; padding: 8px 4px;
  color: var(--muted); border-radius: 6px;
}
.panel-tabs button.active { background: var(--bg-surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.panel-intro { padding: 16px 16px 12px; }
.panel-intro h3 { font-size: 14px; font-weight: 700; color: var(--ink); }
.panel-intro p { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 4px; }

.block-library { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 0 14px; }
.block-tool {
  position: relative; background: var(--bg-surface); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-secondary); min-height: 82px; padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: grab;
}
.block-tool span { color: var(--ink); font-size: 12px; font-weight: 500; text-align: center; }
.block-tool:hover { background: var(--bg-active); border-color: var(--accent); transform: translateY(-1px); }
.block-tool i { font-size: 9px; font-weight: 700; position: absolute; right: 6px; top: 5px; color: var(--accent-text); font-style: normal; }

.panel-tip {
  display: flex; align-items: flex-start; gap: 10px; margin: 18px 14px; padding: 12px;
  background: var(--bg-subtle); border-radius: 8px; color: var(--accent-text);
}
.panel-tip p { font-size: 12px; line-height: 1.55; color: var(--ink-secondary); }
.left-footer { padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg-sidebar); margin-top: auto; display: flex; gap: 6px; }
.left-footer .btn { flex: 1; font-size: 12px; min-height: 36px; padding: 6px 8px; }

.canvas-area { grid-row: 2; grid-column: 2; display: flex; flex-direction: column; overflow: hidden; min-width: 0; min-height: 0; }
.workspace-heading {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-sidebar); border-bottom: 1px solid var(--line); flex-shrink: 0; min-height: 44px;
}
.live-badge { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--accent-text); margin-right: 16px; display: flex; align-items: center; gap: 6px; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); }

.canvas-toolbar {
  min-height: 48px; flex-shrink: 0; padding: 6px 14px; background: var(--bg-surface);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
}
.device-toggle { display: inline-flex; background: var(--bg-subtle); border-radius: 8px; padding: 3px; gap: 2px; }
.device-toggle .btn { background: none; border-color: transparent; font-size: 12px; padding: 5px 11px; min-height: 32px; border-radius: 6px; color: var(--muted); }
.device-toggle .btn.active { color: var(--ink); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
.canvas-toolbar > span { font: 600 12px ui-monospace, monospace; color: var(--muted); }
.canvas-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.canvas-toolbar-right .btn { font-size: 12px; min-height: 34px; padding: 5px 10px; }

.format-dock {
  flex: 0 0 auto; margin: 8px 14px 0; padding: 8px 12px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--bg-surface); max-height: 36vh; overflow: auto;
}
.format-dock[hidden] { display: none !important; }
.format-bar-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.format-bar-head button { font-size: 20px; margin-left: auto; cursor: pointer; padding: 0 6px; }
.format-dock .text-options { display: inline-flex; margin: 2px 8px 2px 0; }
.format-dock .text-selection-label { display: none; }
.format-dock [data-rich-tools] { display: flex; flex-wrap: wrap; }

.canvas-scroll { background: var(--bg-canvas); padding: 28px 28px 36px; overflow: auto; min-height: 0; flex: 1; scrollbar-width: thin; }
.canvas-frame { position: relative; min-height: 0; margin: 0 auto; background: #fff; box-shadow: var(--shadow-md); border: 0; overflow: visible; }
.canvas-frame #canvas { position: absolute; top: 0; left: 0; transform-origin: top left; background: #fff; min-height: 0; }
.canvas-frame.mobile { border-radius: 14px; }
.add-bottom {
  display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 360px;
  margin: 24px auto 0; border: 1.5px dashed var(--line-strong); border-radius: 8px;
  font-size: 13px; font-weight: 600; padding: 10px 20px; color: var(--ink-secondary); background: var(--bg-surface);
}
.add-bottom:hover { border-color: var(--accent); color: var(--accent-text); }
.canvas-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; line-height: 1.6; }

.zoom-bar {
  display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 6px 14px;
  border-top: 1px solid var(--line); background: var(--bg-surface); flex-shrink: 0;
  color: var(--ink-secondary); font-size: 12px;
}
.zoom-bar > button:not(.btn):not(.icon-btn) { font-size: 12px; font-weight: 600; color: var(--ink-secondary); padding: 5px 10px; background: var(--bg-subtle); border-radius: 6px; }
.zoom-bar .icon-btn { width: 30px; height: 30px; }
.zoom-bar select { font-size: 12px; border: 1px solid var(--line); background: var(--bg-input); color: var(--ink); height: 30px; border-radius: 6px; padding: 0 8px; max-width: 112px; }
.zoom-bar .btn { min-height: 30px; font-size: 12px; padding: 5px 10px; }
.zoom-spacer { flex: 1; }
#zoom-label { font: 600 12px ui-monospace, monospace; color: var(--muted); }

.studio-footer {
  grid-column: 1 / -1; grid-row: 3; display: flex; justify-content: space-between; align-items: center;
  gap: 20px; padding: 0 18px; border-top: 1px solid var(--line); background: var(--bg-sidebar);
  font-size: 12px; color: var(--muted);
}
.studio-footer > span { white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.footer-hint { font-size: 11px; color: var(--muted); }

/* Inspector */
.inspector-title { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.inspector-title > div { display: flex; align-items: center; gap: 9px; color: var(--accent-text); }
.inspector-title h3 { font-size: 14px; font-weight: 700; color: var(--ink); }
.block-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 14px; border-bottom: 1px solid var(--line); background: var(--bg-subtle); }
.block-actions .icon-btn { width: 34px; height: 34px; }
.inspector-body { padding: 18px 16px 32px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; color: var(--ink-secondary); margin-bottom: 6px; font-weight: 600; }
.field input:not([type=color]), .field select, .field textarea {
  display: block; width: 100%; border: 1px solid var(--line); background: var(--bg-input);
  border-radius: 7px; padding: 9px 11px; font-size: 13px; color: var(--ink); line-height: 1.5;
}
.field textarea { min-height: 92px; resize: vertical; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-input { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-input); }
.color-input input { width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }
.color-input input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input input::-webkit-color-swatch { border: 0; border-radius: 4px; }
.color-input code { font: 12px ui-monospace, monospace; color: var(--ink-secondary); }

.inspector-body h4 {
  font-size: 11px; font-weight: 700; margin: 22px 0 14px; padding-top: 16px;
  border-top: 1px solid var(--line); text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
}
.inspector-body > .btn { font-size: 13px; width: 100%; margin-top: 8px; }
.field-note { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 10px 0; }
.image-inspector { width: 100%; max-height: 150px; object-fit: contain; background: var(--bg-subtle); border-radius: 6px; display: block; margin-bottom: 10px; }

.inspector-rich-tools { position: relative; background: var(--bg-subtle); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 16px; }
.text-selection-label { font-size: 11px; font-weight: 600; color: var(--ink-secondary); margin: 0 0 6px; }
.text-options { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 5px 0; }
.text-options select { font-size: 12px; border: 1px solid var(--line); background: var(--bg-input); color: var(--ink); max-width: 130px; padding: 4px 6px; height: 32px; border-radius: 5px; }
.text-options input[type=number] { width: 54px; height: 32px; border: 1px solid var(--line); background: var(--bg-input); color: var(--ink); font-size: 12px; border-radius: 5px; padding: 0 6px; }
.text-options input[type=color] { height: 32px; width: 32px; border: 1px solid var(--line); padding: 2px; border-radius: 5px; background: var(--bg-input); }
.text-options button { height: 32px; min-width: 32px; padding: 4px 8px; font-size: 13px; border: 1px solid var(--line); background: var(--bg-surface); color: var(--ink); border-radius: 5px; }
.text-options button.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }

.rich-input-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: #ffffff; max-height: 320px; }
.inspector-body .rich-input {
  zoom: var(--view-scale, 1); width: calc(100% / var(--view-scale, 1));
  border: 0; border-radius: 0; min-height: 100px; max-height: none; padding: 10px;
  box-sizing: border-box; line-height: 1.65; word-break: normal; overflow-wrap: anywhere;
}
.inspector-body .rich-input h1, .inspector-body .rich-input h2, .inspector-body .rich-input h3, .inspector-body .rich-input h4 {
  font-family: inherit; font-weight: bold; line-height: var(--heading-line, 1.25);
  margin: 0 0 var(--heading-gap, 16px); padding: 0; border: 0; color: inherit;
}
.inspector-body .rich-input h1 { font-size: 2em; }
.inspector-body .rich-input h2 { font-size: 1.5em; }
.inspector-body .rich-input h3 { font-size: 1.17em; }
.inspector-body .rich-input p { margin: 0 0 var(--paragraph-gap, 14px); }
.inspector-body .rich-input a { color: var(--link-color, #174d42); text-decoration: underline; }
.inspector-body .rich-input ul, .inspector-body .rich-input ol { margin-block: 1em; padding-left: 25px; }
.inspector-body .rich-input img { max-width: 100%; }
.code-input { font: 12px ui-monospace, monospace !important; min-height: 190px !important; }

.layer-list { padding: 0 12px; }
.layer { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--bg-surface); cursor: grab; }
.layer.selected { background: var(--bg-active); border-color: var(--accent); }
.layer > button:first-child { display: flex; gap: 9px; align-items: center; padding: 10px; min-width: 0; flex: 1; text-align: left; }
.layer > button > span { font-size: 13px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; min-width: 0; }
.layer .icon-btn { width: 28px; height: 32px; }

.module-item { padding: 6px 12px; display: flex; gap: 6px; }
.module-item .btn { font-size: 13px; flex: 1; white-space: normal; text-align: left; }
.empty-small { font-size: 13px; line-height: 1.65; color: var(--muted); padding: 24px 16px; }

.asset-panel-actions { padding: 0 14px 14px; display: grid; gap: 8px; }
.asset-panel-actions > .btn { width: 100%; min-height: 38px; }
.canvas-assets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 14px 18px; }
.canvas-assets > button { min-width: 0; text-align: left; padding: 0; cursor: grab; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-surface); }
.canvas-assets img { display: block; width: 100%; height: 76px; object-fit: cover; pointer-events: none; }
.canvas-assets span { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: 7px 8px; font-size: 11px; color: var(--ink-secondary); }

.gallery-inspector { display: grid; gap: 10px; margin-bottom: 10px; }
.gallery-inspector > div { display: flex; align-items: center; gap: 6px; }
.gallery-inspector img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.gallery-inspector input { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--bg-input); padding: 8px; font-size: 13px; border-radius: 6px; }
.image-settings { padding: 12px; background: var(--bg-subtle); border: 1px solid var(--line); margin: 14px 0; border-radius: 8px; }
.image-settings h4 { margin: 0 0 10px; padding-top: 0; border-top: 0; }
.image-settings .flex { margin-bottom: 10px; }
.column-settings { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }

.editor.expanded { grid-template-columns: 1fr; }
.editor.expanded > .editor-left, .editor.expanded > .editor-right { display: none; }
.editor.expanded > .canvas-area { grid-column: 1; }

.mobile-editor-nav { display: none; }

/* ======================== MODALS ======================== */
.modal {
  border: 1px solid var(--line); border-radius: 16px; width: min(640px, 95vw);
  max-height: 90dvh; padding: 0; background: var(--bg-surface); box-shadow: var(--shadow-lg); color: var(--ink);
}
.modal::backdrop { background: rgba(10, 18, 28, 0.55); backdrop-filter: blur(4px); }
.modal.wide { width: min(1040px, 96vw); }
.modal.preview-modal { width: min(1200px, 96vw); }
.modal-head {
  display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-surface); z-index: 4;
}
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--muted); display: block; margin-bottom: 4px; }
.modal-head h2 { font-size: 21px; letter-spacing: -.4px; font-weight: 700; }
.modal-body { padding: 22px 24px 26px; }
.modal-lead { font-size: 14px; color: var(--ink-secondary); line-height: 1.6; margin-bottom: 18px; }

.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-options > button {
  border: 1px solid var(--line); background: var(--bg-panel); padding: 24px 20px;
  border-radius: 12px; text-align: left;
}
.mode-options > button:hover { border-color: var(--accent); background: var(--bg-active); }
.mode-options > button > span { display: inline-flex; background: var(--accent-soft); padding: 12px; border-radius: 10px; color: var(--accent-text); }
.mode-options h3 { font-size: 18px; margin-top: 16px; font-weight: 700; }
.mode-options p { font-size: 13px; color: var(--ink-secondary); line-height: 1.6; margin-top: 8px; }
.mode-options b { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 650; margin-top: 18px; color: var(--accent-text); }

.modal-bottom {
  display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
}

/* Templates Modal */
.template-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.template-toolbar .modal-lead { margin-bottom: 0; }
.template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.template-card {
  text-align: left; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-surface); overflow: hidden; padding: 0 0 15px; display: flex; flex-direction: column;
}
.template-card > div { position: relative; overflow: hidden; height: 210px; background: var(--bg-subtle); }
.template-card iframe {
  width: 640px; height: 1000px; transform: scale(.38); transform-origin: top left;
  position: absolute; left: calc(50% - 122px); top: 14px; border: 0; pointer-events: none; background: #fff;
}
.template-card > span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--accent-text); padding: 14px 14px 0; }
.template-card h3 { font-size: 14px; font-weight: 650; margin: 6px 14px 10px; line-height: 1.4; color: var(--ink); }
.template-card small { display: flex; justify-content: space-between; align-items: center; padding: 0 14px; color: var(--muted); font-size: 12px; font-weight: 600; margin-top: auto; }
.template-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent); }
.template-card--web { background: var(--web-card-bg); border-color: var(--web-card-bg); }
.template-card--web h3 { color: var(--web-card-ink); }
.template-card--web > span, .template-card--web small { color: var(--web-card-sub); }

.preview-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
.preview-bar > span { font-size: 13px; color: var(--muted); }
.preview-stage { background: var(--bg-canvas); padding: 18px; border-radius: 10px; min-height: 400px; }
.preview-stage iframe { display: block; margin: auto; width: 100%; height: 65dvh; border: 0; background: #fff; }
.copy-frame { width: 100%; height: 56dvh; border: 1px solid var(--line); margin-top: 15px; background: #fff; }
.source-code { width: 100%; height: 55vh; background: var(--bg-code); color: var(--text-code); border: 1px solid var(--line); border-radius: 9px; padding: 18px; font: 12px/1.65 ui-monospace, monospace; margin-top: 14px; resize: vertical; }

.export-layout { display: grid; grid-template-columns: 1.45fr 1fr; gap: 22px; }
.export-option { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-panel); padding: 15px; margin-bottom: 12px; }
.export-option > svg { color: var(--accent-text); }
.export-option > div { flex: 1; min-width: 0; }
.export-option h3 { font-size: 14px; font-weight: 700; }
.export-option p { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 4px; }
.export-check { background: var(--bg-subtle); padding: 18px; border: 1px solid var(--line); border-radius: 10px; }
.export-check h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.audit { font-size: 13px; line-height: 1.6; color: var(--ink-secondary); margin: 12px 0; display: flex; gap: 9px; }
.audit > span { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.audit.warn { color: var(--warn); }
.audit.warn > span { border-color: var(--warn); background: var(--warn-bg); }
.audit.success { color: var(--success); }
.export-how, .help-note { font-size: 13px; line-height: 1.7; background: var(--bg-subtle); border: 1px solid var(--line); padding: 18px; border-radius: 10px; margin-top: 20px; color: var(--ink-secondary); }
.export-how strong { color: var(--ink); font-size: 14px; }
.export-how p { margin: 8px 0; }

.asset-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.asset-toolbar .modal-lead { margin: 0; }
.asset-url { display: flex; gap: 10px; align-items: flex-end; padding: 14px; margin: 12px 0 18px; background: var(--bg-subtle); border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap; }
.asset-url .field { flex: 1; margin: 0; min-width: 200px; }
.asset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.asset-item { position: relative; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--bg-panel); }
.asset-item > button:first-child { display: block; padding: 0; width: 100%; }
.asset-item img { display: block; width: 100%; height: 125px; object-fit: cover; }
.asset-item span { display: block; padding: 10px; font-size: 12px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; text-align: left; padding-right: 32px; }
.asset-item > .icon-btn { position: absolute; bottom: 5px; right: 4px; width: 30px; height: 30px; }

.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.help-grid section { padding: 18px; background: var(--bg-subtle); border-radius: 10px; border: 1px solid var(--line); }
.step { font-size: 28px; font-weight: 800; color: var(--accent-text); }
.help-grid h3 { font-size: 15px; font-weight: 700; margin: 10px 0 8px; }
.help-grid p { font-size: 13px; line-height: 1.65; color: var(--ink-secondary); }
.help-note h3 { font-size: 15px; color: var(--ink); margin: 18px 0 8px; }
.help-note h3:first-child { margin-top: 0; }
.help-note p { margin-bottom: 10px; }

.bullet-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.bullet-presets button { display: flex; gap: 10px; align-items: center; padding: 14px; border: 1px solid var(--line); background: var(--bg-panel); border-radius: 8px; font-size: 13px; }
.bullet-presets img { width: 24px; height: 24px; }
.brand-logo-preview { background: var(--bg-subtle); padding: 18px; text-align: center; margin: 14px 0; min-height: 90px; border-radius: 8px; color: var(--muted); }
.brand-logo-preview img { max-height: 110px; max-width: 100%; }
#brand-form h3 { font-size: 15px; margin: 22px 0 12px; color: var(--ink); }
.saved-themes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.motion-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.motion-card { position: relative; border: 1px solid var(--line); background: var(--bg-panel); border-radius: 10px; text-align: left; padding: 14px; min-height: 196px; overflow: hidden; }
.motion-card.active { border: 2px solid var(--accent); background: var(--bg-active); }
.motion-card:hover, .motion-card:focus-visible { border-color: var(--accent); }
.motion-icon { height: 112px; display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--accent-text); }
.motion-card strong { display: block; font-size: 14px; color: var(--ink); margin: 6px 0 4px; }
.motion-card small { font-size: 12px; color: var(--muted); }
.motion-clip { position: absolute; left: 7px; right: 7px; top: 7px; height: 120px; opacity: 0; pointer-events: none; background: var(--bg-subtle); border-radius: 6px; overflow: hidden; }
.motion-clip img { width: 100%; height: 100%; object-fit: contain; }
.motion-clip span { position: absolute; bottom: 4px; right: 6px; font-size: 10px; background: var(--bg-surface); color: var(--ink); padding: 2px 6px; border-radius: 4px; }
.motion-card:hover .motion-clip, .motion-card:focus-visible .motion-clip { opacity: 1; }

/* Account Gate & Modal */
.account-gate {
  max-width: 480px; margin: 6vh auto; padding: 34px 28px; text-align: center;
  background: var(--bg-surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.account-gate img { width: 58px; height: 58px; border-radius: 14px; }
.account-gate h1 { font-size: 26px; margin: 16px 0 8px; letter-spacing: -.5px; }
.account-gate > p { font-size: 14px; line-height: 1.6; margin: 0 0 20px; color: var(--ink-secondary); }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px;
  background: var(--bg-subtle); border-radius: 10px; margin-bottom: 18px;
}
.auth-tabs button {
  min-height: 40px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--muted);
}
.auth-tabs button.active { background: var(--bg-surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-form { text-align: left; display: grid; gap: 4px; }
.auth-form .field { margin-bottom: 12px; }
.auth-form .field input { font-size: 15px; padding: 11px 12px; }
.auth-remember {
  display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-secondary);
  margin: 2px 0 14px; cursor: pointer;
}
.auth-remember input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.auth-submit { width: 100%; min-height: 46px; font-size: 15px; }
.auth-guest { width: 100%; margin-top: 12px; font-size: 13px; color: var(--muted); }
.gate-error {
  color: var(--danger) !important; background: var(--danger-bg); border: 1px solid var(--danger-border);
  padding: 10px 14px; border-radius: 8px; font-size: 13px !important; margin-bottom: 14px !important; text-align: left;
}

.account-lock {
  position: fixed; inset: 0; z-index: 99999; background: var(--bg-app);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 32px; text-align: center;
}
.account-lock p { font-size: 16px; max-width: 460px; line-height: 1.6; }
.account-card { display: grid; gap: 14px; }
.account-profile { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--bg-subtle); border-radius: 10px; border: 1px solid var(--line); }
.account-profile .avatar { width: 46px; height: 46px; font-size: 18px; }
.account-profile strong { display: block; font-size: 16px; }
.account-profile p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.account-status { font-size: 14px; line-height: 1.6; color: var(--ink-secondary); }
.account-edit { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg-panel); }
.account-edit summary { font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink); }
.account-edit form { margin-top: 14px; }
.account-edit form .btn { width: 100%; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); z-index: 100000;
  max-width: 92vw; padding: 12px 20px; background: #183242; color: #f0f9ff;
  border: 1px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500; line-height: 1.5; pointer-events: none; opacity: 0; transition: .2s;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

.release-notice {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 28px); background: var(--bg-surface);
  border: 1px solid var(--accent); box-shadow: var(--shadow-lg); padding: 14px 18px;
  border-radius: 12px; z-index: 10000; display: flex; align-items: center; gap: 12px;
  font-size: 14px; color: var(--ink);
}
.release-notice span { max-width: 420px; }
.release-notice .btn { flex-shrink: 0; }

/* ======================== RESPONSIVE ======================== */
@media (min-width: 1580px) {
  .project-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .sidebar { width: 220px; }
  .home-main { margin-left: 220px; }
  .editor.stampix-light { grid-template-columns: 220px minmax(260px, 1fr) 275px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile & Small Tablet Experience */
@media (max-width: 820px) {
  :root { font-size: 15px; }

  /* Mobile slide-over drawer for Home sidebar */
  .sidebar {
    transform: translateX(-100%); transition: transform .22s ease;
    width: 280px; box-shadow: var(--shadow-lg);
  }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .app-shell.menu-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25;
  }
  .mobile-menu-btn { display: inline-flex; }
  .home-main { margin-left: 0; }
  .home-top { padding: 0 16px; height: 60px; }
  .crumb { font-size: 15px; }
  .home-content { padding: 18px 16px 36px; }

  .welcome { padding: 24px 20px; }
  .welcome h1 { font-size: 28px; }
  .welcome p { font-size: 15px; }
  .welcome-actions .btn { flex: 1 1 auto; }

  .section-head h2 { font-size: 20px; }
  .library-toolbar { flex-direction: column; align-items: stretch; }
  .library-controls { width: 100%; }
  .search { flex: 1 1 100%; height: 44px; }
  .search input { width: 100%; font-size: 16px; }
  .library-controls select { flex: 1; max-width: none; height: 44px; font-size: 15px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .card-info h3 { font-size: 15px; }

  /* Mobile Editor: Full-pane tabbed experience */
  .editor.stampix-light {
    grid-template-columns: 1fr;
    grid-template-rows: 58px minmax(0, 1fr) 64px;
    height: 100dvh;
  }
  .editor-header { padding: 0 10px; gap: 8px; height: 58px; }
  .studio-brand { display: none; }
  .editor-identity { gap: 6px; }
  .editor-identity input { font-size: 16px; padding: 4px 6px; }
  .editor-identity small { font-size: 12px; }
  .mode-tag { display: none; }
  .editor-actions { gap: 4px; }
  .editor-actions .btn.primary { padding: 8px 12px; font-size: 13px; min-height: 38px; }
  .editor-actions .btn.primary svg { display: none; }

  .editor-left, .canvas-area, .editor-right {
    grid-column: 1 !important; grid-row: 2 !important;
    border: 0 !important; display: none;
  }
  .editor[data-mobile-pane="blocks"] .editor-left { display: flex; }
  .editor[data-mobile-pane="canvas"] .canvas-area { display: flex; }
  .editor[data-mobile-pane="inspector"] .editor-right { display: block; }
  .editor.expanded .mobile-editor-nav { display: none; }
  .editor.expanded { grid-template-rows: 58px minmax(0, 1fr); }

  .studio-footer { display: none; }
  .mobile-editor-nav {
    display: grid; grid-template-columns: repeat(3, 1fr); grid-row: 3; grid-column: 1;
    background: var(--bg-surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom); z-index: 15;
  }
  .mobile-editor-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 4px;
  }
  .mobile-editor-nav button.active { color: var(--accent-text); background: var(--bg-active); }

  .workspace-heading { display: none; }
  .canvas-toolbar { padding: 6px 10px; gap: 6px; overflow-x: auto; }
  .canvas-toolbar > span { display: none; }
  .canvas-scroll { padding: 14px 10px 24px; }
  .zoom-bar { padding: 6px 10px; }
  .zoom-bar select { font-size: 14px; height: 34px; }
  #zoom-label { display: none; }

  /* Larger touch-friendly inputs on mobile (16px prevents iOS Safari auto-zoom) */
  .field > span { font-size: 13px; }
  .field input:not([type=color]), .field select, .field textarea { font-size: 16px; padding: 11px 12px; }
  .inspector-body .btn { min-height: 44px; font-size: 14px; }
  .block-tool { min-height: 88px; }
  .block-tool span { font-size: 13px; }
  .panel-tabs button { font-size: 13px; padding: 10px 4px; }
  .layer > button > span { font-size: 14px; }

  /* Modals on mobile */
  .modal, .modal.wide, .modal.preview-modal { width: 96vw; max-height: 92dvh; border-radius: 14px; }
  .modal-head { padding: 16px 18px; }
  .modal-head h2 { font-size: 19px; }
  .modal-body { padding: 16px 18px 22px; }
  .mode-options, .export-layout, .help-grid { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; }
  .asset-grid { grid-template-columns: repeat(2, 1fr); }
  .motion-grid { grid-template-columns: repeat(2, 1fr); }
  .bullet-presets { grid-template-columns: repeat(2, 1fr); }
  .release-notice { flex-wrap: wrap; width: calc(100vw - 24px); bottom: 12px; }
  .release-notice span { flex-basis: 100%; }
  .account-gate { margin: 4vh 14px; padding: 26px 20px; }
}

@media (max-width: 540px) {
  .project-grid { grid-template-columns: 1fr; }
  .project-preview { height: 220px; }
  .project-preview iframe { transform: scale(.34); left: calc(50% - 109px); }
  .field-grid { grid-template-columns: 1fr; }
}

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