/* ===== CSS Variables ===== */
:root {
  --dark: #1C1A1A;
  --red: #AA3228;
  --red-light: #D4453A;
  --red-pale: rgba(170, 50, 40, 0.08);
  --gray: #787878;
  --gray-light: #B0B0B0;
  --bg: #F5F4F2;
  --white: #FFFFFF;
  --card: #F0EEEb;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 2px 16px rgba(28, 26, 26, 0.08);
  --shadow-lg: 0 8px 40px rgba(28, 26, 26, 0.12);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--dark);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--dark);
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.header-inner {
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--red-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
}

.header-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-light);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.06em;
}

/* ===== App Layout ===== */
.app-body {
  display: flex;
  margin-top: 56px;
  min-height: calc(100vh - 56px);
}

/* ===== Input Panel (Left) ===== */
.input-panel {
  width: 380px;
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid var(--border);
}

.panel-inner {
  padding: 28px 24px;
}

.panel-desc {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.7;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
}

.required {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-pale);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(170,50,40,0.08);
}

.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--dark);
  background: var(--white);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
  outline: none;
  line-height: 1.7;
}

.form-textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(170,50,40,0.08);
}

.form-hint {
  font-size: 11px;
  color: var(--gray-light);
  margin-top: 6px;
  line-height: 1.5;
}

/* Radio (対象種別) */
.radio-group {
  display: flex;
  gap: 12px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  flex: 1;
  transition: all 0.2s;
}

.radio-label:has(input:checked) {
  border-color: var(--red);
  background: var(--red-pale);
}

.radio-label input[type="radio"] {
  accent-color: var(--red);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.radio-text {
  font-size: 13px;
  font-weight: 500;
}

/* Scenario Cards */
.scenario-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.scenario-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--white);
  text-align: center;
}

.scenario-card:has(input:checked) {
  border-color: var(--red);
  background: var(--red-pale);
  box-shadow: 0 0 0 3px rgba(170,50,40,0.08);
}

.scenario-card input[type="radio"] {
  display: none;
}

.scenario-icon {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 50%;
  transition: all 0.2s;
}

.scenario-card:has(input:checked) .scenario-icon {
  background: var(--red);
  color: var(--white);
}

.scenario-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.4;
}

/* Generate Button */
.btn-generate {
  width: 100%;
  height: 52px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  transition: background 0.2s, transform 0.1s;
}

.btn-generate:hover { background: var(--red-light); }
.btn-generate:active { transform: scale(0.98); }
.btn-generate:disabled {
  background: var(--gray-light);
  cursor: not-allowed;
  transform: none;
}

.btn-arrow { font-size: 18px; }

/* ===== Result Panel (Right) ===== */
.result-panel {
  flex: 1;
  min-width: 0;
  padding: 40px 48px;
  overflow-y: auto;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  text-align: center;
  gap: 16px;
}

.empty-icon { font-size: 48px; }

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.6;
}

.empty-desc {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.7;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  gap: 16px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
}

.loading-sub {
  font-size: 13px;
  color: var(--gray);
}

/* Error State */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  gap: 12px;
  text-align: center;
}

.error-icon { font-size: 36px; color: var(--red); }
.error-title { font-size: 16px; font-weight: 600; color: var(--dark); }
.error-message { font-size: 13px; color: var(--gray); max-width: 420px; line-height: 1.6; }

