/* Layout: one column, phone first; the field view is a stack of setting groups. */
html { background: var(--ground); overflow-x: hidden; width: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 24px; -webkit-text-size-adjust: 100%; overflow-x: hidden; width: 100%; }
* { box-sizing: border-box; }
button { font: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding-inline: var(--space-4); padding-block: 0 var(--space-8); width: 100%; box-sizing: border-box; }

/* Header */
.top { position: sticky; top: 0; padding-top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--ground); border-bottom: 1px solid var(--line); width: 100%; overflow: hidden; }
.top-inner { max-width: 560px; margin: 0 auto; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 48px; width: 100%; box-sizing: border-box; }
.brand { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand svg { width: 22px; height: 22px; flex: none; }
.brand-mark-frame { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: square; }
.brand-mark-dot { fill: var(--accent); }
.brand b { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.top-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; }
.seg button { min-width: 30px; height: 30px; min-height: 30px; padding: 0 4px; border: 0; background: transparent; color: var(--ink-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; cursor: pointer; display: grid; place-items: center; box-sizing: border-box; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.seg button:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.seg svg { width: 15px; height: 15px; }

/* Setup */
.setup { display: flex; flex-direction: column; gap: var(--space-4); padding-block: var(--space-4); }
.fa-pick button small { display: block; font-size: 12px; line-height: 14px; color: var(--ink-muted); font-weight: 400; }
.fa-pick button[aria-pressed="true"] small { color: var(--accent); }
.sit-list { display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.sit-cat { font-size: 13px; line-height: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); padding: var(--space-3) var(--space-4) var(--space-1); background: var(--surface); }
.sit { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--touch-min); padding: var(--space-2) var(--space-4); border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.sit-cat + .sit { border-top: 0; }
.sit span { flex: 1; min-width: 0; }
.sit[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.sit:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.draft { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pending); border: 1px solid currentColor; border-radius: var(--radius-sm); padding: 1px 6px; flex: none; }

/* Field view */
.field { display: flex; flex-direction: column; gap: var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--line); }
.field-head h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 32px; line-height: 36px; letter-spacing: -.01em; text-wrap: balance; }
.field-head p { margin: var(--space-2) 0 0; color: var(--ink-muted); }
.field-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.field-meta span { background: var(--surface-raised); color: var(--ink); padding: 2px var(--space-2); border-radius: var(--radius-sm); }
.group h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 28px; }
.group-rows { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.group-rows .fa-setting:last-child { border-bottom: 0; }
.fa-setting { cursor: pointer; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; color: inherit; font: inherit; }
.fa-setting:focus-visible { outline: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.fa-setting-terms { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.fa-setting-terms .fa-badge { margin-top: var(--space-1); font-size: 11px; line-height: 14px; padding: 2px 6px; }
.fa-setting-concept { overflow-wrap: anywhere; }
.fa-setting .fa-path { grid-column: 1 / -1; margin-top: var(--space-2); }
.fa-setting-value { text-align: right; max-width: 12em; overflow-wrap: anywhere; }
.fa-setting-value.is-text { font-size: 16px; line-height: 22px; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-1); }

.expo { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.expo th, .expo td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: top; }
.expo tr:last-child td { border-bottom: 0; }
.expo th { font-size: 13px; line-height: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.expo td.v { font-weight: 700; font-size: 18px; white-space: nowrap; }
.expo td small { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); font-weight: 400; white-space: normal; }

.sun-tracker { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 14px; margin-bottom: var(--space-3); font-size: 13px; line-height: 18px; }
.sun-tracker-phase { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
.sun-tracker-times { color: var(--ink-muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.expo tr.live-active-expo { background: rgba(229, 169, 59, 0.12); box-shadow: inset 4px 0 0 var(--accent); }
.expo tr.live-active-expo td.v { color: var(--accent); }
.live-badge { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: var(--accent); color: #0e1418; padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.live-pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; box-shadow: 0 0 10px var(--accent); animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0% { transform: scale(0.9); opacity: 0.6; } 50% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(0.9); opacity: 0.6; } }
.tips { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.tips li { padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.tc { display: flex; flex-direction: column; gap: var(--space-2); }
.tc div { display: grid; grid-template-columns: 4.5em 1fr; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.tc b { font-family: var(--font-menu); }
.foot { margin-top: var(--space-8); font-size: 13px; line-height: 18px; color: var(--ink-muted); display: flex; flex-direction: column; gap: var(--space-1); }
.empty { padding: var(--space-6) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); }
@media (prefers-reduced-motion: no-preference) { .fa-setting, .sit, .seg button { transition: background-color 120ms; } }

/* Native selects for camera and lens (long lists) */
.fa-select-wrap { position: relative; display: block; }
.fa-select-wrap::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--ink-muted); border-bottom: 2px solid var(--ink-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.fa-select { width: 100%; min-height: var(--touch-min); padding: 0 44px 0 var(--space-4); font: inherit; font-weight: 700; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); appearance: none; -webkit-appearance: none; cursor: pointer; }
.fa-select:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.fa-select optgroup, .fa-select option { color: var(--ink); background: var(--surface); }
.fa-notice-pending { border-color: var(--pending); }
.fa-notice-pending svg { color: var(--pending); }

/* Pro Button in Top Bar */
.pro-btn {
  background: linear-gradient(135deg, rgba(229, 169, 59, 0.18), rgba(229, 169, 59, 0.32));
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  height: 30px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: all 120ms ease;
}
.pro-btn:hover {
  background: var(--accent);
  color: #0e1418;
}
.pro-btn.is-active {
  background: rgba(45, 212, 191, 0.15);
  border-color: rgba(45, 212, 191, 0.5);
  color: #2dd4bf;
}

/* Night Mode Red-Light Overrides (Preserve Night Vision) */
html[data-mode="night"] .pro-btn {
  background: rgba(196, 42, 18, 0.15);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
html[data-mode="night"] .pro-btn:hover {
  background: var(--line-strong);
  color: #000000;
}
html[data-mode="night"] .pro-btn.is-active {
  background: rgba(196, 42, 18, 0.22);
  border-color: var(--ink);
  color: var(--ink);
}
html[data-mode="night"] .fa-modal-card {
  background: #0d0000;
  border-color: #c42a12;
  color: #ff5a45;
  box-shadow: 0 20px 40px rgba(0,0,0,0.9);
}
html[data-mode="night"] .fa-pro-badge-header {
  color: #ff7a63;
  background: rgba(196, 42, 18, 0.2);
  border-color: #c42a12;
}
html[data-mode="night"] .fa-pro-perks li span {
  color: #ff7a63;
}
html[data-mode="night"] .fa-btn-buy {
  background: #c42a12;
  color: #000000;
  box-shadow: 0 4px 14px rgba(196, 42, 18, 0.4);
}
html[data-mode="night"] .fa-btn-restore {
  border-color: #3a0a05;
  color: #e0412e;
}
html[data-mode="night"] .fa-pro-active-box {
  background: rgba(196, 42, 18, 0.15);
  border-color: #c42a12;
  color: #ff7a63;
}

/* Modal Backdrop & Card */
.fa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 10, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: faFadeIn 150ms ease-out;
}
@keyframes faFadeIn { from { opacity: 0; } to { opacity: 1; } }

.fa-modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  max-width: 440px;
  width: 100%;
  padding: 24px 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  color: var(--ink);
  animation: faSlideUp 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes faSlideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.fa-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.fa-modal-close:hover { color: var(--ink); }

.fa-pro-badge-header {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--accent);
  background: rgba(229, 169, 59, 0.12);
  border: 1px solid var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.fa-modal-card h3 {
  margin: 4px 0 6px 0;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
}
.fa-pro-tagline {
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
  margin-bottom: 16px;
}
.fa-pro-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 18px;
}
.fa-pro-perks li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.fa-pro-perks li span {
  color: var(--accent);
  font-weight: 800;
  flex: none;
}
.fa-btn-buy {
  width: 100%;
  background: var(--accent);
  color: #0e1418;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(229, 169, 59, 0.35);
  transition: all 120ms ease;
  margin-bottom: 8px;
}
.fa-btn-buy:active { transform: scale(0.98); }
.fa-btn-restore {
  width: 100%;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.fa-btn-restore:hover { color: var(--ink); border-color: var(--line-strong); }
.fa-pro-active-box {
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  color: #2dd4bf;
  font-size: 13px;
  text-align: center;
}
.fa-modal-legal {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
}
.fa-modal-legal a {
  color: var(--ink-muted);
  text-decoration: underline;
}

/* Web Demo Locked Card */
.web-demo-locked-card {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-raised) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  margin-top: var(--space-4);
  text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,0.4);
}
.web-demo-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(229, 169, 59, 0.12);
  border: 1px solid var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.web-demo-locked-card h3 {
  margin: 0 0 8px 0;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
}
.web-demo-locked-card p {
  margin: 0 0 18px 0;
  font-size: 13px;
  line-height: 19px;
  color: var(--ink-muted);
  max-width: 440px;
  margin-inline: auto;
}
.web-demo-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.web-demo-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0e1418;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(229, 169, 59, 0.35);
  transition: transform 120ms ease;
}
.web-demo-cta-btn:hover { transform: translateY(-1px); }
