:root {
  color-scheme: light;
  --page: #f7f8fc;
  --surface: #ffffff;
  --ink: #171927;
  --muted: #6f7385;
  --line: #e5e7ef;
  --purple: #7557d8;
  --purple-dark: #6042c1;
  --purple-soft: #f2edff;
  --coral: #ef6b57;
  --coral-dark: #d95543;
  --coral-soft: #fff0ed;
  --shadow: 0 18px 50px rgba(40, 35, 72, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% 9%, rgba(117, 87, 216, 0.06), transparent 24rem),
    radial-gradient(circle at 92% 24%, rgba(239, 107, 87, 0.06), transparent 25rem),
    var(--page);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

button, select, .upload-zone { cursor: pointer; }

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(229, 231, 239, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.header-inner {
  width: min(1280px, calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 1.03rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-style: italic;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-dot, .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #52b788;
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.14);
}

.page-shell {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 54px 0 64px;
}

.hero { margin-bottom: 34px; text-align: center; }
.eyebrow, .section-kicker {
  margin: 0 0 9px;
  color: var(--purple);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3.45rem);
  line-height: 1.2;
  letter-spacing: -0.055em;
}

.hero > p:not(.eyebrow) {
  margin: 13px 0 20px;
  color: var(--muted);
  font-size: 0.98rem;
}

.flow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}
.flow b { margin-right: 3px; color: var(--ink); }
.flow i { color: #b1b4c1; font-style: normal; }

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.studio-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.studio-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--purple);
  content: "";
}
.generator-card::before { background: var(--coral); }

.section-intro { display: flex; align-items: center; gap: 14px; }
.section-icon {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  font-size: 1.25rem;
  font-weight: 900;
}
.assistant-icon { background: var(--purple-soft); color: var(--purple); }
.generator-icon { background: var(--coral-soft); color: var(--coral); }
.generator-card .section-kicker { color: var(--coral); }

h2 { margin: 0; font-size: 1.55rem; line-height: 1.24; letter-spacing: -0.035em; }
.section-description { min-height: 3.2em; margin: 16px 0 25px; color: var(--muted); font-size: 0.87rem; line-height: 1.75; }

