:root {
  color-scheme: dark;
  --print-width: 127mm;
  --print-height: 89mm;
  --ink: #f4f1e9;
  --muted: #8d99a8;
  --muted-strong: #b8c0ca;
  --bg: #0b1016;
  --surface: #111923;
  --surface-2: #17212d;
  --surface-3: #202d3a;
  --line: rgba(220, 233, 242, 0.12);
  --line-strong: rgba(220, 233, 242, 0.21);
  --mint: #5ee7d0;
  --mint-dark: #1a7f78;
  --orange: #ff9f6e;
  --red: #ff7d79;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -10%, rgba(94, 231, 208, 0.12), transparent 30rem),
    radial-gradient(circle at 100% 90%, rgba(255, 159, 110, 0.08), transparent 26rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

.app-shell { width: min(100%, 1600px); margin: 0 auto; padding: 0 28px 28px; }

.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border: 1px solid rgba(244, 241, 233, 0.32); border-radius: 12px; display: grid; place-items: center; transform: rotate(-7deg); background: #18232c; box-shadow: inset 0 0 0 5px #101820; }
.brand-mark::before { content: ""; width: 13px; height: 13px; border: 3px solid var(--orange); border-radius: 50%; }
.brand-mark span { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }
.brand-name { display: block; font-size: 15px; font-weight: 760; letter-spacing: 0.16em; line-height: 1.1; }
.brand-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.privacy-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid rgba(94, 231, 208, 0.24); border-radius: 999px; color: var(--muted-strong); font-size: 12px; }
.privacy-dot, .status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(94, 231, 208, 0.1); }
.text-button { border: 0; padding: 8px 0; background: transparent; color: var(--muted-strong); font-size: 13px; cursor: pointer; transition: color .18s ease; }
.text-button:hover { color: var(--ink); }

.workspace { display: grid; grid-template-columns: 250px minmax(420px, 1fr) 330px; gap: 18px; padding-top: 20px; }
.left-rail, .editor-panel, .control-panel { min-width: 0; }
.left-rail { padding: 18px 8px 0 4px; }
.eyebrow { color: var(--mint); font-size: 10px; font-weight: 760; letter-spacing: .17em; }
.rail-heading h1, .editor-toolbar h2, .control-heading h2, .dialog-header h2 { margin: 6px 0 0; font-size: 20px; line-height: 1.2; letter-spacing: -.025em; }
.rail-heading p { max-width: 210px; margin: 11px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.step-list { display: grid; gap: 3px; margin: 30px 0 34px; }
.step { display: flex; align-items: center; gap: 12px; padding: 9px 10px; color: #596675; font-size: 13px; }
.step.active { color: var(--ink); }
.step-number { color: var(--muted); font-size: 10px; font-weight: 760; letter-spacing: .11em; }
.step.active .step-number { color: var(--orange); }

.source-card, .tip-card, .control-section { border: 1px solid var(--line); background: rgba(17, 25, 35, .78); box-shadow: var(--shadow); }
.source-card { padding: 18px; border-radius: 16px; }
.section-kicker { color: var(--orange); font-size: 10px; font-weight: 760; letter-spacing: .16em; }
.source-card h2 { margin: 7px 0 4px; font-size: 16px; }
.muted-copy { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.source-actions { display: grid; gap: 8px; }
.primary-button, .secondary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease; }
.primary-button { border: 1px solid var(--mint); color: #071315; background: var(--mint); }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); background: #80f1dc; }
.secondary-button { border: 1px solid var(--line-strong); color: var(--ink); background: rgba(255, 255, 255, .02); }
.secondary-button:hover:not(:disabled) { border-color: rgba(94, 231, 208, .55); background: rgba(94, 231, 208, .06); }
button:disabled { cursor: not-allowed; opacity: .4; }
.button-icon { font-size: 18px; line-height: 1; font-weight: 400; }
.tip-card { display: flex; gap: 11px; margin-top: 12px; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(255, 159, 110, .1), rgba(17, 25, 35, .72)); box-shadow: none; }
.tip-icon { color: var(--orange); font-size: 17px; line-height: 1.2; }
.tip-card strong { display: block; font-size: 12px; }
.tip-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.editor-panel { display: flex; flex-direction: column; min-height: 760px; border: 1px solid var(--line); border-radius: 20px; background: rgba(12, 18, 26, .75); box-shadow: var(--shadow); overflow: hidden; }
.editor-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); }
.editor-toolbar h2 { margin-top: 5px; font-size: 17px; }
.toolbar-meta { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.meta-divider { width: 3px; height: 3px; border-radius: 50%; background: var(--orange); }
.canvas-stage { position: relative; display: grid; flex: 1; min-height: 560px; place-items: center; padding: 22px; background-color: #10171f; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 26px 26px; cursor: default; }
#editorCanvas { width: 100%; max-height: 620px; aspect-ratio: 3 / 2; display: block; border-radius: 9px; box-shadow: 0 20px 45px rgba(0,0,0,.24); }
.canvas-stage.has-image { cursor: grab; }
.canvas-stage.has-image:active { cursor: grabbing; }
.empty-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; pointer-events: none; color: var(--muted-strong); }
.empty-state[hidden], .drag-hint[hidden] { display: none; }
.empty-state strong { margin-top: 2px; color: var(--ink); font-size: 14px; }
.empty-state > span { color: var(--muted); font-size: 12px; }
.empty-orbit { position: relative; width: 64px; height: 64px; margin-bottom: 3px; border: 1px dashed rgba(94, 231, 208, .55); border-radius: 22px; transform: rotate(12deg); }
.empty-orbit::before { content: ""; position: absolute; inset: 13px; border: 1px solid rgba(255, 159, 110, .6); border-radius: 50%; }
.empty-orbit span { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--mint); }
.empty-orbit span:nth-child(1) { top: 6px; right: 13px; }.empty-orbit span:nth-child(2) { bottom: 10px; left: 7px; background: var(--orange); }.empty-orbit span:nth-child(3) { right: 5px; bottom: 16px; }
.drag-hint { position: absolute; bottom: 30px; padding: 7px 11px; border: 1px solid rgba(94, 231, 208, .28); border-radius: 999px; background: rgba(11, 16, 22, .82); color: var(--mint); font-size: 11px; pointer-events: none; }
.editor-footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.footer-status, .footer-shortcut { display: inline-flex; align-items: center; gap: 9px; }
.status-dot.idle { background: var(--orange); box-shadow: 0 0 0 4px rgba(255, 159, 110, .1); }

