/* ============================================================
   COLOR THEMES — 5 themes: Indigo, Aurora, Slate, Amber, Pueblo
   ============================================================ */

/* --- INDIGO (default) --- */
:root, [data-color-theme="indigo"] {
  --accent: #7F77DD;
  --accent-dark: #534AB7;
  --accent-light: #CECBF6;
  --accent-2: #AFA9EC;
  --accent-2-light: #EEEDFE;
  --accent-2-dark: #8A82D0;
  --bg: #F5F4FE;
  --surface: #FDFCFF;
  --surface-2: #EEEDFE;
  --border: #CECBF6;
  --border-strong: #AFA9EC;
  --text: #1A1540;
  --text-2: #3C3489;
  --text-muted: #7F77DD;
  --btn-secondary-bg: #AFA9EC;
  --btn-secondary-text: #1A1540;
  --shadow: 0 2px 12px rgba(26,21,64,0.1);
  /* ... other vars ... */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  /* ... */
}

/* --- AURORA --- */
[data-color-theme="aurora"] {
  --accent: #2D9E6B;
  --accent-dark: #1A7A50;
  --accent-light: #A8E6C8;
  --accent-2: #4AB89A;
  --accent-2-light: #D8F0E6;
  --accent-2-dark: #1A8A58;
  --bg: #F0F8F5;
  --surface: #F8FCFA;
  --surface-2: #E0F0EA;
  --border: #C0D8D0;
  --border-strong: #8AB8A8;
  --text: #0A1A14;
  --text-2: #1A3A2E;
  --text-muted: #5A7A6E;
  --btn-secondary-bg: #4AB89A;
  --btn-secondary-text: #0A1A14;
  --shadow: 0 2px 12px rgba(10,37,32,0.08);
}

/* --- SLATE --- */
[data-color-theme="graphite"] {
  --accent: #5B6B8A;
  --accent-dark: #3A4A68;
  --accent-light: #B8C4D8;
  --accent-2: #7A8EB0;
  --accent-2-light: #D0D8EC;
  --accent-2-dark: #4A5A7A;
  --bg: #F2F3F7;
  --surface: #F9FAFC;
  --surface-2: #E4E8F0;
  --border: #C8D0E0;
  --border-strong: #A0AEBF;
  --text: #1A1E2E;
  --text-2: #2A3448;
  --text-muted: #5B6B8A;
  --btn-secondary-bg: #7A8EB0;
  --btn-secondary-text: #1A1E2E;
  --shadow: 0 2px 12px rgba(26,30,46,0.1);
}

/* --- AMBER --- */
[data-color-theme="plum"] {
  --accent: #C8882A;
  --accent-dark: #A06818;
  --accent-light: #EDD090;
  --accent-2: #D9A050;
  --accent-2-light: #F5E4C0;
  --accent-2-dark: #B07830;
  --bg: #FAF6EE;
  --surface: #FEFCF8;
  --surface-2: #F5EDD8;
  --border: #E6D5B0;
  --border-strong: #CEB888;
  --text: #1E1508;
  --text-2: #3A2A10;
  --text-muted: #907040;
  --btn-secondary-bg: #D9A050;
  --btn-secondary-text: #1E1508;
  --shadow: 0 2px 12px rgba(30,21,8,0.1);
}

/* --- PUEBLO --- */
[data-color-theme="terracotta"] {
  --accent: #9E5538;
  --accent-dark: #7A3A22;
  --accent-light: #D8A080;
  --accent-2: #BC7858;
  --accent-2-light: #EDD0B8;
  --accent-2-dark: #7A4A30;
  --bg: #F5EDE0;
  --surface: #FBF6EE;
  --surface-2: #FBF6EE;
  --border: #4A7A84;
  --border-strong: #3A6070;
  --text: #1A0E08;
  --text-2: #3A2010;
  --text-muted: #4A7A84;
  --btn-secondary-bg: #EDE0CC;
  --btn-secondary-text: #3A2010;
  --shadow: 0 2px 12px rgba(26,14,8,0.1);
}

/* ============================================================
   DARK MODE — applies to any color theme
   ============================================================ */