.btn-retry {
  margin-top: 8px;
  padding: 10px 24px;
  background: var(--dark);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

/* ===== Result Content ===== */

/* --- カバー --- */
.result-cover {
  background: var(--dark);
  border-radius: 20px;
  padding: 0;
  margin-bottom: 40px;
  overflow: hidden;
  display: flex;
  min-height: 240px;
}

.result-cover-left {
  flex: 1;
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.result-cover-right {
  width: 180px;
  flex-shrink: 0;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.result-cover-to {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.result-cover-scenario {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--white);
  background: var(--red);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.result-cover-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 16px;
}

.result-cover-divider {
  width: 36px;
  height: 3px;
  background: var(--red);
  border-radius: 2px;
  margin-bottom: 14px;
}

.result-cover-tagline {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  line-height: 1.75;
  max-width: 540px;
}

.result-cover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.result-cover-from {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  line-height: 1.6;
}

.export-buttons {
  display: flex;
  gap: 10px;
}

.btn-export {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.btn-pptx {
  background: var(--red);
  color: var(--white);
}

.btn-pptx:hover { background: var(--red-light); }

/* --- セクション共通 --- */
.result-section {
  margin-bottom: 48px;
}

.section-eyebrow {
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.section-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 24px;
  line-height: 1.3;
}

/* --- ストーリーフロー（横4ステップ） --- */
.story-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.story-step {
  padding: 28px 24px;
  border-right: 1px solid var(--border);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story-step:last-child {
  border-right: none;
}

.story-step.step-first {
  background: var(--dark);
}

/* 矢印 */
.story-step:not(:last-child)::after {
  content: '›';
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--gray-light);
  z-index: 1;
  background: var(--white);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.story-step.step-first::after {
  background: var(--dark);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
}

.story-step-num {
  font-size: 36px;
  font-weight: 700;
  color: rgba(0,0,0,0.06);
  line-height: 1;
}

.story-step.step-first .story-step-num {
  color: rgba(255,255,255,0.1);
}

.story-step-phase {
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-step.step-first .story-step-phase {
  color: rgba(255,100,80,0.9);
}

.story-step-message {
  font-size: 13px;
  color: var(--dark);
  line-height: 1.75;
  flex: 1;
}

.story-step.step-first .story-step-message {
  color: rgba(255,255,255,0.85);
}

/* --- エビデンス スライド型カード --- */
.surveys-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.survey-slide {
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

/* スライドトップバー */
.survey-slide-topbar {
  background: var(--dark);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.survey-slide-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--red-light);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.survey-slide-category {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.07);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.06em;
}

/* スライド本体 */
.survey-slide-body {
  padding: 36px 36px 28px;
}

/* 調査名 */
.survey-slide-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  letter-spacing: 0.04em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.survey-slide-name::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--red);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ヘッドライン（大見出し） */
.survey-slide-headline {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.5;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* サポートポイント */
.survey-slide-points {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.survey-slide-point {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--dark);
  line-height: 1.7;
}

.survey-slide-point-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 3px;
}

/* この提案への活用 */
.survey-slide-relevance-wrap {
  background: rgba(170,50,40,0.04);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 20px;
  border-left: 3px solid var(--red);
}

.survey-slide-relevance-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.survey-slide-relevance {
  font-size: 13px;
  color: var(--dark);
  line-height: 1.75;
}

/* スライドフッター */
.survey-slide-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
}

.survey-slide-source-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.survey-slide-source {
  font-size: 11px;
  color: var(--gray-light);
}

.survey-slide-file {
  font-size: 10px;
  color: var(--gray-light);
  font-family: 'Courier New', monospace;
  background: rgba(0,0,0,0.04);
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.survey-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
}

.survey-link:hover { text-decoration: underline; }

/* --- 追加調査 --- */
.additional-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.additional-item {
  background: var(--white);
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.additional-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-pale);
  color: var(--red);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.additional-text {
  font-size: 13px;
  color: var(--dark);
  line-height: 1.7;
}

/* Disclaimer */
.disclaimer {
  font-size: 11px;
  color: var(--gray-light);
  line-height: 1.7;
  padding: 14px 20px;
  background: var(--white);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 8px;
}

/* Utility */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .app-body { flex-direction: column; }

  .input-panel {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .result-panel {
    padding: 28px 20px;
  }

  .result-header { padding: 28px 28px; }
  .result-title { font-size: 24px; }
}
