/* ---- 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);
}

.landing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.questa-hero {
  width: 200px; height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 0 32px rgba(255, 209, 102, 0.3));
}

.questa-hero-placeholder {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  font-size: 5rem;
}

.landing-title {
  text-align: center;
  line-height: 1;
}
.title-questa {
  display: block;
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.title-zh {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 6px;
}

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

/* ---- Questa speech bubble (landing) ---- */
.questa-speech {
  position: relative;
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--card2);
  border-radius: 16px;
  padding: 16px 20px;
  text-align: center;
}
.questa-speech::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 12px solid var(--card2);
}
.questa-speech::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--card);
}
.questa-speech p:first-child {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 6px;
}
.questa-speech .speech-sub {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}

.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; }

/* ---- 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-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;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.history-category {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  flex-shrink: 0;
  padding-top: 2px;
}

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

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

/* ---- 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; }
.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; }
}
