:root {
  --black: #222222;
  --white: #fff;
  --ink: #222222;
  --soft: #f7f7f7;
  --line: #e8e8e8;
  --lime: #eef9ff;
  --lilac: #f7f7f7;
  --cream: #ffffff;
  --pink: #f7f7f7;
  --accent: #0275fd;
  --blue: #0275fd;
}
* { box-sizing: border-box; }
html { background: var(--white); }
body { min-height: 100vh; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr); color: var(--ink); background: var(--white); font-family: Inter, "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif; font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
.sidebar { grid-row: 1 / 3; display: flex; flex-direction: column; padding: 20px 16px; color: var(--white); background: var(--black); }
.app-name { display: flex; align-items: center; gap: 11px; padding: 0 5px 28px; font-size: 16px; font-weight: 480; }
.app-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--black); background: var(--lime); font-size: 19px; }
.sidebar nav { padding-top: 16px; border-top: 1px solid rgba(255,255,255,.18); }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 50px; color: var(--white); text-decoration: none; font-size: 14px; }
.sidebar nav a.active { color: var(--black); background: var(--white); }
.sidebar nav a span { font-size: 17px; }
.sidebar-note { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 11px 10px; color: rgba(255,255,255,.68); font: 12px ui-monospace, SFMono-Regular, monospace; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-note span, .privacy i { width: 7px; height: 7px; border-radius: 50%; background: #39c66d; }
.topbar { grid-column: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(24px, 4vw, 56px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 14px; letter-spacing: -.28px; }
.breadcrumb span, .breadcrumb b { color: #888; font-weight: 400; }
.breadcrumb strong { font-weight: 540; }
.privacy { display: flex; align-items: center; gap: 9px; padding: 8px 13px; border-radius: 50px; background: var(--soft); font-size: 12px; }
.privacy i { display: block; }
main { grid-column: 1; min-width: 0; padding: 48px 32px 64px; }
.empty-view { max-width: 960px; margin: 32px auto; padding: 40px; border-radius: 12px; background: var(--lime); }
.upload-label { margin-bottom: 12px; font-size: 18px; font-weight: 600; }
.upload-label span { color: var(--accent); }
.dropzone { min-height: 160px; padding: 32px; display: flex; justify-content: center; align-items: center; gap: 20px; border: 1.5px dashed #9a9a9a; border-radius: 8px; background: var(--white); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #fbfdff; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-symbol { width: 42px; height: 42px; fill: none; stroke: var(--black); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-copy { font-size: 15px; font-weight: 400; }
.drop-copy strong { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.upload-help { margin: 12px 0 0; font: 12px ui-monospace, SFMono-Regular, monospace; letter-spacing: .03em; }
.error { min-height: 20px; margin: 10px 0 0; color: #9b1539; font-size: 13px; }
.editor-view { max-width: 1200px; margin: 0 auto; }
.workspace-head { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 16px; }
.workspace-head h1 { margin: 0; font-size: 35px; font-weight: 600; line-height: 1.2; letter-spacing: 0; }
.workspace-head > button, .order-heading button { padding: 9px 17px; border: 1px solid var(--black); border-radius: 4px; color: var(--black); background: var(--white); font-size: 13px; font-weight: 500; letter-spacing: -.26px; }
.workspace-head > button:hover, .order-heading button:hover { color: var(--white); background: var(--black); }
.workspace { display: grid; grid-template-columns: minmax(320px, 370px) minmax(0, 1fr); gap: 24px; align-items: start; }
.panel { padding: 24px; border-radius: 10px; }
.controls { background: var(--lilac); }
.preview-panel { min-height: 680px; display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--cream); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.controls h2, .preview-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.3px; }
.controls section > p { margin: 6px 0 14px; font-size: 13px; line-height: 1.5; }
.order-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order-heading button { padding: 7px 12px; border: 0; border-radius: 500px; color: #f7f7f7; background: var(--black); font-size: 11px; }
.order-heading button:hover { background: #3a3a3a; }
.order-heading button:disabled { opacity: .5; cursor: wait; }
.image-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.image-row { position: relative; min-height: 68px; padding: 9px 12px; display: grid; grid-template-columns: 28px 48px minmax(0, 1fr) 28px; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); background: var(--white); cursor: grab; user-select: none; transition: background .1s; }
.image-row:last-child { border-bottom: 0; }
.image-row:hover { background: var(--soft); }
.image-row:active { cursor: grabbing; }
.image-row.dragging { opacity: .4; }
.image-row.dragging-touch { opacity: .55; }
.image-row.drop-target::before { content: ""; position: absolute; z-index: 2; top: -1px; left: 0; right: 0; height: 3px; background: var(--accent); }
.image-row > b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--white); background: var(--accent); font-size: 11px; }
.image-row canvas { display: block; width: 48px; height: 48px; border-radius: 8px; background: var(--soft); object-fit: cover; }
.image-row span { min-width: 0; }
.image-row strong, .image-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-row strong { font-size: 13px; font-weight: 540; }
.image-row small { margin-top: 3px; font: 10px ui-monospace, SFMono-Regular, monospace; }
.drag-handle { width: 28px; height: 42px; padding: 0; border: 0; color: #9a9a9a; background: transparent; font-size: 20px; cursor: grab; touch-action: none; }
.auto-order-status { min-height: 18px; margin: 8px 0 0 !important; font-size: 11px !important; }
.advanced-settings { margin-top: 18px; border-top: 1px solid #dedede; }
.advanced-settings summary { padding: 16px 2px 0; font-size: 14px; font-weight: 540; cursor: pointer; user-select: none; }
.advanced-settings > section { margin-top: 18px; }
.advanced-settings > section + section { margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(0,0,0,.16); }
.controls section > label:not(.range-label) { display: block; margin-top: 9px; font-size: 13px; }
.controls input[type="radio"], .controls input[type="checkbox"] { accent-color: var(--black); }
.range-label { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; font-size: 13px; }
.range-label output { min-width: 54px; padding: 5px 9px; border-radius: 4px; color: var(--accent); background: var(--white); font: 12px ui-monospace, SFMono-Regular, monospace; text-align: center; }
.blend-control { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 10px; align-items: center; margin: 12px 0; }
.blend-control input[type="range"] { width: 100%; height: 30px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
.blend-control input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 50px; background: linear-gradient(to right, var(--accent) 0 var(--range-progress, 0%), #d8d8d8 var(--range-progress, 0%) 100%); }
.blend-control input[type="range"]::-moz-range-track { height: 5px; border: 0; border-radius: 50px; background: rgba(0,0,0,.2); }
.blend-control input[type="range"]::-moz-range-progress { height: 5px; border-radius: 50px; background: var(--accent); }
.blend-control input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -6.5px; appearance: none; -webkit-appearance: none; border: 3px solid var(--white); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.blend-control input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 3px solid var(--white); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.blend-control input[type="range"]:focus-visible, .blend-control button:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.blend-control button { width: 36px; height: 36px; padding: 0; border: 1px solid #cfcfcf; border-radius: 4px; color: var(--black); background: var(--white); font-size: 18px; line-height: 1; }
.blend-control button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.blend-control button:disabled { opacity: .28; cursor: default; }
.preview-head { display: flex; justify-content: space-between; align-items: center; }
.preview-head > span { padding: 6px 10px; border-radius: 4px; background: var(--soft); font: 11px ui-monospace, SFMono-Regular, monospace; }
.canvas-stage { position: relative; min-height: 555px; margin: 16px 0; display: flex; flex: 1; justify-content: center; align-items: center; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background-color: var(--soft); background-image: linear-gradient(45deg,rgba(0,0,0,.035) 25%,transparent 25%),linear-gradient(-45deg,rgba(0,0,0,.035) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(0,0,0,.035) 75%),linear-gradient(-45deg,transparent 75%,rgba(0,0,0,.035) 75%); background-size: 18px 18px; background-position: 0 0,0 9px,9px -9px,-9px 0; }
.canvas-stage canvas { display: block; max-width: 94%; max-height: 525px; background: var(--white); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.action-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.action-row > span { font-size: 11px; }
.primary-btn { padding: 10px 24px; border: 0; border-radius: 500px; color: #f7f7f7; background: var(--black); font-size: 13px; font-weight: 500; letter-spacing: -.26px; }
.primary-btn:hover { background: #3a3a3a; }
.toast { position: fixed; z-index: 20; bottom: 24px; left: 50%; padding: 10px 16px; border-radius: 50px; color: var(--white); background: var(--black); font-size: 13px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 960px) {
  body { grid-template-columns: 1fr; grid-template-rows: 56px minmax(0,1fr); }
  .sidebar { display: none; }
  .topbar, main { grid-column: 1; }
  .topbar { padding: 0 18px; }
  .workspace { grid-template-columns: 1fr; }
  .controls { order: 1; }
  .preview-panel { order: 2; min-height: 500px; }
  .canvas-stage { min-height: 380px; }
  .toast { left: 50%; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 13px; }
  .breadcrumb span, .breadcrumb b, .privacy { display: none; }
  .breadcrumb strong { font-size: 13px; }
  main { padding: 20px 12px 36px; }
  .empty-view { margin: 14px auto; padding: 24px 16px; border-radius: 12px; }
  .upload-label { font-size: 16px; }
  .dropzone { min-height: 150px; padding: 20px 14px; flex-direction: column; gap: 10px; border-radius: 12px; }
  .upload-symbol { width: 34px; height: 34px; }
  .drop-copy { font-size: 15px; line-height: 1.55; }
  .workspace-head { margin-bottom: 16px; }
  .workspace-head h1 { font-size: 26px; }
  .workspace-head > button { padding: 8px 12px; font-size: 11px; }
  .workspace { gap: 12px; }
  .panel { padding: 17px; border-radius: 10px; }
  .order-heading { align-items: flex-start; }
  .order-heading button { max-width: 140px; white-space: normal; }
  .image-row { grid-template-columns: 36px 44px minmax(0,1fr) 25px; gap: 8px; min-height: 64px; padding: 8px; }
  .image-row canvas { width: 44px; height: 44px; }
  .drag-handle { width: 36px; height: 46px; font-size: 21px; }
  .preview-panel { min-height: 390px; }
  .canvas-stage { min-height: 270px; margin: 12px 0; }
  .canvas-stage canvas { max-width: 100%; max-height: 300px; }
  .action-row { display: block; }
  .action-row > span { display: block; margin-bottom: 10px; }
  .primary-btn { width: 100%; min-height: 44px; }
}
