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

:root {
  --bg:        #FBF8F3;
  --surface:   #FFFFFF;
  --border:    #EDE5D8;
  --text:      #2C2420;
  --text-soft: #8A7A6A;
  --accent:    #C17F24;
  --accent-lt: #F5ECD6;
  --green:     #3a9e6e;
  --green-lt:  #d6f0e5;
  --yellow:    #f5c842;
  --yellow-lt: #fef8dc;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 2px 16px rgba(44,36,32,0.06);
  --shadow-md: 0 4px 24px rgba(44,36,32,0.10);
  --font:      'Plus Jakarta Sans', system-ui, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}

/* ── Themes ── */
html[data-theme="coastal"] {
  --bg:        #eef6f9;
  --surface:   #ffffff;
  --border:    #c5dfe8;
  --text:      #1a3a45;
  --text-soft: #5a8090;
  --accent:    #1d8fa0;
  --accent-lt: #d0edf2;
}
html[data-theme="forest"] {
  --bg:        #eef5ee;
  --surface:   #ffffff;
  --border:    #bdd9c1;
  --text:      #1a3220;
  --text-soft: #4a7055;
  --accent:    #2a7a4a;
  --accent-lt: #cce8d4;
}
html[data-theme="slate"] {
  --bg:        #f0f2f5;
  --surface:   #ffffff;
  --border:    #c8d2dc;
  --text:      #1a2a38;
  --text-soft: #5a6a7a;
  --accent:    #3d6a8a;
  --accent-lt: #d0e2ee;
}
html[data-theme="dusk"] {
  --bg:        #f4f0f9;
  --surface:   #ffffff;
  --border:    #d5c8eb;
  --text:      #251840;
  --text-soft: #6a558a;
  --accent:    #7340b0;
  --accent-lt: #e5daf5;
}
html[data-theme="high-contrast"] {
  --bg:        #ffffff;
  --surface:   #ffffff;
  --border:    #000000;
  --text:      #000000;
  --text-soft: #333333;
  --accent:    #000000;
  --accent-lt: #e8e8e8;
}

/* ── Dark mode ── */
/* Base dark overrides — sufficient contrast for all body text */
html[data-dark="true"] {
  --bg:        #181614;
  --surface:   #232120;
  --border:    #38322e;
  --text:      #F2EDE6;   /* 12.3:1 on #232120 — AAA */
  --text-soft: #A89880;   /* 4.6:1 on #232120 — AA */
  --green:     #4ecb8a;
  --green-lt:  rgba(78, 203, 138, 0.12);
  --yellow:    #d4a833;
  --yellow-lt: rgba(212, 168, 51, 0.12);
}
/* Dark accent-lt per theme */
html[data-dark="true"]:not([data-theme]),
html[data-dark="true"][data-theme="sunrise"]      { --accent-lt: rgba(193, 127,  36, 0.20); }
html[data-dark="true"][data-theme="coastal"]      {
  --accent:    #2aafc2;
  --accent-lt: rgba( 42, 175, 194, 0.18);
}
html[data-dark="true"][data-theme="forest"]       {
  --accent:    #3aaa65;
  --accent-lt: rgba( 58, 170, 101, 0.18);
}
html[data-dark="true"][data-theme="slate"]        {
  --accent:    #5a8fb5;
  --accent-lt: rgba( 90, 143, 181, 0.18);
}
html[data-dark="true"][data-theme="dusk"]         {
  --accent:    #9b6fd4;
  --accent-lt: rgba(155, 111, 212, 0.18);
}
html[data-dark="true"][data-theme="high-contrast"] {
  --bg:        #000000;
  --surface:   #0d0d0d;
  --border:    #ffffff;
  --text:      #ffffff;
  --text-soft: #dddddd;
  --accent:    #f0c060;
  --accent-lt: rgba(240, 192,  96, 0.20);
}

/* Dark mode component overrides for guaranteed contrast */
html[data-dark="true"] .bubble-english {
  background: rgba(193, 127, 36, 0.14);
  color: var(--text);        /* #F2EDE6 — 12.3:1 on dark surface — AAA */
  border-left-color: #C17F24;
}
html[data-dark="true"] .bubble-correction {
  background: rgba(78, 203, 138, 0.10);
  color: #6dcf9a;            /* 4.6:1 on dark surface — AA */
  border-left-color: #4ecb8a;
}
html[data-dark="true"] .correction-text { color: #6dcf9a; }
html[data-dark="true"] .spanglish-item {
  color: #d4aa74;
  background: rgba(193,127,36,0.12);
  border-color: rgba(193,127,36,0.35);
}
html[data-dark="true"] .progress-message {
  background: rgba(78, 203, 138, 0.10);
  color: #6dcf9a;
}
html[data-dark="true"] .message.user .bubble-user {
  background: rgba(193, 127, 36, 0.22);
  color: #F2EDE6;
}
html[data-dark="true"] .bubble-spanish {
  background: var(--surface);
  color: var(--text);
}
html[data-dark="true"] .spanish-text {
  color: var(--text);
}
html[data-dark="true"] .settings-input,
html[data-dark="true"] .settings-textarea {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
html[data-dark="true"] .modal-card {
  background: var(--surface);
  color: var(--text);
}
html[data-dark="true"] .modal-card input {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
html[data-dark="true"] #doc-text {
  background: var(--surface);
  color: var(--text);
}
html[data-dark="true"] .phrase-card {
  background: var(--surface);
}
html[data-dark="true"] .phrase-english,
html[data-dark="true"] .session-meta {
  color: var(--text-soft);
}
html[data-dark="true"] .about-intro,
html[data-dark="true"] .lucy-caption {
  color: var(--text-soft);
}
html[data-dark="true"] .chip {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-soft);
}
html[data-dark="true"] .chip:hover {
  background: var(--accent-lt);
  color: var(--accent);
  border-color: var(--accent);
}
html[data-dark="true"] #chat-input,
html[data-dark="true"] #phrase-search {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html[data-dark="true"] .voice-select {
  background: var(--surface);
  color: var(--text);
}

