/* =========================================================
   Manga Creative Studio — スタイル
   色・余白・角丸はすべて :root の変数で管理しています
   ========================================================= */
:root {
  /* ベースカラー */
  --bg: #f5f6fa;
  --surface: #ffffff;
  --text: #1a1d2e;
  --muted: #5b6178;          /* 白背景でコントラスト比 約6:1 */
  --border: #e4e7ef;

  /* エリア別カラー：アシスタント＝ティール、生成＝バイオレット */
  --assistant: #0f766e;      /* 白文字・白背景とも 5:1 以上 */
  --assistant-hover: #0d5f59;
  --assistant-soft: #eefaf8;
  --assistant-line: #b5e6df;
  --generate: #5b3df5;
  --generate-hover: #4a2ee0;
  --generate-soft: #f3f0ff;
  --generate-line: #d4cbff;

  /* 状態カラー */
  --error: #b42318;
  --error-soft: #fef3f2;
  --error-line: #fecdca;

  /* 形・影・余白 */
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(26, 29, 46, 0.04), 0 8px 24px rgba(26, 29, 46, 0.06);
  --space: 8px;

  --font: "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 80px; }   /* 固定ヘッダーの下に隠れないように */

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background:
    radial-gradient(1200px 400px at 10% -10%, #e7f6f3 0%, transparent 60%),
    radial-gradient(1200px 400px at 90% -10%, #eeeaff 0%, transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 calc(var(--space) * 4);
}

/* 線画アイコン共通 */
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== ヘッダー ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--assistant), var(--generate));
}
.logo {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.badge-mock {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
}

/* ===== 2カラムレイアウト ===== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: calc(var(--space) * 4);
  padding-top: calc(var(--space) * 5);
  padding-bottom: calc(var(--space) * 4);
}

/* ===== パネル ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: calc(var(--space) * 4);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.panel-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
}
.panel-icon .icon { width: 24px; height: 24px; }
.panel-assistant .panel-icon { background: var(--assistant-soft); color: var(--assistant); }
.panel-generate  .panel-icon { background: var(--generate-soft);  color: var(--generate); }

.panel-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.panel-assistant .panel-label { color: var(--assistant); }
.panel-generate  .panel-label { color: var(--generate); }

.panel h2 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.4;
}
.panel-desc {
  margin: 0 0 calc(var(--space) * 3);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ===== 入力欄 ===== */
.field { margin-bottom: calc(var(--space) * 3); }
.field-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
  padding: 12px 16px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: #fafbfd;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
textarea { resize: vertical; }
textarea::placeholder { color: #8a90a6; }

/* セレクトの矢印をシンプルな形に */
select {
  appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6178' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}

select:hover,
textarea:hover { border-color: #cfd3e0; }

.panel-assistant select:focus,
.panel-assistant textarea:focus {
  outline: none;
  background-color: #fff;
  border-color: var(--assistant);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}
.panel-generate select:focus,
.panel-generate textarea:focus {
  outline: none;
  background-color: #fff;
  border-color: var(--generate);
  box-shadow: 0 0 0 4px rgba(91, 61, 245, 0.12);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.field-wide { grid-column: 1 / -1; }

/* アップロード欄 */
.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: calc(var(--space) * 4) calc(var(--space) * 2);
  border: 1.5px dashed var(--assistant-line);
  border-radius: var(--radius-md);
  background: var(--assistant-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.upload-box:hover { border-color: var(--assistant); background: #e4f6f2; }
.upload-icon {
  width: 32px;
  height: 32px;
  color: var(--assistant);
  margin-bottom: 4px;
}
.upload-text { font-weight: 700; color: var(--assistant); }
.upload-hint { font-size: 0.85rem; color: var(--muted); }

/* 補足テキスト */
.note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}
.note .icon { width: 16px; height: 16px; margin-top: 3px; }
.note-generate {
  margin: 0 0 calc(var(--space) * 3);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--generate-soft);
  color: var(--generate);
  font-weight: 500;
}

/* ===== ボタン ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: -6px; }

.btn-assistant { background: var(--assistant); box-shadow: 0 4px 14px rgba(15, 118, 110, 0.25); }
.btn-assistant:hover:not(:disabled) { background: var(--assistant-hover); }
.btn-generate  { background: var(--generate);  box-shadow: 0 4px 14px rgba(91, 61, 245, 0.25); }
.btn-generate:hover:not(:disabled)  { background: var(--generate-hover); }

/* ===== アシスタント回答エリア ===== */
.output-box {
  margin-top: calc(var(--space) * 3);
  border: 1px solid var(--assistant-line);
  border-radius: var(--radius-md);
  background: var(--assistant-soft);
  overflow: hidden;
}
.output-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--assistant);
  border-bottom: 1px solid var(--assistant-line);
}
.output-title .icon { width: 18px; height: 18px; }
.output-body { padding: 16px 20px 20px; }
.output-body p { margin: 0 0 8px; }
.output-body ul { margin: 0 0 8px; padding-left: 1.3em; }
.output-body li { margin-bottom: 6px; }
.output-body li::marker { color: var(--assistant); }
.output-heading { font-weight: 700; margin-top: 8px !important; }
.output-body > :first-child { margin-top: 0 !important; }
.loading { color: var(--assistant); font-weight: 700; }
.muted { color: var(--muted); }

/* ===== エラー・案内 ===== */
.error-box,
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.6;
}
.error-box[hidden],
.info-box[hidden] { display: none; }
.error-box::before,
.info-box::before {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: var(--mask) center / contain no-repeat;
          mask: var(--mask) center / contain no-repeat;
}
.error-box {
  background: var(--error-soft);
  border: 1px solid var(--error-line);
  color: var(--error);
  --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
}
.info-box {
  background: var(--generate-soft);
  border: 1px solid var(--generate-line);
  color: #3a2699;
  --mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
}

/* ===== 生成プレビュー ===== */
.preview-head {
  margin: calc(var(--space) * 4) 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* PC：パネル内で2列 */
  gap: 16px;
}
.preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.preview-card:hover { border-color: var(--generate-line); box-shadow: var(--shadow); }
.preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}
.chip {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--generate-soft);
  color: var(--generate);
  white-space: nowrap;
}
.preview-image {
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--generate-line);
  background: linear-gradient(160deg, #faf9ff 0%, var(--generate-soft) 100%);
  text-align: center;
}
.preview-image .icon { width: 32px; height: 32px; color: #9d8cff; }
.preview-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--generate);
}
.preview-image p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ===== フッター ===== */
.app-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 8px 16px 40px;
}

/* ===== タブレット（〜1024px）：エリアを縦並びに ===== */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
    max-width: 760px;
  }
  .field-row { grid-template-columns: repeat(3, 1fr); }
  .field-wide { grid-column: auto; }
  .preview-grid { grid-template-columns: repeat(2, 1fr); }
  .preview-image { aspect-ratio: 4 / 3; }
}

/* ===== スマホ（〜600px） ===== */
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .header-inner { height: 56px; }
  .logo { font-size: 1.05rem; }
  .brand-mark { width: 32px; height: 32px; }
  .main-grid { gap: 20px; padding-top: 20px; }
  .panel { padding: 24px 20px; border-radius: 16px; }
  .panel-head { gap: 12px; }
  .panel-icon { width: 44px; height: 44px; }
  .panel h2 { font-size: 1.2rem; }
  .field-row { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: 1fr; }   /* スマホ：1列 */
}
