/* ---- Variables ---- */
:root {
  --bg:         #0f1226;
  --bg2:        #161b35;
  --fg:         #f5f3ff;
  --muted:      #9aa0c7;
  --accent:     #ffd166;
  --accent-fg:  #1a1430;
  --card:       #1a1f3d;
  --card2:      #222846;
  --danger:     #ff6b6b;
  --danger-fg:  #fff;
  --success:    #6bcb77;
  --radius:     16px;
  --radius-lg:  24px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure hidden attribute always wins over CSS display rules */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei",
               "Noto Sans TC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: var(--accent); text-decoration: none; }
input { font-family: inherit; }

/* ---- Loading ---- */
#screen-loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--card2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Shared screen wrapper ---- */
#screen-landing,
#screen-onboarding,
#screen-app {
  position: fixed; inset: 0;
  max-width: 390px;
  margin: 0 auto;
}

/* ---- Landing ---- */
#screen-landing {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(env(safe-area-inset-top), 32px) 32px
           max(env(safe-area-inset-bottom), 32px);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Two-layer starfield: ::before = static big stars, ::after = slow-drifting micro stars */
#screen-landing::before,
#screen-landing::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-repeat: repeat;
}

#screen-landing::before {
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 209, 102, 0.55), transparent 60%),
    radial-gradient(1px 1px at 73% 31%, rgba(245, 243, 255, 0.45), transparent 60%),
    radial-gradient(1.2px 1.2px at 38% 62%, rgba(255, 209, 102, 0.35), transparent 60%),
    radial-gradient(1px 1px at 88% 78%, rgba(245, 243, 255, 0.30), transparent 60%),
    radial-gradient(1.3px 1.3px at 22% 84%, rgba(255, 209, 102, 0.40), transparent 60%),
    radial-gradient(1px 1px at 56% 12%, rgba(245, 243, 255, 0.25), transparent 60%);
  background-size: 100% 100%;
  animation: stardrift 22s linear infinite;
  opacity: 0.85;
}

#screen-landing::after {
  background-image:
    radial-gradient(0.8px 0.8px at 18% 38%, rgba(245, 243, 255, 0.55), transparent 60%),
    radial-gradient(0.8px 0.8px at 62% 22%, rgba(245, 243, 255, 0.40), transparent 60%),
    radial-gradient(0.8px 0.8px at 84% 56%, rgba(245, 243, 255, 0.50), transparent 60%),
    radial-gradient(0.8px 0.8px at 30% 72%, rgba(255, 209, 102, 0.45), transparent 60%),
    radial-gradient(0.8px 0.8px at 48% 92%, rgba(245, 243, 255, 0.35), transparent 60%);
  background-size: 100% 100%;
  animation: stardrift 38s linear infinite reverse;
  opacity: 0.6;
}

@keyframes stardrift {
  from { background-position: 0 0; }
  to   { background-position: 0 -200px; }
}

@media (prefers-reduced-motion: reduce) {
  #screen-landing::before,
  #screen-landing::after { animation: none; }
}

.landing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  position: relative;
  z-index: 0;
}

.questa-hero {
  width: 160px; height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 0 32px rgba(255, 209, 102, 0.30))
          drop-shadow(0 4px 18px rgba(0, 0, 0, 0.35));
}