/* ── Font size ── */
html[data-fontsize="small"]  { font-size: 14px; }
html[data-fontsize="medium"] { font-size: 16px; }
html[data-fontsize="large"]  { font-size: 18px; }

/* ── Layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: 72px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0 1rem;
  gap: 1rem;
  align-items: center;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  position: relative;
  z-index: 10;
}
/* Expanded state */
#sidebar.expanded {
  width: 180px;
  align-items: flex-start;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;    /* centers img + text horizontally */
  width: 100%;            /* fills sidebar so centering has room */
  gap: 0;
  padding: 0.1rem 0;      /* vertical only — no horizontal offset */
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
}
.logo:hover { opacity: 0.8; }
#sidebar.expanded .logo {
  flex-direction: column;
  align-items: center;
  align-self: stretch;    /* overrides sidebar's align-items:flex-start */
  width: 100%;
  gap: 0;
  padding: 0.2rem 0;      /* vertical only — no horizontal offset */
  text-align: center;
}
.logo-img {
  display: block;
  width: 80%;
  max-width: 65px;        /* matches former dark-mode scale(1.25) of 52px */
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  margin: 0 auto;         /* belt-and-suspenders centering */
}
#sidebar.expanded .logo-img {
  max-width: 138px;       /* matches former dark-mode scale(1.25) of 110px */
  width: 75%;
  margin: 0 auto;
}
.logo-text {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.2rem, 3vw, 1.4rem);  /* collapsed: ~1.4rem */
  font-weight: 700;
  color: #C17F24;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: font-size 0.3s ease;
  text-align: center;
}
#sidebar.expanded .logo-text {
  font-size: clamp(1.5rem, 3.5vw, 1.8rem);  /* expanded: ~1.8rem */
}
/* In collapsed mode text is below the image — always visible */

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: 100%;
  flex: 1;
  order: 0;
}

.nav-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s, width 0.22s;
  position: relative;
  flex-direction: row;
  gap: 0.55rem;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
}
#sidebar.expanded .nav-btn {
  width: 100%;
  height: 40px;
  padding: 0 0.6rem;
  border-radius: 10px;
  justify-content: flex-start;
}
.nav-btn:hover {
  background: var(--accent-lt);
  color: var(--accent);
}
.nav-btn.active {
  color: var(--accent);
  background: var(--accent-lt);
}
/* Collapsed: amber left-border instead of full fill */
#sidebar:not(.expanded) .nav-btn.active {
  background: none;
}
#sidebar:not(.expanded) .nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  text-align: center;
  width: 1.5rem;
}
.nav-label {
  font-size: 0.83rem;
  font-weight: 600;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.18s, width 0.22s;
}
#sidebar.expanded .nav-label {
  opacity: 1;
  width: auto;
}

/* ── Sidebar expand/collapse toggle ── */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
  /* Position at vertical center of sidebar — right edge */
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
}
.sidebar-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
#sidebar.expanded .sidebar-toggle-btn { margin: 0 0 0 auto; }
.sidebar-toggle-icon {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.22s;
  display: inline-block;
}
#sidebar.expanded .sidebar-toggle-icon { transform: rotate(180deg); }

/* sidebar-footer removed — Piper now lives in the main content corner */

/* ── Age gate overlay ── */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(44, 36, 32, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.age-gate.hidden { display: none; }
.age-gate-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}
.age-gate-logo-img {
  width: 72px;
  height: auto;
}
.age-gate-logo-text {
  font-family: 'Dancing Script', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.age-gate-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.25rem;
}
.age-gate-question {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.age-gate-btns {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  margin-top: 0.25rem;
}
.age-gate-note {
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.5;
}

/* ── Setup wizard ── */
.wiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.wiz-overlay.hidden { display: none; }

.wiz-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: auto; /* stays centered when overflow-y scrolls */
}

/* Progress dots */
.wiz-dots {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}
.wiz-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}
.wiz-dot.active { background: var(--accent); }

/* Step containers — only .active is shown */
.wiz-step { display: none; flex-direction: column; align-items: center; gap: 0.85rem; text-align: center; }
.wiz-step.active { display: flex; animation: wizFadeIn 0.2s ease; }
@keyframes wizFadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.wiz-heading { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.wiz-sub     { font-size: 0.9rem; color: var(--text-soft); line-height: 1.6; }
.wiz-note    { font-size: 0.74rem; color: var(--text-soft); font-style: italic; }
.wiz-hint    { font-size: 0.84rem; color: var(--text-soft); line-height: 1.55; text-align: left; width: 100%; }
.wiz-optional { font-size: 0.74rem; font-weight: 400; color: var(--text-soft); }

.wiz-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 100%;
  text-align: left;
}
.wiz-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
}
.wiz-input {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.wiz-input:focus { border-color: var(--accent); }
.wiz-select {
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  width: 100%;
  cursor: pointer;
}
.wiz-select:focus { border-color: var(--accent); }
.wiz-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  width: 100%;
}
.wiz-error {
  font-size: 0.78rem;
  color: #c0392b;
  text-align: left;
  width: 100%;
}
.wiz-error.hidden { display: none; }
.wiz-hidden { display: none; }

