:root {
  --blue: #4C5696;
  --coral: #D33969;
  --coral-dark: #b32f5c;
  --ink: #26252D;
  --ink-2: #3a3845;
  --ink-3: #4a4856;
  --offwhite: #F2F7FB;
  --yellow: #F9C44D;
  --radius: 18px;
  --pad: 16px;
  --tap: 52px;
  --maxw: 680px;
}

* { box-sizing: border-box; }

/* Snappier taps across iOS/Android: no 300ms delay, no grey flash */
button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Edge padding: hugs the screen on phones, centres a column on tablets/large
   screens, and clears notches/rounded corners in any orientation. */
.app-header,
.app-footer,
.screen {
  padding-left: max(calc(var(--pad) + env(safe-area-inset-left)), calc((100% - var(--maxw)) / 2));
  padding-right: max(calc(var(--pad) + env(safe-area-inset-right)), calc((100% - var(--maxw)) / 2));
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--offwhite);
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 2px 10px rgba(0,0,0,0.28);
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: calc(14px + env(safe-area-inset-top));
}

.app-logo {
  height: 54px;
  width: auto;
  display: block;
}

/* Pushes the settings cog to the far right now the lockup carries the name. */
.app-spacer { flex: 1; }

/* Keep the app name in the DOM for screen readers / the a11y tree, but hidden
   visually because the lockup image already shows it. */
.app-title-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Thin co-brand divider between the iPhotography logo and the app name. */
.app-divider {
  flex: none;
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.18);
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  flex: 1;
  letter-spacing: 0.2px;
  color: var(--offwhite);
}

.icon-btn {
  background: transparent;
  color: var(--offwhite);
  border: none;
  font-size: 22px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  padding: 0;
}

.chat {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen {
  flex: 1;
  /* Always allow vertical scroll so nothing is ever clipped on short or
     landscape screens; it only actually scrolls when content overflows. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 26px;
  padding-bottom: 36px;
  animation: screenIn 220ms ease-out both;
}

/* Never let flexbox squash a child to fit the viewport. Children with
   overflow:hidden (the cards) get an automatic min-height of 0 in a flex
   column, so without this they shrink and clip their content instead of
   letting .screen scroll. Keep natural heights; let the screen scroll. */
.screen > * {
  flex-shrink: 0;
}

.context-pill {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}

.question {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin: 4px 0 4px;
  color: var(--offwhite);
}

.subtitle {
  font-size: 15px;
  line-height: 1.4;
  color: rgba(255,255,255,0.7);
  margin: -8px 0 4px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  background: var(--ink);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
}

/* Small iPhotography credit, centred in the footer on every screen. */
.footer-credit {
  height: 14px;
  width: auto;
  opacity: 0.5;
  align-self: center;
  flex: none;
  pointer-events: none;
}

.ghost-btn {
  background: transparent;
  color: var(--offwhite);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  min-height: 40px;
  cursor: pointer;
}

.ghost-btn[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

.options.grid {
  display: grid;
  /* 2 columns on phones, 3 on wider phones/tablets — fills the centred column. */
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 460px) {
  .options.grid { grid-template-columns: repeat(3, 1fr); }
}

.option-btn {
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: var(--tap);
  padding: 14px 20px;
  cursor: pointer;
  text-align: left;
  transition: transform 100ms ease, background 100ms ease;
}

.option-btn:active {
  transform: scale(0.97);
  background: var(--coral-dark);
}

.option-btn.secondary {
  background: var(--ink-2);
  border: 1px solid rgba(255,255,255,0.12);
}

.option-btn.secondary:active {
  background: var(--ink-3);
}

/* Distinct action colour (e.g. "Back to shooting") — clearly a step, and
   different from the coral add buttons so it doesn't read as one of them. */
.option-btn.go {
  background: var(--blue);
}

.option-btn.go:active {
  background: #3b4479;
}

/* Button with a circled arrow on the right (e.g. "Let's go →") to pull the eye
   to the action. */
.option-btn.has-arrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.option-btn .opt-arrow {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  color: var(--coral);
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-btn.has-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px 8px 14px;
  min-height: 96px;
  gap: 6px;
  line-height: 1.15;
}

.option-btn .opt-icon {
  font-size: 30px;
  line-height: 1;
}

.option-btn .opt-label {
  font-size: 14px;
  font-weight: 600;
}

.card {
  align-self: stretch;
  background: var(--ink-2);
  border-radius: 14px;
  padding: 20px 20px 22px;
  position: relative;
  overflow: hidden;
}

.card.tips {
  background: var(--blue);
}

.card h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.steps-card {
  border-left: 6px solid var(--coral);
  padding-left: 16px;
}

.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.steps-list .step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  padding: 16px 0;
  align-items: start;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.steps-list .step:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.steps-list .step:first-child {
  padding-top: 4px;
}

.step-num {
  width: 30px;
  height: 30px;
  background: var(--coral);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0;
}

.step-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--offwhite);
}

.step-text strong {
  color: var(--yellow);
  font-weight: 700;
}

.summary-card {
  border-left: 6px solid var(--yellow);
  padding-left: 16px;
}

.setting-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
  align-items: baseline;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row .label {
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.3px;
}

.setting-row .value {
  font-weight: 500;
  color: var(--offwhite);
}

.meter-ic {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
  margin-right: 6px;
  color: var(--yellow);
}

.card-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.3px;
}
.card-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(249,196,77,0.10);
  border-left: 3px solid #f9c44d;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.72);
}