[data-dark-mode="true"] {
  --bg: #0E0A08;
  --surface: #1A1210;
  --surface-2: #261A14;
  --border: #3A2820;
  --border-strong: #5A3C2A;
  --text: #F5EAE0;
  --text-2: #C8A080;
  --text-muted: #886650;
  --btn-secondary-bg: #3A2A00;
  --btn-secondary-text: #E8C56A;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* Dark mode overrides for specific themes */
[data-color-theme="indigo"][data-dark-mode="true"] {
  --bg: #08040F;
  --surface: #0E0820;
  --surface-2: #14102A;
  --border: #1A1540;
  --border-strong: #2A205A;
  --text: #EEEDFE;
  --text-2: #AFA9EC;
  --text-muted: #7F77DD;
  --btn-secondary-bg: #14102A;
  --btn-secondary-text: #AFA9EC;
}

[data-color-theme="aurora"][data-dark-mode="true"] {
  --bg: #060C0A;
  --surface: #0A1410;
  --surface-2: #101A15;
  --border: #1A2A20;
  --border-strong: #2A3A30;
  --text: #E8F5EE;
  --text-2: #9FD1BE;
  --text-muted: #6A9A85;
  --btn-secondary-bg: #101A15;
  --btn-secondary-text: #9FD1BE;
}

[data-color-theme="graphite"][data-dark-mode="true"] {
  --bg: #0A0C12;
  --surface: #121620;
  --surface-2: #1A1E2A;
  --border: #262C3C;
  --border-strong: #3A4255;
  --text: #E8EAF5;
  --text-2: #A8B4CC;
  --text-muted: #7A8EB0;
  --btn-secondary-bg: #1A1E2A;
  --btn-secondary-text: #A8B4CC;
}

[data-color-theme="plum"][data-dark-mode="true"] {
  --bg: #100C04;
  --surface: #1C1608;
  --surface-2: #261E0C;
  --border: #3A2E14;
  --border-strong: #504020;
  --text: #FAF0DC;
  --text-2: #D4A860;
  --text-muted: #A07840;
  --btn-secondary-bg: #261E0C;
  --btn-secondary-text: #D4A860;
}

[data-color-theme="terracotta"][data-dark-mode="true"] {
  --bg: #0C0804;
  --surface: #160E08;
  --surface-2: #1E140C;
  --border: #2A6068;
  --border-strong: #3A7880;
  --text: #F5E8DC;
  --text-2: #D4A888;
  --text-muted: #5A9098;
  --btn-secondary-bg: #1E140C;
  --btn-secondary-text: #D4A888;
}

/* ============================================================
   FONTS
   ============================================================ */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

[data-font="jakarta"] body,
[data-font="jakarta"] .screen,
[data-font="jakarta"] button,
[data-font="jakarta"] input,
[data-font="jakarta"] select {
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

[data-font="inter"] body,
[data-font="inter"] .screen,
[data-font="inter"] button,
[data-font="inter"] input,
[data-font="inter"] select {
  font-family: 'Inter', sans-serif !important;
}

[data-font="fraunces"] body,
[data-font="fraunces"] .screen,
[data-font="fraunces"] button,
[data-font="fraunces"] input,
[data-font="fraunces"] select {
  font-family: 'Fraunces', serif !important;
}

[data-font="bree"] body,
[data-font="bree"] .screen,
[data-font="bree"] button,
[data-font="bree"] input,
[data-font="bree"] select {
  font-family: 'Bree Serif', serif !important;
}

[data-font="germania"] body,
[data-font="germania"] .screen,
[data-font="germania"] button,
[data-font="germania"] input,
[data-font="germania"] select {
  font-family: 'Germania One', cursive !important;
}

[data-font="play"] body,
[data-font="play"] .screen,
[data-font="play"] button,
[data-font="play"] input,
[data-font="play"] select {
  font-family: 'Play', sans-serif !important;
}

[data-font="system"] body,
[data-font="system"] .screen,
[data-font="system"] button,
[data-font="system"] input,
[data-font="system"] select {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  padding: 0 0 40px;
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  padding: 24px 20px 40px;
  animation: fadeIn 0.18s ease;
}
.screen.active { display: flex; }

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

/* ============================================================
   SHARED COMPONENTS
   ============================================================ */

.nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  min-height: 36px;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 0;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--text-2); }
.btn-back svg { flex-shrink: 0; }

.step-dots {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background 0.2s, transform 0.2s;
}
.step-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}
.step-dot.done { background: var(--accent-light); }

.screen-heading {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.25;
}
.screen-subheading {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 20px 18px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--surface);
  text-align: left;
  transition: opacity 0.15s, transform 0.12s;
  box-shadow: var(--shadow);
}
.action-btn:active { transform: scale(0.98); opacity: 0.92; }