/* Level picker */
.wiz-level-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}
.wiz-level-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}
.wiz-level-opt:hover  { border-color: var(--accent); }
.wiz-level-opt.active { background: var(--accent-lt); border-color: var(--accent); }
.wiz-level-name { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.wiz-level-desc { font-size: 0.76rem; color: var(--text-soft); }

/* Topic chips */
.wiz-topics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  width: 100%;
}
.wiz-topic-chip {
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.wiz-topic-chip:hover               { border-color: var(--accent); color: var(--accent); }
.wiz-topic-chip.active              { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }
.wiz-topic-chip.wiz-topic-permanent { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); opacity: 0.55; cursor: default; }
.wiz-topic-count { font-size: 0.82rem; color: var(--text-soft); }
.wiz-topic-count span { font-weight: 700; color: var(--accent); }

/* Nav buttons */
.wiz-btn-row { display: flex; gap: 0.6rem; width: 100%; margin-top: 0.25rem; }
.wiz-btn-row .btn-primary { flex: 1; }
.wiz-btn-row .btn-ghost   { flex-shrink: 0; }
.wiz-full { width: 100%; }

/* Done step */
.wiz-done-icon { font-size: 3rem; }

/* Boot loading screen ── */
.boot-loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.boot-loading.hidden { display: none; }
.boot-spinner {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.boot-spinner span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.3;
  animation: bootPulse 1.2s ease-in-out infinite;
}
.boot-spinner span:nth-child(2) { animation-delay: 0.2s; }
.boot-spinner span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bootPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%           { opacity: 1;   transform: scale(1); }
}

/* ── Login overlay ── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-overlay.hidden { display: none; }
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}
.login-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.25rem;
}
.login-fields {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  margin-top: 0.25rem;
}
.login-field { display: flex; flex-direction: column; gap: 0.25rem; }
.login-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
}
.login-field input {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.login-field input:focus { border-color: var(--accent); }
.login-error {
  font-size: 0.82rem;
  color: #c0392b;
  margin-top: -0.15rem;
}
.login-error.hidden { display: none; }
.login-invite-note {
  font-size: 0.76rem;
  color: var(--text-soft);
  margin-top: 0.25rem;
}

/* ── AI disclosure / time reminder banners ── */
.ai-disclosure {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--accent-lt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin: 0.25rem 0;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.5;
}
.ai-disclosure-text { flex: 1; }
/* hidden class has no generic CSS rule — add it explicitly for ai-disclosure */
.ai-disclosure.hidden { display: none !important; }
.ai-disclosure-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-soft);
  padding: 0 0.1rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.12s;
}
.ai-disclosure-dismiss:hover { opacity: 1; }

/* ── Safety section in About page ── */
.safety-section {
  background: rgba(210, 240, 220, 0.35);
  border: 1px solid var(--green-lt);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}
.safety-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 0.4rem;
}
.safety-list {
  margin: 0.5rem 0 0.5rem 1.2rem;
}
.safety-list li { margin-bottom: 0.2rem; }
.safety-note {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: 0.5rem;
}
html[data-dark="true"] .safety-section {
  background: rgba(78, 203, 138, 0.08);
  border-color: rgba(78, 203, 138, 0.25);
}
html[data-dark="true"] .ai-disclosure {
  background: var(--surface);
  border-color: var(--border);
}

/* ── Piper mascot — bottom-right corner of main content ── */
.piper-corner {
  position: fixed;
  bottom: 100px;   /* floats above the chat input row */
  right: 24px;
  cursor: pointer;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.piper-mascot {
  width: 156px;
  display: block;
  transition: opacity 0.2s ease;
  cursor: pointer;
  /* no flip — faces inward naturally */
}
.piper-mascot.fading { opacity: 0; }
.piper-nudge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-soft);
  text-align: center;
  margin-top: 0.3rem;
  opacity: 0.85;
}

/* ── Main ── */
#main {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

/* ── View transitions ── */
.view {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 2rem 2.5rem;
  overflow-y: auto;
}
.view.active {
  display: flex;
  animation: viewFadeIn 0.18s ease;
}
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ── */
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 700; }

.view-header { margin-bottom: 1.5rem; }
.view-header h1 { font-size: 1.5rem; font-weight: 700; }
.view-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-top: 0.2rem;
}

.practice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.autoplay-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  margin-top: 0.25rem;
}
.autoplay-btn.active {
  background: var(--accent-lt);
  border-color: var(--accent);
  color: var(--accent);
}
.autoplay-btn:hover { opacity: 0.8; }

/* ── Dark mode toggle quick button ── */
.dark-mode-btn {
  padding: 0.4rem 0.6rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 0.25rem;
  font-family: var(--font);
  color: var(--text-soft);
  font-weight: 700;
  white-space: nowrap;
}
.dark-mode-btn:hover { opacity: 0.8; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.voice-select {
  padding: 0.35rem 0.6rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface);
  cursor: pointer;
  outline: none;
  max-width: 130px;
}
.voice-select:focus { border-color: var(--accent); }