.landing-title {
  text-align: center;
  line-height: 1;
  margin: 0;
}
.title-questa {
  display: block;
  font-family: "Fraunces", "PingFang TC", "Noto Serif TC", serif;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  font-weight: 800;
  font-size: 3.6rem;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.title-zh {
  display: block;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 8px;
  letter-spacing: 0.18em;
  font-feature-settings: "palt" 1;
}
.title-zh:lang(en) {
  font-family: "Fraunces", "PingFang TC", "Noto Serif TC", serif;
  font-variation-settings: "opsz" 60, "SOFT" 50;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  font-feature-settings: normal;
}

.title-rule {
  display: block;
  width: 56px;
  height: 1px;
  background: var(--accent);
  opacity: 0.65;
  margin: -16px 0 0;
}

.tagline {
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.04em;
}

/* ---- Staggered fade-in (CSS-only) ---- */
.landing-inner [data-step] {
  opacity: 0;
  transform: translateY(8px);
  animation: landing-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.landing-inner [data-step="1"] { animation-delay: 0.05s; }
.landing-inner [data-step="2"] { animation-delay: 0.20s; }
.landing-inner [data-step="3"] { animation-delay: 0.35s; }
.landing-inner [data-step="4"] { animation-delay: 0.50s; }
.landing-inner [data-step="5"] { animation-delay: 0.65s; }
.landing-inner [data-step="6"] { animation-delay: 0.80s; }
.landing-inner [data-step="7"] { animation-delay: 0.95s; }
.landing-inner [data-step="8"] { animation-delay: 1.10s; }

@keyframes landing-rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .landing-inner [data-step] {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px 24px;
  background: var(--fg);
  color: #1a1a1a;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius);
}
.btn-google:active { transform: scale(0.98); }

.google-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---- Onboarding ---- */
#screen-onboarding {
  display: flex;
  flex-direction: column;
  padding-top: max(env(safe-area-inset-top), 16px);
  padding-bottom: max(env(safe-area-inset-bottom), 24px);
  overflow-y: auto;
}

.onboard-header {
  display: flex;
  align-items: center;
  padding: 8px 16px 16px;
  gap: 12px;
}

.btn-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:active { background: var(--card); }

.progress-bar-track {
  flex: 1;
  height: 4px;
  background: var(--card2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.onboard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 28px 0;
  gap: 16px;
  flex: 1;
}

.onboard-questa {
  width: 100px; height: 100px;
  object-fit: contain;
}

.onboard-step h2 {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

.onboard-hint {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: -8px;
}

/* ---- Form inputs ---- */
.text-input {
  width: 100%;
  padding: 16px 18px;
  background: var(--card);
  color: var(--fg);
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}
.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: var(--muted); }
.text-input--center { text-align: center; }

.field-error {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-top: -8px;
}

/* ---- Radio group ---- */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.radio-option:has(input:checked) { background: var(--card2); outline: 2px solid var(--accent); }
.radio-option:has(input:focus-visible) { outline: 2px solid var(--accent); }
.radio-option input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.radio-option span { font-size: 1rem; font-weight: 500; }

/* ---- Topic grid ---- */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.topic-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  border: 2px solid transparent;
  user-select: none;
}
.topic-chip.selected {
  background: var(--card2);
  border-color: var(--accent);
}
.topic-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.topic-chip input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.btn-toggle-all {
  align-self: flex-end;
  margin: 0 0 8px auto;
  padding: 6px 12px;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
}
.btn-toggle-all:active { opacity: 0.7; }
.topic-chip .chip-emoji { font-size: 1.6rem; }
.topic-chip .chip-label { font-size: 0.85rem; font-weight: 500; text-align: center; }

/* ---- Language picker (onboard step 0) ---- */
.onboard-language {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}
.lang-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 16px;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  min-height: 80px;
}
.lang-pill:active { transform: scale(0.98); }
.lang-pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-pill-native {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.02em;
}
.lang-pill-sub {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

/* ---- Landing language chip (top-right) ---- */
.lang-chip {
  position: absolute;
  top: max(env(safe-area-inset-top), 16px);
  right: 20px;
  z-index: 2;
  min-width: 44px;
  min-height: 36px;
  padding: 6px 14px;
  background: var(--card);
  color: var(--fg);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid var(--card2);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.lang-chip:active { transform: scale(0.95); background: var(--card2); }

/* ---- Buttons ---- */
.btn-primary {
  padding: 18px 24px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius);
  text-align: center;
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  padding: 16px 24px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1.5px solid var(--muted);
}
.btn-secondary:active { opacity: 0.7; }

.btn-destructive {
  padding: 16px 24px;
  background: transparent;
  color: var(--danger);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1.5px solid var(--danger);
}
.btn-destructive:active { opacity: 0.7; }

.btn-full { width: 100%; }
.btn-sm { padding: 10px 18px; font-size: 0.9rem; }

/* ---- Main app shell ---- */
#screen-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.tab-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- Tab bar ---- */
#tab-bar {
  display: flex;
  flex-shrink: 0;
  background: var(--bg2);
  border-top: 1px solid var(--card2);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px;
  min-height: 56px;
  color: var(--muted);
  transition: color 0.15s;
}
.tab-btn.active { color: var(--accent); }
.tab-btn:active { opacity: 0.7; }

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-icon svg { width: 22px; height: 22px; }
.tab-label { font-size: 0.7rem; font-weight: 500; letter-spacing: 0.03em; }

/* ---- Question tab ---- */
#tab-question {
  padding: 0;
  gap: 0;
}

.questa-area {
  height: 35dvh;
  min-height: 190px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  padding-top: max(env(safe-area-inset-top), 16px);
}

#questa-img {
  height: 100%;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.35));
}

.question-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  margin-top: -40px;
  padding: 20px 24px 16px;
  position: relative;
  z-index: 1;
}

.category-label {
  display: inline-flex;
  align-items: center;
  align-self: center;
  padding: 5px 14px;
  background: rgba(255, 209, 102, 0.12);
  border: 1.5px solid rgba(255, 209, 102, 0.35);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
  min-height: 28px;
  transition: opacity 0.2s;
}
.category-label:empty {
  background: transparent;
  border-color: transparent;
}

.question-card {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius-lg);
  border-top: 3px solid var(--accent);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
}
.question-card #question-text {
  margin: 0;
}

