:root {
  --bg: #0c1018;
  --surface: #141a24;
  --surface2: #1b2330;
  --border: #293342;
  --border2: #41516a;
  --accent: #bfd3f5;
  --accent-lt: #e1eaff;
  --text: #edf1f7;
  --text-2: #b1bdcf;
  --text-3: #8e9db3;
  --radius: 8px;
  --radius-lg: 8px;
  --ui-font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --header-h: 64px;
}
body, button, input, select, textarea, .header-main, .shape-card-label {
  font-family: var(--ui-font);
  letter-spacing: 0;
}
* { letter-spacing: 0 !important; }
button, input, select, textarea { font-size: 14px; }
button { touch-action: manipulation; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid #91baf5;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
body { background: #0b0f17; }
.app-header { box-shadow: none; backdrop-filter: none; background: #101620; gap: 12px; padding: 0 24px; }
.header-main { font-size: 19px; font-weight: 600; padding: 0; }
.header-logo { height: 36px; }
.header-home { gap: 8px; }
.header-divider { margin: 0 6px; }
.app-menu, .cutout-dropdown { border-radius: 8px; background: #192230; }
.app-menu button { border-radius: 4px; }
.btn-primary, .btn-success, .btn-accent, .btn-download {
  background: #bfd3f5; border: 1px solid #bfd3f5; color: #142238; box-shadow: none; border-radius: 6px;
}
.btn-primary:hover, .btn-success:hover, .btn-accent:hover, .btn-download:hover { background: #dae6fa; color: #142238; }
.btn-outline, .btn-toolbar, .btn-icon, .editor-close-btn { border-radius: 6px; }
.btn-outline { color: var(--text); border-color: var(--border2); background: transparent; }
.field-input, .dim-form-input, .color-hex { border-radius: 6px; background: #0e1520; color: var(--text); border: 1px solid #40516a; }
.field-input::placeholder { color: #8b9bb0; }
.field-label { color: #b5c1d3; font-size: 13px; }
.shape-picker-wrap { max-width: 1060px; padding: 40px; gap: 24px; }
#step-upload.active { justify-content: flex-start; overflow-y: auto; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 12px 0 24px; border-bottom: 1px solid var(--border); }
.workspace-heading .picker-title { text-align: left; font-size: 28px; font-weight: 600; }
.workspace-eyebrow { color: #9cacc3; font-size: 11px; margin-bottom: 12px; }
.workspace-date { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h3, .section-heading h4 { font-size: 14px; font-weight: 500; }
.section-heading > span { font-size: 12px; color: var(--text-3); }
.shape-grid { gap: 16px; }
.shape-card { min-height: 152px; border-radius: 8px; padding: 24px; color: #e1eaff; background: linear-gradient(145deg, #1b2a40, #151d2a); border: 1px solid #33445e; gap: 18px; }
.shape-card:hover { background: #21314a; border-color: #8baad5; transform: none; }
.shape-card-icon { height: 52px; width: 80px; }
.shape-card-icon svg { width: 64px; height: 52px; }
.shape-card-label { color: #edf1f7; font-size: 16px; }
.saved-projects-panel { padding: 8px 0 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.saved-projects-head { padding-bottom: 16px; }
.saved-project-card { border-radius: 6px; background: #141c29; border: 1px solid #29384e; }
.saved-project-open { min-width: 0; }
.saved-project-name { overflow-wrap: anywhere; }
.saved-project-meta { color: #9eaec4; }
.rotate-wrap { max-width: 620px; }
#step-rotate.active { overflow-y: auto; justify-content: flex-start; padding-top: 24px; }
.mode-option { min-height: 86px; border-radius: 8px; text-align: left; }
.mode-ic { border: 0; background: transparent; }
.mode-title { color: var(--text); }
#rotatePreviewBox { text-align: center; }
.rotate-preview-img { width: 100%; max-width: 100%; max-height: 340px; }
.rotate-controls { justify-content: center; }
.loading-wrap { gap: 18px; }
.loading-wrap .btn-outline { margin-top: 16px; }
.editor-root { position: relative; }
.canvas-panel { padding: 0; gap: 0; background: #0b1019; }
.toolbar { padding: 12px 18px; min-height: 65px; border-bottom: 1px solid var(--border); background: #151d29; }
.toolbar-left { min-width: 0; flex-wrap: wrap; gap: 8px; }
.toolbar-right { flex-wrap: wrap; gap: 8px; }
.btn-toolbar { min-height: 40px; min-width: 0; padding: 8px 12px; font-size: 13px; }
.toolbar-right .btn-toolbar { border-radius: 6px; }
.toolbar-right .btn-success, .toolbar-right .btn-accent { background: transparent; color: #dbe5f5; border-color: #43546d; }
.toolbar-right button[onclick="saveProject()"] { background: #bfd3f5; border-color: #bfd3f5; color: #142238; }
.shape-badge { border-radius: 4px; padding: 4px 0; background: transparent; border: 0; max-width: 300px; text-align: left; }
#shapeInfo { overflow-wrap: anywhere; white-space: normal; }
.workspace-save-status { color: #b6c9bc; font-size: 12px; }
.workspace-save-status.is-error { color: #edb697; }
.workspace-tools { display: flex; justify-content: space-between; gap: 12px; padding: 8px 18px; background: #111925; border-bottom: 1px solid var(--border); }
.workspace-tool-group { display: flex; gap: 4px; }
.workspace-tool-group button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px; border: 1px solid transparent; border-radius: 5px; color: #c1cede; background: transparent; cursor: pointer; white-space: nowrap; }
.workspace-tool-group button:hover { background: #22324b; border-color: #3b5476; color: #fff; }
.workspace-view-tools { border-left: 1px solid var(--border); padding-left: 8px; }
.ic { width: 20px; height: 20px; flex-shrink: 0; }
.canvas-wrap { margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 160px; }
.workspace-zoom { position: absolute; bottom: 16px; right: 16px; display: flex; background: #172335; border: 1px solid #3e536e; border-radius: 6px; }
.workspace-zoom button { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; color: #d9e6fa; cursor: pointer; }
.workspace-zoom button:hover { background: #2e4565; }
.canvas-wrap::after { display: none; }
.canvas-hint { display: none; }
.slab-list-bar, .download-bar { border: 0; border-top: 1px solid var(--border); background: #141c28; border-radius: 0; padding: 12px 18px; }
.download-bar { gap: 12px; }
.download-bar .field-input { min-width: 0; }
.download-bar .btn-download { white-space: nowrap; min-width: 120px; min-height: 44px; }
.workspace-inspector { flex: 0 0 270px; width: 270px; padding: 20px 16px; border-left: 1px solid var(--border); background: #141b26; overflow-y: auto; }
.inspector-heading { display: flex; align-items: center; justify-content: space-between; }
.inspector-heading h3 { font-size: 15px; font-weight: 600; }
.inspector-dimensions { font-size: 20px; padding: 18px 0 22px; font-variant-numeric: tabular-nums; }
.inspector-dimensions span, .inspector-dimensions small { color: #9bacc5; font-size: 13px; }
.inspector-items { margin: 12px 0 24px; }
.inspector-edge { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; min-height: 64px; padding: 8px 4px; background: none; color: var(--text); border: 0; border-bottom: 1px solid #263345; cursor: pointer; }
.inspector-edge.selected, .inspector-edge:hover { background: #22324a; }
.edge-number { min-width: 24px; height: 24px; display: grid; place-items: center; background: #293c59; border-radius: 4px; font-size: 12px; }
.inspector-edge strong { display: block; font-weight: 500; font-size: 13px; }
.inspector-edge small { display: block; max-width: 145px; overflow-wrap: anywhere; color: #a0b1c9; margin-top: 5px; font-size: 11px; }
.edge-value { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 13px; }
.inspector-item { display: flex; width: 100%; justify-content: space-between; gap: 8px; padding: 12px 4px; background: none; color: var(--text); border: 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.inspector-item span, .inspector-empty { color: #9bacc5; font-size: 12px; }
.inspector-close { display: none; }
.drawer { background: #151f2e; border-radius: 0; }
.drawer-header { border-bottom: 1px solid #34435b; }
.cutout-modal, .app-modal { border-radius: 8px; background: #151e2b; border: 1px solid #3a4c66; box-shadow: 0 24px 80px #0008; max-height: calc(100dvh - 32px); }
.modal-overlay { backdrop-filter: none; background: #0009; padding: 16px; }
.cutout-modal-header { padding: 18px 24px; }
.cutout-modal-body { padding: 24px; }
.app-form-grid { gap: 16px; }
.app-form-actions { gap: 12px; padding-top: 12px; }
.app-form-actions button { min-height: 44px; }
.location-preview { width: 100%; height: 190px; color: #b8ccef; }
.location-preview circle { fill: #304e77; stroke: #afc7e7; }
.location-preview text { fill: white; font-size: 12px; }
.location-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.location-options button { min-height: 48px; white-space: normal; }
.dim-form-layout { gap: 32px; }
.dim-form-row { border-bottom: 1px solid #2b394e; border-radius: 0; }
.dim-form-input { min-width: 0; min-height: 44px; }
.dim-form-unit { min-width: 48px; color: #a9bad1; }
.dim-form-input.ai-filled { border-color: #6988b5; color: var(--text); background: #16263b; }
.ai-note { white-space: pre-line; color: #e5c5a2; background: #27241f; border: 1px solid #5e503e; border-radius: 6px; padding: 12px; }
.form-error { color: #f0b4ad; font-size: 13px; line-height: 1.6; }
.form-error:empty { display: none; }
.dimension-conflict { margin-top: 16px; padding: 16px 0; border-top: 1px solid #776544; }
.dimension-conflict h3 { font-size: 15px; color: #f1d8ae; margin-bottom: 8px; }
.dimension-conflict p, .dimension-preview-status { font-size: 13px; color: #b1bdcf; line-height: 1.6; }
.dimension-conflict button { display: block; width: 100%; min-height: 44px; margin-top: 8px; text-align: left; white-space: normal; }
.editor-root.preview-fullscreen .workspace-tools, .editor-root.preview-fullscreen .workspace-inspector { display: none; }
@media (max-width: 1200px) {
  .workspace-inspector { display: none; }
  .workspace-inspector.is-open { display: block; position: absolute; top: 0; right: 0; bottom: 0; z-index: 110; width: min(310px, 90%); box-shadow: -20px 0 60px #0008; }
  .inspector-close { display: flex; }
}
@media (max-width: 700px) {
  .app-header { padding: 0 12px; gap: 8px; }
  .header-logo { height: 28px; max-width: 160px; }
  .header-main { font-size: 16px; }
  .header-divider { margin: 0; }
  .shape-picker-wrap { padding: 24px 16px; gap: 20px; }
  .workspace-heading { align-items: start; padding-top: 8px; }
  .workspace-heading .picker-title { font-size: 24px; }
  .workspace-date { font-size: 11px; padding-top: 4px; }
  .shape-grid { gap: 8px; }
  .shape-card { min-height: 118px; padding: 16px 8px; gap: 12px; }
  .shape-card-icon { width: 48px; height: 44px; }
  .shape-card-icon svg { width: 44px; height: 44px; }
  .shape-card-label { font-size: 14px; }
  .toolbar { padding: 8px 12px; gap: 10px; }
  .toolbar-left { width: 100%; display: flex; flex-direction: row; justify-content: space-between; }
  .toolbar-left .shape-badge { width: auto; flex: 0 1 auto; }
  .toolbar-right { width: 100%; display: flex; justify-content: flex-start; gap: 6px; }
  .toolbar-right .cutout-menu { width: auto; }
  .toolbar-right .editor-close-btn { width: 40px; }
  .btn-toolbar { padding: 8px 10px; min-height: 44px; font-size: 12px; }
  .toolbar-right .btn-toolbar { flex: 0 1 auto; width: auto; min-width: 0; }
  .toolbar-right .btn-toolbar-primary { flex: 0 1 auto; }
  .toolbar .ic { width: 16px; height: 16px; }
  .workspace-tools { padding: 6px 8px; gap: 4px; }
  .workspace-tool-group button { padding: 8px; gap: 4px; min-height: 44px; font-size: 12px; }
  .workspace-tool-group .ic { width: 18px; height: 18px; }
  .workspace-view-tools { padding-left: 2px; }
  .download-bar, .slab-list-bar { padding: 10px 12px; }
  .download-bar { flex-direction: row; flex-wrap: nowrap; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .download-bar .btn-download { width: auto; min-width: 94px; font-size: 13px; padding: 8px 12px; }
  .field-input, .dim-form-input, select, textarea { font-size: 16px; }
  .cutout-modal-body { padding: 16px; }
  .cutout-modal-header { padding: 16px; }
  .cutout-modal, .app-modal { width: 100%; max-height: calc(100dvh - 24px); }
  .modal-overlay { padding: 12px; }
  .location-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-form-actions { flex-wrap: wrap; }
  .dim-form-layout { grid-template-columns: minmax(0, 1fr); display: grid; gap: 20px; }
  .dim-form-left, .dim-form-right { min-width: 0; width: 100%; }
  .shape-picker-wrap.dim-entry-wrap { max-width: 100%; padding: 20px 16px; }
  .mobile-app-shell .shape-grid { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
  .mobile-app-shell .variant-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
}
@media (max-width: 360px) {
  .workspace-tool-group button { padding: 8px 5px; }
  .header-main { font-size: 14px; }
  .header-logo { max-width: 128px; }
  .workspace-date { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.right-angle-option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px; border-bottom: 1px solid #344154; }
.right-angle-option input { flex: 0 0 20px; width: 20px; height: 20px; accent-color: #9bbce9; }
.right-angle-option span { min-width: 0; overflow-wrap: anywhere; }