/* ── Assessment progress bar ── */
.assessment-bar { display:flex; align-items:center; gap:0.65rem; padding:0.4rem 0.75rem; background:rgba(193,127,36,0.08); border-left:3px solid #C17F24; border-radius:0 8px 8px 0; margin-bottom:0.4rem; opacity:1; transition:opacity 0.6s ease; }
.assessment-bar.fade-out { opacity:0; }
.assessment-bar.hidden { display:none; }
.assessment-bar-track { flex:1; height:5px; background:var(--border); border-radius:3px; overflow:hidden; }
.assessment-bar-fill { height:100%; background:#C17F24; border-radius:3px; transition:width 0.4s ease; width:0%; }
.assessment-label { font-size:0.78rem; font-weight:600; color:var(--accent); white-space:nowrap; }

/* ── Conversation ── */
.chat-box {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0.5rem 0 1rem;
}

/* ── User message ── */
.message.user {
  align-self: flex-end;
  max-width: 72%;
}
.message.user .bubble-user {
  background: var(--accent-lt);
  color: var(--text);
  padding: 0.75rem 1.1rem;
  border-radius: 20px;
  border-bottom-right-radius: 6px;
  font-size: 1rem;
  line-height: 1.55;
  box-shadow: var(--shadow);
}

/* ── Tutor message ── */
.message.tutor {
  align-self: flex-start;
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tutor-avatar-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-soft);
}
.tutor-avatar-row .avatar { font-size: 1.25rem; }

/* Spanish block — large, prominent */
.bubble-spanish {
  background: var(--surface);
  border-radius: 14px;
  border-top-left-radius: 4px;
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.spanish-text {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--text);
}

/* TTS speak button */
.speak-btn {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: none;
  background: var(--accent-lt);
  color: var(--accent);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  margin-top: 0.1rem;
}
.speak-btn:hover  { background: var(--accent); color: #fff; }
.speak-btn.speaking { background: var(--accent); color: #fff; transform: scale(1.1); }

/* English block — smaller, softer */
.bubble-english {
  background: rgba(245, 236, 214, 0.5);
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.55;
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

.spanglish-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px dashed #e0c96a;
}

.spanglish-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  color: #7a5a00;
  background: #fff9e6;
  border: 1px solid #e0c96a;
  border-radius: 4px;
  padding: 0.1rem 0.35rem 0.1rem 0.45rem;
  white-space: nowrap;
}

/* Correction block */
.bubble-correction {
  background: rgba(210, 240, 220, 0.5);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.87rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--green);
  font-weight: 700;
  border-left: 3px solid var(--green);
}

.correction-text { flex: 1; line-height: 1.5; }

.correction-thumb {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.45;
  padding: 0 0.1rem;
  transition: opacity 0.15s;
  line-height: 1;
}
.correction-thumb:hover { opacity: 1; }

.correction-question {
  width: 100%;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 0.35rem;
}

.correction-option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--green);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--green);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 0.3rem;
}
.correction-option:hover { background: var(--green-lt); }

.correction-resolved {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--green);
  line-height: 1.5;
}

/* Loading dots */
.bubble-loading {
  background: var(--surface);
  border-radius: var(--radius);
  border-top-left-radius: 4px;
  padding: 0.75rem 1.2rem;
  box-shadow: var(--shadow);
}
.dot-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  height: 1.2rem;
}
.dot-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border);
  animation: dotBounce 1.2s infinite;
}
.dot-typing span:nth-child(2) { animation-delay: 0.2s; }
.dot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); background: var(--border); }
  40%           { transform: translateY(-6px); background: var(--accent); }
}

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-right: 188px;
}
.chip {
  padding: 0.4rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-lt); }

/* ── Recent vocab strip ── */
.vocab-strip {
  /* no border-top — Lucy's ear divider below handles the visual separation */
  background: var(--surface);
  flex-shrink: 0;
  padding-right: 188px;
}
.vocab-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
  gap: 0.35rem;
  padding: 0.3rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.vocab-toggle:hover { color: var(--accent); }
.vocab-toggle-icon {
  font-size: 0.65rem;
  transition: transform 0.15s;
  transform: rotate(180deg); /* points down = collapsed */
}
.vocab-strip.open .vocab-toggle-icon { transform: rotate(0deg); }
.vocab-words {
  display: none;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1rem 0.6rem;
}
.vocab-strip.open .vocab-words { display: flex; }
.vocab-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: var(--accent-lt);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-family: 'Courier New', monospace;
  color: var(--text);
}
.vocab-save-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.vocab-save-btn:hover { opacity: 1; }
.vocab-empty {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-style: italic;
}

/* ── Spanglish chip save button ── */
.spanglish-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.chip-save-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.chip-save-btn:hover { opacity: 1; }

/* ── Correction save button ── */
.corr-save-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  opacity: 0.45;
  padding: 0 0.1rem;
  transition: opacity 0.15s;
  line-height: 1;
}
.corr-save-btn:hover { opacity: 1; }

/* ── Save button pill (dark mode visibility) ── */
.save-phrase-btn, .chip-save-btn, .corr-save-btn, .vocab-save-btn {
  background: var(--surface);
  border-radius: 6px;
  padding: 0.1rem 0.3rem;
}