.control-panel { display: grid; align-content: start; gap: 10px; }
.control-section { padding: 17px 16px; border-radius: 16px; box-shadow: none; }
.control-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.control-heading h2 { font-size: 15px; }
.size-chip { margin-top: 2px; padding: 4px 7px; border: 1px solid rgba(255, 159, 110, .3); border-radius: 5px; color: var(--orange); font-size: 10px; white-space: nowrap; }
.size-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.size-option { min-height: 63px; display: flex; flex-direction: column; align-items: start; justify-content: center; gap: 3px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.size-option.wide { grid-column: 1 / -1; min-height: 48px; flex-direction: row; align-items: center; justify-content: space-between; }
.size-option strong { font-size: 12px; }.size-option span { color: var(--muted); font-size: 10px; }
.size-option:hover, .size-option.selected { border-color: rgba(94, 231, 208, .75); background: rgba(94, 231, 208, .08); }
.size-option.selected strong { color: var(--mint); }
.icon-button-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 16px; }
.icon-button { min-height: 54px; display: grid; place-items: center; gap: 1px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); color: var(--muted-strong); cursor: pointer; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.icon-button:hover { border-color: rgba(94, 231, 208, .55); color: var(--mint); background: rgba(94, 231, 208, .06); }
.icon-button span { font-size: 10px; }.icon-button { font-size: 23px; line-height: 1; }
.range-row { display: flex; justify-content: space-between; margin: 11px 0 5px; color: var(--muted-strong); font-size: 12px; }.range-row output { color: var(--mint); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 4px; display: block; margin: 0 0 4px; accent-color: var(--mint); cursor: pointer; }
.range-help { margin: 9px 0 0; color: var(--muted); font-size: 10px; }
.background-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 11px; }
.background-option { min-height: 40px; display: flex; align-items: center; gap: 7px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.015); color: var(--muted-strong); font-size: 11px; cursor: pointer; }
.background-option:hover, .background-option.selected { border-color: rgba(94, 231, 208, .65); color: var(--ink); background: rgba(94, 231, 208, .06); }
.swatch { flex: 0 0 auto; width: 17px; height: 17px; border: 1px solid rgba(255,255,255,.22); border-radius: 5px; }.swatch.white { background: #fff; }.swatch.gray { background: #e9edf0; }.swatch.photo { background: linear-gradient(135deg, #ec9a71 0 45%, #51757b 46% 100%); }.swatch.checker { background: conic-gradient(#d6dbe0 25%, white 0 50%, #d6dbe0 0 75%, white 0) 0 0 / 8px 8px; }
.ai-button { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid rgba(255, 159, 110, .35); border-radius: 10px; background: linear-gradient(100deg, rgba(255, 159, 110, .12), rgba(255, 159, 110, .03)); text-align: left; cursor: pointer; transition: border-color .18s ease, transform .18s ease; }
.ai-button:hover:not(:disabled) { border-color: rgba(255, 159, 110, .75); transform: translateY(-1px); }.sparkle { color: var(--orange); font-size: 19px; }.ai-button strong, .ai-button small { display: block; }.ai-button strong { color: var(--ink); font-size: 11px; }.ai-button small { margin-top: 2px; color: var(--muted); font-size: 10px; }.ai-button .arrow { margin-left: auto; color: var(--orange); font-size: 17px; }
.full-button { width: 100%; }.print-settings { display: grid; gap: 6px; margin-top: 12px; }.print-settings label { color: var(--muted-strong); font-size: 11px; }.print-settings select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--ink); font-size: 12px; cursor: pointer; }.print-settings select:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }.output-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin-top: 8px; }.output-row .text-button { font-size: 11px; }.output-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }

