:root {
  /* ---- カラー：ベース / 文字 / ボーダー ---- */
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #1b1f2a;
  --text-soft: #545c6e;
  --text-muted: #8a92a3;
  --border: #e8eaf3;
  --border-strong: #d9dcea;

  /* ---- アクセント（役割で色分け）：アシスタント=青 / 生成=紫 ---- */
  --assistant: #3b6cff;
  --assistant-strong: #2a56e0;
  --assistant-soft: #eef3ff;
  --assistant-ring: rgba(59, 108, 255, 0.18);
  --generate: #8b3dff;
  --generate-strong: #7628e6;
  --generate-soft: #f4ecff;
  --generate-ring: rgba(139, 61, 255, 0.18);

  /* ---- 角丸 ---- */
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  /* ---- 影（やわらかく重ねる） ---- */
  --shadow-sm: 0 1px 2px rgba(28, 32, 50, 0.06);
  --shadow: 0 10px 30px rgba(28, 32, 50, 0.07);
  --shadow-lg: 0 18px 44px rgba(28, 32, 50, 0.1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", "Noto Sans JP", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  /* 上部にごく淡いグラデーションで奥行きを出す */
  background-image:
    radial-gradient(1200px 480px at 12% -8%, #eaf1ff 0%, rgba(234, 241, 255, 0) 60%),
    radial-gradient(1100px 460px at 100% -6%, #f4ecff 0%, rgba(244, 236, 255, 0) 60%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- ヘッダー ---------- */
.app-header {
  background: linear-gradient(120deg, #3b6cff 0%, #6a4bff 52%, #8b3dff 100%);
  color: #fff;
  padding: 22px 24px;
  box-shadow: 0 8px 30px rgba(74, 74, 200, 0.22);
}
.app-header__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-header__logo {
  font-size: 26px;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  flex: none;
}
.app-header__title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.app-header__subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
}

/* ---------- レイアウト（PC:2カラム / スマホ:縦） ---------- */
.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* ---------- パネル（カード） ---------- */
.panel {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px;
  overflow: hidden;
}
/* カード上部に役割カラーの帯 */
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
}
.panel--assistant::before { background: linear-gradient(90deg, var(--assistant), #6a8bff); }
.panel--generate::before { background: linear-gradient(90deg, var(--generate), #b06bff); }

.panel__badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.panel--assistant .panel__badge { background: var(--assistant-soft); color: var(--assistant-strong); }
.panel--generate .panel__badge { background: var(--generate-soft); color: var(--generate-strong); }

.panel__title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.panel__desc {
  margin: 0 0 26px;
  color: var(--text-soft);
  font-size: 14px;
}

/* ---------- フォーム ---------- */
.field { margin-bottom: 22px; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 9px;
  color: var(--text);
}
.input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text);
  background: #fbfcff;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input::placeholder { color: var(--text-muted); }
.input:hover { border-color: #c6cadd; }
.input:focus {
  outline: none;
  background: #fff;
  border-color: var(--assistant);
  box-shadow: 0 0 0 4px var(--assistant-ring);
}
/* 生成パネル内はアクセントを紫に */
.panel--generate .input:focus {
  border-color: var(--generate);
  box-shadow: 0 0 0 4px var(--generate-ring);
}
/* セレクトに控えめな矢印 */
select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238a92a3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 40px;
  cursor: pointer;
}
.input--textarea {
  min-height: 116px;
  resize: vertical;
}

/* ---------- アップロード欄 ---------- */
.upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 32px 18px;
  border: 2px dashed #cdd2e6;
  border-radius: var(--radius);
  background: #fafbff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload:hover { border-color: var(--assistant); background: var(--assistant-soft); }
.upload__icon {
  font-size: 26px;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--assistant-soft);
  border-radius: 50%;
}
.upload__text { font-size: 14px; font-weight: 600; color: var(--text); }
.upload__hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.upload__input { display: none; }

/* ---------- ボタン ---------- */
.btn {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: var(--radius);
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  margin-top: 6px;
  transition: transform 0.08s ease, box-shadow 0.18s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(59, 108, 255, 0.4); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn--assistant {
  background: linear-gradient(120deg, var(--assistant), var(--assistant-strong));
  box-shadow: 0 10px 22px rgba(59, 108, 255, 0.28);
}
.btn--generate {
  background: linear-gradient(120deg, var(--generate), var(--generate-strong));
  box-shadow: 0 10px 22px rgba(139, 61, 255, 0.28);
}

/* ---------- 出力結果（アシスタント） ---------- */
.result {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.result__label {
  background: var(--assistant-soft);
  color: var(--assistant-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 11px 18px;
}
.result__body {
  padding: 18px;
  font-size: 14.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* ---------- プレビュー（生成） ---------- */
.preview { margin-top: 24px; }
.preview__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--generate-strong);
  margin-bottom: 14px;
}
.preview__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.preview-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 15px;
  background: var(--generate-soft);
}
.preview-card__page { font-weight: 700; font-size: 14px; color: var(--generate-strong); }
.preview-card__tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  background: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}
.preview-card__canvas {
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 18px;
  background:
    repeating-linear-gradient(45deg, #fafbff 0 14px, #f1f2f9 14px 28px);
  color: var(--text-soft);
}
.preview-card__canvas-title { font-size: 14px; font-weight: 700; }
.preview-card__canvas-note { font-size: 12px; color: var(--text-muted); }

/* ---------- お知らせ / エラー ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: 13.5px;
  line-height: 1.7;
  margin: 16px 0;
}
.alert--info {
  background: #fff7e9;
  border: 1px solid #ffe2ad;
  color: #8a5a00;
}
.alert--error {
  background: #fdecec;
  border: 1px solid #f4b4b4;
  color: #b42318;
  font-weight: 600;
}

/* ---------- フッター ---------- */
.app-footer {
  text-align: center;
  padding: 28px 24px 36px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- レスポンシブ ---------- */
/* タブレット：2カラムを1カラムに（読みやすい幅に寄せる） */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    max-width: 640px;
    padding: 32px 22px 40px;
  }
}
/* スマホ：横並び要素を縦に、余白と文字を最適化 */
@media (max-width: 560px) {
  body { font-size: 15px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .preview__grid { grid-template-columns: 1fr; }
  .app-header { padding: 18px 18px; }
  .app-header__title { font-size: 19px; }
  .app-header__subtitle { font-size: 12px; }
  .layout { padding: 24px 16px 32px; gap: 22px; }
  .panel { padding: 22px 18px; border-radius: var(--radius); }
  .panel__title { font-size: 20px; }
}