/* ── Save button icons: full opacity by default in dark mode ── */
html[data-dark="true"] .save-phrase-btn,
html[data-dark="true"] .chip-save-btn,
html[data-dark="true"] .corr-save-btn,
html[data-dark="true"] .vocab-save-btn {
  opacity: 1;
}

/* ── Language settings selects ── */
.settings-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  appearance: auto;
  margin-top: 0.35rem;
}
.settings-select:focus {
  outline: none;
  border-color: var(--accent);
}
html[data-dark="true"] .settings-select {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.settings-field--two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Chat input row ── */
.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-top: 0.75rem;
  /* no border-top — Lucy's ear divider above handles the visual separation */
}

.mic-btn {
  flex-shrink: 0;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.mic-btn:hover { border-color: var(--accent); background: var(--accent-lt); }
.mic-btn.recording {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

#chat-input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 1rem;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  box-shadow: var(--shadow);
}
#chat-input:focus { border-color: var(--accent); }

.send-btn {
  flex-shrink: 0;
  padding: 0.7rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.send-btn:hover { opacity: 0.88; }

/* ── Phrases ── */
.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

#phrase-search {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  background: var(--surface);
}
#phrase-search:focus { border-color: var(--accent); }

.btn-primary {
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  padding: 0.6rem 1.1rem;
  background: none;
  color: var(--text-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.phrases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.phrase-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
}
.phrase-spanish {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}
.phrase-english {
  font-size: 0.9rem;
  color: var(--text-soft);
}
.phrase-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
.phrase-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background: var(--yellow-lt);
  color: #7a5a00;
  border-radius: 999px;
  font-weight: 600;
}
.phrase-delete {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--border);
  transition: color 0.15s;
}
.phrase-delete:hover { color: var(--accent); }

.empty-state {
  color: var(--text-soft);
  font-size: 0.95rem;
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 0;
}

/* ── Empty state illustrated ── */
.empty-state-illustrated {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  grid-column: 1 / -1;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.empty-state-icon {
  width: 52px;
  height: 52px;
  opacity: 0.7;
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.modal-card h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.25rem; }
.modal-card label { font-size: 0.82rem; font-weight: 600; color: var(--text-soft); }
.modal-card input {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  background: var(--bg);
}
.modal-card input:focus { border-color: var(--accent); }
.modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* ── Documents ── */
.doc-input-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
#doc-text {
  padding: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  background: var(--surface);
  line-height: 1.6;
}
#doc-text:focus { border-color: var(--accent); }
.doc-actions { display: flex; gap: 0.6rem; }

.doc-result {
  margin-top: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.doc-result h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.doc-result.hidden { display: none; }
#doc-output { font-size: 0.95rem; line-height: 1.65; color: var(--text-soft); }

/* ── Progress ── */
#view-progress { position: relative; }

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.progress-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.card-icon { font-size: 1.6rem; margin-bottom: 0.4rem; }
.card-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.card-label { font-size: 0.82rem; color: var(--text-soft); font-weight: 600; margin-top: 0.2rem; }

.progress-message {
  background: var(--green-lt);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.recent-topics-section {
  position: relative;
  z-index: 1;
}
.recent-topics-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin-bottom: 0.6rem;
}
.chip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ── History view ── */
#view-history { position: relative; }

.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.session-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  padding-right: 188px;
  box-shadow: var(--shadow);
  cursor: default;
  transition: box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.session-item:hover { box-shadow: var(--shadow-md); }

.session-item-info { flex: 1; min-width: 0; }

.session-title {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.session-meta {
  font-size: 0.8rem;
  color: var(--text-soft);
  font-weight: 600;
}

/* ── Bookmark / save-phrase button (inside Spanish bubble) ── */
.save-phrase-btn {
  background: var(--accent-lt);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 6px;
  opacity: 0.3;
  transition: opacity 0.18s, background 0.18s;
  align-self: flex-start;
  margin-top: 2px;
}
.bubble-spanish:hover .save-phrase-btn { opacity: 0.65; }
.save-phrase-btn:hover { opacity: 1 !important; background: rgba(0,0,0,0.07); }
.save-phrase-btn.saved { opacity: 1; color: var(--green); }

/* ── Phrase-saved toast (inline in chat) ── */
.phrase-saved-toast {
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  margin: 0.25rem auto;
  text-align: center;
  animation: fadeout 4s forwards;
}
@keyframes fadeout {
  0%  { opacity: 1; }
  70% { opacity: 1; }
  100%{ opacity: 0; }
}

/* ── New Chat button ── */
.new-chat-btn {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  color: var(--text-soft);
  border: 1.5px solid var(--border);
}
.new-chat-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-lt); }

/* ── Session-resume marker ── */
.session-resume-marker {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  padding: 0.4rem 1rem;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin: 0.5rem 0;
}

/* ── History: Continue button ── */
.continue-btn {
  flex-shrink: 0;
  background: var(--accent-lt);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.continue-btn:hover { background: var(--accent); color: #fff; }

/* ── Settings view ── */
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 620px;
}

/* ── Settings nav chips (jump to section) ── */
.settings-nav-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.settings-nav-chip {
  padding: 0.4rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}
.settings-nav-chip:hover,
.settings-nav-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
}

