:root {
  color-scheme: light;
  --bg: #f6f1ea;
  --panel: #fffaf2;
  --panel-strong: #ffffff;
  --ink: #211a16;
  --muted: #7d7067;
  --line: #eadfce;
  --brand: #e84d2a;
  --brand-dark: #b83218;
  --soft: #fff0e8;
  --green: #1d8a63;
  --shadow: 0 24px 70px rgba(91, 55, 26, 0.14);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.access-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(246, 241, 234, .92);
  backdrop-filter: blur(12px);
}
.access-panel {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.access-panel h2 {
  font-size: 28px;
}
.access-panel p {
  color: var(--muted);
  line-height: 1.6;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: .62;
}
.compose-view.is-locked .settings-block,
.compose-view.is-locked .templates-panel,
.compose-view.is-locked .composer-card {
  border-color: #dccfbd;
}
.shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 36px 0 56px;
}
.hero {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 26px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--brand-dark);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 12px;
}
h1 {
  margin: 0;
  font-size: 56px;
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 780px;
}
.hero-copy {
  margin: 18px 0 0;
  max-width: 690px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}
.credit-card {
  background: linear-gradient(145deg, #2a1811, #6d2819);
  color: white;
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.credit-card span { color: #ffd9c2; font-weight: 700; }
.credit-card strong { font-size: 56px; letter-spacing: 0; }
.credit-card small { color: #ffe9dd; line-height: 1.5; }
.credit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.credit-btn {
  border: 1px solid rgba(255,255,255,.35);
  color: white;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 800;
}
.credit-btn:hover { background: rgba(255,255,255,.2); }
.workspace {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 22px;
}
.templates-panel, .composer-card {
  background: rgba(255, 250, 242, .88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.templates-panel { padding: 18px; }
.composer-card { padding: 24px; }
.section-title { margin-bottom: 16px; }
.section-title span {
  display: block;
  font-weight: 900;
  font-size: 20px;
}
.section-title small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.5;
}
.section-title.horizontal {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.template-list { display: grid; gap: 12px; }
.template-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 16px;
  transition: .18s ease;
}
.template-card:hover, .template-card.active {
  border-color: rgba(232, 77, 42, .65);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(122, 74, 39, .11);
}
.template-card .badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
}
.template-card strong { display: block; font-size: 17px; margin-bottom: 6px; }
.template-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field span { font-weight: 800; font-size: 14px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 8px;
  padding: 13px 14px;
  outline: none;
}
textarea { resize: vertical; min-height: 150px; line-height: 1.65; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(232,77,42,.1); }
.settings-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(255,255,255,.55);
  margin: 12px 0 18px;
}
.settings-block summary { font-weight: 900; color: var(--brand-dark); }
.setting-group {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 14px;
}
.setting-heading span {
  display: block;
  font-size: 15px;
  font-weight: 900;
}
.setting-heading small {
  display: block;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 5px;
}
.preset-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  margin-bottom: 16px;
}
.preset-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--brand-dark);
  background: white;
  font-weight: 900;
}
.preset-chip:hover, .preset-chip.active { border-color: var(--brand); background: var(--soft); }
.hidden-field { display: none; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 18px;
}
.settings-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.settings-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.primary-btn, .ghost-btn {
  border: 0;
  border-radius: 999px;
  font-weight: 900;
}
.primary-btn {
  background: var(--brand);
  color: white;
  padding: 14px 24px;
  box-shadow: 0 16px 30px rgba(232, 77, 42, .28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
}
.primary-btn:hover { background: var(--brand-dark); }
.primary-btn:disabled { opacity: .78; cursor: wait; }
.run-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: white;
  border-radius: 50%;
  display: none;
}
.primary-btn.is-running .run-spinner {
  display: inline-block;
  animation: spin .8s linear infinite;
}
.ghost-btn {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 14px;
}
.action-row { display: flex; align-items: center; gap: 16px; }
.status-text, .inline-message { color: var(--muted); font-size: 14px; }
.generation-status {
  margin-top: 16px;
  border: 1px solid #ead8c8;
  background: #fff8ef;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 12px 26px rgba(91, 55, 26, 0.08);
}
.generation-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.generation-head strong {
  display: block;
  font-size: 15px;
}
.generation-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
}
.loading-orbit {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #f0cdb8;
  display: inline-grid;
  place-items: center;
  background: white;
  position: relative;
}
.loading-orbit::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid #ffe1d1;
  border-top-color: var(--brand);
  animation: spin 1s linear infinite;
}
.loading-orbit i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 1.2s ease-in-out infinite;
}
.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #f2dfcf;
  margin-top: 13px;
}
.progress-track span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e84d2a, #f5a05f);
  animation: progress-slide 1.6s ease-in-out infinite;
}
.generation-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.generation-steps span {
  color: #7a4b24;
  background: white;
  border: 1px solid #f0dfc2;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
  animation: step-pulse 1.8s ease-in-out infinite;
}
.generation-steps span:nth-child(2) { animation-delay: .2s; }
.generation-steps span:nth-child(3) { animation-delay: .4s; }
.compose-view.is-locked .generation-status {
  border-color: rgba(232, 77, 42, .42);
}
.compose-view.is-locked .composer-card {
  box-shadow: 0 24px 70px rgba(91, 55, 26, 0.17);
}
.report-page {
  padding: 0;
}
.hidden { display: none; }
.report-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 18px;
}
h2 { margin: 0; font-size: 32px; letter-spacing: 0; }
.report-meta {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 14px;
}
.source-notice {
  background: #f3fbf6;
  border: 1px solid #ccebdc;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  color: #1f5f49;
}
.source-notice strong {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
}
.source-notice p {
  margin: 0;
  color: #2e6d56;
  line-height: 1.6;
}
.recommendation-section {
  margin: 22px 0;
}
.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.recommendation-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  min-height: 236px;
  box-shadow: 0 16px 34px rgba(91, 55, 26, 0.08);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.recommendation-card:hover {
  transform: translateY(-2px);
  border-color: rgba(232, 77, 42, .42);
  box-shadow: 0 20px 42px rgba(91, 55, 26, 0.13);
}
.card-photo {
  background: #dfe9e3;
  min-height: 236px;
  position: relative;
}
.card-photo img {
  width: 100%;
  height: 100%;
  min-height: 236px;
  object-fit: cover;
  display: block;
}
.card-image-empty {
  height: 100%;
  min-height: 236px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ddebe3, #fff4df);
  color: #537061;
  font-weight: 900;
}
.card-body {
  padding: 16px;
  min-width: 0;
}
.card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.rating-pill, .strength-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}
.rating-pill {
  color: #8f4c00;
  background: #fff3d8;
  font-variant-numeric: tabular-nums;
}
.rating-pill strong { margin-left: 4px; }
.strength-pill {
  color: #155f49;
  background: #e7f6ee;
}
.recommendation-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.card-reason {
  margin: 9px 0 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.5;
}
.card-evidence-note {
  margin: 9px 0 0;
  color: #6b4a2c;
  background: #fff7ea;
  border: 1px solid #f0dfc2;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 0;
}
.tag-row span {
  background: #f4f7fb;
  color: #2c4f68;
  border: 1px solid #dce9f2;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}
.card-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.card-detail-grid div {
  min-width: 0;
  border: 1px solid #eee2d4;
  border-radius: 8px;
  background: #fffaf4;
  padding: 8px;
}
.card-detail-grid dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.card-detail-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.card-intro, .card-caution {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}
.card-caution {
  color: #7a4b24;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.mini-action {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf4;
  color: var(--brand-dark);
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.mini-action:hover, .mini-action.active {
  border-color: var(--brand);
  background: var(--soft);
}
.mini-action:active {
  transform: scale(.97);
}
.mini-action.disabled {
  color: var(--muted);
  background: #f4f1ed;
}
.card-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.detail-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin: 28px 0 12px;
}
.detail-heading h3 {
  margin: 0;
  font-size: 22px;
}
.detail-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.report-output {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 20px;
  line-height: 1.75;
}
.report-output h1, .report-output h2, .report-output h3 { letter-spacing: 0; }
.report-output h1 { font-size: 30px; }
.report-output a { color: var(--brand-dark); font-weight: 800; }
.report-output pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.evidence-wrap { margin-top: 20px; }
.evidence-list { display: grid; gap: 12px; }
.evidence-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.evidence-card a { color: var(--brand-dark); font-weight: 900; text-decoration: none; }
.evidence-meta { color: var(--muted); font-size: 13px; margin-top: 8px; }
.copy-title-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-dark);
  background: #fff8ef;
  font-weight: 900;
  padding: 7px 10px;
  margin-top: 12px;
}
.copy-title-btn:hover { border-color: var(--brand); background: var(--soft); }
.error-box {
  background: #fff0f0;
  border: 1px solid #ffd0d0;
  color: #8d1e1e;
  padding: 14px 16px;
  border-radius: 8px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: .45; transform: scale(.86); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes progress-slide {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(80%); }
  100% { transform: translateX(270%); }
}
@keyframes step-pulse {
  0%, 100% { opacity: .58; transform: translateY(0); }
  45% { opacity: 1; transform: translateY(-1px); }
}
@media (max-width: 860px) {
  .hero, .workspace { grid-template-columns: 1fr; }
  .recommendation-grid { grid-template-columns: 1fr; }
  .recommendation-card { grid-template-columns: 1fr; }
  .card-photo, .card-photo img, .card-image-empty { min-height: 220px; }
  .settings-grid { grid-template-columns: 1fr; }
  .shell { width: min(100vw - 24px, 1180px); padding-top: 22px; }
  h1 { font-size: 38px; }
  .credit-card strong { font-size: 44px; }
  .section-title.horizontal, .result-header, .report-nav, .detail-heading { flex-direction: column; }
  .action-row { align-items: stretch; flex-direction: column; }
  .primary-btn { width: 100%; }
  .generation-head { align-items: flex-start; }
  .report-nav { align-items: stretch; }
}
