:root {
  font-family: Inter, "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
  color: #292735;
  background: #f6f6fa;
  --purple: #6954bd;
  --orange: #ab572b;
  --border: #e3e0ea;
  --muted: #686373;
  --focus: #8c74da;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.7; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
a { color: var(--purple); text-underline-offset: 4px; }
button, select, textarea, input { font: inherit; }
button { cursor: pointer; }
button, a, select, textarea, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button:disabled { cursor: not-allowed; opacity: .6; transform: none !important; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1360px; margin: auto; padding: 20px 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: #292735; text-decoration: none; font-size: 21px; font-weight: 750; letter-spacing: -.5px; }
.brand-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--purple); color: white; display: grid; place-items: center; }
.prototype { padding: 6px 12px; border: 1px solid var(--border); border-radius: 30px; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .06em; white-space: nowrap; }
.prototype > span { display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: #8c7bbb; border-radius: 50%; }
main { max-width: 1360px; padding: 0 40px; margin: auto; }
.intro { text-align: center; padding: 36px 0 30px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .19em; color: #796591; }
h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.4; letter-spacing: .02em; margin: 9px 0 12px; }
.intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.9; }
.workflow { display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 12px; font-weight: 600; color: #655c74; margin-top: 18px; }
.workflow b { display: inline-block; margin-right: 7px; padding: 2px 7px; border-radius: 5px; background: #eeebf9; color: #6852a1; font-size: 11px; }
.workflow > span:last-child b { background: #faeade; color: #92512f; }
.flow-line { width: 34px; height: 1px; background: #cec6df; }
.workflow a { display: inline-flex; align-items: center; min-height: 44px; padding: 5px 9px; border-radius: 8px; color: #655c74; text-decoration: none; transition: background .15s; }
.workflow a:hover { background: #ece7f6; }
.workflow a:nth-of-type(n+2) b { background: #faeade; color: #92512f; }
#planning, #creation, #page-import { scroll-margin-top: 24px; }
#planning:focus-visible, #creation:focus-visible, #page-import:focus-visible { outline: 3px solid var(--focus); outline-offset: 5px; }
.connection-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 16px 28px; padding: 22px 26px; border: 1px solid var(--border); border-radius: 16px; background: white; margin-bottom: 26px; }
.connection-card strong { font-size: 15px; }
.connection-card p { font-size: 12px; margin: 6px 0 0; line-height: 1.8; overflow-wrap: anywhere; }
.connection-note { color: var(--muted); }
#connection-status { color: #655096; font-weight: 600; }
.connection-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.connection-actions label { grid-column: 1 / -1; margin: 0 !important; font-size: 12px !important; }
.connection-actions a { grid-column: 1 / -1; justify-self: start; font-size: 12px; min-height: 32px; display: inline-flex; align-items: center; }
.connection-card #connection-message { grid-column: 1 / -1; margin: 0; color: #9b3d35; }
#connection-message:empty { display: none; }
.connection-actions button, .prompt-actions button, .text-button { padding: 10px 13px; min-height: 44px; border: 1px solid #d9d1ec; background: #f3effb; color: #5a458a; border-radius: 8px; font-size: 13px; font-weight: 600; transition: background .15s; }
.connection-actions button:hover:not(:disabled), .text-button:hover { background: #eae3f7; }
#connect-button { background: var(--purple); color: white; border-color: var(--purple); }
#connect-button:hover { background: #5843a7; }
#disconnect-button { background: white; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; }
.studio-card { border: 1px solid var(--border); border-top: 3px solid #aa95de; border-radius: 18px; background: white; padding: 28px; box-shadow: 0 5px 22px #32214c05; min-width: 0; }
.generation { border-top-color: #dea580; --purple: var(--orange); --focus: #c27a50; }
.card-heading { display: flex; align-items: center; gap: 12px; }
.section-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #7557b5; background: #eee9fa; }
.generation .section-icon { color: #a5623e; background: #fcf0e7; }
.step-label { color: #786884; font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.generation .step-label { color: #88644e; }
.mode-badge { margin-left: auto; border-radius: 6px; background: #f0ebfa; color: #67518e; padding: 4px 8px; font-size: 11px; font-weight: 600; }
.generation .mode-badge { background: #faeee4; color: #8b5837; }
h2 { font-size: 22px; line-height: 1.6; letter-spacing: -.03em; margin: 14px 0 8px; }
.description { color: var(--muted); font-size: 13px; line-height: 1.9; min-height: 50px; margin: 0 0 26px; }
form { min-width: 0; }
.field { margin-bottom: 22px; min-width: 0; }
label:not(.upload-zone) { display: block; font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.optional { margin-left: 6px; padding: 3px 6px; border-radius: 4px; font-size: 11px; font-weight: 400; color: #6f657d; background: #f1eef7; }
select, textarea { display: block; width: 100%; min-width: 0; border: 1px solid #d3cddb; border-radius: 9px; padding: 12px 13px; background: white; color: #393240; font-size: 14px; line-height: 1.8; transition: border-color .15s, box-shadow .15s; }
select { min-height: 48px; cursor: pointer; }
select:disabled { background: #f5f4f7; color: #716977; cursor: not-allowed; }
textarea { resize: vertical; min-height: 132px; }
textarea::placeholder { color: #787080; opacity: 1; font-size: 13px; }
textarea:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
#story { min-height: 180px; }
#character-notes { min-height: 112px; }
#panel-notes { min-height: 200px; }
.field-status, .preview-status { font-size: 12px; color: var(--muted); line-height: 1.85; margin: 8px 0 0; overflow-wrap: anywhere; }
.field-status:empty { display: none; }
.form-group { min-width: 0; margin: 0 0 24px; padding: 18px 18px 2px; border: 1px solid #eee3da; border-radius: 11px; background: #fffdfa; }
.form-group legend { font-size: 12px; font-weight: 700; padding: 0 7px; color: #875a41; }
.form-group .field:last-child { margin-bottom: 16px; }
.form-group .field-row:last-of-type .field { margin-bottom: 8px; }
.settings-help { margin: 0 0 8px; }
.settings-help:last-child { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.field-row label { font-size: 13px; }
.upload-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 156px; padding: 20px 14px; border: 1.5px dashed #cfc2e6; background: #faf8ff; border-radius: 10px; text-align: center; cursor: pointer; transition: background .15s; }
.upload-zone:hover, .upload-zone.dragging { border-color: #957cc5; background: #f1ebfc; }
.upload-zone svg { width: 27px; height: 27px; color: #8569ae; margin-bottom: 4px; }
.upload-zone strong { color: #5e467e; font-size: 14px; font-weight: 600; }
.upload-zone span, .upload-zone small { color: #766387; font-size: 12px; }
.upload-zone img { max-width: 100%; max-height: 180px; object-fit: contain; margin-top: 8px; border-radius: 5px; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.upload-zone:has(+ .file-input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.text-button { margin: -10px 0 22px; background: white; }
.primary-button { display: flex; justify-content: center; align-items: center; gap: 9px; width: 100%; min-height: 52px; padding: 12px 16px; background: var(--purple); border: 0; border-radius: 10px; color: white; font-size: 15px; font-weight: 650; box-shadow: 0 4px 9px #3930490d; transition: filter .15s, transform .15s; }
.primary-button svg { width: 19px; height: 19px; }
.primary-button > span { margin-left: auto; font-size: 20px; }
.primary-button:before { content: ""; width: 20px; margin-right: auto; }
.primary-button:hover:not(:disabled) { filter: brightness(.93); transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 24px; margin-top: 28px; border-top: 1px solid var(--border); }
h3 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 14px; font-weight: 650; }
h3 svg { width: 18px; height: 18px; color: #876ea4; }
.sample-badge { color: #6c5b80; background: #f2edf8; font-size: 11px; padding: 4px 8px; border-radius: 5px; white-space: nowrap; }
.generation .sample-badge { background: #fbefe5; color: #895d3c; }
.idea-output { padding: 20px; margin-top: 14px; border: 1px solid #e4ddf2; border-radius: 11px; background: #f8f5fd; color: #51435f; font-size: 14px; line-height: 1.95; }
.answer-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt-section { margin-top: 26px; padding: 20px; background: #fffaf4; border: 1px solid #eddfd2; border-radius: 12px; }
#generation-prompt { min-height: 280px; font-size: 14px; }
.prompt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.prompt-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--orange); color: white; border-color: var(--orange); }
.prompt-actions button svg { width: 17px; height: 17px; }
.prompt-actions a { min-height: 44px; display: inline-flex; align-items: center; font-size: 13px; }
.instructions { list-style: none; counter-reset: workflow; padding: 0; color: #71583e; font-size: 12px; line-height: 1.9; margin: 20px 0 12px; }
.instructions li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 9px; align-items: start; }
.instructions li::before { counter-increment: workflow; content: counter(workflow); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #f4e3d1; color: #835131; font-size: 11px; font-weight: 700; }
.instructions li + li { margin-top: 12px; }
.preview-status { margin: 12px 0 16px; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.preview-card { min-width: 0; border: 1px solid #e5ddd5; background: #fffefa; border-radius: 11px; padding: 14px; }
.preview-card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; color: #665143; }
.preview-card-header strong { font-size: 14px; }
.preview-card-header span { font-size: 11px; padding: 2px 5px; background: #f4ede6; border-radius: 4px; }
.comic-placeholder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 6px; padding: 10px; margin: 14px 0; height: 172px; border: 1px solid #e7dfd5; border-radius: 5px; background: #f5f0e9; }
.comic-placeholder span { position: relative; border: 1px solid #d9cdbc; background: #fffcf7; }
.comic-placeholder span:after { content: ""; position: absolute; right: 8px; top: 8px; width: 20px; height: 12px; border: 1px solid #dbcebe; border-radius: 50%; background: white; }
.imported-page { display: block; max-width: 100%; height: auto; margin: 14px auto; }
.page-upload { color: #81512c; font-size: 12px !important; margin: 10px 0 0 !important; }
.page-file { display: block; width: 100%; color: #65594b; font-size: 12px; margin: 8px 0 12px; overflow: hidden; }
.page-file::file-selector-button { min-height: 44px; max-width: 100%; margin-right: 6px; padding: 8px 10px; color: #825230; background: #f9eee2; border: 1px solid #e0cdb9; border-radius: 7px; cursor: pointer; font: inherit; }
.preview-card p { font-size: 12px; color: #78644d; line-height: 1.8; margin: 0; overflow-wrap: anywhere; }
footer { text-align: center; padding: 32px 0; color: #726980; font-size: 13px; }
.footer-mark { color: #9274b1; margin-right: 5px; }
footer p { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 10px 0 0; }
@media (max-width: 1180px) {
  main { padding: 0 28px; }
  .topbar-inner { padding: 18px 28px; }
  .connection-card { grid-template-columns: 1fr; }
  .connection-actions { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .connection-actions a { grid-column: auto; justify-self: end; }
  .studio-card { padding: 24px; }
  h2 { font-size: 20px; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .description { min-height: 0; }
  .studio-card { padding: 28px; }
  .connection-actions { grid-template-columns: minmax(0, 1fr) auto auto; }
  .connection-actions a { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 600px) {
  main { padding: 0 16px; }
  .topbar-inner { padding: 15px 16px; }
  .brand { font-size: 16px; gap: 9px; }
  .brand-icon { width: 34px; height: 34px; }
  .prototype { display: none; }
  .intro { padding: 27px 0 24px; }
  .intro p { font-size: 13px; }
  .desktop-break { display: none; }
  .workflow { gap: 10px; font-size: 11px; }
  .workflow { flex-wrap: nowrap; gap: 5px; }
  .workflow .flow-line { display: none; }
  .workflow a { flex: 1; min-width: 0; flex-direction: column; gap: 5px; padding: 7px 3px; font-size: 12px; }
  .workflow b { margin-right: 0; }
  .connection-card { padding: 20px; gap: 14px; margin-bottom: 20px; }
  .connection-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .connection-actions select { grid-column: 1 / -1; }
  .connection-actions a { min-height: 44px; }
  .workspace { gap: 22px; }
  .studio-card { padding: 22px 18px; border-radius: 14px; }
  .card-heading { flex-wrap: wrap; gap: 8px; }
  .mode-badge { max-width: 100%; font-size: 10px; padding: 4px 6px; }
  h2 { font-size: 20px; }
  select, textarea { font-size: 16px; }
  textarea::placeholder { font-size: 14px; }
  .form-group { padding: 15px 12px 0; }
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .field-row label { font-size: 14px; }
  .primary-button { font-size: 14px; }
  .primary-button:before { display: none; }
  .primary-button > span { margin-left: 6px; }
  .result-heading { flex-wrap: wrap; }
  .preview-grid { grid-template-columns: minmax(0, 1fr); }
  .comic-placeholder { height: 220px; }
  .prompt-section { padding: 16px; }
  .prompt-actions { flex-direction: column; align-items: stretch; gap: 5px; }
  .prompt-actions a { justify-content: center; }
  .idea-output { padding: 16px; }
  footer { padding: 26px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