.action-btn.secondary {
  background: var(--accent);
  color: var(--surface);
}

.action-btn.ghost {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  box-shadow: none;
}

.action-btn .btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.action-btn.ghost .btn-icon {
  background: var(--surface-2);
}
.action-btn.ghost .btn-icon svg { color: var(--text-muted); }

.action-btn .btn-label { flex: 1; }
.action-btn .btn-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
}
.action-btn .btn-desc {
  display: block;
  font-size: 13px;
  opacity: 0.78;
  margin-top: 2px;
}

.action-btn .btn-arrow {
  opacity: 0.5;
  flex-shrink: 0;
}

.settings-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
  color: var(--text-muted);
  font-size: 14px;
  transition: background 0.15s;
}
.settings-btn:hover { background: var(--surface-2); }
.settings-btn .btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-btn .btn-title { font-size: 14px; font-weight: 500; color: var(--text-2); }
.settings-btn .btn-desc  { font-size: 12px; color: var(--text-muted); }
.settings-btn .btn-arrow { margin-left: auto; opacity: 0.4; }

.btn-stack { display: flex; flex-direction: column; gap: 12px; margin: 0 20px; }

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  min-height: 64px;
  text-align: center;
  line-height: 1.2;
}
.chip span.chip-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 3px;
}
.chip:hover { border-color: var(--accent); }
.chip.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}
.chip.selected span.chip-sub { opacity: 0.75; color: rgba(255,255,255,0.75);}

.skip-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
  transition: background 0.15s, color 0.15s;
}
.skip-btn:hover { background: var(--surface-2); color: var(--text-2); }
.skip-btn.selected {
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--accent-light);
}

.fine-control-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px 0 2px;
  width: fit-content;
  transition: color 0.15s;
}
.fine-control-toggle:hover { color: var(--text-2); }
.fine-control-toggle svg { transition: transform 0.2s; }
.fine-control-toggle.open svg { transform: rotate(180deg); }

.slider-panel {
  display: none;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-top: 10px;
}
.slider-panel.open { display: block; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.slider-row:last-child { margin-bottom: 0; }
.slider-label {
  font-size: 12px;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}
.slider-row input[type=range] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
.slider-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 52px;
  text-align: left;
}

.continue-btn {
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.continue-btn button {
  width: 100%;
  padding: 17px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--surface);
  font-size: 16px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.12s;
  box-shadow: var(--shadow);
}
.continue-btn button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.continue-btn button:not(:disabled):active { transform: scale(0.98); }
.continue-btn button.skip {
  background: var(--surface);
  color: var(--text-2);
  border: 1px dashed var(--border-strong);
  box-shadow: none;
}

/* ============================================================
   HOME SCREEN
   ============================================================ */
#screen-home {
  padding: 0 0 40px;
}

.home-header {
  background: var(--surface);
  display: flex;
  align-items: center;
  height: 200px;
  margin: 0;
  margin-bottom: 32px;
  overflow: hidden;
  position: relative;
}

.home-header-info {
  flex: 1;
  min-width: 0;
  padding: 0 20px;
}

.home-eyebrow {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.home-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.thumb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  width: 200px;
  height: 200px;
  flex-shrink: 0;
  background: var(--surface-2);
  box-sizing: border-box;
}

.thumb-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: var(--border);
  border-radius: 4px;
  width: 100%;
  height: 100%;
}
.thumb-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-cell .thumb-emoji {
  font-size: 22px;
  z-index: 1;
  position: relative;
}

.home-cta {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 14px;
}

/* ============================================================
   FILTER SCREENS
   ============================================================ */
#screen-players .chip-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* ============================================================
   FILTER SUMMARY SCREEN
   ============================================================ */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 8px;
  transition: background 0.3s, border-color 0.3s;
}
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.summary-row:last-child { border-bottom: none; padding-bottom: 0; }
.summary-row:first-child { padding-top: 0; }
.summary-label { color: var(--text-muted); font-size: 14px; }
.summary-value { font-weight: 600; color: var(--text); text-align: right; }
.summary-edit {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  margin-left: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.summary-edit:hover { text-decoration: underline; }

.match-count {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.match-count strong { color: var(--accent); font-size: 20px; font-weight: 600; }

/* ============================================================
   RESULTS SCREEN
   ============================================================ */
.featured-section { margin-bottom: 28px; }

.section-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.featured-cards { display: flex; flex-direction: column; gap: 10px; }

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: stretch;
  gap: 0;
  box-shadow: var(--shadow);
  cursor: default;
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}
.game-card.featured {
  border-color: var(--accent-light);
}

.game-card-thumb {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.game-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}
.game-card-thumb .thumb-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  z-index: 0;
}