/* Optional search on the first (subject) screen — a shortcut above the tap grid */
.subject-search-wrap { margin: 4px 0 12px; }
.subject-search {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 16px; /* 16px stops iOS zooming in on focus */
  color: #f4f7fb;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 13px 18px;
  -webkit-appearance: none;
  appearance: none;
}
.subject-search::placeholder { color: rgba(244,247,251,0.5); }
.subject-search:focus {
  outline: none;
  border-color: #d33969;
  box-shadow: 0 0 0 3px rgba(211,57,105,0.28);
}
.search-hint {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(244,247,251,0.62);
  margin: -4px 0 12px;
  padding: 0 6px;
}

/* Alert lines on a result (turn off IS, motion-blur note, ND filter, etc.) */
.alerts-card {
  background: rgba(249,196,77,0.10);
  border: 1px solid rgba(249,196,77,0.35);
  border-radius: 14px;
  padding: 12px 14px;
}
.alert-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.45;
  color: #f4f7fb;
}
.alert-line + .alert-line { margin-top: 8px; }
.alert-ic { flex: 0 0 auto; color: #f9c44d; }
.alert-tx { color: rgba(244,247,251,0.9); }

/* "Step by step" how-to list for the technique branches */
.howto-list { margin: 10px 0 0; padding-left: 26px; }
.howto-list li {
  margin: 0 0 12px 0;
  padding-left: 4px;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(244,247,251,0.9);
}
.howto-list li::marker { color: #d33969; font-weight: 700; }

/* PLUS+ promo strip on the results screen — gentle, non-blocking, clearly a
   link rather than the primary coral action. */
.plus-strip {
  display: block;
  text-decoration: none;
  background: rgba(76, 86, 150, 0.16);
  border: 1px solid rgba(76, 86, 150, 0.55);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--offwhite);
}

.plus-strip:active {
  background: rgba(76, 86, 150, 0.28);
}

.plus-eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 6px;
}

.plus-body {
  display: block;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255,255,255,0.9);
}

.plus-cta {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--yellow);
}

.tips-list {
  margin: 0;
  padding-left: 22px;
  font-size: 15px;
  line-height: 1.55;
}

.tips-list li {
  padding: 7px 0;
}

.lens-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.lens-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink-2);
  border-radius: 12px;
  padding: 12px 8px 12px 16px;
  min-height: 52px;
}

.lens-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lens-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--offwhite);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lens-ap {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

.lens-del {
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: none;
  font-size: 18px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}

.lens-del:active {
  background: rgba(211,57,105,0.2);
  color: var(--coral);
}

.lens-empty {
  background: var(--ink-2);
  border-radius: 12px;
  padding: 18px;
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  text-align: center;
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.input-row input[type="text"] {
  background: var(--ink-2);
  color: var(--offwhite);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  padding: 14px 16px;
  min-height: var(--tap);
}

.input-row input[type="text"]:focus {
  outline: none;
  border-color: var(--coral);
}

.link-btn {
  background: transparent;
  color: var(--yellow);
  border: none;
  font: inherit;
  text-decoration: underline;
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
  align-self: flex-start;
}

@keyframes screenIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---------- Tablets & large phones: scale type up for the 45–75 audience ---------- */
@media (min-width: 600px) {
  .app-logo { height: 62px; }
  .app-divider { height: 26px; }
  .app-title { font-size: 21px; }
  .question { font-size: 28px; }
  .subtitle { font-size: 16px; }
  .option-btn { font-size: 17px; min-height: 56px; }
  .option-btn.has-icon { min-height: 108px; }
  .option-btn .opt-icon { font-size: 34px; }
  .option-btn .opt-label { font-size: 15px; }
  .step-text,
  .tips-list { font-size: 16px; }
  .setting-row { font-size: 15px; }
}

/* ---------- Short / landscape screens: stop the subject grid overflowing ---------- */
@media (max-height: 560px) {
  .screen { padding-top: 16px; padding-bottom: 20px; gap: 14px; }
  .question { font-size: 20px; }
  .option-btn.has-icon { min-height: 76px; padding-top: 12px; }
  .option-btn .opt-icon { font-size: 26px; }
}

/* ---------- Pointer devices (tablets with a mouse/trackpad, desktop) ---------- */
@media (hover: hover) {
  .option-btn:hover { background: var(--coral-dark); }
  .option-btn.secondary:hover { background: var(--ink-3); }
  .option-btn.go:hover { background: #3b4479; }
  .ghost-btn:hover { border-color: rgba(255,255,255,0.4); }
  .plus-strip:hover { background: rgba(76, 86, 150, 0.28); }
  .icon-btn:hover { opacity: 0.8; }
  .link-btn:hover { opacity: 0.8; }
}

/* ---------- Keyboard accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* ---------- Respect reduced-motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .option-btn { transition: none; }
}
