/* AI Creator OS v1.2 — style.css */
:root {
  --navy: #1a2744;
  --navy-light: #243058;
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #6b7280;
  --gray-800: #1f2937;
  --white: #ffffff;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  font-size: 15px;
}

.container { max-width: 800px; margin: 0 auto; padding: 0 16px; }

/* Hero */
.hero {
  background: var(--navy);
  color: var(--white);
  padding: 32px 0 28px;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero h1 .version {
  font-size: 16px;
  font-weight: 500;
  opacity: 0.6;
  margin-left: 4px;
}
.hero-sub {
  font-size: 14px;
  opacity: 0.75;
  margin-top: 6px;
}

/* Sections */
section { margin: 20px 0; }

/* Mode Tabs */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mode-tab {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mode-tab .mode-icon { font-size: 20px; }
.mode-tab small { font-weight: 400; font-size: 11px; }
.mode-tab.active {
  border-color: var(--blue);
  color: var(--blue);
  background: #eff6ff;
}
.mode-tab:hover:not(.active) { border-color: var(--gray-400); }

/* Form */
.input-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--gray-800);
}
.required {
  background: #fee2e2;
  color: var(--red);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}
.optional {
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}
textarea, input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  background: var(--white);
  color: var(--gray-800);
}
textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
}
.char-count { text-align: right; font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* Chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--gray-600);
  font-weight: 500;
}
.chip.active { border-color: var(--blue); background: #eff6ff; color: var(--blue); }
.chip:hover:not(.active) { border-color: var(--gray-400); }

/* Hidden mode fields */
.mode-field { display: none; }
.mode-field.visible { display: block; }

/* Submit Button */
.btn-primary {
  width: 100%;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:active { background: #1e40af; }
.btn-primary.compact { padding: 11px 14px; font-size: 14px; margin-top: 0; }

.btn-secondary {
  background: var(--white);
  color: var(--blue);
  border: 1.5px solid var(--blue);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: #eff6ff; }
.btn-secondary.subtle {
  color: var(--gray-600);
  border-color: var(--gray-200);
}
.btn-secondary.subtle:hover { background: var(--gray-100); }

select {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-800);
}
select:focus { outline: none; border-color: var(--blue); }

/* Results */
.results-section { display: none; }
.results-section.visible { display: block; }

/* Total Score Card */
.total-score-card {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-md);
}
.score-ring-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.score-ring { transform: rotate(-90deg); width: 120px; height: 120px; }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.15); stroke-width: 10; }
.ring-fill {
  fill: none;
  stroke: var(--blue-light);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1s ease;
}
.ring-fill.green { stroke: #4ade80; }
.ring-fill.yellow { stroke: #fbbf24; }
.ring-fill.red { stroke: #f87171; }
.score-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.score-number { font-size: 32px; font-weight: 800; }
.score-label { font-size: 12px; opacity: 0.6; }
.score-summary h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.score-summary p { font-size: 13px; opacity: 0.8; }
.mode-badge {
  display: inline-block;
  margin-top: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Engagement / Conversion サブスコア ──────── */
.sub-scores-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 10px;
}
.sub-score-card {
  border-radius: var(--radius);
  padding: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  border-top: 4px solid transparent;
}
.sub-score-card.eng-card { border-top-color: #2563eb; }
.sub-score-card.conv-card { border-top-color: #7c3aed; }
.sub-score-label { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.sub-score-desc  { font-size: 11px; color: var(--gray-600); margin-bottom: 8px; }
.sub-score-num   { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 8px; }
.eng-card .sub-score-num { color: #2563eb; }
.conv-card .sub-score-num { color: #7c3aed; }
.sub-score-bar-bg {
  height: 6px; background: var(--gray-200); border-radius: 3px; margin-bottom: 8px;
}
.sub-score-bar {
  height: 6px; border-radius: 3px; transition: width 1s ease;
}
.eng-bar  { background: #2563eb; }
.conv-bar { background: #7c3aed; }
.sub-score-dims { font-size: 10px; color: var(--gray-400); line-height: 1.5; }

/* E/C 次元タグ */
.dim-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.dim-tag.eng  { background: #dbeafe; color: #1e40af; }
.dim-tag.conv { background: #ede9fe; color: #5b21b6; }
.dim-tag.both { background: #f3f4f6; color: #374151; }

@media (max-width: 520px) {
  .sub-scores-row { grid-template-columns: 1fr; }
}

/* Publish Gate */
.publish-gate {
  margin: 14px 0;
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  background: var(--white);
  border-left: 6px solid var(--gray-400);
}
.publish-gate h2 {
  font-size: 17px;
  margin-bottom: 4px;
}
.publish-gate p {
  font-size: 13px;
  color: var(--gray-600);
}
.publish-gate.good { border-left-color: var(--green); background: #f0fdf4; }
.publish-gate.warn { border-left-color: var(--yellow); background: #fffbeb; }
.publish-gate.fix { border-left-color: #f97316; background: #fff7ed; }
.publish-gate.stop { border-left-color: var(--red); background: #fef2f2; }

/* Scores Grid */
.scores-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.score-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.score-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.score-card-name { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.score-card-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
}
.score-card-num.high { color: var(--green); }
.score-card-num.mid { color: var(--yellow); }
.score-card-num.low { color: var(--red); }
.score-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--blue);
  transition: width 0.8s ease;
}
.score-bar-fill.high { background: var(--green); }
.score-bar-fill.mid { background: var(--yellow); }
.score-bar-fill.low { background: var(--red); }
.score-card-reason { font-size: 11px; color: var(--gray-600); margin-bottom: 6px; }
.score-card-improve {
  font-size: 11px;
  color: var(--blue);
  background: #eff6ff;
  border-radius: 6px;
  padding: 6px 8px;
}

/* Sections shared */
.improvement-section,
.revised-section,
.ab-section,
.kpi-section,
.validation-section,
.export-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 12px 0;
}
.revision-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 12px 0;
}
.improvement-section h2,
.revised-section h2,
.ab-section h2,
.kpi-section h2,
.validation-section h2,
.revision-section h2,
.export-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--navy);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray-100);
}
.section-note {
  font-size: 13px;
  color: var(--gray-600);
  margin: -4px 0 14px;
}
.playbook-alert {
  display: none;
  border: 1.5px solid #fbbf24;
  background: #fffbeb;
  color: #92400e;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.playbook-alert.visible { display: block; }
.revision-form {
  background: var(--gray-100);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.revision-form .form-group { margin-bottom: 12px; }
.revision-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.revision-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.revision-log-card {
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
}
.revision-log-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--gray-600);
  font-size: 11px;
  margin-bottom: 6px;
}
.revision-log-title {
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.revision-log-body {
  color: var(--gray-600);
  line-height: 1.7;
}

/* Improvement items */
.improvement-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.improvement-item:last-child { border-bottom: none; }
.improvement-rank {
  width: 28px;
  height: 28px;
  background: var(--navy);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.improvement-content { flex: 1; }
.improvement-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.improvement-desc { font-size: 13px; color: var(--gray-600); }

/* Revised tabs */
.revised-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.rev-tab {
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--gray-600);
  font-weight: 600;
  transition: all 0.15s;
}
.rev-tab.active { border-color: var(--navy); background: var(--navy); color: var(--white); }
.revised-content {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  min-height: 80px;
}

/* A/B cards */
.ab-cards { display: flex; flex-direction: column; gap: 10px; }
.ab-card {
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px;
}
.ab-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ab-content { font-size: 13px; color: var(--gray-800); white-space: pre-wrap; }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.kpi-item {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}
.kpi-name { font-weight: 600; margin-bottom: 2px; }
.kpi-target { color: var(--gray-600); font-size: 12px; }

/* Validation */
.validation-timeline { display: flex; flex-direction: column; gap: 16px; }
.val-step { display: flex; gap: 14px; }
.val-time {
  width: 60px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
  padding-top: 2px;
}
.val-items { flex: 1; font-size: 13px; color: var(--gray-600); }
.val-items li { margin-bottom: 3px; }

/* CSV */
.csv-data {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  font-family: monospace;
  word-break: break-all;
  margin-bottom: 10px;
  color: var(--gray-600);
  max-height: 80px;
  overflow: hidden;
}

/* Footer */
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 16px 0;
  margin-top: 40px;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 520px) {
  .scores-grid { grid-template-columns: 1fr; }
  .total-score-card { flex-direction: column; text-align: center; }
  .kpi-grid { grid-template-columns: 1fr; }
  .mode-tabs { grid-template-columns: 1fr; }
  .hero h1 { font-size: 22px; }
}
