:root {
  color-scheme: light;
  --ui-bg: #e9eeec;
  --ui-panel: #f8faf9;
  --ui-card: #ffffff;
  --ui-text: #18201f;
  --ui-muted: #687270;
  --ui-line: #d5ddda;
  --ui-accent: #263d3a;
  --ui-accent-soft: #dfe9e6;
  --ui-danger: #a94848;
  --header-height: 64px;
  --mobile-preview-height: 46dvh;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { height: 100dvh; overflow: hidden; background: var(--ui-bg); color: var(--ui-text); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #4c7770; outline-offset: 2px; }
[hidden] { display: none !important; }

.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid #cbd5d1;
  background: rgba(248,250,249,.96);
  position: relative;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 270px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--ui-accent); color: white; font-family: Georgia, serif; font-size: 22px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 14px; letter-spacing: .02em; }
.brand-copy small { font-size: 9px; color: var(--ui-muted); letter-spacing: .16em; }
.project-name-field { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; max-width: 340px; }
.project-name-field span { font-size: 11px; color: var(--ui-muted); }
.project-name-field input { width: 100%; border: 0; border-bottom: 1px solid var(--ui-line); background: transparent; padding: 7px 2px; font-weight: 650; }
.header-actions { display: flex; gap: 7px; margin-left: auto; }
.button, .icon-button, .text-button { border: 0; cursor: pointer; transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease; }
.button { min-height: 38px; padding: 0 13px; border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-card); font-size: 12px; font-weight: 700; }
.button:hover { border-color: #aab8b4; transform: translateY(-1px); }
.button.primary { background: var(--ui-accent); color: white; border-color: var(--ui-accent); }
.button.ghost { background: transparent; }
.button.compact { min-height: 32px; padding: 0 10px; font-size: 11px; }
.button.danger { color: var(--ui-danger); border-color: #e6c6c6; }
.file-button { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.short-label { display: none; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-card); display: grid; place-items: center; font-weight: 800; }
.text-button { padding: 4px 0; background: transparent; font-size: 11px; font-weight: 700; color: var(--ui-muted); }
.text-button.danger { color: var(--ui-danger); }

.workspace { height: calc(100dvh - var(--header-height)); display: grid; grid-template-columns: 350px minmax(0, 1fr) 360px; min-width: 0; }
.editor-panel { min-width: 0; min-height: 0; background: var(--ui-panel); display: flex; flex-direction: column; }
.content-panel { border-right: 1px solid var(--ui-line); }
.style-panel { border-left: 1px solid var(--ui-line); }
.mode-dock { padding: 14px 15px 11px; border-bottom: 1px solid var(--ui-line); background: #f2f6f4; display: grid; gap: 9px; }
.segmented { display: grid; padding: 3px; border-radius: 9px; background: #dfe6e3; gap: 3px; }
.platform-switch { grid-template-columns: repeat(3, 1fr); }
.device-switch { grid-template-columns: repeat(2, 1fr); }
.segmented button { min-height: 33px; border: 0; border-radius: 7px; background: transparent; color: #66706d; font-size: 11px; font-weight: 800; cursor: pointer; }
.segmented button.active { color: var(--ui-text); background: white; box-shadow: 0 1px 4px rgba(25,42,38,.12); }
.editor-scroll { overflow: auto; overscroll-behavior: contain; padding: 18px 15px 80px; scrollbar-width: thin; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.panel-heading span, .preview-toolbar span, .card-kicker { display: block; color: #71807c; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.panel-heading h1, .panel-heading h2 { margin: 3px 0 0; font-size: 18px; font-family: Georgia, "Noto Serif SC", serif; }
.mobile-editor-tabs { display: none; }

.editor-card { margin-bottom: 12px; padding: 14px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-card); }
.editor-card > header { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 12px; }
.editor-card > header h3 { margin: 0; font-size: 13px; }
.editor-card > header p { margin: 4px 0 0; color: var(--ui-muted); font-size: 10px; line-height: 1.5; }
.editor-card > header span { color: #8b9693; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-grid.one { grid-template-columns: 1fr; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span, .range-field > span { color: #65706d; font-size: 10px; font-weight: 700; }
.field input:not([type="checkbox"]):not([type="color"]), .field textarea, .field select { width: 100%; min-height: 38px; border: 1px solid var(--ui-line); border-radius: 7px; background: #fbfcfc; padding: 8px 9px; color: var(--ui-text); font-size: 12px; }
.field textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.field input[type="color"], .field input[data-oc-color] { width: 100%; height: 38px; border: 1px solid var(--ui-line); border-radius: 7px; background: #fbfcfc; }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #4f5b58; }
.check-field input { accent-color: var(--ui-accent); }
.range-field { display: grid; gap: 7px; }
.range-field > span { display: flex; justify-content: space-between; }
.range-field input { width: 100%; accent-color: var(--ui-accent); }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.export-card { margin-top: 18px; border-color: #b9c9c4; background: linear-gradient(180deg,#f9fcfb,#eef5f2); box-shadow: 0 8px 22px rgba(31,54,48,.08); }
.export-size-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding: 9px 10px; border-radius: 7px; background: #dfeae6; color: #53635f; font-size: 10px; }
.export-size-row output { color: var(--ui-text); font-weight: 850; font-variant-numeric: tabular-nums; }
.export-button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.export-button-grid .button { width: 100%; }
.export-button-grid #export-stickers-button, .export-button-grid .oc-pw-export-button { grid-column: 1 / -1; }
.media-slot { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; }
.media-thumb { width: 76px; height: 58px; border: 1px solid var(--ui-line); border-radius: 8px; background: linear-gradient(135deg,#dfe7e4,#cdd8d4); overflow: hidden; display: grid; place-items: center; color: #7b8884; font-size: 9px; text-align: center; }
.media-thumb.avatar-thumb { width: 64px; height: 64px; border-radius: 50%; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-copy { min-width: 0; }
.media-copy strong { display: block; font-size: 11px; margin-bottom: 3px; }
.media-copy small { color: var(--ui-muted); font-size: 9px; line-height: 1.4; }
.media-copy .card-actions { margin-top: 7px; }
.upload-button { position: relative; overflow: hidden; }
.upload-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.video-list { display: grid; gap: 9px; }
.video-editor { border: 1px solid var(--ui-line); border-radius: 9px; overflow: hidden; background: #fbfcfc; }
.video-editor summary { list-style: none; display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 7px 9px; cursor: pointer; }
.video-editor summary::-webkit-details-marker { display: none; }
.video-editor summary::before { content: "+"; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 5px; background: #e6ece9; font-weight: 800; }
.video-editor[open] summary::before { content: "−"; }
.video-summary-thumb { width: 50px; height: 32px; border-radius: 5px; background: linear-gradient(135deg,#d9e0de,#c3ceca); overflow: hidden; flex: 0 0 auto; }
.video-summary-thumb.portrait { width: 26px; height: 36px; }
.video-summary-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-summary-copy { min-width: 0; flex: 1; }
.video-summary-copy b, .video-summary-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-summary-copy b { font-size: 11px; }
.video-summary-copy small { font-size: 9px; color: var(--ui-muted); margin-top: 2px; }
.video-editor-body { border-top: 1px solid var(--ui-line); padding: 11px; }
.video-row-actions { display: flex; gap: 5px; margin-left: auto; }
.mini-button { width: 26px; height: 26px; border: 1px solid var(--ui-line); background: white; border-radius: 6px; cursor: pointer; font-size: 11px; }
.empty-note { padding: 20px 12px; border: 1px dashed #c9d4d0; border-radius: 8px; color: var(--ui-muted); text-align: center; font-size: 11px; line-height: 1.6; }

.preview-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #d7dfdc; }
.preview-toolbar { height: 50px; flex: 0 0 50px; padding: 0 14px; border-bottom: 1px solid #c3ceca; display: flex; align-items: center; justify-content: space-between; background: #eef2f0; }
.preview-toolbar strong { display: block; margin-top: 2px; font-size: 12px; }
.preview-actions { display: flex; align-items: center; gap: 6px; }
.preview-actions output { min-width: 34px; text-align: center; color: var(--ui-muted); font-size: 9px; }
.save-state { display: flex !important; align-items: center; gap: 5px; margin-right: 4px; letter-spacing: 0 !important; }
.save-state i { width: 6px; height: 6px; border-radius: 50%; background: #4c8b6e; }
.save-state.is-saving i { animation: pulse 1s infinite; background: #bb8b43; }
.save-state.is-error i { background: #b24747; }
@keyframes pulse { 50% { opacity: .25; } }
.preview-viewport { min-height: 0; flex: 1; overflow: auto; position: relative; display: grid; align-items: start; justify-items: center; padding: 28px; overscroll-behavior: contain; }
.canvas-frame { position: relative; flex: 0 0 auto; transform-origin: top left; filter: drop-shadow(0 18px 30px rgba(20,35,31,.18)); }

.profile-canvas {
  --canvas-bg: #f5f7f8;
  --surface: #ffffff;
  --text: #18191c;
  --muted: #66717a;
  --accent: #ef6c91;
  --line: #e2e7ea;
  --button: #f1f3f5;
  --button-text: #23282c;
  position: relative;
  overflow: hidden;
  width: 1440px;
  height: auto;
  background: var(--canvas-bg);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  isolation: isolate;
}
.profile-canvas.device-mobile { width: 390px; }
.profile-canvas.is-exporting { transform: none !important; }
.profile-canvas * { box-sizing: border-box; }
.profile-canvas button { pointer-events: none; }
.profile-canvas img { display: block; }
.canvas-content { width: 100%; min-height: 1px; overflow: hidden; position: relative; z-index: 1; }
.canvas-image { width: 100%; height: 100%; object-fit: cover; }
.image-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255,255,255,.72); text-align: center; letter-spacing: .12em; font-size: 14px; font-weight: 800; }
.image-placeholder::before { content: attr(data-label); }
.banner-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-shell { overflow: hidden; border-radius: 50%; background: linear-gradient(145deg,var(--accent),#64717f); display: grid; place-items: center; color: white; font-weight: 900; }
.avatar-shell img { width: 100%; height: 100%; object-fit: cover; }
.verification { display: inline-flex; align-items: center; gap: 4px; max-width: 260px; min-height: 24px; margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: var(--accent); color: white; font-size: 12px; font-weight: 800; line-height: 1.2; vertical-align: 4px; }
.verification > span { flex: 0 0 auto; }
.profile-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; min-width: 0; }
.profile-action { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-width: 88px; height: 44px; padding: 0 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--button); color: var(--button-text); font-size: 16px; font-weight: 800; line-height: 1; text-align: center; white-space: nowrap; word-break: keep-all; overflow-wrap: normal; writing-mode: horizontal-tb; }
.profile-action.primary { background: var(--accent); color: white; border-color: var(--accent); }
.profile-canvas.is-exporting .profile-actions { flex-wrap: nowrap !important; }
.profile-canvas.is-exporting .profile-action { display: inline-flex !important; flex-shrink: 0 !important; align-items: center !important; justify-content: center !important; white-space: nowrap !important; word-break: keep-all !important; overflow-wrap: normal !important; writing-mode: horizontal-tb !important; }
.profile-tabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--surface); }
.profile-tabs span { position: relative; display: grid; place-items: center; min-width: 96px; padding: 0 20px; color: var(--muted); font-size: 16px; font-weight: 700; }
.profile-tabs span.active { color: var(--text); }
.profile-tabs span.active::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.video-cover { position: relative; overflow: hidden; background: linear-gradient(135deg,#90a8a1,#354743); }
.video-cover .canvas-image { object-fit: cover; }
.video-cover-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.82); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.duration { position: absolute; right: 8px; bottom: 7px; padding: 3px 6px; border-radius: 4px; background: rgba(0,0,0,.72); color: white; font-size: 13px; font-weight: 750; }
.video-card h4 { margin: 9px 0 5px; color: var(--text); font-size: 16px; line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.video-card p { margin: 0; color: var(--muted); font-size: 13px; }
.video-card .video-description { line-height: 1.5; }
.mockup-mark { position: absolute; right: 22px; bottom: 18px; z-index: 5; padding: 6px 9px; border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); background: color-mix(in srgb, var(--surface) 78%, transparent); color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .1em; backdrop-filter: blur(2px); }

/* Bilibili canvas: no platform top or bottom bar. */
.platform-bilibili .bili-banner { height: 210px; position: relative; overflow: hidden; background: linear-gradient(110deg,#a8cfda 0%,#726e9f 50%,#d68da6 100%); }
.platform-bilibili .bili-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg,rgba(20,24,30,.34),transparent 56%); }
.platform-bilibili .bili-profile { min-height: 150px; padding: 22px 52px 18px; display: grid; grid-template-columns: 112px minmax(0,1fr) auto; gap: 22px; align-items: center; background: var(--surface); }
.platform-bilibili .avatar-shell { width: 112px; height: 112px; border: 5px solid var(--surface); margin-top: -62px; position: relative; z-index: 2; font-size: 34px; }
.profile-name { margin: 0; font-size: 30px; line-height: 1.18; }
.profile-handle { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.profile-bio { margin: 8px 0 0; max-width: 760px; color: var(--muted); font-size: 15px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-location { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.stats { display: flex; gap: 30px; margin-top: 10px; }
.stat { display: grid; gap: 3px; }
.stat b { font-size: 19px; }
.stat small { color: var(--muted); font-size: 12px; }
.platform-bilibili .profile-tabs { height: 54px; padding-left: 36px; }
.bili-body { padding: 24px 44px 34px; }
.featured-row { display: grid; grid-template-columns: 390px minmax(0,1fr); gap: 24px; padding: 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; }
.featured-row .video-cover { aspect-ratio: 16/9; border-radius: 8px; }
.featured-copy { padding: 12px 6px; }
.featured-copy small { color: var(--accent); font-weight: 800; font-size: 13px; }
.featured-copy h3 { margin: 10px 0 8px; font-size: 25px; }
.featured-copy p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; max-width: 650px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 11px; }
.section-title h3 { margin: 0; font-size: 20px; }
.section-title span { color: var(--muted); font-size: 12px; }
.video-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-auto-flow: row; gap: 18px; align-items: start; }
.video-grid .video-cover { aspect-ratio: 16/9; border-radius: 7px; }

/* Douyin canvas: profile starts immediately; sidebar is not a top/bottom bar. */
.platform-douyin { --canvas-bg:#0f1012; --surface:#17191d; --text:#f5f6f7; --muted:#9da2aa; --line:#2a2d33; --accent:#fe2c55; --button:#2a2d32; --button-text:#fff; }
.douyin-layout { display: grid; grid-template-columns: 210px minmax(0,1fr); align-items: stretch; }
.douyin-side { border-right: 1px solid var(--line); padding: 44px 25px; background: #121316; }
.douyin-side strong { display: block; font-size: 22px; letter-spacing: .08em; margin-bottom: 38px; }
.douyin-side span { display: block; padding: 15px 13px; margin-bottom: 7px; border-radius: 8px; color: var(--muted); font-size: 17px; font-weight: 700; }
.douyin-side span.active { color: var(--text); background: #25272c; }
.douyin-main { min-width: 0; padding: 46px 58px 40px; overflow: hidden; }
.douyin-profile { display: grid; grid-template-columns: 126px minmax(0,1fr) auto; gap: 28px; align-items: center; padding-bottom: 30px; }
.douyin-profile .avatar-shell { width: 126px; height: 126px; font-size: 36px; }
.douyin-profile .profile-name { font-size: 32px; }
.douyin-profile .stats { margin-top: 18px; }
.douyin-profile .stat { display: flex; gap: 7px; align-items: baseline; }
.douyin-profile .stat b { font-size: 21px; }
.douyin-main .profile-tabs { height: 58px; padding-left: 0; background: transparent; }
.douyin-main .profile-tabs span { min-width: 130px; font-size: 17px; }
.douyin-section-title { margin: 18px 0 0; }
.douyin-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-auto-flow: row; gap: 12px; padding-top: 12px; align-items: start; }
.douyin-grid .video-cover { aspect-ratio: 3/4; border-radius: 5px; }
.douyin-grid .video-card h4 { font-size: 15px; margin: 8px 0 3px; }
.play-count { position: absolute; left: 9px; bottom: 8px; z-index: 2; color: white; text-shadow: 0 1px 4px rgba(0,0,0,.7); font-size: 14px; font-weight: 800; }
.pin-badge { position: absolute; left: 8px; top: 8px; padding: 4px 6px; border-radius: 3px; background: var(--accent); color: white; font-size: 11px; font-weight: 900; }

/* YouTube canvas: starts at channel banner. */
.platform-youtube { --canvas-bg:#f7f7f7; --surface:#fff; --text:#0f0f0f; --muted:#606060; --line:#dedede; --accent:#d92525; --button:#efefef; --button-text:#0f0f0f; }
.youtube-banner { height: 220px; position: relative; overflow: hidden; background: linear-gradient(120deg,#20252e,#4f6179 46%,#ad675c); }
.youtube-channel { min-height: 152px; padding: 20px 64px; display: grid; grid-template-columns: 118px minmax(0,1fr) auto; gap: 24px; align-items: center; background: var(--surface); }
.youtube-channel-main { min-width: 0; }
.youtube-channel .avatar-shell { width: 112px; height: 112px; font-size: 34px; }
.youtube-channel .profile-name { font-size: 32px; }
.youtube-channel .profile-bio { margin-top: 6px; }
.platform-youtube .profile-tabs { height: 54px; padding-left: 48px; }
.youtube-body { padding: 22px 52px 36px; }
.youtube-body .featured-row { border: 0; border-radius: 0; padding: 0; background: transparent; grid-template-columns: 420px minmax(0,1fr); }
.youtube-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-auto-flow: row; gap: 16px; align-items: start; }
.youtube-grid .video-cover { aspect-ratio: 16/9; border-radius: 8px; }

/* Mobile output canvases remain headerless and footerless. */
.device-mobile .profile-action { min-width: 72px; height: 36px; padding: 0 17px; border-radius: 6px; font-size: 12px; }
.device-mobile .profile-name { font-size: 22px; }
.device-mobile .verification { max-width: 160px; min-height: 20px; margin-left: 5px; padding: 2px 7px; font-size: 10px; vertical-align: 3px; }
.device-mobile .profile-bio { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 12px; line-height: 1.5; }
.device-mobile .profile-location { margin-top: 4px; font-size: 11px; }
.device-mobile .stats { gap: 0; justify-content: space-between; width: 100%; }
.device-mobile .stat { text-align: center; }
.device-mobile .stat b { font-size: 16px; }
.device-mobile .stat small { font-size: 10px; }
.device-mobile .profile-tabs { overflow: hidden; padding: 0; }
.device-mobile .profile-tabs span { flex: 1; min-width: 0; padding: 0 6px; font-size: 12px; white-space: nowrap; }
.device-mobile .profile-tabs span.active::after { left: 12px; right: 12px; height: 2px; }
.device-mobile .mockup-mark { right: 9px; bottom: 9px; padding: 4px 6px; font-size: 8px; }

.platform-bilibili.device-mobile .bili-banner { height: 132px; }
.platform-bilibili.device-mobile .bili-profile { min-height: 0; padding: 12px 17px 18px; display: grid; grid-template-columns: 88px minmax(0,1fr); grid-template-areas: "avatar stats" "avatar actions" "main main"; column-gap: 14px; row-gap: 8px; align-items: start; }
.platform-bilibili.device-mobile .avatar-shell { grid-area: avatar; width: 84px; height: 84px; border-width: 3px; margin: 0; transform: translateY(-43px); font-size: 27px; }
.platform-bilibili.device-mobile .bili-profile-main { grid-area: main; min-width: 0; margin-top: 2px; }
.platform-bilibili.device-mobile .profile-handle { font-size: 11px; margin-top: 2px; }
.platform-bilibili.device-mobile .profile-bio { margin-top: 5px; padding-right: 0; }
.platform-bilibili.device-mobile .bili-mobile-stats { grid-area: stats; align-self: center; margin: 0; }
.platform-bilibili.device-mobile .bili-mobile-stats .stat { flex: 1; justify-items: center; }
.platform-bilibili.device-mobile .profile-actions { grid-area: actions; gap: 7px; align-self: center; }
.platform-bilibili.device-mobile .profile-actions .profile-action { min-width: 0; }
.platform-bilibili.device-mobile .profile-actions .primary { order: 2; flex: 1.45; }
.platform-bilibili.device-mobile .profile-actions .profile-action:not(.primary) { order: 1; flex: 1; }
.platform-bilibili.device-mobile .profile-tabs { height: 45px; }
.platform-bilibili.device-mobile .bili-body { padding: 13px 12px 24px; }
.platform-bilibili.device-mobile .featured-row { grid-template-columns: 1fr; gap: 7px; padding: 0; border: 0; background: transparent; }
.platform-bilibili.device-mobile .featured-copy { padding: 0 1px; }
.platform-bilibili.device-mobile .featured-copy small { display: none; }
.platform-bilibili.device-mobile .featured-copy h3 { font-size: 15px; margin: 0; }
.platform-bilibili.device-mobile .featured-copy p { margin-top: 5px; font-size: 11px; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.platform-bilibili.device-mobile .section-title { margin: 12px 0 7px; }
.platform-bilibili.device-mobile .section-title h3 { font-size: 15px; }
.platform-bilibili.device-mobile .video-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.device-mobile .video-card h4 { margin: 6px 0 3px; font-size: 12px; -webkit-line-clamp: 1; }
.device-mobile .video-card p { font-size: 10px; }
.device-mobile .duration { right: 5px; bottom: 5px; padding: 2px 4px; font-size: 10px; }

.platform-douyin.device-mobile .douyin-layout { display: block; }
.platform-douyin.device-mobile .douyin-side { display: none; }
.platform-douyin.device-mobile .douyin-main { padding: 30px 17px 24px; }
.platform-douyin.device-mobile .douyin-profile { display: block; padding-bottom: 14px; }
.platform-douyin.device-mobile .douyin-profile .avatar-shell { width: 80px; height: 80px; margin-bottom: 10px; font-size: 25px; }
.platform-douyin.device-mobile .douyin-profile .profile-name { font-size: 24px; }
.platform-douyin.device-mobile .douyin-profile .profile-handle { margin-top: 4px; }
.platform-douyin.device-mobile .douyin-profile .profile-bio { margin-top: 9px; min-height: 32px; }
.platform-douyin.device-mobile .douyin-profile .stats { margin-top: 14px; }
.platform-douyin.device-mobile .douyin-profile .profile-actions { margin-top: 13px; }
.platform-douyin.device-mobile .douyin-main .profile-tabs { height: 47px; }
.platform-douyin.device-mobile .douyin-main .profile-tabs span { min-width: 0; }
.platform-douyin.device-mobile .douyin-section-title { margin: 12px 0 0; }
.platform-douyin.device-mobile .douyin-section-title h3 { font-size: 15px; }
.platform-douyin.device-mobile .douyin-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; padding-top: 8px; }
.platform-douyin.device-mobile .douyin-grid .video-card h4 { display: none; }
.platform-douyin.device-mobile .play-count { left: 5px; bottom: 5px; font-size: 10px; }
.platform-douyin.device-mobile .pin-badge { left: 4px; top: 4px; padding: 2px 4px; font-size: 9px; }

.platform-youtube.device-mobile .youtube-banner { height: 112px; }
.platform-youtube.device-mobile .youtube-channel { min-height: 0; padding: 14px 16px 16px; display: grid; grid-template-columns: 68px minmax(0,1fr); gap: 8px 12px; align-items: start; }
.platform-youtube.device-mobile .youtube-channel .avatar-shell { width: 68px; height: 68px; margin: 0; font-size: 23px; }
.platform-youtube.device-mobile .youtube-channel-main { min-width: 0; }
.platform-youtube.device-mobile .youtube-channel .profile-name { font-size: 22px; }
.platform-youtube.device-mobile .youtube-channel .profile-handle { margin-top: 2px; font-size: 11px; }
.platform-youtube.device-mobile .youtube-channel .profile-bio { margin-top: 5px; }
.platform-youtube.device-mobile .youtube-channel .profile-actions { grid-column: 1 / -1; margin-top: 3px; }
.platform-youtube.device-mobile .youtube-channel .profile-action { width: 100%; }
.platform-youtube.device-mobile .profile-tabs { height: 45px; }
.platform-youtube.device-mobile .youtube-body { padding: 12px 10px 24px; }
.platform-youtube.device-mobile .youtube-body .featured-row { grid-template-columns: 1fr; gap: 7px; }
.platform-youtube.device-mobile .youtube-body .featured-copy { padding: 0 2px; }
.platform-youtube.device-mobile .youtube-body .featured-copy small { display: none; }
.platform-youtube.device-mobile .youtube-body .featured-copy h3 { font-size: 15px; margin: 0; }
.platform-youtube.device-mobile .youtube-body .featured-copy p { margin-top: 5px; font-size: 11px; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.platform-youtube.device-mobile .youtube-body .section-title { margin: 13px 1px 8px; }
.platform-youtube.device-mobile .youtube-grid { display: block; }
.platform-youtube.device-mobile .youtube-grid .video-card { display: grid; grid-template-columns: 154px minmax(0,1fr); column-gap: 9px; row-gap: 3px; margin-bottom: 13px; }
.platform-youtube.device-mobile .youtube-grid .video-card .video-cover { grid-column: 1; grid-row: 1 / span 3; }
.platform-youtube.device-mobile .youtube-grid .video-card h4 { grid-column: 2; grid-row: 1; align-self: start; margin: 0; white-space: normal; -webkit-line-clamp: 2; }
.platform-youtube.device-mobile .youtube-grid .video-card .video-meta { grid-column: 2; grid-row: 2; align-self: start; }
.platform-youtube.device-mobile .youtube-grid .video-card .video-description { grid-column: 2; grid-row: 3; align-self: start; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 10px; line-height: 1.4; }

/* Sticker layer */
.sticker-layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.canvas-sticker { position: absolute; pointer-events: auto; transform-origin: center; user-select: none; touch-action: none; }
.canvas-sticker.is-hidden { display: none; }
.canvas-sticker.is-locked { pointer-events: none; }
.sticker-content { width: 100%; height: 100%; overflow: hidden; }
.canvas-sticker.text .sticker-content { display: flex; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; }
.canvas-sticker.image .sticker-content img { width: 100%; height: 100%; }
.canvas-sticker.selected::after { content: ""; position: absolute; inset: -4px; border: 2px solid #2c8f82; pointer-events: none; }
.sticker-handle { position: absolute; right: -10px; bottom: -10px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid white; background: #2c8f82; box-shadow: 0 1px 5px rgba(0,0,0,.25); cursor: nwse-resize; touch-action: none; }
.canvas-sticker:not(.selected) .sticker-handle, .profile-canvas.is-exporting .sticker-handle, .profile-canvas.is-exporting .canvas-sticker::after { display: none; }
.layer-list { display: grid; gap: 7px; }
.layer-row { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 7px; align-items: center; padding: 7px; border: 1px solid var(--ui-line); border-radius: 7px; background: #fbfcfc; cursor: pointer; }
.layer-row.active { border-color: #6e958d; background: #edf4f1; }
.layer-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 5px; background: #e6ece9; font-size: 10px; font-weight: 900; }
.layer-copy { min-width: 0; }
.layer-copy b, .layer-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-copy b { font-size: 10px; }
.layer-copy small { margin-top: 2px; color: var(--ui-muted); font-size: 8px; }
.layer-actions { display: flex; gap: 3px; }

/* Modals and utilities */
.crop-modal, .tutorial-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16,24,22,.62); backdrop-filter: blur(4px); }
.crop-dialog, .tutorial-dialog { position: relative; width: min(680px,100%); max-height: calc(100dvh - 36px); overflow: auto; border: 1px solid #bdcac6; border-radius: 14px; background: #f9fbfa; box-shadow: 0 26px 80px rgba(0,0,0,.28); padding: 18px; }
.crop-dialog > header, .tutorial-dialog > header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 13px; }
.crop-dialog header span, .tutorial-dialog header span { font-size: 9px; font-weight: 900; letter-spacing: .15em; color: var(--ui-muted); }
.crop-dialog h2, .tutorial-dialog h2 { margin: 3px 0 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 19px; }
.crop-stage { display: grid; place-items: center; min-height: 280px; max-height: 54dvh; padding: 12px; border-radius: 10px; background: #202523; overflow: hidden; touch-action: none; }
.crop-stage canvas { display: block; max-width: 100%; max-height: 50dvh; box-shadow: 0 0 0 1px rgba(255,255,255,.25); cursor: grab; touch-action: none; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-dialog > p { color: var(--ui-muted); font-size: 11px; line-height: 1.6; }
.crop-dialog footer, .tutorial-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.tutorial-dialog { width: min(620px,100%); }
.tutorial-dialog ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.tutorial-dialog li { padding: 12px; border: 1px solid var(--ui-line); border-radius: 9px; background: white; display: grid; gap: 4px; }
.tutorial-dialog li b { font-size: 12px; }
.tutorial-dialog li span { color: var(--ui-muted); font-size: 10px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 200; transform: translate(-50%,14px); opacity: 0; pointer-events: none; max-width: min(500px,calc(100vw - 30px)); padding: 10px 14px; border-radius: 8px; background: #20302d; color: white; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 11px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.toast.error { background: #8e3939; }
.focus-exit { display: none; position: fixed; right: 18px; top: 18px; z-index: 80; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; background: rgba(20,27,25,.88); color: white; padding: 10px 14px; cursor: pointer; }
body.focus-mode .app-header, body.focus-mode .editor-panel, body.focus-mode .preview-toolbar, body.focus-mode .mobile-resizer { display: none; }
body.focus-mode .workspace { height: 100dvh; display: block; }
body.focus-mode .preview-panel { width: 100%; height: 100%; }
body.focus-mode .preview-viewport { padding: 30px; }
body.focus-mode .focus-exit { display: block; }
body.mobile-resizing { user-select: none; cursor: row-resize; }
.mobile-resizer { display: none; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 315px minmax(0,1fr) 325px; }
  .desktop-only { display: none !important; }
  .brand { min-width: 230px; }
}

@media (max-width: 900px) {
  :root { --header-height: 56px; }
  .app-header { padding: 0 9px; gap: 7px; }
  .brand { min-width: 0; margin-right: auto; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 12px; }
  .brand-copy small { display: none; }
  .header-actions { gap: 4px; }
  .header-actions .button { min-height: 34px; padding: 0 9px; font-size: 10px; }
  .wide-label { display: none; }
  .short-label { display: inline; }
  .workspace { height: calc(100dvh - var(--header-height)); display: grid; grid-template-columns: 1fr; grid-template-rows: var(--mobile-preview-height) 18px minmax(0,1fr); }
  .preview-panel { grid-row: 1; }
  .preview-toolbar { height: 42px; flex-basis: 42px; padding: 0 9px; }
  .preview-actions { gap: 4px; }
  .preview-actions .save-state, .preview-actions output, #zoom-out-button, #zoom-in-button { display: none !important; }
  .preview-viewport { padding: 12px; display: grid; align-items: start; justify-items: center; }
  .canvas-frame { filter: drop-shadow(0 8px 18px rgba(20,35,31,.18)); }
  .mobile-resizer { grid-row: 2; display: grid; place-items: center; background: #e7ecea; border-top: 1px solid #cad4d0; border-bottom: 1px solid #cad4d0; cursor: row-resize; touch-action: none; z-index: 10; }
  .mobile-resizer span { width: 42px; height: 4px; border-radius: 4px; background: #8d9b97; }
  .editor-panel { grid-row: 3; grid-column: 1; border: 0; min-height: 0; }
  .mode-dock { padding: 9px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 7px; }
  .segmented button { min-height: 30px; font-size: 9px; }
  .style-panel .mode-dock { display: none; }
  .mobile-editor-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 0; border-bottom: 1px solid var(--ui-line); background: #eef2f0; }
  .mobile-editor-tabs button { min-height: 39px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ui-muted); font-size: 11px; font-weight: 800; }
  .mobile-editor-tabs button.active { color: var(--ui-text); border-bottom-color: var(--ui-accent); background: white; }
  body[data-editor-tab="content"] .style-panel { display: none; }
  body[data-editor-tab="style"] .content-panel { display: none; }
  body[data-editor-tab="style"] .style-panel { display: flex; }
  .editor-scroll { padding: 13px 11px 70px; }
  .panel-heading { margin-bottom: 10px; }
  .panel-heading h1, .panel-heading h2 { font-size: 16px; }
  .editor-card { padding: 12px; margin-bottom: 10px; }
  .field input:not([type="checkbox"]):not([type="color"]), .field textarea, .field select { min-height: 42px; font-size: 12px; }
  .tutorial-dialog ol { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .brand-copy strong { max-width: 102px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-actions .button { padding: 0 7px; }
  #tutorial-button { display: none; }
  .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .crop-modal, .tutorial-modal { padding: 8px; }
  .crop-dialog, .tutorial-dialog { max-height: calc(100dvh - 16px); padding: 14px; }
  .crop-stage { min-height: 220px; }
}

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