:root {
  color-scheme: light;
  --ink: #202b38;
  --muted: #89929d;
  --line: #e8ebef;
  --paper: #fff;
  --canvas: #f0f2f5;
  --blue: #3478f6;
  --blue-dark: #2464df;
  --mint: #e8f5f0;
  font-family: "DM Sans", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 360px; min-height: 100vh; color: var(--ink); background: #f6f7f9; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; }
.topbar { height: 66px; padding: 0 max(36px, calc((100vw - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--paper); border-bottom: 1px solid #eef0f3; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #233244; text-decoration: none; font-size: 19px; font-weight: 700; letter-spacing: -.7px; }
.brand-light { color: #83909c; font-weight: 500; }
.brand-mark { width: 25px; height: 25px; position: relative; display: inline-block; }
.brand-mark span { position: absolute; width: 15px; height: 19px; top: 3px; border-radius: 3px; border: 1.7px solid #3478f6; background: #fff; }
.brand-mark span:first-child { left: 2px; opacity: .48; }
.brand-mark span:last-child { right: 2px; background: #eaf1ff; }
.topbar-note { display: flex; align-items: center; gap: 8px; color: #78838e; font-size: 11px; }
.privacy-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ab28b; box-shadow: 0 0 0 3px #e9f6f1; }
.app-shell { max-width: 1440px; margin: auto; padding: 31px 36px 16px; }
.intro { min-height: 118px; display: flex; align-items: flex-start; justify-content: space-between; }
.eyebrow { color: #82909d; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.eyebrow span { margin-left: 9px; color: #b6bec7; font-weight: 500; }
h1 { margin: 11px 0 7px; font-family: "Noto Sans JP", sans-serif; font-size: 24px; letter-spacing: -.7px; font-weight: 700; }
.intro p { margin: 0; color: #808b97; font-size: 12px; }
.text-button { border: 0; color: #8a949e; background: transparent; padding: 8px; font-size: 11px; }
.text-button:disabled { opacity: .45; }
.text-button span { font-size: 16px; vertical-align: -1px; }
.workspace { min-height: 665px; display: grid; grid-template-columns: 248px minmax(390px, 1fr) 263px; background: #fff; border: 1px solid #e8ebef; border-radius: 9px; overflow: hidden; box-shadow: 0 8px 26px rgb(34 49 67 / 4%); }
.sidebar, .settings-panel { display: flex; flex-direction: column; padding: 21px 17px 18px; }
.sidebar { border-right: 1px solid #edf0f3; }
.settings-panel { border-left: 1px solid #edf0f3; padding-right: 18px; padding-left: 18px; }
.panel-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; }
.panel-heading h2 { margin: 0; font-size: 13px; font-weight: 700; }
.step-number { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 6px; background: #edf3ff; color: var(--blue); font-size: 9px; font-weight: 700; }
.file-card { padding: 13px 12px 12px; border: 1px solid #e7ebf0; border-radius: 7px; margin-bottom: 11px; }
.overlay-card { border-style: dashed; background: #fbfcfe; }
.file-card-top { display: flex; align-items: center; gap: 7px; }
.file-icon { display: inline-grid; place-items: center; width: 25px; height: 27px; border-radius: 4px; background: #fff0ef; color: #ed6b63; font-size: 7px; font-weight: 700; }
.overlay-icon { color: #3788a1; background: #e8f5f7; }
.file-tag { color: #64707b; font-size: 9px; font-weight: 600; }
.overlay-tag { color: #42889b; }
.file-status { margin-left: auto; color: #a0a9b2; font-size: 9px; }
.file-status.loaded { color: #26976e; }
.file-title { margin: 12px 0 3px; font-size: 11px; font-weight: 700; }
.file-name { margin: 0 0 11px; min-height: 15px; overflow: hidden; color: #929ba5; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.outline-button { height: 30px; width: 100%; color: #536271; border: 1px solid #e2e7ec; border-radius: 4px; background: #fff; font-size: 10px; font-weight: 600; transition: border-color .15s, color .15s; }
.outline-button:hover { color: var(--blue); border-color: #9ab9fa; }
.privacy-card { display: flex; align-items: flex-start; gap: 9px; margin-top: auto; padding: 12px 10px; border-radius: 6px; background: #f5faf8; }
.privacy-icon { color: #43a885; font-size: 14px; }
.privacy-card strong { display: block; margin: 1px 0 4px; color: #536c62; font-size: 9px; }
.privacy-card p { margin: 0; color: #8a9b93; font-size: 8px; line-height: 1.7; }
.preview-panel { display: flex; min-width: 0; flex-direction: column; background: #f1f3f6; }
.preview-toolbar { height: 47px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; background: #fff; border-bottom: 1px solid #edf0f3; }
.preview-label { display: flex; align-items: center; gap: 7px; color: #65717e; font-size: 10px; font-weight: 600; }
.preview-indicator { width: 6px; height: 6px; border-radius: 50%; background: #aeb8c2; }
.preview-indicator.active { background: #43b38c; }
.page-nav { display: flex; align-items: center; gap: 9px; color: #66717c; font-size: 9px; }
.page-nav button { width: 22px; height: 22px; border: 1px solid #e8ebef; border-radius: 4px; color: #64717e; background: #fff; font-size: 15px; line-height: 16px; }
.page-nav button:disabled { color: #c9cfd5; }
.page-divider { margin: 0 4px; color: #bdc4cb; }
.preview-stage { display: grid; flex: 1; min-height: 0; place-items: center; overflow: auto; padding: 27px 22px; }
.empty-state { display: flex; flex-direction: column; align-items: center; color: #8b96a2; }
.empty-state strong { margin-top: 21px; color: #596777; font-size: 12px; }
.empty-state > span { margin-top: 6px; font-size: 9px; }
.empty-art { position: relative; width: 123px; height: 131px; }
.empty-sheet { position: absolute; width: 75px; height: 102px; border: 1px solid #dfe5ec; border-radius: 5px; background: #fff; }
.sheet-back { top: 13px; left: 14px; transform: rotate(-10deg); }
.sheet-front { top: 8px; left: 34px; padding: 24px 12px; box-shadow: 0 7px 17px rgb(41 58 79 / 8%); }
.sheet-front span { display: block; height: 3px; margin-bottom: 7px; border-radius: 2px; background: #e9edf2; }
.sheet-front span:nth-child(2) { width: 76%; }
.sheet-front span:nth-child(3) { width: 56%; }
.sheet-front i { position: absolute; right: 10px; bottom: 11px; color: #e07d76; font-size: 8px; font-style: normal; font-weight: 700; }
.empty-plus { position: absolute; top: 2px; right: 3px; display: grid; width: 24px; height: 24px; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: var(--blue); font-size: 16px; box-shadow: 0 2px 6px #b3c9f8; }
.page-frame { position: relative; max-width: 100%; overflow: hidden; background: white; box-shadow: 0 3px 18px rgb(34 49 67 / 16%); line-height: 0; }
#baseCanvas { display: block; max-width: 100%; height: auto; }
.overlay-layer { position: absolute; top: 0; left: 0; line-height: 0; cursor: grab; touch-action: none; user-select: none; }
.overlay-layer:active { cursor: grabbing; }
#overlayCanvas { display: block; }
.drag-hint { position: absolute; top: -21px; left: 0; padding: 4px 6px; border-radius: 3px; color: white; background: #3478f6; font-size: 8px; line-height: 1; white-space: nowrap; opacity: 0; transition: opacity .16s; pointer-events: none; }
.overlay-layer:hover .drag-hint { opacity: 1; }
.preview-footer { display: flex; align-items: center; justify-content: center; gap: 7px; height: 35px; color: #9aa3ac; background: #f8f9fa; border-top: 1px solid #e8ebef; font-size: 9px; }
.drag-symbol { color: #7d9de1; font-size: 14px; }
.settings-content { flex: 1; }
.field-label { display: block; margin-bottom: 8px; color: #596673; font-size: 10px; font-weight: 600; }
.input-with-unit { height: 35px; display: flex; align-items: center; border: 1px solid #e5e9ee; border-radius: 5px; background: white; }
.input-with-unit input { width: 45px; height: 100%; padding: 0 0 0 10px; border: 0; outline: none; color: #364452; background: transparent; font-size: 11px; font-weight: 600; }
.input-unit { color: #9ba4ad; font-size: 9px; }
.mini-arrows { display: flex; height: 22px; margin-left: auto; margin-right: 5px; border: 1px solid #e9edf1; border-radius: 4px; overflow: hidden; }
.mini-arrows button { width: 23px; padding: 0; border: 0; color: #687786; background: #fff; font-size: 13px; }
.mini-arrows button + button { border-left: 1px solid #e9edf1; }
.mini-arrows button:disabled { color: #bfc6cd; }
.field-help { margin: 6px 0 0; color: #a0a8b1; font-size: 8px; }
.field-spacer { height: 20px; }
.range-value { display: flex; align-items: baseline; justify-content: space-between; margin: 0 1px 8px; color: #8f99a3; font-size: 9px; }
.range-value strong { color: #495867; font-size: 10px; }
.range-input { display: block; width: 100%; height: 4px; margin: 0; accent-color: var(--blue); }
.range-ends { display: flex; justify-content: space-between; margin-top: 6px; color: #a4acb5; font-size: 8px; }
.select-input { width: 100%; height: 35px; padding: 0 9px; border: 1px solid #e5e9ee; border-radius: 5px; outline: none; color: #596673; background: #fff; font-size: 9px; }
.settings-bottom { padding-top: 14px; border-top: 1px solid #edf0f3; }
.export-button { width: 100%; height: 39px; border: 0; border-radius: 5px; color: #fff; background: var(--blue); font-size: 10px; font-weight: 700; box-shadow: 0 3px 8px rgb(52 120 246 / 20%); transition: background .15s, transform .15s; }
.export-button:not(:disabled):hover { background: var(--blue-dark); transform: translateY(-1px); }
.export-button:disabled { background: #bdc9dc; box-shadow: none; }
.export-button span { margin-right: 5px; font-size: 15px; vertical-align: -1px; }
.export-note { display: block; margin-top: 8px; color: #a0a8b1; text-align: center; font-size: 8px; }
.app-footer { display: flex; justify-content: space-between; padding: 14px 2px 0; color: #a9b0b8; font-size: 8px; letter-spacing: .8px; }
.app-footer span + span { letter-spacing: 0; }
.toast { position: fixed; z-index: 5; bottom: 24px; left: 50%; max-width: calc(100vw - 32px); padding: 11px 16px; transform: translate(-50%, 20px); border-radius: 6px; color: white; background: #283746; box-shadow: 0 5px 18px rgb(0 0 0 / 16%); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (min-height: 950px) { .workspace { min-height: 710px; } }
@media (max-width: 1050px) {
  .app-shell { padding-right: 22px; padding-left: 22px; }
  .workspace { grid-template-columns: 220px minmax(320px, 1fr); }
  .settings-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 190px 1fr 210px; align-items: center; border-top: 1px solid #edf0f3; border-left: 0; padding: 14px 18px; }
  .settings-panel .panel-heading { margin: 0; }
  .settings-content { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; align-items: center; }
  .settings-content .field-spacer, .settings-content .field-help, .settings-content .range-ends { display: none; }
  .settings-content .field-label { margin: 0; }
  .settings-content .input-with-unit, .settings-content .range-value, .settings-content .range-input, .settings-content .select-input { grid-column: 2; }
  .settings-content .range-value { grid-row: span 1; }
  .settings-bottom { padding: 0 0 0 14px; border: 0; }
}
@media (max-width: 700px) {
  .topbar { height: 56px; padding: 0 17px; }
  .topbar-note { font-size: 9px; }
  .app-shell { padding: 24px 14px 12px; }
  .intro { min-height: 119px; }
  h1 { font-size: 20px; }
  .intro p { max-width: 285px; font-size: 10px; line-height: 1.7; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 0 9px; border-right: 0; padding: 15px; }
  .sidebar .panel-heading { grid-column: 1 / -1; margin-bottom: 12px; }
  .file-card { margin-bottom: 0; }
  .privacy-card { display: none; }
  .preview-panel { min-height: 450px; }
  .preview-stage { padding: 22px 14px; }
  .settings-panel { display: flex; grid-column: auto; border-top: 1px solid #edf0f3; padding: 16px; }
  .settings-panel .panel-heading { margin-bottom: 16px; }
  .settings-content { display: block; }
  .settings-content .field-spacer { display: block; height: 17px; }
  .settings-content .field-help, .settings-content .range-ends { display: block; }
  .settings-content .field-label { margin-bottom: 7px; }
  .settings-content .input-with-unit, .settings-content .range-value, .settings-content .range-input, .settings-content .select-input { width: 100%; }
  .settings-content .range-value { margin-bottom: 8px; }
  .settings-bottom { margin-top: 18px; padding: 14px 0 0; border-top: 1px solid #edf0f3; }
}
@media (max-width: 420px) {
  .topbar-note { max-width: 154px; }
  .file-card { padding: 10px 8px; }
  .file-title { font-size: 10px; }
  .file-name { font-size: 8px; }
}