.game-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
}
.game-card-info { flex: 1; min-width: 0; }
.game-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
.game-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.meta-tag {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}
.game-card-rating {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.game-card.compact .game-card-thumb { width: 120px; height: 120px; }
.game-card.compact .game-card-thumb .thumb-emoji { font-size: 22px; }
.game-card.compact .game-card-body { padding: 12px 12px; }
.game-card.compact .game-card-name { font-size: 14px; }

.pick-btn {
  width: 100%;
  padding: 17px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--surface);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: opacity 0.15s, transform 0.12s;
}
.pick-btn:active { transform: scale(0.98); }

.all-games-toggle {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  margin-bottom: 12px;
}
.all-games-toggle svg { transition: transform 0.2s; }
.all-games-toggle.open svg { transform: rotate(180deg); }

.all-games-list { display: none; flex-direction: column; gap: 8px; }
.all-games-list.open { display: flex; }

.game-card.highlighted {
  border: 2px solid var(--accent);
  animation: pulse-border 1s ease;
}
@keyframes pulse-border {
  0%   { box-shadow: 0 0 0 0 rgba(127,119,221,0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(127,119,221,0); }
  100% { box-shadow: 0 0 0 0 rgba(127,119,221,0); }
}

.no-results {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.no-results p { font-size: 15px; margin-bottom: 8px; }
.no-results small { font-size: 13px; }

/* ============================================================
   RANDOM RESULT SCREEN
   ============================================================ */
#screen-random {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0;
}

.random-card {
  background: var(--surface);
  border: 2px solid var(--accent-light);
  border-radius: 20px;
  width: 100%;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}
.random-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.random-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}
.random-thumb .thumb-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  z-index: 0;
}
.random-card-body {
  padding: 20px 24px 24px;
}
.random-name {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.25;
}
.random-meta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.random-meta .meta-tag { font-size: 16px; }

.random-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ============================================================
   PASSCODE SCREEN
   ============================================================ */
#screen-passcode {
  align-items: center;
  text-align: center;
}
.passcode-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
}
.passcode-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}
.passcode-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.digit-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}
.digit-box {
  width: 44px;
  height: 54px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s;
}
.digit-box.active { border-color: var(--accent); }
.digit-box.filled { border-color: var(--accent-light); }

.passcode-error {
  font-size: 13px;
  color: #C0392B;
  min-height: 20px;
  margin-bottom: 24px;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}
.shake { animation: shake 0.35s ease; }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 10px;
  justify-content: center;
}
.numpad-key {
  height: 56px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s, transform 0.1s;
}
.numpad-key:active { background: var(--surface-2); transform: scale(0.95); }
.numpad-key.del { font-size: 16px; color: var(--text-muted); }
.numpad-key.empty { visibility: hidden; }

/* ============================================================
   SETTINGS SCREEN
   ============================================================ */
.settings-section { margin-bottom: 28px; }
.settings-section-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  gap: 12px;
  transition: background 0.3s, border-color 0.3s;
}
.settings-row-label { font-size: 14px; font-weight: 500; color: var(--text); }
.settings-row-sub   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
  pointer-events: none;
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stepper-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 18px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s;
}
.stepper-btn:hover { background: var(--border); }
.stepper-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  min-width: 28px;
  text-align: center;
}

/* Theme picker */
.theme-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.theme-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s;
}
.theme-chip .swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.theme-chip.selected { border-color: var(--accent); }

/* Theme squares */
.theme-squares {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.theme-square {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2.5px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
  background: var(--surface-2);
}
.theme-square:hover {
  transform: scale(1.08);
}
.theme-square.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

/* Font selector */
#font-selector {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
#font-selector:focus { outline: 2px solid var(--accent); }

.change-passcode-btn {
  width: 100%;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s;
}
.change-passcode-btn:hover { background: var(--surface-2); }

/* ============================================================
   RESPONSIVE TWEAKS
   ============================================================ */
@media (min-width: 480px) {
  #app { padding-bottom: 60px; }
  .screen { padding: 32px 28px 48px; }
  #screen-home { padding-top: 0; }
}