.camera-dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: #101820; color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.camera-dialog::backdrop { background: rgba(3, 7, 11, .78); backdrop-filter: blur(7px); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; padding: 20px 22px 15px; }.dialog-header h2 { font-size: 18px; }.close-button { border: 0; background: transparent; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }.close-button:hover { color: var(--ink); }
.video-frame { position: relative; margin: 0 22px; overflow: hidden; border-radius: 12px; background: #070b10; aspect-ratio: 4 / 3; }.video-frame video { width: 100%; height: 100%; display: block; object-fit: cover; }.camera-guide { position: absolute; top: 9%; left: 50%; width: 40%; height: 73%; transform: translateX(-50%); border: 2px solid rgba(94, 231, 208, .9); border-radius: 50% 50% 44% 44% / 43% 43% 56% 56%; box-shadow: 0 0 0 999px rgba(3, 7, 11, .25), 0 0 0 1px rgba(255, 255, 255, .18); pointer-events: none; }.camera-guide::before { content: ""; position: absolute; left: -28%; right: -28%; bottom: -18%; height: 29%; border: 1px dashed rgba(255, 159, 110, .76); border-top: 0; border-radius: 0 0 50% 50%; }.camera-guide::after { content: "顔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 2px 5px; border-radius: 999px; background: rgba(3, 7, 11, .4); color: rgba(244, 241, 233, .74); font-size: 10px; letter-spacing: .08em; }.dialog-message { min-height: 21px; margin: 12px 22px; color: var(--muted); font-size: 12px; }.dialog-actions { display: flex; gap: 8px; padding: 0 22px 22px; }.dialog-actions .primary-button, .dialog-actions .secondary-button { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; max-width: min(420px, calc(100% - 32px)); padding: 11px 15px; border: 1px solid rgba(94, 231, 208, .35); border-radius: 999px; background: rgba(16, 24, 32, .95); color: var(--ink); font-size: 12px; box-shadow: 0 15px 40px rgba(0,0,0,.3); opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }.toast.show { opacity: 1; transform: translate(-50%, 0); }
#printArea { display: none; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 215px minmax(390px, 1fr) 300px; gap: 12px; }
  .app-shell { padding-left: 18px; padding-right: 18px; }
  .editor-toolbar, .editor-footer { padding-left: 18px; padding-right: 18px; }
  .canvas-stage { padding: 15px; }
}

@media (max-width: 940px) {
  .workspace { grid-template-columns: 1fr 1fr; }.left-rail { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 6px 0 0; }.step-list { display: none; }.source-card { align-self: end; }.tip-card { margin-top: 0; align-self: end; }.rail-heading { align-self: center; }.rail-heading p { max-width: 280px; }.editor-panel { min-height: 680px; }.control-panel { grid-column: 2; grid-row: 2; }.editor-panel { grid-column: 1; grid-row: 2; }
}

@media (max-width: 680px) {
  .app-shell { padding: 0 12px 16px; }.topbar { height: 72px; }.privacy-pill { display: none; }.topbar-actions { gap: 0; }.workspace { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }.left-rail { display: block; }.rail-heading { padding: 4px 4px 7px; }.rail-heading p { max-width: none; margin-top: 6px; }.source-card { margin-top: 10px; }.tip-card { display: none; }.editor-panel { order: 2; min-height: 480px; }.control-panel { order: 3; }.editor-toolbar { align-items: start; flex-direction: column; gap: 8px; padding: 15px; }.toolbar-meta { font-size: 10px; }.canvas-stage { min-height: 335px; padding: 10px; }.editor-footer { padding: 11px 15px; }.footer-shortcut { display: none; }.control-section { padding: 15px; }.brand-name { font-size: 13px; }.brand-subtitle { font-size: 10px; }.brand-mark { width: 34px; height: 34px; }.output-row { grid-template-columns: 1fr auto; }.video-frame { margin: 0 16px; }.dialog-header { padding: 17px 16px 13px; }.dialog-message { margin-left: 16px; margin-right: 16px; }.dialog-actions { padding-left: 16px; padding-right: 16px; padding-bottom: 16px; }
}

@media print {
  @page { size: var(--print-width) var(--print-height); margin: 0; }
  html, body { width: var(--print-width); height: var(--print-height); min-width: 0; background: white; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { width: var(--print-width); height: var(--print-height); display: block; background: white; overflow: hidden; }
  #printCanvas { width: var(--print-width); height: var(--print-height); display: block; }
  #printSheetInfo { display: none; }
}