.form-stack, .field-group { display: grid; }
.form-stack { gap: 19px; }
.field-group { gap: 8px; }
.field-label { color: #35384a; font-size: 0.8rem; font-weight: 800; }
.optional { color: #a4a7b2; font-size: 0.68rem; font-weight: 650; }

.upload-zone {
  min-height: 126px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 18px;
  border: 1.5px dashed #cfc6eb;
  border-radius: 14px;
  background: #fbfaff;
  color: #434052;
  text-align: center;
  transition: border-color .2s, background .2s, transform .2s;
}
.upload-zone:hover { border-color: var(--purple); background: var(--purple-soft); transform: translateY(-1px); }
.upload-zone strong { font-size: 0.83rem; }
.upload-zone small { color: var(--muted); font-size: 0.68rem; }
.upload-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  margin-bottom: 2px;
  border: 1px solid #ddd7ef;
  border-radius: 9px;
  background: #fff;
  color: var(--purple);
  font-size: 1.05rem;
  font-weight: 900;
}

select, textarea {
  width: 100%;
  border: 1px solid #dde0e9;
  border-radius: 11px;
  background: #fbfbfd;
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

select { height: 46px; padding: 0 39px 0 12px; appearance: none; }
.select-wrap { position: relative; }
.select-wrap::after { position: absolute; top: 50%; right: 15px; color: #8c8f9c; content: "⌄"; pointer-events: none; transform: translateY(-55%); }
textarea { min-height: 126px; padding: 12px 13px; resize: vertical; line-height: 1.7; }
textarea::placeholder { color: #a4a7b3; }
select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(117,87,216,.12); }
.generator-card select:focus, .generator-card textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(239,107,87,.12); }

.split-fields { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 13px; }

.primary-button {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(71, 53, 136, .16);
  transition: transform .18s, box-shadow .18s, background .18s;
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 11px 23px rgba(71, 53, 136, .22); }
.primary-button:active { transform: translateY(0); }
.assistant-button { background: var(--purple); }
.assistant-button:hover { background: var(--purple-dark); }
.generator-button { background: var(--coral); box-shadow: 0 8px 18px rgba(188, 74, 57, .16); }
.generator-button:hover { background: var(--coral-dark); box-shadow: 0 11px 23px rgba(188, 74, 57, .22); }
.primary-button.is-working { opacity: .78; pointer-events: none; }

.form-message {
  min-height: 1.35em;
  margin: -7px 2px 0;
  color: #bd493b;
  font-size: .73rem;
  font-weight: 750;
  line-height: 1.5;
}
.form-message.is-success { color: #27805a; }
.result-copy.is-ai-response { white-space: pre-wrap; }

.result-panel, .preview-section { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 22px; }
.result-heading, .preview-heading, .preview-heading > div { display: flex; align-items: center; }
.result-heading { gap: 9px; margin-bottom: 12px; font-size: 0.8rem; }
.result-heading > span { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; background: var(--purple); color: #fff; font-size: 0.58rem; font-weight: 900; }
.result-copy { padding: 16px; border-radius: 13px; background: var(--purple-soft); color: #555066; font-size: 0.77rem; line-height: 1.7; }
.result-copy strong { color: var(--purple-dark); }
.result-copy ul { margin: 7px 0 0; padding-left: 1.25rem; }
.result-copy li + li { margin-top: 4px; }

.preview-heading { justify-content: space-between; margin-bottom: 13px; }
.preview-heading > div { gap: 9px; font-size: 0.8rem; }
.preview-heading small { color: var(--muted); font-size: 0.65rem; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.preview-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.preview-card header { display: flex; justify-content: space-between; padding: 10px 11px; border-bottom: 1px solid var(--line); font-size: 0.7rem; }
.preview-card header strong { font-size: 0.73rem; }
.preview-card header span { color: var(--muted); }
.comic-placeholder {
  aspect-ratio: 4 / 3;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 8px;
  background: #f1f2f5;
}
.comic-panel { position: relative; overflow: hidden; border: 1px solid #d5d7dd; background: linear-gradient(145deg, #fff 0 45%, #eceef2 46% 100%); }
.comic-panel::before { position: absolute; top: 16%; left: 12%; width: 40%; height: 20%; border: 1px solid #c9ccd3; border-radius: 50%; background: #fff; content: ""; }
.comic-panel::after { position: absolute; right: 11%; bottom: 12%; width: 34%; height: 48%; border-radius: 50% 50% 22% 22%; background: #d7d9df; content: ""; }
.preview-caption { margin: 0; padding: 9px; color: var(--muted); font-size: 0.62rem; text-align: center; }

.comic-placeholder.is-loading { display: grid; grid-template-columns: 1fr; place-items: center; }
.preview-loading { display: grid; place-items: center; gap: 9px; color: var(--muted); font-size: .7rem; }
.spinner { width: 25px; height: 25px; border: 3px solid #e6e1f5; border-top-color: var(--coral); border-radius: 50%; animation: spin .8s linear infinite; }
.generated-image-wrap { aspect-ratio: 2 / 3; overflow: hidden; background: #eef0f4; }
.generated-image-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; }

@keyframes spin { to { transform: rotate(360deg); } }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

footer { padding: 24px; border-top: 1px solid var(--line); color: #9a9dab; font-size: 0.7rem; text-align: center; }
footer span { margin: 0 6px; }

@media (max-width: 980px) {
  .page-shell, .header-inner { width: min(100% - 32px, 760px); }
  .studio-grid { grid-template-columns: 1fr; }
  .section-description { min-height: auto; }
  .title-break { display: none; }
}

@media (max-width: 600px) {
  .header-inner { width: min(100% - 24px, 760px); min-height: 62px; }
  .brand { gap: 9px; font-size: .86rem; }
  .brand-mark { width: 33px; height: 33px; border-radius: 9px; }
  .status { padding: 6px 8px; font-size: .64rem; }
  .page-shell { width: min(100% - 24px, 760px); padding: 36px 0 45px; }
  .hero { margin-bottom: 25px; }
  .hero h1 { font-size: 2rem; }
  .hero > p:not(.eyebrow) { font-size: .83rem; line-height: 1.7; }
  .flow { width: 100%; justify-content: center; gap: 6px; padding: 9px 7px; font-size: .62rem; }
  .studio-card { padding: 22px 18px; border-radius: 18px; }
  .section-icon { width: 43px; height: 43px; }
  h2 { font-size: 1.3rem; }
  .section-description { font-size: .81rem; }
  .split-fields { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: 1fr; }
  .comic-placeholder { aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
