/* =========================================
   Manga Creative Studio - Mockup Styles
   ========================================= */
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #5f6675;       /* 補足テキスト（白背景でも読める濃さ） */
  --placeholder: #9aa1ad;
  --border: #e3e6ee;

  /* アシスタント = ティール系 */
  --assist: #0f9d8a;
  --assist-dark: #0b7d6e;
  --assist-soft: #e6f6f3;

  /* 生成 = バイオレット系 */
  --gen: #6d4aff;
  --gen-dark: #5634e0;
  --gen-soft: #efebff;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.04), 0 8px 24px rgba(20, 24, 40, 0.06);
  --focus: 0 0 0 3px rgba(109, 74, 255, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* 英字は各OSのモダンなUIフォント、日本語は読みやすいゴシック体 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  background: linear-gradient(180deg, #fbfbfe 0%, var(--bg) 360px);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Header ---------- */
.app-header {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--assist), var(--gen));
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.app-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.app-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.mock-badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff4d6;
  color: #9a6b00;
}

/* ---------- Layout ---------- */
.main-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* ---------- Panel (Card) ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border-top: 4px solid;
}
.panel-assistant { border-top-color: var(--assist); }
.panel-generate  { border-top-color: var(--gen); }

.panel-head { margin-bottom: 20px; }
.step-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.panel-assistant .step-tag { background: var(--assist-soft); color: var(--assist-dark); }
.panel-generate  .step-tag { background: var(--gen-soft);    color: var(--gen-dark); }

.panel-title {
  margin: 12px 0 8px;
  font-size: 22px;
  line-height: 1.45;
  word-break: keep-all; /* 狭い画面では <wbr> の位置で自然に折り返す */
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* アイコン：線の太さ・サイズ・色を全体で統一（色は文字色を継承） */
.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.title-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 20px;
  flex-shrink: 0;
}
.panel-assistant .title-icon { background: var(--assist-soft); color: var(--assist-dark); }
.panel-generate  .title-icon { background: var(--gen-soft);    color: var(--gen-dark); }
.panel-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Form ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.label {
  font-size: 14px;
  font-weight: 700;
}
.input {
  width: 100%;
  font: inherit;
  font-size: 16px; /* iOSでズームされないよう16px */
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfd;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: #cfd4df; }
.input::placeholder { color: var(--placeholder); }
.textarea { resize: vertical; min-height: 110px; }
.panel-assistant .input:focus { outline: none; border-color: var(--assist); box-shadow: 0 0 0 3px var(--assist-soft); }
.panel-generate  .input:focus { outline: none; border-color: var(--gen);    box-shadow: 0 0 0 3px var(--gen-soft); }

/* Upload box */
.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 16px;
  border: 2px dashed #b9dcd6;
  border-radius: 12px;
  background: var(--assist-soft);
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.upload-box:hover { border-color: var(--assist); background: #d9f1ec; }
.upload-icon { font-size: 30px; line-height: 1; color: var(--assist); margin-bottom: 4px; }
.upload-icon .icon { stroke-width: 1.75; }
.upload-main { font-weight: 700; font-size: 14px; }
.upload-sub  { font-size: 13px; color: var(--muted); }
.upload-file { font-size: 13px; color: var(--assist-dark); font-weight: 700; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}

/* ---------- Buttons ---------- */
.btn {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:hover:not([disabled]) { transform: translateY(-1px); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-assistant { background: var(--assist); box-shadow: 0 6px 16px rgba(15, 157, 138, .3); }
.btn-assistant:hover { background: var(--assist-dark); }
.btn-generate { background: var(--gen); box-shadow: 0 6px 16px rgba(109, 74, 255, .3); }
.btn-generate:hover { background: var(--gen-dark); }
.btn[disabled] { opacity: .7; cursor: wait; }
.btn-generate.is-unavailable { background: #9b8bd9; box-shadow: none; }

/* ---------- Assistant result ---------- */
.result-box {
  margin-top: 24px;
  border: 1px solid #cdeae5;
  background: #f7fcfb;
  border-radius: 14px;
  padding: 20px 22px;
}
.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--assist);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.result-label { font-size: 14px; font-weight: 700; }
.result-title { margin: 0 0 6px; font-weight: 700; }
.result-list { margin: 0; padding-left: 1.2em; font-size: 14px; }
.result-list li + li { margin-top: 6px; }

.hint { margin: 2px 0 0; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.hint .icon { margin-top: 0.3em; color: var(--assist); }
.powered {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--assist-dark);
  background: var(--assist-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.result-placeholder { margin: 0; font-size: 14px; color: var(--muted); }
.result-text { font-size: 15px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; }
.result-text strong { color: var(--assist-dark); }
.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

.error-box, .notice-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}
.error-box  { background: #fdecec; color: #b42318; border: 1px solid #f5c2c0; }
.notice-box { margin-top: 18px; background: #fff7e0; color: #7a5300; border: 1px solid #f3dc9a; }

.tag-future { margin-left: 6px; background: #fff4d6 !important; color: #9a6b00 !important; }

/* ---------- Generate preview ---------- */
.preview-area { margin-top: 24px; }
.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.preview-meta {
  font-size: 12px;
  color: var(--gen-dark);
  background: var(--gen-soft);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.page-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.04);
}
.page-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.page-card-head small { color: var(--muted); font-weight: 500; font-size: 12px; }
.page-sheet {
  aspect-ratio: 3 / 4;
  margin: 10px;
  padding: 6px;
  border: 2px solid #2a2a2a;
  background: #fff;
  display: grid;
  gap: 5px;
}
.koma {
  border: 2px solid #2a2a2a;
  background: repeating-linear-gradient(45deg, #f4f2ff, #f4f2ff 6px, #fbfaff 6px, #fbfaff 12px);
}
.page-card-foot {
  padding: 0 12px 12px;
  text-align: center;
}
.page-card-foot strong {
  display: block;
  font-size: 12px;
  color: var(--gen-dark);
}
.page-card-foot span {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 24px 40px;
}

/* =========================================
   Responsive
   ========================================= */
/* タブレット：縦並び */
@media (max-width: 960px) {
  /* 1列のときはフォームが横に伸びすぎないよう最大幅を設定 */
  .main-grid { grid-template-columns: 1fr; max-width: 760px; }
}

/* スマホ */
@media (max-width: 600px) {
  .header-inner { padding: 10px 16px; gap: 12px; }
  .logo-mark { width: 38px; height: 38px; font-size: 19px; border-radius: 10px; }
  .app-title { font-size: 17px; }
  .app-subtitle { display: none; }
  .main-grid { padding: 20px 16px; gap: 20px; }
  .panel { padding: 20px 18px; }
  .panel-title { font-size: 17px; gap: 10px; }
  .title-icon { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
  .upload-box { padding: 20px 14px; }
  .result-box { padding: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: 1fr; }
  .page-sheet { max-width: 280px; margin: 10px auto; }
}
