:root {
  --bg: #f4f1ea;
  --ink: #1c241f;
  --muted: #5c6b62;
  --card: #fffcf6;
  --line: #d5c8b8;
  --accent: #2c4a3e;
  --accent-2: #c4a35a;
  --danger: #8b2e2e;
  --ok: #2f6b4f;
  --shadow: 0 10px 30px rgba(28, 36, 31, 0.08);
  --radius: 18px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(196, 163, 90, 0.18), transparent 30%),
    linear-gradient(180deg, #ebe4d6 0%, var(--bg) 42%, #e7efe9 100%);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
}

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top {
  padding: 6px 4px 0;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-pop {
  font-size: 2.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.brand-sub {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
}
.byline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

#screen {
  flex: 1;
  background: var(--card);
  border: 1px solid rgba(44, 74, 62, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px 18px;
}

h1 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  line-height: 1.22;
  color: var(--accent);
}
h2.list-label {
  margin: 6px 0 8px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.lead {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 1.06rem;
}
.lead.tight { margin-bottom: 8px; }

.hero {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.hero-face,
.plan-face {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 3px solid #e8d7a8;
  box-shadow: 0 4px 14px rgba(44, 74, 62, 0.15);
  background: #ddd;
  flex-shrink: 0;
}
/* Field test: Pathfinder logo larger; clip cut edges via inner zoom */
.hero-face-wrap {
  width: 152px;
  height: 152px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  transform: translateY(-10%);
  /* soft edge only — no hard ring that shows crop cut lines */
  border: none;
  box-shadow: 0 4px 16px rgba(44, 74, 62, 0.18);
  background: #1a2e26;
}
.hero-face-wrap .hero-face {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  /* +20% zoom past previous; scale past side cut-off of photo */
  transform: scale(1.28);
  object-fit: cover;
  object-position: center 16%;
}
.plan-face {
  width: 56px;
  height: 56px;
  border-width: 2px;
}
.plan-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}
.hero-kicker {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-2);
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
button.choice,
button.primary,
button.ghost {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 15px 16px;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
  transition: transform 0.08s ease, opacity 0.15s ease;
  line-height: 1.3;
}
button.choice:active,
button.primary:active,
button.ghost:active { transform: scale(0.98); }

button.choice {
  background: #eef3ef;
  color: var(--ink);
  border: 1px solid #d7e2da;
}
button.choice.selected {
  background: #dceadf;
  border-color: var(--accent);
}
button.choice.danger {
  background: #f7e8e8;
  border-color: #e2bcbc;
  color: var(--danger);
}
button.primary {
  background: var(--accent);
  color: #fff;
  text-align: center;
  width: 100%;
  margin-top: 4px;
}
button.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.ghost {
  background: transparent;
  color: var(--accent);
  text-align: center;
  width: 100%;
  border: 1px dashed #b7c7bd;
}
button.ghost.subtle {
  border: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.98rem;
  padding-top: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.chips.tight { margin-bottom: 0; }
.chip {
  border-radius: 999px;
  padding: 11px 14px;
  background: #eef3ef;
  border: 1px solid #d7e2da;
  font-weight: 650;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  color: var(--ink);
}
.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.res-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}
.res-block {
  padding: 10px 12px;
  background: #f7faf7;
  border-radius: 12px;
  border: 1px solid #e2ebe5;
}
.res-title {
  font-weight: 750;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.plan-list {
  margin: 0 0 14px;
  padding-left: 1.25rem;
  line-height: 1.45;
  font-size: 1.06rem;
}
.plan-list li {
  margin: 0 0 11px;
  padding-left: 4px;
}
.plan-list.also {
  list-style: disc;
  color: var(--muted);
  font-size: 1.02rem;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.tag {
  font-size: 0.9rem;
  background: #f0e6cf;
  color: #5a4a22;
  border-radius: 999px;
  padding: 7px 11px;
  font-weight: 650;
}
.note {
  background: #f7f1e4;
  border-left: 4px solid var(--accent-2);
  padding: 13px 14px;
  border-radius: 10px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.45;
  font-size: 1.02rem;
}

/* Field test: top info bubble — blue instead of gold */
.note.note-blue {
  background: #e8f1f8;
  border-color: #9bb8d0;
}

.danger-box {
  background: #f8ecec;
  border: 1px solid #e2bcbc;
  color: var(--danger);
  border-radius: 14px;
  padding: 16px;
  line-height: 1.45;
  margin-bottom: 14px;
  font-weight: 650;
  font-size: 1.08rem;
}
.actions-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.progress-wrap { margin-top: 18px; margin-bottom: 4px; }
.progress {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.bar {
  height: 6px;
  background: #e2ebe5;
  border-radius: 999px;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #3d6b58);
  border-radius: 999px;
}
.foot {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
  line-height: 1.4;
  padding: 0 8px;
}
.note.saved {
  border-left-color: var(--accent);
  background: #eef5f0;
}
.ver {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: #8a968e;
}

@media print {
  .plan-list { font-size: 12.5pt; }
  .plan-head { break-inside: avoid; }
  body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  body { background: #fff; font-size: 12pt; }
  .top, .foot, .actions-row, .progress-wrap, .note { display: none !important; }
  #app { max-width: none; padding: 0; }
  #screen { box-shadow: none; border: 0; padding: 0; }
  .plan-face { width: 48px; height: 48px; }
}

.field-label {
  display: block;
  margin: 14px 0 6px;
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}
.note-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1.05rem;
  background: #fff;
  color: var(--ink);
  resize: vertical;
  min-height: 64px;
}
.note-field:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.plan-note { margin-top: 10px; }

.filter-line {
  border-left: 4px solid var(--accent-2);
  background: rgba(196, 163, 90, 0.14);
  font-weight: 600;
}

.branch-block {
  margin: 12px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #faf7f1;
}
.branch-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 1rem;
}
.detail-step {
  margin: 0 0 16px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffcf6;
}
.detail-step-title {
  font-weight: 750;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1.3;
  margin-bottom: 8px;
}
.detail-bullets {
  margin: 0;
  padding-left: 1.15rem;
}
.detail-bullets li {
  margin: 0 0 8px;
  line-height: 1.4;
  font-size: 1.02rem;
}
.detail-bullets li:last-child { margin-bottom: 0; }
.branch-lines {
  margin: 0;
}
.meta-line {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 2px 0;
}
.meta-line.soft { opacity: 0.9; }
.choice .hint {
  display: block;
  margin-top: 4px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}
.choice.selected .hint { color: inherit; opacity: 0.85; }

.danger-inline {
  border-left: 4px solid var(--danger);
  background: rgba(139, 46, 46, 0.08);
  font-weight: 600;
  margin-top: 12px;
}

.choice-hint {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}

.choice.selected .choice-hint {
  color: inherit;
  opacity: 0.85;
}

@media print {
  .filter-line, .danger-inline, .plan-note, .meta {
    display: block !important;
  }
}

/* Language picker (dropdown) */
.lang-bar {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(44, 74, 62, 0.12);
  background: #eef5f8;
}
.lang-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.lang-select {
  width: 100%;
  appearance: auto;
  -webkit-appearance: menulist;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 2px solid rgba(44, 74, 62, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
}
.lang-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lang-hint {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Arabic / RTL */
body.rtl #app,
html[dir="rtl"] #app {
  direction: rtl;
}
body.rtl .hero,
html[dir="rtl"] .hero {
  flex-direction: row-reverse;
}
body.rtl .plan-head,
html[dir="rtl"] .plan-head {
  flex-direction: row-reverse;
}
body.rtl .brand,
html[dir="rtl"] .brand {
  flex-direction: row-reverse;
}
body.rtl .detail-bullets,
html[dir="rtl"] .detail-bullets {
  padding-right: 1.2em;
  padding-left: 0;
}

.lang-bar-compact {
  padding: 8px 10px;
  margin-bottom: 10px;
}
.lang-bar-compact .lang-label {
  margin-bottom: 4px;
  font-size: 0.75rem;
}
.lang-bar-compact .lang-select {
  min-height: 42px;
  padding: 8px 12px;
  font-size: 0.98rem;
}