#question-text {
  font-size: clamp(1.3rem, 4.5vw, 1.9rem);
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
  color: var(--fg);
}

.question-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  flex-shrink: 0;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: left;
}

.feedback-row {
  display: flex;
  gap: 12px;
}

.feedback-btn {
  width: 72px; height: 72px;
  font-size: 1.8rem;
  background: var(--card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.feedback-btn:active { transform: scale(0.9); background: var(--card2); }
.feedback-btn.selected { background: var(--card2); outline: 2px solid var(--accent); }

.link-destructive {
  display: block;
  text-align: center;
  color: var(--danger);
  font-size: 0.9rem;
  padding: 8px;
  cursor: pointer;
}

/* ---- History tab ---- */
.screen-header {
  padding: max(env(safe-area-inset-top), 20px) 24px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--card2);
}
.screen-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.scrollable-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px max(env(safe-area-inset-bottom), 16px);
  -webkit-overflow-scrolling: touch;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 40px 0;
  font-size: 0.95rem;
}

.history-filter-row {
  display: flex;
  gap: 8px;
  padding: 10px 24px 0;
  flex-shrink: 0;
}

.history-filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  transition: color 0.15s, background 0.15s;
}

.history-filter-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
}

.history-group { margin-bottom: 24px; }

.history-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-category {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.history-question {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--fg);
}

.history-feedback {
  font-size: 1rem;
}

/* ---- Profile tab ---- */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.save-msg {
  text-align: center;
  color: var(--success);
  font-size: 0.9rem;
  padding: 8px 0;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--card2);
}

/* ---- Support tab ---- */
.support-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.questa-support {
  width: 120px; height: 120px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--card);
  margin-top: 16px;
}

.support-content h3 { font-size: 1.2rem; font-weight: 700; }
.support-content p { color: var(--muted); font-size: 0.95rem; line-height: 1.6; }

.support-badge {
  padding: 12px 20px;
  background: var(--card);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---- More tab ---- */
.more-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 8px;
}
.more-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.more-section h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--card);
  border: none;
  border-radius: var(--radius);
  color: inherit;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  min-height: 48px;
}
.link-row::after {
  content: '›';
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
}
.link-row:active { opacity: 0.7; }
.link-row-danger { color: var(--danger); }
.more-blurb {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ---- Acceptance checkbox ---- */
.accept-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 2px;
  font-size: 0.9rem;
  line-height: 1.5;
  cursor: pointer;
}
.accept-row input[type="checkbox"] {
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}
.inline-link {
  color: var(--accent);
  text-decoration: underline;
}

/* ---- Document viewer modal ---- */
.doc-modal {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.doc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card2);
  flex-shrink: 0;
}
.doc-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.btn-doc-close {
  width: 40px; height: 40px;
  background: transparent;
  color: var(--fg);
  font-size: 1.8rem;
  line-height: 1;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.btn-doc-close:active { background: var(--card); }
.doc-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 32px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--fg);
  -webkit-overflow-scrolling: touch;
}
.doc-modal-body h1 { font-size: 1.4rem; margin: 16px 0 12px; }
.doc-modal-body h2 { font-size: 1.15rem; margin: 20px 0 10px; }
.doc-modal-body h3 { font-size: 1.02rem; margin: 16px 0 8px; }
.doc-modal-body p { margin: 0 0 12px; color: var(--muted); }
.doc-modal-body ul, .doc-modal-body ol { margin: 0 0 12px 20px; color: var(--muted); }
.doc-modal-body li { margin-bottom: 6px; }
.doc-modal-body a { color: var(--accent); text-decoration: underline; }
.doc-modal-body strong { color: var(--fg); }
.doc-modal-body hr { border: none; border-top: 1px solid var(--card2); margin: 20px 0; }
.doc-modal-body table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 0.85rem; }
.doc-modal-body th, .doc-modal-body td { border: 1px solid var(--card2); padding: 6px 8px; text-align: left; }
.doc-modal-body code { background: var(--card); padding: 2px 5px; border-radius: 4px; font-size: 0.85rem; }

/* ---- About view ---- */
.doc-modal-body--about { padding: 0 0 32px; }
.doc-modal-body--about p,
.doc-modal-body--about li,
.doc-modal-body--about ul { color: inherit; }

.about-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 24px 24px;
  background: linear-gradient(180deg, var(--card2) 0%, transparent 100%);
  text-align: center;
}
.about-hero img {
  width: 120px; height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.25));
}
.about-hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0 0;
}
.about-tagline {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

.about-block {
  padding: 20px 24px;
}
.about-block h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.about-block p {
  margin: 0 0 10px;
  line-height: 1.7;
  font-size: 0.95rem;
}
.about-block blockquote {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--card);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
}

