/* ── Story Tool ── */
* { box-sizing: border-box; }

:root {
  --bg: #fff;
  --bg2: #f8f8f8;
  --bg3: #f2f2f2;
  --border: #e0e0e0;
  --border2: #d0d0d0;
  --text: #222;
  --muted: #888;
  --light: #aaa;
  --accent: #333;
  --gold: #c4a832;
  --green: #4a7c4e;
  --red: #c0392b;
  --blue: #2244aa;
  --font: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Courier New', monospace;
}

/* ── Password gate ── */
.st-pw-gate {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 360px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.st-pw-box { text-align: center; padding: 48px 40px; max-width: 360px; width: 100%; }

.st-logo {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.st-pw-sub {
  font-size: 10px;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 28px;
}

.st-pw-form { display: flex; flex-direction: column; gap: 10px; }

.st-pw-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.st-pw-input:focus { border-color: var(--accent); }

.st-notice {
  padding: 14px 18px;
  background: #fffbee;
  border: 1px solid #e8d080;
  border-radius: 4px;
  font-size: 13px;
  color: #666;
  font-family: var(--font);
}

/* ── Main App ── */
.st-app {
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--font);
}

/* ── Progress ── */
.st-progress {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin-bottom: 28px;
  overflow: hidden;
}
.st-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.4s ease;
  width: 20%;
}

/* ── Steps ── */
.st-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
}

.st-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  opacity: 0.35;
  transition: opacity 0.2s;
}

.st-step.active  { opacity: 1; }
.st-step.done    { opacity: 0.7; }

.st-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  transition: all 0.2s;
}

.st-step.active .st-step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.st-step.done .st-step-num {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--muted);
}

.st-step-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

.st-step.active .st-step-label { color: var(--text); font-weight: 600; }

.st-step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 24px;
  max-width: 60px;
  margin-bottom: 18px;
}

/* ── Panels ── */
.st-panel { display: none; }
.st-panel.active { display: block; }

.st-panel-header { margin-bottom: 28px; }

.st-pillar-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--light);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2px 8px;
  margin-bottom: 10px;
}

.st-panel-title {
  font-size: 24px !important;
  font-weight: 300 !important;
  color: var(--text) !important;
  margin: 0 0 10px 0 !important;
  padding: 0 !important;
  border: none !important;
  letter-spacing: -0.01em;
}

.st-panel-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
  max-width: 560px;
}

/* ── Fields ── */
.st-fields { display: flex; flex-direction: column; gap: 18px; margin-bottom: 24px; }

.st-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }

.st-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.st-req { color: var(--gold); }

.st-field input[type="text"],
.st-field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  overflow: auto;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}

.st-field textarea {
  min-height: 60px;
  max-height: 300px;
}

.st-field input:focus,
.st-field textarea:focus {
  border-color: var(--accent);
  background: var(--bg);
}

.st-field input::placeholder,
.st-field textarea::placeholder { color: var(--border2); }

/* ── Conflict grid ── */
.st-conflict-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 16px;
}

.st-conflict-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg2);
}

.st-conflict-card:hover {
  border-color: var(--accent);
  background: var(--bg);
}

.st-conflict-card.selected {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: inset 3px 0 0 var(--accent);
}

.st-conflict-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.st-conflict-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Radio ── */
.st-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* ── AI Box ── */
.st-ai-box {
  background: #fffbee;
  border: 1px solid #e8d890;
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.st-ai-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 8px;
}

.st-ai-text {
  font-size: 13px;
  color: #555;
  line-height: 1.75;
}

/* ── Actions ── */
.st-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Buttons ── */
.st-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  border-radius: 3px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s;
  text-decoration: none;
}

.st-btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.st-btn-primary:hover { background: #444; }
.st-btn-primary:disabled { background: var(--border); color: var(--light); cursor: default; }

.st-btn-secondary { background: var(--bg2); color: var(--gold); border-color: #e0d080; }
.st-btn-secondary:hover { background: #fffbee; }

.st-btn-ghost { background: none; color: var(--muted); border-color: var(--border); }
.st-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Brief ── */
.st-brief-loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 13px;
}

.st-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: stSpin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.st-brief-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 32px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.st-brief-content h2 {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.12em !important;
  color: var(--light) !important;
  margin: 24px 0 8px !important;
  padding: 0 !important;
  border: none !important;
}

.st-brief-content h2:first-child { margin-top: 0 !important; }

.st-brief-content p {
  margin: 0 0 12px;
  color: var(--text);
}

.st-brief-content ul, .st-brief-content ol {
  padding-left: 20px;
  margin: 0 0 12px;
}

.st-brief-content li { margin-bottom: 4px; color: var(--text); }

.st-brief-content strong { font-weight: 600; color: var(--text); }

/* Print */
@media print {
  .st-steps, .st-progress, .st-actions, .st-pw-gate { display: none !important; }
  .st-brief-content { border: none; padding: 0; background: white; }
  .st-app { max-width: 100%; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .st-conflict-grid { grid-template-columns: 1fr; }
  .st-step-line { min-width: 12px; }
  .st-step-label { display: none; }
  .st-brief-content { padding: 20px; }
}

/* ── Brief content visibility fix ── */
#st-brief-content:empty { display: none; }
#st-brief-content:not(:empty) { display: block !important; }
#st-brief-actions.visible { visibility: visible !important; height: auto !important; overflow: visible !important; display: flex !important; }
