/* ===== 基本設定 ===== */
:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #5b6272;
  --border: #e3e5ec;
  --border-strong: #cfd3de;

  /* アシスタント = ティール系 */
  --assist: #0d9488;
  --assist-soft: #e6f6f4;

  /* 漫画生成 = パープル系 */
  --gen: #6d4aff;
  --gen-soft: #efebff;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow-card: 0 1px 2px rgba(20, 24, 40, 0.04), 0 8px 28px rgba(20, 24, 40, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  background:
    radial-gradient(900px 400px at 8% -10%, rgba(13, 148, 136, 0.10), transparent 60%),
    radial-gradient(900px 400px at 92% -10%, rgba(109, 74, 255, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ===== メイン 2カラム ===== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding-top: 40px;
  padding-bottom: 40px;
  align-items: start;
}

/* ===== パネル（カード） ===== */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--accent);
}
.panel-assistant { --accent: var(--assist); --accent-soft: var(--assist-soft); }
.panel-generate  { --accent: var(--gen);    --accent-soft: var(--gen-soft); }

.panel-head { margin-bottom: 32px; }
.step {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
}
.panel h2 { font-size: 1.5rem; line-height: 1.4; margin: 12px 0 8px; }
.panel-desc { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.8; }

/* ===== 入力欄 ===== */
.field { margin-bottom: 24px; flex: 1; min-width: 0; }
.field > label:not(.upload-box) {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.field-row { display: flex; gap: 16px; }

select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* iOSでズームしないよう16px */
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  line-height: 1.6;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select {
  min-height: 48px;
  appearance: none;
  padding-right: 44px;
  cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%235b6272' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 16px center;
}
textarea { resize: vertical; min-height: 120px; }
textarea::placeholder { color: #8a90a0; }
select:hover,
textarea:hover { border-color: var(--accent); }
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* アップロード欄 */
.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 32px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fafbfc;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.upload-box:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { font-size: 2rem; }
.upload-text { font-weight: 700; color: var(--accent); }
.upload-hint { font-size: 0.85rem; color: var(--muted); }

/* ===== ボタン ===== */
.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 75%, #000));
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.15s, filter 0.15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible,
.upload-box:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ===== 出力エリア ===== */
.output { margin-top: 32px; }
.output-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
}
.output-body {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 24px;
}
.output-title { font-weight: 700; margin: 0 0 6px; color: var(--accent); }
.output-body ul { margin: 0; padding-left: 1.2em; }
.output-body li + li { margin-top: 8px; }

/* ===== プレビューカード ===== */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.04);
}
.preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-size: 0.85rem;
}
.preview-meta strong { font-size: 0.9rem; }
.preview-meta span { color: var(--gen); font-weight: 700; }
.preview-image {
  aspect-ratio: 3 / 4;
  margin: 0 12px;
  display: grid;
  gap: 4px;
  padding: 6px;
  background: var(--gen-soft);
  border-radius: 8px;
}
.preview-image div {
  background: #fff;
  border: 1.5px solid #c9bfff;
  border-radius: 3px;
}
.preview-caption { padding: 10px 12px 14px; }
.preview-caption b { display: block; font-size: 0.85rem; }
.preview-caption small { color: var(--muted); font-size: 0.8rem; line-height: 1.6; display: block; }

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

/* ===== タブレット ===== */
@media (max-width: 960px) {
  .main-grid { grid-template-columns: 1fr; gap: 24px; max-width: 760px; }
}

/* ===== スマホ ===== */
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .header-inner { height: 60px; }
  .main-grid { padding-top: 20px; padding-bottom: 24px; gap: 20px; }
  .panel { padding: 28px 20px; border-radius: 16px; }
  .panel h2 { font-size: 1.3rem; }
  .logo h1 { font-size: 1.05rem; }
  .field-row { flex-direction: column; gap: 0; }
  .preview-grid { grid-template-columns: 1fr; }
  .preview-image { aspect-ratio: 4 / 3; }
}

/* ===== API連携で追加 ===== */
.btn:disabled { opacity: 0.7; cursor: wait; transform: none; filter: none; }

.error-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #fdecec;
  color: #b42318;
  border: 1px solid #f5c2c0;
  font-size: 0.95rem;
  line-height: 1.7;
}

.output-text { margin: 0; white-space: pre-wrap; }

.preview-result { display: block; margin: 0 12px; }
.preview-result img {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* 動きを減らす設定の利用者向け */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