.about-block--with-figure {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.about-block--with-figure .about-figure {
  flex-shrink: 0;
  width: 110px; height: 110px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--card);
  padding: 8px;
}
.about-block--with-figure .about-text {
  flex: 1;
  min-width: 0;
}
.about-block--reverse {
  flex-direction: row-reverse;
}

.about-meta {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}
.about-meta li {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.about-meta li span {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 48px;
}
.about-meta a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.about-social {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 24px 8px;
}
.about-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  transition: transform 0.15s;
}
.about-social-btn:active { transform: scale(0.95); }
.about-social-btn svg {
  width: 30px; height: 30px;
  display: block;
}
.about-social-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.about-copyright {
  margin: 16px 24px 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---- Cookie banner ---- */
#cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 390px;
  margin: 0 auto;
  background: var(--card2);
  border-top: 1px solid var(--card);
  padding: 14px 20px max(env(safe-area-inset-bottom), 14px);
  z-index: 50;
}

#cookie-banner p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.cookie-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ---- Landscape overlay ---- */
#landscape-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 200;
  text-align: center;
  padding: 32px;
}

#landscape-overlay img {
  width: 100px; height: 100px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--card);
}

#landscape-overlay p { font-size: 1.1rem; font-weight: 600; }
.muted-text { color: var(--muted) !important; font-size: 0.9rem !important; font-weight: 400 !important; }

/* Only show on narrow screens (phones) rotated to landscape — not on desktop */
@media (orientation: landscape) and (max-height: 500px) {
  #landscape-overlay { display: flex; }
}

/* ---- Delete modal ---- */
#delete-modal {
  position: fixed; inset: 0;
  display: flex;
  align-items: flex-end;
  z-index: 100;
  padding: 0;
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  background: var(--bg2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px max(env(safe-area-inset-bottom), 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-box h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-box p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ---- Toast ---- */
#toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--card2);
  color: var(--fg);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 99;
  white-space: nowrap;
  pointer-events: none;
  animation: fade-in-up 0.2s ease;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Error text ---- */
.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
}

/* ---- Desktop enhancements ---- */
@media (min-width: 500px) {
  body {
    background:
      radial-gradient(ellipse 600px 400px at 20% 25%, rgba(255, 209, 102, 0.04), transparent),
      radial-gradient(ellipse 600px 400px at 80% 75%, rgba(154, 160, 199, 0.04), transparent),
      var(--bg);
  }

  /* Frame the app column with subtle borders + soft glow */
  #screen-landing,
  #screen-onboarding,
  #screen-app {
    border-left: 1px solid var(--card2);
    border-right: 1px solid var(--card2);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.45);
  }

  /* Match cookie banner + modal box to the column edges */
  #cookie-banner,
  .modal-box {
    border-left: 1px solid var(--card2);
    border-right: 1px solid var(--card2);
  }

  /* Cap Questa image area on tall desktop screens */
  .questa-area { max-height: 240px; }

  /* Cursor affordance on interactive elements */
  button, .topic-chip, .radio-option, .tab-btn { cursor: pointer; }
}

/* ---- New version banner ---- */
.update-banner {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: update-slide-up 0.3s ease;
}
.update-banner-text { flex: 1; font-size: 0.95rem; font-weight: 600; }
.update-banner-btn {
  background: #fff;
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.update-banner-dismiss {
  background: transparent;
  color: var(--accent-fg);
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.7;
}
@keyframes update-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Landing sample questions ---- */
.landing-inner { gap: 20px; }

.landing-samples {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.landing-samples-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 2px;
  align-self: flex-start;
}
.landing-sample-card {
  width: 100%;
  background: var(--card);
  border-left: 2px solid rgba(255, 209, 102, 0.45);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: left;
}

/* ---- Feedback tip ---- */
.feedback-tip {
  background: rgba(255, 209, 102, 0.07);
  border: 1px solid rgba(255, 209, 102, 0.18);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.feedback-tip-dismiss {
  flex-shrink: 0;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(154, 160, 199, 0.4);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.feedback-tip-dismiss:active { opacity: 0.6; }

/* ---- Toast interactive variant (for undo) ---- */
#toast.toast--interactive {
  pointer-events: auto;
  white-space: normal;
  max-width: min(300px, calc(100% - 48px));
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-undo-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.toast-undo-btn:active { opacity: 0.8; }

/* ---- In-app install nudge ---- */
.install-nudge {
  background: var(--card);
  border: 1.5px solid rgba(255, 209, 102, 0.25);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--fg);
  line-height: 1.4;
}
.install-nudge-text { flex: 1; color: var(--muted); }
.install-nudge-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.install-nudge-btn:active { opacity: 0.85; }
.install-nudge-dismiss {
  flex-shrink: 0;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  font-family: inherit;
}
.install-nudge-dismiss:active { opacity: 0.6; }
