:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #5a6972;
  --line: #d9e0e4;
  --accent: #146c78;
  --accent-strong: #0e535d;
  --accent-soft: #e3f2f4;
  --warning: #805400;
  --warning-bg: #fff7dc;
  --shadow: 0 16px 50px rgba(24, 42, 51, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Hiragino Sans", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { width: 100%; min-height: 100vh; padding: 24px; }
.workspace { display: grid; grid-template-columns: minmax(380px, 500px) minmax(0, 1fr); gap: 20px; max-width: 1480px; margin: 0 auto; }
.input-panel, .result-panel { min-height: calc(100vh - 48px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.input-panel { padding: 24px; overflow: auto; }
.result-panel { display: flex; flex-direction: column; min-width: 0; }

.brand { margin-bottom: 18px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 28px; line-height: 1.25; }
h2 { margin-bottom: 6px; font-size: 20px; line-height: 1.35; }
h3 { margin-bottom: 10px; font-size: 17px; }
.brand p, .empty-state p, .recommendation p, .recommendation li, .helper-copy p { color: var(--muted); line-height: 1.75; }

.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 5px;
  margin: 0 0 20px;
  list-style: none;
  background: #eef3f5;
  border-radius: 8px;
}

.flow-step {
  min-height: 36px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.flow-step strong { font-size: 13px; line-height: 1.2; }
.flow-step small {
  width: 100%;
  color: #71808a;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-step.active {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: 0 4px 14px rgba(20, 108, 120, 0.15);
}

.flow-step.active small { color: var(--accent-strong); }

form, .step-panel { display: grid; gap: 16px; }
.field-group { display: grid; gap: 7px; }
label { font-weight: 700; color: #263740; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--text); background: #fbfcfd; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #9aa8ae; opacity: 1; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.choice-list { display: grid; gap: 10px; }
.choice-list.compact { gap: 8px; }
.choice-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--text);
  text-align: left;
}

.choice-card:hover { border-color: #b9c7cd; background: #ffffff; }
.choice-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px rgba(20, 108, 120, 0.12); }
.choice-card strong { font-size: 15px; line-height: 1.45; }
.choice-card span, .choice-card small { color: var(--muted); line-height: 1.6; }
.choice-badge { display: inline-block; margin-left: 6px; min-height: 22px; padding: 1px 7px; border-radius: 999px; background: #fff7dc; color: #805400; font-size: 12px; font-style: normal; font-weight: 800; vertical-align: 1px; }
.choice-card.checkbox { grid-template-columns: auto 1fr; align-items: start; cursor: pointer; }
.choice-card.checkbox input { width: 18px; height: 18px; margin: 3px 2px 0 0; accent-color: var(--accent); }
.choice-card.checkbox span { display: grid; gap: 4px; }

.choice-example {
  margin-top: 2px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--accent-soft);
  color: #20313a;
  font-size: 13px;
  line-height: 1.6;
}
.choice-example em {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.plan-example {
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--accent-soft);
}

.metric-note { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.judgment-metrics { display: grid; gap: 10px; }
.judgment-metric { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.judgment-metric strong { display: block; margin-bottom: 6px; font-size: 14px; }
.judgment-metric p { margin: 4px 0; line-height: 1.6; }
.metric-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef3f5;
  color: #5b6b71;
  font-size: 12px;
  font-weight: 800;
}
.metric-tag.main { background: var(--accent-soft); color: var(--accent-strong); }
.section-label { margin: 4px 0 -4px; font-size: 14px; color: #30444d; }
.feedback-panel {
  padding: 12px 14px;
  border: 1px solid #f0d27a;
  border-radius: 8px;
  background: var(--warning-bg);
}
.feedback-panel h3 { margin-bottom: 6px; color: var(--warning); font-size: 15px; }
.feedback-panel ul { margin: 0; padding-left: 1.2rem; color: #5f4a13; line-height: 1.65; }
.ai-assist-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}
.ai-assist-panel summary { cursor: pointer; font-weight: 800; color: #30444d; }
.ai-assist-panel .field-group { margin-top: 10px; }
.ai-assist-panel p { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.ai-assist-panel .ai-status {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
  color: var(--muted);
  font-weight: 800;
}
.ai-assist-panel .ai-status.ready {
  border-color: #9ccfb4;
  background: #edf8f1;
  color: #246541;
}
.ai-assist-panel .ai-status.unavailable {
  border-color: #f0d27a;
  background: var(--warning-bg);
  color: var(--warning);
}
.checkbox-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-weight: 700; }
.checkbox-row input { width: auto; margin-top: 3px; }

.actions, .export-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.primary-action, .secondary-action, .export-actions button { min-height: 42px; border-radius: 8px; border: 1px solid var(--line); padding: 0 14px; font-weight: 800; }
.primary-action { flex: 1; border-color: var(--accent); background: var(--accent); color: white; }
.secondary-action, .export-actions button { background: var(--panel); color: var(--accent-strong); }
.export-actions button.primary-export { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.inline-action { justify-self: start; min-height: 38px; }
.step-actions select { width: auto; min-width: 170px; min-height: 42px; }
.step-actions select:disabled { cursor: not-allowed; opacity: 0.48; background: #eef3f5; color: #71808a; }
.step-actions { padding-top: 2px; }

.result-toolbar { display: flex; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.empty-state { max-width: 760px; margin: auto; padding: 32px; text-align: center; }
.recommendation { padding: 24px; overflow: auto; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.full-width { grid-column: 1 / -1; }
.block { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #ffffff; }
.block h3 { color: #20313a; }
.warning { border-color: #f0d27a; background: var(--warning-bg); }
.warning h3 { color: var(--warning); }
.recommendation ul, .recommendation ol { padding-left: 1.25rem; margin: 8px 0 0; }

.design-list, .metric-list { display: grid; gap: 12px; margin-top: 12px; }
.metric-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.analysis-steps { display: grid; gap: 12px; margin-top: 12px; }
.metric-role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.role-guidance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plan-summary h4, .metric-role h4, .analysis-step h4 { margin: 0 0 8px; font-size: 15px; color: #20313a; }
.design-option, .metric-option, .metric-role, .analysis-step {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.design-option h5, .metric-option h5 { margin: 0 0 6px; font-size: 15px; color: #20313a; }
.design-option p, .metric-option p { margin: 0; }
.design-option p + p, .metric-option p + p { margin-top: 8px; }
.analysis-step p { margin: 0; }

@media (max-width: 980px) {
  .app-shell { padding: 12px; }
  .workspace { grid-template-columns: 1fr; }
  .input-panel, .result-panel { min-height: auto; }
}

@media (max-width: 640px) {
  .two-column, .section-grid, .metric-list, .metric-role-grid, .role-guidance-grid, .analysis-steps { grid-template-columns: 1fr; }
  .result-toolbar { flex-direction: column; }
  .flow-steps { grid-template-columns: repeat(2, 1fr); }
}
