:root {
  --bg: #1a1f2e;
  --text: #f5f5f5;
  --muted: rgba(255,255,255,0.7);
  --accent: #ffd166;
  --panel: rgba(255,255,255,0.06);
  --panel-border: rgba(255,255,255,0.12);
  --btn-bg: rgba(255,255,255,0.12);
  --btn-bg-hover: rgba(255,255,255,0.22);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: linear-gradient(135deg, #1a1f2e 0%, #2c3e50 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
/* Only `body` is the flex container. Applying `display: flex` to `html` AS WELL
   would make body the sole flex item and the `align-items: center` declaration
   on html would shrink body to its intrinsic content width on phones,
   leaving huge empty margins on both sides of the page. */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}
/* Web only, non-phone: never collapse below settings-page width (560px content + 32px padding).
   Phones (≤480px) drop the min-width so the page fills the viewport instead of horizontally scrolling. */
@media (min-width: 481px) {
  html:not(.native) body { min-width: 592px; }
}
header {
  text-align: center;
  margin-bottom: 24px;
  max-width: 560px;
  width: 100%;
  position: relative;
}
.back-arrow {
  position: absolute;
  top: 0;
  left: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.back-arrow:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.25);
  transform: translateX(-2px);
}
.back-arrow svg { width: 18px; height: 18px; }
@media (max-width: 480px) {
  .back-arrow { width: 34px; height: 34px; }
}
h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 6px;
}
.subtitle {
  color: var(--muted);
  font-size: 13px;
}
.panel {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 18px;
}
.panel-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 600;
}
.option {
  display: flex;
  /* Top-align so the radio/checkbox sits on the title row, not the visual
     center of (title + helper text) where it appears to float below. */
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
  border: 1px solid transparent;
  margin-bottom: 6px;
}
.option:hover { background: rgba(255,255,255,0.05); }
.option input[type="radio"],
.option input[type="checkbox"] {
  margin-right: 14px;
  /* Nudge the 18px control down to the title line's optical center
     (15px font ≈ 21px line box, so center sits ~2px below the top). */
  margin-top: 2px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.option-label {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.option-label .primary-text {
  font-size: 15px;
  font-weight: 500;
}
.option-label .helper-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.preview-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.15s ease;
  margin-left: 8px;
}
.preview-btn:hover { background: rgba(255,255,255,0.18); }
.preview-btn:active { transform: scale(0.96); }
.nav {
  width: 100%;
  max-width: 560px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav a:hover { border-bottom-color: var(--accent); }
.back-arrow-icon { width: 16px; height: 16px; flex-shrink: 0; }
.save-status {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  transition: opacity 0.4s ease;
  opacity: 0;
}
.save-status.visible { opacity: 1; }