/* ── Back-to-top links at the end of each section ── */
.settings-back-to-top {
  margin-top: -0.75rem;
  text-align: right;
}
.settings-top-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s;
}
.settings-top-link:hover { opacity: 1; color: var(--accent); }
.settings-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.settings-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 1.25rem;
}
.settings-field { margin-bottom: 1.2rem; }
.settings-field:last-child { margin-bottom: 0; }
.settings-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.45rem;
}
.settings-hint {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.settings-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
}
.settings-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.settings-input:focus, .settings-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.settings-row-label { font-size: 0.9rem; font-weight: 700; }
.settings-row-hint  { font-size: 0.78rem; color: var(--text-soft); margin-top: 0.15rem; }
.settings-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.25rem;
}
.settings-saved-msg {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.25s;
}
.settings-saved-msg.visible { opacity: 1; }

/* Inline auto-save indicator */
.saved-inline-indicator {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green);
  margin-left: 0.5rem;
  animation: settingsFadeOut 2s ease-in-out forwards;
  pointer-events: none;
}
@keyframes settingsFadeOut {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Pronoun buttons ── */
.pronoun-options, .pill-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.pronoun-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 0.28rem 0.8rem;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.pronoun-btn:hover  { border-color: var(--accent); color: var(--accent); }
.pronoun-btn.active { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }
.pronoun-custom-input { margin-top: 0.4rem; }

/* ── Avatar grid ── */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s;
}
.avatar-option:hover    { border-color: var(--accent); background: var(--accent-lt); }
.avatar-option.selected { border-color: var(--accent); background: var(--accent-lt); box-shadow: 0 0 0 2px var(--accent); }
.avatar-option-emoji  { font-size: 1.75rem; line-height: 1; }
.avatar-option-label  { font-size: 0.68rem; font-weight: 700; color: var(--text-soft); text-align: center; }
.avatar-custom-thumb  { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-upload-label  { display: block; margin-top: 0.3rem; }
.avatar-custom-img    { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; vertical-align: middle; }

/* ── About page ── */
.about-body {
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.about-intro {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
}
.about-intro p { margin-bottom: 0.85rem; }
.about-intro p:last-child { margin-bottom: 0; }

.about-lucy {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-top: 3px solid #D4922A;
}
.lucy-img-wrapper { width: 100%; display: flex; justify-content: center; }
.lucy-memorial-img {
  width: 100%;
  max-width: 260px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(212, 146, 42, 0.20);
}
.lucy-caption {
  font-size: 0.88rem;
  color: var(--text-soft);
  font-style: italic;
  text-align: center;
  line-height: 1.6;
  margin: 0;
}

/* ── About page photo (lucy-and-piper) ── */
.about-photo {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0 0.5rem;
}
.about-photo-img {
  max-width: 400px;
  width: 100%;
  display: block;
  border-radius: 10px;
}

/* ── Theme swatches ── */
.theme-swatches {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.swatch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.swatch-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}
.theme-swatch {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s;
}
.theme-swatch:hover  { transform: scale(1.12); }
.theme-swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4.5px var(--text); }
.swatch-sunrise       { background: conic-gradient(#F5ECD6 0% 50%, #C17F24 50% 100%); }
.swatch-coastal       { background: conic-gradient(#d0edf2 0% 50%, #1d8fa0 50% 100%); }
.swatch-forest        { background: conic-gradient(#cce8d4 0% 50%, #2a7a4a 50% 100%); }
.swatch-slate         { background: conic-gradient(#d0e2ee 0% 50%, #3d6a8a 50% 100%); }
.swatch-dusk          { background: conic-gradient(#e5daf5 0% 50%, #7340b0 50% 100%); }
.swatch-high-contrast { background: conic-gradient(#ffffff 0% 50%, #000000 50% 100%); border-color: #aaaaaa; }

/* ── Font size options ── */
.font-size-options {
  display: flex;
  gap: 0.5rem;
}
.font-size-btn {
  padding: 0.3rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.font-size-btn:hover  { border-color: var(--accent); color: var(--accent); }
.font-size-btn.active { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }
.font-size-btn[data-size="small"] { font-size: 0.78rem; }
.font-size-btn[data-size="large"] { font-size: 0.90rem; }

/* ── Slider row ── */
.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
}
.settings-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
}
.slider-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 2.5rem;
  text-align: right;
}

/* ── Account link ── */
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  transition: all 0.15s;
}
.account-link:hover { background: var(--accent-lt); }

/* ── Lucy ear elements ── */
/* ── Progress page header — heading with ear decoration alongside ── */
.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.lucy-ear-progress {
  height: 50px;
  width: auto;
  flex-shrink: 0;
  opacity: 0.5;
  pointer-events: none;
}

.lucy-ear-about {
  display: flex;
  justify-content: center;
  padding: 1rem 0 0;
  opacity: 0.35;
}
.lucy-ear-about img { max-width: 220px; width: 100%; }

/* ── About page header — two-column layout with ear on right ── */
.about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 580px;   /* matches .about-body so ear aligns with content edge */
  width: 100%;
}
.about-header-text { flex: 1; }
.about-header .lucy-ear-about {
  padding: 0;
  flex-shrink: 0;
}
.about-header .lucy-ear-about img {
  height: 3.5rem;   /* visually matches h1 + subtitle combined height */
  width: auto;
  max-width: none;
}

.lucy-ear-history {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 160px;
  pointer-events: none;
  opacity: 0.08;
}
.lucy-ear-history img { width: 100%; }

/* ── Learning level selector ── */
.level-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
.level-btn {
  padding: 0.28rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.level-btn:hover  { border-color: var(--accent); color: var(--accent); }
.level-btn.active { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }

.level-customized-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--border);
  border-radius: 20px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.4rem;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.level-customized-badge.hidden { display: none; }

/* ── Visibility & speed option buttons ── */
.visibility-options,
.speed-options {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

/* Compact variant — used in the Practice header, alongside other controls */
.speed-options--compact {
  margin-top: 0;
  gap: 0.3rem;
}
.speed-options--compact .speed-btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
}
.vis-btn,
.speed-btn {
  padding: 0.28rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.vis-btn:hover,  .speed-btn:hover  { border-color: var(--accent); color: var(--accent); }
.vis-btn.active, .speed-btn.active { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }

/* ── Per-message EN translate button ── */
.translate-msg-btn {
  flex-shrink: 0;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text-soft);
  padding: 0.1rem 0.35rem;
  line-height: 1.5;
  opacity: 0.45;
  transition: opacity 0.12s, border-color 0.12s, color 0.12s, background 0.12s;
  align-self: flex-start;
  margin-top: 3px;
  letter-spacing: 0.03em;
}
.translate-msg-btn:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }
.translate-msg-btn.active {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
}

/* ── Coaching / spanglish reveal toggle ── */
.content-reveal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  opacity: 0.7;
  padding: 0.2rem 0;
  transition: opacity 0.15s, color 0.15s;
  font-family: var(--font);
}
.content-reveal-btn:hover { opacity: 1; color: var(--accent); }
.content-reveal-btn.coaching { color: var(--green); }
.content-reveal-btn.coaching:hover { opacity: 1; }

/* ── Assessment mode banner ── */
.assessment-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(115, 64, 176, 0.08);
  border: 1px solid rgba(115, 64, 176, 0.25);
  border-left: 3px solid #7340b0;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0;
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
}

/* ── Level suggestion card (inline in chat) ── */
.level-suggestion-card {
  background: var(--accent-lt);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.level-suggestion-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.level-suggestion-actions {
  display: flex;
  gap: 0.4rem;
}
.level-suggestion-yes {
  padding: 0.28rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.level-suggestion-yes:hover { opacity: 0.85; }
.level-suggestion-no {
  padding: 0.28rem 0.75rem;
  background: none;
  color: var(--text-soft);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.level-suggestion-no:hover { border-color: var(--accent); color: var(--accent); }

/* ── My Contexts page ── */
.contexts-intro {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.65;
  background: var(--accent-lt);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}
.contexts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.context-tile {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.context-tile:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.context-tile-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.context-tile-preview { font-size: 0.8rem; color: var(--text-soft); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.context-tile-date { font-size: 0.72rem; color: var(--text-soft); opacity: 0.7; }
.context-tile-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.context-use-btn {
  flex: 1;
  padding: 0.4rem 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.context-use-btn:hover { opacity: 0.88; }
.context-delete-btn {
  padding: 0.4rem 0.6rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.context-delete-btn:hover { border-color: #e74c3c; color: #e74c3c; }

.modal-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 0.35rem;
  margin-top: 0.1rem;
}
.title-suggestion {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--accent-lt);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  margin-top: 0.35rem;
}
.title-suggestion.hidden { display: none; }

/* ── Context shortcuts in Practice view ── */
.context-shortcuts {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0 0.25rem;
  margin-bottom: 0.1rem;
}
.context-shortcuts.hidden { display: none; }
.context-shortcut-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.75rem;
  background: var(--card-bg);
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.context-shortcut-btn:hover { background: var(--accent-lt); }
.context-shortcut-btn.active-context { background: var(--accent-lt); }
.context-shortcut-icon { font-size: 0.85rem; flex-shrink: 0; }

/* Active context badge in header */
.active-context-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-lt);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.active-context-badge:hover { opacity: 0.8; }

/* ── Topic picker in Settings ── */
.topic-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.topic-option {
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.topic-option:hover { border-color: var(--accent); color: var(--accent); }
.topic-option.selected { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }
.topic-option.permanent { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); opacity: 0.6; cursor: default; }
.settings-hint-inline { font-size: 0.78rem; color: var(--text-soft); font-weight: 400; }

/* ── Lucy's ear divider ── */
.lucy-ear-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;       /* no vertical padding — just the single line + ear */
  opacity: 0.5;
}
.lucy-ear-divider .divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.lucy-ear-divider .divider-ear {
  width: auto;
  height: 32px;     /* ~20% smaller than previous 40px */
  filter: sepia(1) saturate(2) hue-rotate(10deg) brightness(0.85);
  display: block;
}

/* ── API key management ── */
.apikey-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
}
.apikey-masked {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-soft);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
}
.apikey-edit-row { margin-top: 0.5rem; }
.apikey-edit-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.apikey-error { font-size: 0.8rem; color: #c0392b; margin-top: 0.25rem; }
.apikey-error.hidden { display: none; }
#quit-app-field.hidden { display: none; }

/* ── History: language pill ── */
.session-lang-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent-lt);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.4rem;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

/* ── Logo dark mode — same size as light mode, just lighter filter ── */
html[data-dark="true"] .logo-img {
  filter: brightness(1.25) saturate(1.15);
}

/* ── Piper click animation ── */
@keyframes piperBounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.12); }
  60%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.piper-mascot.bouncing { animation: piperBounce 0.35s ease forwards; }

/* ── Profile switcher (sidebar bottom) ── */
.profile-switcher {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  margin-top: auto;
  order: 2;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: background 0.15s;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text-soft);
}
.profile-switcher:hover { background: var(--accent-lt); }
.profile-icon { font-size: 1rem; flex-shrink: 0; }
.profile-switcher-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  opacity: 0;
  transition: opacity 0.18s;
}
#sidebar.expanded .profile-switcher-name { opacity: 1; }
.profile-arrow {
  font-size: 0.78rem;
  color: var(--text-soft);
  opacity: 0;
  transform: rotate(90deg);
  transition: opacity 0.18s;
}
#sidebar.expanded .profile-arrow { opacity: 1; }

/* ── Profile picker card (shown via #profile-picker-placeholder) ── */
.profile-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}
.profile-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.profile-list-item:hover { border-color: var(--accent); background: var(--accent-lt); }
.profile-list-item:disabled { opacity: 0.5; cursor: default; }
.profile-list-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.profile-list-lang { font-size: 0.8rem; color: var(--text-soft); }
.picker-divider { height: 1px; background: var(--border); margin: 0.75rem 0 0.5rem; width: 100%; }
.picker-logout-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 0.5rem 0.25rem;
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.picker-logout-btn:hover { background: var(--accent-lt); }
.picker-logout-label { font-size: 0.88rem; font-weight: 600; color: var(--text-soft); }
.picker-logout-sub   { font-size: 0.75rem; color: var(--text-soft); opacity: 0.7; margin-top: 0.1rem; }

/* ── Profile picker overlay ── */
.profile-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  /* Subtle dim behind the card */
  background: rgba(0, 0, 0, 0.25);
}
.profile-picker-overlay.hidden { display: none; }
.profile-picker-card {
  position: absolute;
  bottom: 60px;
  left: 12px;
  width: 220px;
  /* Use --bg (always defined for every theme/dark-mode combo) for solid opaque fill */
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.profile-picker-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.6rem 0.85rem 0.3rem;
}
.profile-picker-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.profile-picker-item:hover { background: var(--accent-lt); }
.profile-picker-active { font-weight: 700; }
.profile-picker-icon { font-size: 0.9rem; flex-shrink: 0; }
.profile-picker-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-picker-check { font-size: 0.75rem; color: var(--accent); }
.profile-picker-divider { height: 1px; background: var(--border); margin: 0.2rem 0; }
.profile-picker-settings { color: var(--text-soft); font-size: 0.84rem; }
.profile-picker-add { color: var(--text-soft); font-size: 0.84rem; }
.profile-picker-soon {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--border);
  color: var(--text-soft);
  border-radius: 20px;
  padding: 0.1rem 0.4rem;
  margin-left: auto;
}

/* ── Emoji picker ── */
.emoji-picker-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.emoji-opt {
  width: 2rem; height: 2rem; font-size: 1.25rem;
  border: 2px solid transparent; border-radius: 8px;
  background: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.emoji-opt:hover  { background: var(--accent-lt); }
.emoji-opt.selected { border-color: var(--accent); background: var(--accent-lt); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  /* Sidebar collapses further, never expanded on mobile */
  #sidebar, #sidebar.expanded {
    width: 52px;
    padding: 0.75rem 0;
    gap: 0.6rem;
    align-items: center;
  }
  #sidebar.expanded .nav-label { opacity: 0; width: 0; }
  #sidebar.expanded .nav-btn { width: 40px; padding: 0; justify-content: center; }
  #sidebar.expanded .logo { flex-direction: column; }
  #sidebar.expanded .logo-img { height: 36px; }
  #sidebar.expanded .logo-text { font-size: 1.1rem; }
  .logo-img { height: 36px; }
  .logo-text { font-size: 0.95rem; }
  .nav-btn { width: 38px; height: 38px; }
  .nav-icon { font-size: 1.15rem; }
  .sidebar-toggle-btn { display: none; }

  /* Main content gets more room */
  .view { padding: 1.25rem 1rem; }
  .view-header h1 { font-size: 1.3rem; }

  /* Practice header stacks */
  .practice-header { flex-direction: column; gap: 0.5rem; }
  .header-controls { flex-wrap: wrap; gap: 0.4rem; }

  /* Cards / grids */
  .progress-grid { grid-template-columns: 1fr 1fr; }
  .phrases-grid  { grid-template-columns: 1fr; }

  /* Chat input row stays comfortable */
  .chat-input-row { gap: 0.35rem; }
  .send-btn { padding: 0.6rem 0.85rem; font-size: 0.85rem; }
  #chat-input { font-size: 0.95rem; }

  /* Piper stays prominent on mobile */
  .piper-mascot { width: 110px; }
  .piper-corner { bottom: 80px; right: 12px; }

  /* About page photo */
  .about-photo-img { border-radius: 8px; }
  .about-body { gap: 1.25rem; }
}

/* ── Profile picker — delete button ── */
.profile-picker-delete { background: none; border: none; cursor: pointer; font-size: 0.9rem; opacity: 0.5; padding: 0.1rem 0.2rem; margin-left: auto; transition: opacity 0.15s; }
.profile-picker-delete:hover { opacity: 1; }
