/* =========================================================
   Global Reset
   ========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* =========================================================
   Theme Tokens (CSS variables)
   Base: Calm Purple Glass
   ========================================================= */
:root {
  --bg-main: #050318;
  --bg-elevated: rgba(20, 17, 45, 0.78);
  --bg-soft: rgba(10, 8, 30, 0.9);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-highlight: rgba(255, 255, 255, 0.18);
  --accent: #8b7dff;
  --accent-soft: #5645ff;
  --accent-strong: #bba5ff;
  --accent-success: #4ccd8a;
  --danger: #ff6f8a;

  --text-main: #ffffff;
  --text-muted: #a4a1d0;
  --text-soft: #7f7ba7;
  --text-invert: #050318;

  --btn-primary-bg: linear-gradient(135deg, #7661ff, #9f82ff);
  --btn-primary-bg-active: linear-gradient(135deg, #5c49d8, #8a6eff);
  --btn-neutral-bg: rgba(33, 28, 76, 0.9);
  --btn-neutral-border: rgba(255, 255, 255, 0.12);
  --btn-success-bg: linear-gradient(135deg, #36d58b, #30c07d);

  --field-bg: rgba(10, 8, 35, 0.9);
  --field-border: rgba(151, 143, 255, 0.35);

  --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.85);
  --radius-card: 22px;
  --radius-soft: 16px;
  --radius-pill: 999px;

  --bottom-nav-bg: rgba(5, 3, 24, 0.96);
  --bottom-nav-border: rgba(255, 255, 255, 0.07);

  --link-muted: #c5baff;
}

/* =========================================================
   Theme: Warm Dawn (body.theme-dawn)
   ========================================================= */
body.theme-dawn {
  --bg-main: #140a12;
  --bg-elevated: rgba(41, 21, 36, 0.80);
  --bg-soft: rgba(28, 15, 28, 0.92);
  --glass-border: rgba(255, 212, 196, 0.20);
  --glass-highlight: rgba(255, 232, 210, 0.25);

  --accent: #ff9b7b;
  --accent-soft: #f47a7a;
  --accent-strong: #ffd0a8;
  --accent-success: #48d6a3;

  --text-main: #fff7f4;
  --text-muted: #f2c9c1;
  --text-soft: #c7968f;
  --text-invert: #1a0b0b;

  --btn-primary-bg: linear-gradient(135deg, #ff9b7b, #ffc179);
  --btn-primary-bg-active: linear-gradient(135deg, #f38263, #ffb25d);
  --btn-neutral-bg: rgba(49, 27, 37, 0.92);
  --btn-neutral-border: rgba(255, 233, 210, 0.22);
  --btn-success-bg: linear-gradient(135deg, #5bdd9e, #3fc786);

  --field-bg: rgba(32, 18, 28, 0.92);
  --field-border: rgba(255, 204, 157, 0.6);

  --bottom-nav-bg: rgba(13, 6, 11, 0.97);
  --bottom-nav-border: rgba(255, 213, 195, 0.22);
}

/* =========================================================
   Theme: Deep Night (body.theme-blackout)
   ========================================================= */
body.theme-blackout {
  --bg-main: #000000;
  --bg-elevated: rgba(6, 6, 10, 0.96);
  --bg-soft: rgba(4, 4, 8, 0.96);
  --glass-border: rgba(120, 120, 120, 0.28);
  --glass-highlight: rgba(255, 255, 255, 0.06);

  --accent: #f5f5f5;
  --accent-soft: #d8d8d8;
  --accent-strong: #ffffff;
  --accent-success: #49d88d;

  --text-main: #f5f5f5;
  --text-muted: #b0b0b0;
  --text-soft: #888888;
  --text-invert: #050505;

  --btn-primary-bg: linear-gradient(135deg, #ffffff, #d1d1d1);
  --btn-primary-bg-active: linear-gradient(135deg, #dfdfdf, #b8b8b8);
  --btn-neutral-bg: rgba(18, 18, 18, 0.96);
  --btn-neutral-border: rgba(255, 255, 255, 0.18);
  --btn-success-bg: linear-gradient(135deg, #49d88d, #37bf76);

  --field-bg: rgba(8, 8, 8, 0.96);
  --field-border: rgba(120, 120, 120, 0.65);

  --bottom-nav-bg: rgba(0, 0, 0, 0.98);
  --bottom-nav-border: rgba(80, 80, 80, 0.8);
}

/* =========================================================
   Base
   ========================================================= */
body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: radial-gradient(circle at top, #120b35 0%, var(--bg-main) 55%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(7, 5, 20, 0.96), rgba(4, 2, 12, 0.98));
}

/* =========================================================
   Header (glass)
   ========================================================= */
header {
  padding: 12px 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;

  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.07),
      rgba(255, 255, 255, 0.02)
    );
  background-color: rgba(5, 3, 20, 0.9);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);

  /* FIX: isolate header glass for Chrome */
  backface-visibility: hidden;
  transform: translateZ(0);
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Menu + Back buttons */
.menu-btn,
.back-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 21px;
  padding: 4px 8px;
}

.menu-btn {
  right: 12px;
}

.back-btn {
  left: 10px;
}

/* =========================================================
   Main Container
   ========================================================= */
main {
  flex: 1;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  padding: 12px 16px 80px;
  overflow-x: hidden;
  overflow-y: auto;

  /* FIX: prevent scroll/glass artifacts in Chrome */
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* =========================================================
   Screens (fade-in)
   ========================================================= */
.screen {
  display: none !important;

  /* FIX: smoother, safer transitions */
  will-change: opacity, transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.screen.active {
  display: block !important;
  animation: screenFadeIn 0.22s ease-out;
}

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

/* =========================================================
   Generic Buttons
   ========================================================= */
.btn {
  width: 100%;
  padding: 12px 16px;
  margin: 6px 0;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  display: inline-block;
  cursor: pointer;
  background-image: none;
  background-color: transparent;
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out,
    opacity 0.1s ease-out,
    background 0.15s ease-out,
    border-color 0.15s ease-out;
}

.btn-primary {
  background: var(--btn-primary-bg);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.85);
  color: var(--text-invert);
}

.btn-success {
  background: var(--btn-success-bg);
  border-color: rgba(0, 0, 0, 0.7);
  color: #021208;
}

.btn-neutral {
  background: var(--btn-neutral-bg);
  border-color: var(--btn-neutral-border);
  color: var(--text-main);
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
  width: auto;
  opacity: 0.95;
}

.btn:active {
  transform: translateY(1px) scale(0.985);
  opacity: 0.92;
}

.btn-primary:active {
  background: var(--btn-primary-bg-active);
}

/* =========================================================
   Form Fields
   ========================================================= */
.field {
  margin: 10px 0;
}

.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-main);
  font-size: 15px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(143, 129, 255, 0.4);
}

.field input[type="range"] {
  padding: 0;
  background: transparent;
}

.field .hint {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 3px;
}

/* =========================================================
   Text Styles
   ========================================================= */
h2 {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 2px;
}

.section-title {
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.footer-note {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.4;
}

/* =========================================================
   Log List / Tips Boxes / Worry Box (glass cards)
   ========================================================= */
.log-list,
.tips-box,
.emergency-card,
.worry-box {
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.04),
      rgba(255, 255, 255, 0.01)
    );
  background-color: var(--bg-elevated);
  border-radius: 18px;
  padding: 13px 14px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);

  /* FIX: isolate glass cards */
  backface-visibility: hidden;
  transform: translateZ(0);
}

.log-list {
  margin-top: 8px;
  font-size: 13px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-line;
}

.worry-box {
  font-size: 13px;
  min-height: 60px;
  color: var(--text-main);
}

/* Worry saved card styling */
#worrySavedBox {
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
}

.worry-saved-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.worry-saved-row {
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.worry-saved-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.worry-saved-text {
  font-size: 14px;
  color: var(--text-main);
  white-space: pre-wrap;
}

/* =========================================================
   Journal
   ========================================================= */
.journal-field {
  margin-top: 14px;
}

.journal-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.journal-input {
  width: 100%;
  min-height: 90px;
  padding: 10px;
  border-radius: 11px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-main);
  resize: vertical;
  font-size: 14px;
}

/* ============================
   Journal Ã¢â‚¬â€œ saved reflection box
   ============================ */

#journalSavedBox {
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;          /* no weird bullets on one line */
}

.journal-saved-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.journal-saved-row {
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.journal-saved-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.journal-saved-text {
  font-size: 14px;
  color: var(--text-main);
  white-space: pre-wrap;        /* keep your line breaks inside the text */
}

/* =========================================================
   Routine
   ========================================================= */
.routine-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

.routine-item:last-child {
  border-bottom: none;
}

.routine-item input[type="checkbox"] {
  margin-top: 3px;
}

/* =========================================================
   Home Layout (glass hero & cards)
   ========================================================= */

/* Primary action cards */
.home-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-card-btn {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px 15px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(45, 40, 95, 0.72), rgba(20, 15, 55, 0.85));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
  border: 1px solid var(--glass-border);
  text-align: left;
  cursor: pointer;
  transform: translateY(0);
  transition:
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out,
    background 0.16s ease-out;

  /* FIX: glass button */
  backface-visibility: hidden;
  transform: translateZ(0);
}

.home-card-btn::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.18),
      transparent 55%
    );
  opacity: 0.4;
  pointer-events: none;
}

.home-card-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  z-index: 1;
}

.home-card-title {
  font-size: 15px;
  font-weight: 600;
}

.home-card-subtitle {
  font-size: 13px;
  color: #f1edff;
  line-height: 1.4;
}

.home-card-pill {
  position: relative;
  z-index: 1;
  font-size: 11px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: rgba(7, 4, 34, 0.55);
  border: 1px solid rgba(232, 224, 255, 0.7);
  color: #f7f4ff;
  white-space: nowrap;
}

/* Secondary tools */
.home-secondary {
  margin-top: 26px;
}

.home-secondary-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.home-secondary-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-secondary-btn {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(
      135deg,
      rgba(24, 20, 60, 0.95),
      rgba(14, 11, 34, 0.96)
    );
  color: var(--text-main);
  font-size: 14px;
  text-align: left;
  border: 1px solid var(--glass-border);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  /* FIX: glassy secondary buttons */
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Press feeling for home buttons */
.home-card-btn:active,
.home-secondary-btn:active {
  transform: translateY(2px) scale(0.985);
  opacity: 0.96;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.75);
}

/* =========================================================
   Emergency Night Panel
   ========================================================= */
.emergency-card {
  margin-top: 16px;
}

.emergency-text {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

.emergency-btn-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
/* Emergency Night Ã¢â‚¬â€œ upgraded polish */
.emergency-card {
  margin-top: 16px;
  padding: 18px 16px 20px;
  border-radius: 18px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
  );
  background-color: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}

.emergency-text {
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-line;
  color: var(--text-main);
}

.emergency-btn-row {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}



/* =========================================================
   Mood Tracker
   ========================================================= */
.mood-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.mood-pill {
  flex: 1 1 calc(50% - 8px);
  padding: 10px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-soft);
  color: var(--text-main);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    background 0.15s ease-out,
    border-color 0.15s ease-out,
    transform 0.08s ease-out;
}

.mood-pill .emoji {
  font-size: 18px;
}

.mood-pill:hover {
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

/* selected state Ã¢â‚¬â€œ used by JS class `mood-selected` */
.mood-pill.mood-selected {
  border-color: rgba(255, 255, 255, 0.45);
  background:
    radial-gradient(circle at 0% 0%, rgba(155, 135, 255, 0.5), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.12), transparent 55%),
    linear-gradient(135deg, #5b4fdb, #8c7bff);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 12px 30px rgba(0, 0, 0, 0.65);
  transform: translateY(-1px);
}

/* fallback if any old markup still uses this */
.active-mood {
  background-color: #007aff;
  color: #fff;
  border: 1px solid #007aff;
}



/* =========================================================
   Bottom Navigation (glass dock)
   ========================================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bottom-nav-bg);
  border-top: 1px solid var(--bottom-nav-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  /* FIX: dock glass */
  backface-visibility: hidden;
  transform: translateZ(0);
}

.bottom-nav button {
  flex: 1;
  border: none;
  background: none;
  color: var(--text-soft);
  font-size: 13px;
  padding: 6px 0;
}

.bottom-nav button.active {
  color: var(--accent-strong);
  font-weight: 600;
}

/* =========================================================
   Hamburger Side Menu (glass panel)
   ========================================================= */
.side-menu {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 30;

  /* Helps avoid blur bleed on overlay */
  backface-visibility: hidden;
  transform: translateZ(0);
}

.side-menu.open {
  display: block;
}

.side-menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 72%;
  max-width: 260px;
  height: 100%;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.04),
      rgba(255, 255, 255, 0.01)
    );
  background-color: rgba(5, 5, 12, 0.96);
  border-left: 1px solid var(--glass-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);

  /* FIX: side panel glass */
  backface-visibility: hidden;
  transform: translateZ(0);
}

.side-menu-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.side-menu-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.side-menu button {
  text-align: left;
  border-radius: 11px;
  font-size: 14px;
}

.side-menu-close {
  margin-top: auto;
  background: rgba(15, 15, 20, 0.95);
}

/* =========================================================
   Sounds
   ========================================================= */
.sound-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* =========================================================
   Reminders banner
   ========================================================= */
.reminder-banner {
  background: linear-gradient(
      135deg,
      rgba(190, 170, 255, 0.85),
      rgba(101, 67, 219, 0.9)
    );
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #fdfbff;

  /* FIX: banner is also effected by blur layers sometimes */
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* =========================================================
   Account / Profile
   ========================================================= */
#accountProfileBox {
  line-height: 1.5;
}

#accountProfileBox ul {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
}

/* Space tweaks on account fields */
#screen-account .field {
  margin-top: 10px;
}

/* =========================================================
   Utility
   ========================================================= */
a {
  color: var(--link-muted);
}

hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}


/* =========================================================
   Night help screen (breathing)
   ========================================================= */

.night-help-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Hero intro */
.night-help-hero {
  border-radius: var(--radius-card);
  padding: 18px 16px 20px;
  background:
    radial-gradient(circle at top left, rgba(139, 125, 255, 0.7), transparent 55%),
    radial-gradient(circle at bottom right, rgba(52, 34, 144, 0.9), var(--bg-soft));
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.night-help-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -45px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--glass-highlight), transparent 60%);
  opacity: 0.75;
}

.night-help-kicker {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 6px;
  opacity: 0.95;
}

.night-help-title {
  font-size: 22px;
  font-weight: 600;
}

.night-help-subtitle {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Breathing card */
.night-breath-card {
  border-radius: 18px;
  padding: 14px 14px 16px;
  background:
    linear-gradient(135deg, rgba(23, 18, 60, 0.96), rgba(10, 7, 26, 0.98));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backface-visibility: hidden;
  position: relative;
  z-index: 6;

}

.night-breath-header {
  margin-bottom: 8px;
}

.night-breath-label {
  font-size: 14px;
  font-weight: 600;
}

.night-breath-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.night-breath-notes {
  margin-top: 14px;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.night-breath-notes li {
  list-style: disc;
  line-height: 1.4;
}
/* =========================================================
   Breathing
   ========================================================= */
.breath-main {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.breath-step {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
}

.breath-timer {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Big round breathing button */
.breath-circle-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle at top, var(--accent-soft), var(--accent));
  box-shadow: 0 18px 40px rgba(0,0,0,0.65);
  color: var(--text-invert);
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto 10px;
  cursor: pointer;
  transition: opacity 0.15s ease-out;
  position: relative;

  /* Chrome-friendly: own layer, no blur */
  transform: translateZ(0);
  will-change: transform, box-shadow;
  isolation: isolate;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Glow ring Ã¢â‚¬â€œ this is what pulses */
.breath-circle-btn::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(139,125,255,0.55), transparent 72%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
  will-change: opacity, transform, box-shadow;
}

.breath-circle-btn:active {
  opacity: 0.92;
}

/* Smooth breathing pulse (Calm-style), applied to the GLOW only */
@keyframes breathingPulse {
  0% {
    transform: scale(0.9);
    box-shadow:
      0 0 32px rgba(139,125,255,0.25),
      0 0 70px rgba(139,125,255,0.12);
  }
  50% {
    transform: scale(1.1);
    box-shadow:
      0 0 55px rgba(139,125,255,0.45),
      0 0 110px rgba(139,125,255,0.26);
  }
  100% {
    transform: scale(0.9);
    box-shadow:
      0 0 32px rgba(139,125,255,0.25),
      0 0 70px rgba(139,125,255,0.12);
  }
}

/* Phase classes Ã¢â‚¬â€œ different durations on glow ring */
.breath-circle-btn.inhale::before {
  opacity: 0.9;
  animation: breathingPulse 8s ease-in-out infinite;
}

.breath-circle-btn.exhale::before {
  opacity: 0.9;
  animation: breathingPulse 6s ease-in-out infinite;
}

.breath-circle-btn.pause::before {
  opacity: 0.85;
  animation: breathingPulse 5s ease-in-out infinite;
}

.breath-circle-btn.hold::before {
  opacity: 0.75;
  animation: none;
  transform: scale(1.02);
  box-shadow:
    0 0 40px rgba(139,125,255,0.35),
    0 0 80px rgba(139,125,255,0.18);
}

/* Breathing guide text */
.breath-guide {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-soft);
  min-height: 1.4em;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.breath-guide.visible {
  opacity: 1;
}

/* Screen dimmer while breathing */
.breath-dimmer {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(5, 3, 20, 0.92), rgba(0, 0, 0, 0.98));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-out;
  z-index: 5;
}

.breath-dimmer.active {
  opacity: 1;
}

/* Chrome breathing animation fix: remove blur only on this card */
@supports (-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px)) {
  .night-breath-card {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* Soothing sounds screen layout */
#screen-sounds .btn {
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 500;
}

#screen-sounds #btnRainSound,
#screen-sounds #btnFanSound {
  width: 100%;
  margin-bottom: 10px;
}

#screen-sounds #btnStopSound {
  min-width: 130px;
  padding-inline: 18px;
  margin-top: 12px;
}

#screen-sounds .sound-status {
  margin-top: 14px;
  font-size: 13px;
  text-align: center;
}


/* ================================================
   Soothing Sounds Ã¢â‚¬â€œ Modern Card Layout
   Matches Night Help breathing style
================================================ */

#screen-sounds {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sounds-card {
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(
      135deg,
      rgba(23, 18, 60, 0.96),
      rgba(10, 7, 26, 0.98)
  );
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

#screen-sounds h2 {
  margin-bottom: 4px;
}

#btnRainSound,
#btnFanSound {
  padding: 15px 16px;
  font-size: 16px;
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 30px rgba(0,0,0,0.55);
}

#btnRainSound {
  background: var(--btn-success-bg);
  color: var(--text-invert);
  font-weight: 600;
}

#btnFanSound {
  background: var(--btn-neutral-bg);
}

#btnStopSound {
  margin-top: 12px;
  width: 140px;
  align-self: center;
}

.sound-status {
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-muted);
}
.hidden-audio {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.hidden-audio {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

/* ============================================
   Soothing Sounds Ã¢â‚¬â€œ Upgraded UI
   Matches the breathing card
=============================================== */

/* Card wrapper */
.sounds-card {
  margin-top: 16px;
  padding: 18px 16px 20px;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    rgba(23, 18, 60, 0.92),
    rgba(10, 7, 26, 0.98)
  );
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

/* Button look + spacing */
#screen-sounds .btn {
  border-radius: var(--radius-pill);
  padding: 14px 16px;
  font-size: 16px;
  width: 100%;
  margin-bottom: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.55);
}

/* Stop button smaller */
#btnStopSound {
  width: 140px;
  margin: 12px auto 0;
  display: block;
}

/* Status text */
#soundStatus {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  min-height: 20px;
}

/* Pulse ring while sound is playing */
.sound-pulse-active {
  animation: soundPulse 2.8s ease-in-out infinite;
}

/* Pulse animation */
@keyframes soundPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 22px rgba(145, 130, 255, 0.25);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 42px rgba(145, 130, 255, 0.45);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 22px rgba(145, 130, 255, 0.25);
  }
}
/* ============================================
   Soothing sounds Ã¢â‚¬â€œ active state + pulse
=============================================== */

/* Active sound button */
.sound-btn-active {
  position: relative;
  animation: sound-btn-pulse 2.8s ease-in-out infinite;
  box-shadow:
    0 0 0 0 rgba(145, 130, 255, 0.0),
    0 16px 40px rgba(0, 0, 0, 0.65);
}

/* Slightly brighter text for active button */
.sound-btn-active span,
.sound-btn-active {
  color: var(--text-invert);
}

/* Pulse animation */
@keyframes sound-btn-pulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 0 0 0 rgba(145, 130, 255, 0.0),
      0 16px 40px rgba(0, 0, 0, 0.65);
  }
  50% {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
      0 0 18px 6px rgba(145, 130, 255, 0.35),
      0 20px 50px rgba(0, 0, 0, 0.85);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 0 0 0 rgba(145, 130, 255, 0.0),
      0 16px 40px rgba(0, 0, 0, 0.65);
  }
}

/* Status text made a touch clearer */
#soundStatus {
  margin-top: 18px;
  font-size: 14px;
  text-align: center;
  color: var(--text-muted);
  min-height: 20px;
}
/* ============================================
   Soothing sounds Ã¢â‚¬â€œ richer rows (per button)
   Uses existing .btn-success / .btn-neutral
=============================================== */

/* Base spacing for all rows on this screen */
#screen-sounds .btn {
  margin-bottom: 12px;
}

/* Top rain row Ã¢â‚¬â€ make it feel more 3D and primary */
#screen-sounds #btnRainSound.btn-success {
  background:
    linear-gradient(135deg, #3be593, #29c975);
  border-color: rgba(0, 0, 0, 0.7);
  color: var(--text-invert);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 18px 40px rgba(0, 0, 0, 0.85);
}

/* Neutral rows (fan, ocean, forest, brown, stop) */
#screen-sounds .btn-neutral {
  background: linear-gradient(
      145deg,
      rgba(40, 30, 70, 0.72),
      rgba(18, 12, 40, 0.96)
  );
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.16),
    0 12px 26px rgba(0, 0, 0, 0.8);
  color: var(--text-main);
}

/* Slight lift on hover / tap (desktop mostly) */
#screen-sounds .btn-neutral:hover,
#screen-sounds #btnRainSound:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    0 16px 32px rgba(0, 0, 0, 0.9);
}

/* Active sound (combined with .sound-btn-active) */
#screen-sounds .sound-btn-active {
  background: linear-gradient(
      145deg,
      rgba(130, 110, 255, 0.9),
      rgba(90, 70, 230, 0.98)
  );
  border-color: rgba(180, 160, 255, 0.7);
  color: #ffffff;
}

/* Make stop row feel a bit "secondary" */
#screen-sounds #btnStopSound {
  max-width: 220px;
  margin-inline: auto;
  opacity: 0.95;
}

/* ============================================
   Soothing sounds Ã¢â‚¬â€œ theme-specific rows
=============================================== */

/* Warm Dawn theme Ã¢â‚¬â€œ warmer plum rows */
body.theme-dawn #screen-sounds .btn-neutral {
  background: linear-gradient(
      145deg,
      rgba(64, 34, 62, 0.85),
      rgba(37, 17, 40, 0.98)
  );
  border-color: rgba(255, 190, 165, 0.30);
  box-shadow:
    inset 0 1px 1px rgba(255, 230, 215, 0.25),
    0 12px 26px rgba(0, 0, 0, 0.85);
  color: var(--text-main);
}

/* Deep Night theme Ã¢â‚¬â€œ cooler, inky rows */
body.theme-blackout #screen-sounds .btn-neutral {
  background: linear-gradient(
      145deg,
      rgba(18, 20, 40, 0.92),
      rgba(5, 6, 18, 0.98)
  );
  border-color: rgba(140, 140, 200, 0.30);
  box-shadow:
    inset 0 1px 1px rgba(220, 220, 255, 0.08),
    0 12px 26px rgba(0, 0, 0, 0.90);
  color: var(--text-main);
}

/* Active sound button per theme */

/* Warm Dawn active */
body.theme-dawn #screen-sounds .sound-btn-active {
  background: linear-gradient(
      145deg,
      rgba(255, 158, 122, 0.9),
      rgba(243, 119, 122, 0.95)
  );
  border-color: rgba(255, 210, 168, 0.8);
  color: #220f0f;
}

/* Deep Night active */
body.theme-blackout #screen-sounds .sound-btn-active {
  background: linear-gradient(
      145deg,
      rgba(112, 130, 255, 0.95),
      rgba(76, 92, 210, 0.98)
  );
  border-color: rgba(176, 188, 255, 0.85);
  color: #ffffff;
}


/* =========================================================
   Affirmations Screen Ã¢â‚¬â€œ Calm Cards Layout
========================================================= */

.affirm-card {
  margin-top: 14px;
  padding: 16px 16px 18px;
  border-radius: 18px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
    );
  background-color: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  line-height: 1.55;
  font-size: 14px;
  color: var(--text-main);
  white-space: pre-line;

  /* prevent chrome blur bleed */
  backface-visibility: hidden;
  transform: translateZ(0);
}

.affirm-note {
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.5;
}

/* individual list points (soft separators) */
.affirm-card .affirm-line {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.affirm-card .affirm-line:last-child {
  border-bottom: none;
}

/* Shuffle button (optional) */
#affirmShuffleBtn {
  margin-top: 20px;
  width: 180px;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  text-align: center;
  border: 1px solid var(--glass-border);
  background: var(--btn-neutral-bg);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.65);
  align-self: center;
}
/* ============================================
   Affirmations Ã¢â‚¬â€œ Blackout theme adjustments
=============================================== */

body.theme-blackout .affirm-card {
  background: linear-gradient(
      135deg,
      rgba(15, 15, 28, 0.85),
      rgba(5, 5, 18, 0.96)
  );
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 34px rgba(0,0,0,0.9);
}

/* Softer lines in blackout theme */
body.theme-blackout .affirm-card .affirm-line {
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

/* Text slightly brighter in blackout mode */
body.theme-blackout .affirm-card {
  color: rgba(230, 230, 245, 0.92);
}

body.theme-blackout .affirm-note {
  color: rgba(180, 180, 220, 0.6);
}

/* Even spacing between rows */
.affirm-line {
  padding: 10px 0;
}

.affirm-line:first-child {
  padding-top: 14px;
}

.affirm-line:last-child {
  padding-bottom: 14px;
}

/* =========================================================
   Single Affirmation Mode
========================================================= */

.affirm-single-card {
  margin-top: 18px;
  padding: 20px 18px 24px;
  border-radius: 20px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
  );
  background-color: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);

  font-size: 16px;
  line-height: 1.55;
  color: var(--text-main);
  min-height: 80px;
  display: flex;
  align-items: center;
  text-align: left;

  opacity: 0;
  animation: fadeInAffirm 0.6s ease forwards;
}

/* Fade animation */
@keyframes fadeInAffirm {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Blackout theme polish */
body.theme-blackout .affirm-single-card {
  background: linear-gradient(
      135deg,
      rgba(15, 15, 28, 0.85),
      rgba(5, 5, 18, 0.96)
  );
  border-color: rgba(255, 255, 255, 0.06);
  color: rgba(230, 230, 245, 0.92);
}

/* Dawntheme polish */
body.theme-dawn .affirm-single-card {
  background: linear-gradient(
      135deg,
      rgba(58, 40, 82, 0.65),
      rgba(35, 22, 55, 0.85)
  );
  border-color: rgba(255, 190, 165, 0.25);
  color: rgba(245, 235, 245, 0.95);
}


.fadeIn {
  animation: fadeInEmergency 0.45s ease-out forwards;
}

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


.screen-hero {
    background: linear-gradient(135deg, #5b3bea, #7c4dff);
    padding: 18px 20px;
    border-radius: 18px;
    margin-bottom: 18px;
    color: white;
}

.screen-hero-kicker {
    font-size: 12px;
    letter-spacing: 1.4px;
    opacity: 0.85;
    text-transform: uppercase;
}

.screen-hero-title {
    font-size: 26px;
    margin: 6px 0 4px;
    font-weight: 600;
}

.screen-hero-subtitle {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
}


.side-menu-hero {
    padding: 24px 16px 20px;
    background: linear-gradient(135deg, #1d1f27 0%, #2d3040 100%);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.side-menu-hero-kicker {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9aa0b5;
    margin-bottom: 4px;
}

.side-menu-hero-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.side-menu-hero-subtitle {
    font-size: 0.85rem;
    line-height: 1.35;
    color: #b4b9c9;
    margin: 0;
}

/* =========================================================
   Home Ã¢â‚¬â€œ tone down purple intensity
   ========================================================= */

/* Primary cards on Home */
#screen-home .home-card-btn {
  background:
    linear-gradient(
      135deg,
      rgba(28, 25, 60, 0.9),
      rgba(10, 8, 30, 0.96)
    );
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.85);
}

/* Secondary buttons on Home ("More tools") */
#screen-home .home-secondary-btn {
  background:
    linear-gradient(
      135deg,
      rgba(18, 16, 40, 0.9),
      rgba(8, 6, 22, 0.95)
    );
  border-color: rgba(255, 255, 255, 0.08);
}

/* Slightly more breathing room under the hero on Home only */
#screen-home .screen-hero {
  margin-bottom: 14px;
}

/* =========================================================
   Home Ã¢â‚¬â€œ improve card text contrast
   ========================================================= */

/* Primary cards ("Night help", "Soothing sounds", etc.) */
#screen-home .home-card-title {
  color: #fdfbff;          /* brighter white */
  font-weight: 600;
}

#screen-home .home-card-subtitle {
  color: rgba(244, 241, 255, 0.88);  /* soft but readable */
}

/* Secondary tools ("Track todayÃ¢â‚¬â„¢s mood", etc.) */
#screen-home .home-secondary-btn {
  color: #fdfbff;
}

#screen-home .home-secondary-btn span {
  color: inherit;
}

/* Bottom nav labels Ã¢â‚¬â€œ a touch brighter so theyÃ¢â‚¬â„¢re clearer too */
.bottom-nav button {
  color: var(--text-soft);
}

.bottom-nav button.active {
  color: var(--accent-strong);
}


/* =========================================================
   Tips & kindness screen Ã¢â‚¬â€œ readable bullets
   ========================================================= */

#screen-tips .tips-box {
  margin-top: 14px;
  padding: 16px 16px 18px;
  border-radius: 18px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
  );
  background-color: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

/* Bullet list */
#screen-tips .tips-box ul {
  margin: 4px 0 0;
  padding-left: 18px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 8px;              /* space between bullets */
}

#screen-tips .tips-box li {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-main);
}

/* Footnote inside the card */
#screen-tips .tips-footnote {
  margin-top: 14px;
  padding-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Small tweak so the hero + card feel consistent */
#screen-tips .screen-hero {
  margin-bottom: 16px;
}

/* =========================================================
   Weekly Summary Card Ã¢â‚¬â€œ Matches tips/about cards
   ========================================================= */
.summary-card {
  padding: 16px 16px 18px;
  border-radius: 18px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
  );
  background-color: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);

  font-size: 14px;
  color: var(--text-main);
  line-height: 1.55;

  /* spacing between rows */
  display: flex;
  flex-direction: column;
  gap: 8px;

  /* prevent blur bleeding */
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* label/value style */
.summary-row strong {
  color: var(--accent-strong);
  font-weight: 600;
}

/* small spacing before metrics blocks */
.summary-block {
  margin-top: 4px;
}

/* Shared bullet layout for tips/emergency/about */
.tips-list {
  margin: 0;
  padding-left: 18px;
  list-style-type: disc;
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.6;
}

.tips-list li + li {
  margin-top: 6px;
}

/* Highlighted call-to-action line */
.tips-cta {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-soft);
}


/* =========================================================
   About Screen Ã¢â‚¬â€œ readable, calm layout
   ========================================================= */

#screen-about .about-box {
  margin-top: 14px;
  padding: 16px 16px 20px;
  border-radius: 18px;

  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
  );
  background-color: var(--bg-elevated);

  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

#screen-about .about-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-strong);
  margin-bottom: 6px;
}

#screen-about ul {
  padding-left: 18px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#screen-about ul li {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.55;
}

#screen-about .about-footnote {
  margin-top: 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
}

/* =========================================================
   Export / Backup Ã¢â‚¬â€œ glass cards
   ========================================================= */

#screen-export .export-card {
  margin-top: 14px;
  padding: 16px 16px 18px;
  border-radius: 18px;

  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
  );
  background-color: var(--bg-elevated);

  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);

  /* keeps stack feeling airy */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#screen-export .export-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-strong);
  margin-bottom: 6px;
}

#screen-export .btn {
  margin-top: 4px;
}

#screen-export .export-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
}



/* =========================================================
   Weekly summary Ã¢â‚¬â€œ stats card
   ========================================================= */

#screen-summary .summary-card {
  margin-top: 14px;
  padding: 16px 16px 18px;
  border-radius: 18px;

  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.015)
  );
  background-color: var(--bg-elevated);

  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);

  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-line;          /* keep your line breaks */
}

/* If you ever inject HTML with <strong> labels, keep them clear */
#screen-summary .summary-card strong {
  font-weight: 600;
  color: var(--text-main);
}

/* Make the whole overlay scrollable on small screens */
#sideMenu {
  /* existing styles ... */
  overflow-y: auto;                 /* allow vertical scroll */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;              /* instead of none so scrolling works */
}

/* Make just the panel scroll if content is long */
.side-menu-panel {
  /* existing styles ... */
  max-height: calc(100vh - 32px);   /* keep it within the screen */
  overflow-y: auto;                 /* scroll inside the panel */
}
/* Sleep log recent entries card Ã¢â‚¬â€œ make it more readable */
.log-list {
  margin-top: 8px;
  background: var(--card-bg-alt);
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid var(--card-border-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  color: var(--text-soft);
  max-height: 220px;
  overflow-y: auto;
}

/* Slightly tighten fields when theyÃ¢â‚¬â„¢re inside a tips-box (like this screen) */
#screen-log .field {
  margin: 8px 0;
}

/* ----- CUSTOM INPUT STYLING FOR DATE & TIME PICKERS ----- */

input[type="date"],
input[type="time"],
select {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-normal);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 16px;
  width: 100%;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

/* Make sure calendar/time icons invert to light mode */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.7);
  cursor: pointer;
}

/* Remove extra padding chrome safari add */
input[type="date"]::-webkit-date-and-time-value {
  color: var(--text-normal);
}

/* On focus */
input[type="date"]:focus,
input[type="time"]:focus,
select:focus {
  outline: none;
  border: 1px solid var(--brand-purple);
  background-color: rgba(255, 255, 255, 0.12);
}
/* --- Sleep Systems Scroll --- */
.sleep-systems-scroll {
  margin-top: 14px;
  margin-bottom: 10px;
}

.systems-title {
  font-size: 1rem;
  opacity: .8;
  margin-bottom: 6px;
}

.systems-row {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 6px;

  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.system-card {
  display: flex;
  flex-direction: row;       /* icon + text side by side */
  align-items: center;       /* vertical alignment fixed */
  gap: 10px;

  min-width: 160px;
  padding: 10px 16px;
  border-radius: 14px;
  background: linear-gradient(145deg, #6b4cff, #5126d8);
  color: white;
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .15s ease;

  scroll-snap-align: center;
  text-align: left;          /* no weird centering */
}

.system-card:hover {
  transform: scale(1.05);
}

.system-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 auto;            /* fixed icon size */
}

.system-card span {
  font-size: 0.9rem;
  line-height: 1.2;
  display: block;
}

.systems-hint {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: -2px;
  margin-bottom: 6px;
}

/* --- Sleep science modal --- */

.science-modal {
  position: fixed;
  inset: 0; /* top:0 right:0 bottom:0 left:0 */
  background: rgba(0, 0, 0, 0.65);
  display: none;                /* hidden until JS sets flex */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.science-panel {
  max-width: 420px;
  width: 90%;
  background: radial-gradient(circle at top left, #7a5cff, #1a102e);
  border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  color: #f7f0ff;
  font-size: 0.9rem;
  line-height: 1.5;
}

.science-panel h2#scienceTitle {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.science-panel p#scienceText {
  white-space: pre-wrap; /* respect \n\n from JS */
  margin-bottom: 14px;
}

#scienceClose {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 8px 0;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.25);
  color: #f7f0ff;
  cursor: pointer;
}
#scienceClose:hover {
  background: rgba(0, 0, 0, 0.4);
}


.science-tools {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.science-tool-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.25);
  color: #f7f0ff;
  cursor: pointer;
}

.science-tool-btn:hover {
  background: rgba(0, 0, 0, 0.4);
}

.science-tools-label {
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  opacity: 0.8;
}
.science-panel p {
  font-size: 0.9rem;
  line-height: 1.45;
}

/* --- System tags on tool screens --- */
.system-tags-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.system-tag {
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  opacity: 0.9;
}


/* --- Premium Plan Card --- */
.plan-card{
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.plan-header{
  display:flex;
  gap:12px;
  align-items:flex-start;
  justify-content:space-between;
}

.plan-kicker{
  font-size:.78rem;
  opacity:.75;
  letter-spacing:.02em;
  margin-bottom:4px;
}

.plan-title{
  display:flex;
  gap:8px;
  align-items:center;
  font-size:1.05rem;
  font-weight:700;
}

.plan-badge{
  font-size:.7rem;
  padding:3px 8px;
  border-radius:999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.14);
  opacity:.95;
}

.plan-sub{
  font-size:.92rem;
  opacity:.85;
  margin-top:6px;
  max-width: 420px;
}

.plan-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:12px;
}

.plan-item{
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.08);
}

.plan-item-title{
  font-size:.78rem;
  opacity:.75;
  margin-bottom:6px;
}

.plan-item-value{
  font-size:1rem;
  font-weight:700;
  margin-bottom:2px;
}

.plan-item-hint{
  font-size:.78rem;
  opacity:.65;
}

.plan-note{
  margin-top:12px;
  font-size:.86rem;
  opacity:.75;
}

/* small screens */
@media (max-width: 360px){
  .plan-grid{ grid-template-columns: 1fr; }
  .plan-header{ flex-direction: column; align-items:flex-start; }
  #upgradeBtn{ width:100%; }
}

.insight-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.insight-chip {
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #eaeaf0;
  white-space: nowrap;
}

.insight-chip.positive {
  background: rgba(120,200,160,0.12);
  border-color: rgba(120,200,160,0.35);
}

.insight-chip.warning {
  background: rgba(220,160,120,0.12);
  border-color: rgba(220,160,120,0.35);
}

.insight-chip.neutral {
  opacity: 0.85;
}

/* ===========================
   HOTFIX: missing tokens + hero respects theme
   Paste at END of CSS
=========================== */

/* Define tokens that were referenced later but never declared */
:root{
  --card-bg-alt: var(--bg-elevated);
  --card-border-soft: var(--glass-border);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --text-normal: var(--text-main);
  --brand-purple: var(--accent);
}

/* Stop the hard-coded purple hero from overriding themes */
.screen-hero{
  background:
    radial-gradient(circle at 0% 0%, rgba(255,255,255,0.12), transparent 55%),
    linear-gradient(135deg, rgba(90,70,230,0.55), rgba(20,15,55,0.75));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--text-main);
}

/* Keep blackout/dawn readable without forcing purple */
body.theme-blackout .screen-hero{
  background:
    radial-gradient(circle at 0% 0%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(135deg, rgba(18,18,18,0.92), rgba(0,0,0,0.96));
}

body.theme-dawn .screen-hero{
  background:
    radial-gradient(circle at 0% 0%, rgba(255,235,220,0.14), transparent 60%),
    linear-gradient(135deg, rgba(255,155,123,0.35), rgba(41,21,36,0.85));
}

/* Fix: log-list should not rely on missing vars (and avoid double-styling) */
.log-list{
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-family: var(--font-mono);
}
/* ===========================
   HEADER: stable layout with status pills
   Paste at END of CSS
=========================== */

/* Make header a flex row but keep absolute buttons */
header{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Title stays centered and doesn't collide */
#headerTitle{
  flex: 1;
  min-width: 0;
  text-align: center;
  padding-inline: 64px; /* reserves space for back/menu buttons */
}

/* Keep buttons above layout and clickable */
.menu-btn,
.back-btn{
  z-index: 2;
}

/* Pills sit to the right, before the menu button */
.status-pills{
  position: absolute;
  right: 52px;  /* leaves room for Ã¢ËœÂ° button on far right */
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 1;
  max-width: 45vw;
  overflow: hidden;
}

/* Pills: compact + truncation safe */
.status-pills .pill{
  font-size: .78rem;
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.92);
  white-space: nowrap;
  max-width: 22vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-auth{ font-weight: 700; }
.pill-sync{ opacity: .95; }

/* State classes (status.js should toggle these) */
.pill--ok   { background: rgba(80, 200, 140, .14); border-color: rgba(80, 200, 140, .25); }
.pill--warn { background: rgba(255, 200, 90,  .14); border-color: rgba(255, 200, 90,  .25); }
.pill--err  { background: rgba(255, 120, 120, .14); border-color: rgba(255, 120, 120, .25); }
.pill--info { background: rgba(120, 170, 255, .14); border-color: rgba(120, 170, 255, .25); }

/* On small screens, hide pills to prevent header collisions */
@media (max-width: 420px){
  .status-pills{ display: none; }
  #headerTitle{ padding-inline: 52px; }
}

.pill-plan.is-premium { font-weight: 800; }

/* =========================================================
   Responsive hardening (v2)
   - Prevent header pill collisions on narrow desktop windows
   - Improve comfort on very large screens
   ========================================================= */

/* Narrow windows (including desktop split-view): hide pills earlier */
@media (max-width: 720px){
  .status-pills{ display: none; }
  #headerTitle{ padding-inline: 52px; }
}

/* Mid widths: keep pills but tighten their footprint */
@media (min-width: 721px) and (max-width: 980px){
  .status-pills{ max-width: 38vw; }
  .status-pills .pill{ max-width: 18vw; padding: 6px 9px; font-size: .76rem; }
}

/* Big screens: allow slightly wider content (keeps it premium) */
@media (min-width: 900px){
  main{ max-width: 980px; }
}

/* Make horizontal chip rows easier to scroll with mouse/trackpad */
.systems-row{
  scrollbar-width: none; /* Firefox */
}
.systems-row::-webkit-scrollbar{ height: 0; }

/* ==== Header pills: keep Account visible on small screens ==== */
@media (max-width: 720px){
  /* v2 hid all pills; keep the group visible again */
  .status-pills{ display:flex; right:48px; max-width:52vw; }

  /* keep ONLY the account pill (hide Synced + Free) */
  .status-pills .pill-sync,
  .status-pills .pill-plan{ display:none; }

  /* compact + allow truncation if needed */
  .status-pills .pill{
    max-width:50vw;
    padding:6px 10px;
    font-size:.78rem;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  /* keep title safe from menu/pill overlap */
  #headerTitle{ padding-inline:52px; }
}

@media (max-width: 420px){
  .status-pills{ right:46px; max-width:62vw; }
  .status-pills .pill{ max-width:60vw; font-size:.76rem; }
}

/* =========================================================
   FINAL OVERRIDES â€” responsive + sleep-friendly (2026-01-26)
   Paste-last pack to standardize ALL screens.
   ========================================================= */

/* ---- Layout spine tokens ---- */
:root{
  --content-max: 1120px;
  --content-pad: clamp(14px, 2.6vw, 22px);
  --nav-h: 64px;
  --header-h: 56px;

  /* Sleep-first type scale */
  --fs-body: 15.5px;
  --fs-body-lg: 16.5px;
  --fs-title: 18px;
  --fs-hero: clamp(24px, 3vw, 30px);
  --lh-body: 1.58;

  /* Softer night contrast (keeps your palette, reduces glare) */
  --text-main-soft: rgba(255,255,255,.92);
  --text-muted-soft: rgba(255,255,255,.72);
  --text-soft-soft: rgba(255,255,255,.56);
}

/* ---- Global typography tuning ---- */
body{
  font-size: var(--fs-body) !important;
  line-height: var(--lh-body) !important;
  color: var(--text-main-soft) !important;
}

p{ color: var(--text-muted-soft); }

.small, .muted, .hint, .helper, .footer-note{
  color: var(--text-soft-soft) !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
}

/* Headings calmer + consistent */
h1,h2,h3{
  color: var(--text-main-soft) !important;
  letter-spacing: -0.01em;
}

header h1, #headerTitle{
  font-size: 16px !important;
  letter-spacing: 0.10em !important;
  text-transform: uppercase;
  font-weight: 650 !important;
}

/* ---- ONE consistent container for every screen ---- */
main{
  width: min(100%, var(--content-max)) !important;
  max-width: none !important;             /* kills old max-width:600 */
  margin-inline: auto !important;

  padding-left: var(--content-pad) !important;
  padding-right: var(--content-pad) !important;

  /* keep content above bottom nav */
  padding-bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)) !important;

  /* Keep your current scrolling model */
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Screens should not impose their own widths */
.screen, .card, .tips-box, .log-list, .export-card, .plan-card, .sounds-card{
  width: 100%;
  max-width: 100%;
}

/* ---- Header aligns with container rhythm (still full-bleed glass) ---- */
header{
  padding-left: var(--content-pad) !important;
  padding-right: var(--content-pad) !important;
}

/* ---- Calm/Home hero readability (uses your existing classes) ---- */
.screen-hero-title{ font-size: var(--fs-hero) !important; line-height: 1.18 !important; }
.screen-hero-subtitle{
  font-size: var(--fs-body-lg) !important;
  line-height: 1.62 !important;
  color: var(--text-muted-soft) !important;
  max-width: 62ch;
}

/* ---- Primary action cards: symmetric grid across breakpoints ---- */
.home-actions{
  display: grid !important;
  gap: 16px !important;
  grid-template-columns: 1fr !important;
}

@media (min-width: 640px){
  .home-actions{ grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
}
@media (min-width: 980px){
  .home-actions{ grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
}

.home-card-btn{
  border-radius: 18px !important;
  min-height: 96px !important;
  padding: 16px !important;
  border: 1px solid var(--glass-border) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.home-card-title{
  font-size: 18px !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em;
}

.home-card-subtitle{
  font-size: 15px !important;
  color: var(--text-muted-soft) !important;
  line-height: 1.6 !important;
}

.home-card-pill{
  font-size: 13px !important;
  color: var(--text-muted-soft) !important;
  border: 1px solid rgba(255,255,255,.14) !important;
}

/* ---- Secondary row: always symmetric ---- */
.home-secondary-grid{
  display: grid !important;
  gap: 16px !important;
  grid-template-columns: 1fr !important;
}
@media (min-width: 720px){
  .home-secondary-grid{ grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
}
.home-secondary-btn{
  border-radius: 18px !important;
  padding: 14px 14px !important;
  font-size: 16px !important;
  border: 1px solid var(--glass-border) !important;
}

/* ---- â€œHow sleep worksâ€ tiles: grid, quieter than actions ---- */
.systems-row{
  display: grid !important;
  gap: 12px !important;
  grid-template-columns: repeat(2, minmax(0,1fr)) !important;
}
@media (min-width: 720px){
  .systems-row{ grid-template-columns: repeat(4, minmax(0,1fr)) !important; }
}

.system-card{
  border-radius: 18px !important;
  border: 1px solid var(--glass-border) !important;
  box-shadow: none !important;
  filter: saturate(.92) !important;
  font-size: 14.5px !important;
  color: var(--text-muted-soft) !important;
}

/* ---- Bottom nav: responsive dock (centered on desktop, full-width on small phones) ---- */
.bottom-nav{
  height: var(--nav-h) !important;
  padding-bottom: env(safe-area-inset-bottom) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;

  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) translateZ(0) !important;

  width: min(100%, var(--content-max)) !important;
  padding-left: var(--content-pad) !important;
  padding-right: var(--content-pad) !important;

  border-top-left-radius: 18px !important;
  border-top-right-radius: 18px !important;
}

.bottom-nav button{
  flex: 1 1 0 !important;
  min-width: 0 !important;
  font-size: 14px !important;
  color: var(--text-soft-soft) !important;
}

.bottom-nav button.active{
  color: var(--text-main-soft) !important;
  font-weight: 650 !important;
}

@media (max-width: 420px){
  .bottom-nav{
    left: 0 !important;
    transform: none !important;
    width: 100% !important;
    border-radius: 0 !important;
  }
}

/* ---- Side menu: consistent width ---- */
.side-menu-panel{
  width: min(420px, 92vw) !important;
  max-width: none !important;
  border-radius: 18px !important;
}

/* ---- Accessibility: reduce motion ---- */
@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

:focus-visible{
  outline: 2px solid rgba(180,140,255,.40);
  outline-offset: 3px;
}

/* ===============================
   Affirmations screen polish
   Patch-03A (fix)
   =============================== */

#screen-affirmations #affirmShuffleBtn {
  display: block;
  margin: 24px auto 0 auto; /* centered */
  width: fit-content;       /* keeps it nicely sized */
}

/* Optional: slightly nicer tap target on mobile */
@media (max-width: 480px) {
  #screen-affirmations #affirmShuffleBtn {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* Patch: Sleep Log save button only */
#screen-log #sleepSaveBtn{
  width: min(520px, 100%);
  display: block;
  margin: 12px auto 0 auto; /* centered */
}

/* ============================
   PATCH — Worry screen buttons
   Scope: #screen-worry only
   ============================ */

#screen-worry #worrySaveBtn{
  display: block;
  width: min(560px, 100%);     /* nice on desktop, still full on small */
  margin: 14px auto 0 auto;    /* centered */
}

#screen-worry #worryClearBtn{
  display: block;
  width: fit-content;          /* small pill, not full-width */
  margin: 10px auto 0 auto;    /* centered under Save */
  padding-left: 16px;
  padding-right: 16px;
}

/* Optional: keep Save full-width on very small phones */
@media (max-width: 420px){
  #screen-worry #worrySaveBtn{
    width: 100%;
  }
}

/* ============================
   Wind-down routine grid
   ============================ */

#screen-routine .routine-grid{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* 2 columns on wider screens */
@media (min-width: 720px){
  #screen-routine .routine-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#screen-routine .routine-tile{
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.04),
    rgba(255,255,255,0.01)
  );
  background-color: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.12s ease-out, border-color 0.12s ease-out, opacity 0.12s ease-out;
}

#screen-routine .routine-tile:active{
  transform: translateY(1px) scale(0.99);
  opacity: 0.95;
}

/* routine.js toggles .is-done */
#screen-routine .routine-tile.is-done{
  border-color: rgba(180,160,255,0.55);
  background:
    radial-gradient(circle at 0% 0%, rgba(155,135,255,0.45), transparent 60%),
    linear-gradient(135deg, rgba(95,75,235,0.55), rgba(20,15,55,0.85));
}

/* Center reset button */
#screen-routine .routine-reset{
  display: block;
  width: fit-content;
  margin: 16px auto 0;
  padding-left: 18px;
  padding-right: 18px;
}

#screen-routine .routine-tile.is-done{
  opacity: 0.9;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}


@media (max-width: 420px){
  #screen-routine .routine-tile{
    padding: 16px;
    border-radius: 20px;
  }
}


/* ============================
   PATCH — Journal layout polish
   Scope: #screen-journal only
   ============================ */

#screen-journal .journal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Desktop: two-column reflection */
@media (min-width: 900px) {
  #screen-journal .journal-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

/* Journal: center + reduce Save button width (like other centered buttons) */
#screen-journal #journalSaveBtn{
  display: block;
  width: min(520px, 100%);  /* caps width on desktop */
  margin: 18px auto 0;      /* centered */
}

/* On small phones, keep it full-width for usability */
@media (max-width: 520px){
  #screen-journal #journalSaveBtn{
    width: 100%;
  }
}


/* Slightly softer spacing below saved box */
#screen-journal #journalSavedBox {
  margin-top: 20px;
}


/* Two-column field row (desktop), stacks on mobile */
.field-row-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 720px){
  .field-row-2{
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Allows a field to span across the 2-column grid */
.field-span-2{
  grid-column: 1 / -1;
}


/* ===============================
   EXPORT / BACKUP — button sizing
   Scope: #screen-export only
   =============================== */

#screen-export .btn {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 420px; /* matches preferred centered size */
}

/* Slight spacing between stacked buttons */
#screen-export .btn + .btn {
  margin-top: 10px;
}

/* Desktop: keep them centered & tidy */
@media (min-width: 768px) {
  #screen-export .btn {
    max-width: 420px;
  }
}


/* ===============================
   REMINDERS — grid layout
   Scope: #screen-reminders only
   =============================== */

#screen-reminders .reminders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 12px;
}

#screen-reminders .reminder-card {
  background: var(--card-bg, rgba(255,255,255,0.04));
  border-radius: 16px;
  padding: 14px;
}

#screen-reminders .reminder-title {
  font-weight: 600;
  margin-bottom: 10px;
}

#screen-reminders .reminder-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-bottom: 4px;
}

/* Desktop: two-column */
@media (min-width: 900px) {
  #screen-reminders .reminders-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Center reset button (same pattern as other screens) */
#screen-reminders #remResetBtn {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 320px;
}

/* ===============================
   REMINDERS — active state glow
   =============================== */

#screen-reminders .reminder-card {
  border: 1px solid rgba(255,255,255,0.08);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

/* When checkbox inside card is checked */
#screen-reminders .reminder-card:has(input[type="checkbox"]:checked) {
  border-color: rgba(138, 117, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(138, 117, 255, 0.25),
    0 6px 20px rgba(138, 117, 255, 0.18);
}

/* Optional: slightly brighter title when active */
#screen-reminders
.reminder-card:has(input[type="checkbox"]:checked)
.reminder-title {
  color: #d6ccff;
}

/* ===============================
   ACCOUNT / PLAN — layout polish
   =============================== */

/* Make the account profile box read more like a left-aligned dashboard */
#screen-account #accountProfileBox {
  text-align: left;
}

/* Better spacing + consistent list rhythm */
#screen-account #accountProfileBox ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
#screen-account #accountProfileBox li {
  margin: 4px 0;
}

/* Plan header: stack on mobile, split on desktop */
#screen-account .plan-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

#screen-account .plan-header > div {
  flex: 1 1 auto;
  min-width: 0;
}

/* Upgrade button: match your preferred centered desktop size */
#screen-account #upgradeBtn {
  width: 100%;
  max-width: 560px;   /* tweak 520–620 if you want */
  margin: 12px auto 0;
  display: block;
}

/* On wider screens: keep plan text on left, button centered within its own column */
@media (min-width: 860px) {
  #screen-account .plan-header {
    align-items: center;
  }

  #screen-account #upgradeBtn {
    width: auto;
    min-width: 360px;
    max-width: 520px;
    margin: 0;              /* don't push down */
  }

  /* Put the button in a right-side column but keep it visually centered */
  #screen-account .plan-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

/* ===============================
   Preferences grid + save button
   =============================== */

#screen-account .prefs-grid{
  display: grid;
  gap: 14px;
}

/* 2-column on desktop, 1-column on mobile */
@media (min-width: 860px){
  #screen-account .prefs-grid{
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  /* let the tips row span full width (feels nicer) */
  #screen-account .prefs-check{
    grid-column: 1 / -1;
  }
}

#screen-account .prefs-check{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

#screen-account .prefs-check-label{
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

#screen-account .prefs-check-title{
  font-weight: 600;
}

#screen-account .prefs-check-hint{
  font-size: 0.92em;
  opacity: 0.75;
}

/* nicer checkbox sizing */
#screen-account .prefs-check input[type="checkbox"]{
  transform: scale(1.05);
}

/* Save button: centered preferred size (like your other centered buttons) */
#screen-account #btnSaveSettings{
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.pref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start; /* 👈 this is the key */
}

/* Mobile */
@media (max-width: 720px) {
  .pref-grid {
    grid-template-columns: 1fr;
  }
}

/* ===============================
   AUTH — clean layout (final)
   =============================== */

#screen-auth .auth-actions{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center; /* keeps row visually centered */
}

/* Stop global .btn { width:100% } from breaking this row */
#screen-auth .auth-actions .btn{
  width: auto;
  margin: 0;
}

/* Log in + Create: same width, aligned, centered */
#screen-auth #btnLogin,
#screen-auth #btnSignup{
  flex: 1 1 320px;         /* equal width, wraps nicely */
  max-width: 560px;        /* your preferred desktop cap */
}





/* AUTH: force a line break after the first row (Login + Signup) */
#screen-auth .auth-actions::after{
  content: "";
  flex: 0 0 100%;
  height: 0;
}

/* AUTH: Logout = small centered pill on the next line */
#screen-auth .auth-actions {
  flex: 0 0 auto !important;      /* undo any 100% basis from earlier */
  flex-basis: auto !important;
  width: fit-content !important;  /* shrink to text */
  max-width: none !important;

  display: inline-flex !important;
  margin: 10px auto 0 !important; /* centered */
  padding: 10px 18px !important;
}

/* Mobile: still easy to tap */
@media (max-width: 480px){
  #screen-auth .auth-actions {
    width: min(360px, 100%) !important;
  }
}

/* ===============================
   AUTH — final (grid, no fighting)
   =============================== */

#screen-auth .auth-actions{
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;   /* Login | Signup */
  gap: 12px !important;
  align-items: center !important;
}

/* remove global btn margins inside this block */
#screen-auth .auth-actions .btn{
  margin: 0 !important;
}

/* Login + Signup fill their columns (but capped like your preference) */
#screen-auth #btnLogin,
#screen-auth #btnSignup{
  width: 100% !important;
  max-width: 560px !important;
  justify-self: stretch !important;
}



/* Mobile: stack all 3 */
@media (max-width: 520px){
  #screen-auth .auth-actions{
    grid-template-columns: 1fr !important;
  }
}

/* Emergency screen: center the "Next gentle step" button */
#screen-emergency .emergency-btn-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 14px;   /* optional: match your spacing */
}

/* Emergency screen — text clarity & hierarchy */
#screen-emergency .emergency-text {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.05rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

/* First sentence = anchor message */
#screen-emergency .emergency-text strong,
#screen-emergency .emergency-text b {
  color: #ffffff;
  font-weight: 600;
}

/* Paragraph spacing inside emergency text */
#screen-emergency .emergency-text br + br {
  content: "";
  display: block;
  margin-top: 0.6rem;
}

/* Emergency card text baseline */
#screen-emergency .emergency-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1.65;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* Anchor sentence (the emotional landing point) */
#screen-emergency .emergency-anchor {
  display: block;
  color: #ffffff;
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.45;
  margin-bottom: 6px;
}

/* Give the emergency card a calm focus frame */
#screen-emergency .emergency-card {
  position: relative;
  border: 1px solid rgba(255,255,255,0.07);
}

/* Subtle divider between message and action */
#screen-emergency .emergency-btn-row {
  margin-top: 18px;
}

/* Strengthen first line without shouting */
#screen-emergency .emergency-text {
  font-size: 1.06rem;
}

#screen-emergency .emergency-text::first-line {
  color: #ffffff;
  font-weight: 600;
}

/* Emotional pause before action */
#screen-emergency .emergency-btn-row {
  margin-top: 22px;
  padding-top: 14px;
  position: relative;
}

#screen-emergency .emergency-btn-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 1px;
  background: rgba(255,255,255,0.18);
  border-radius: 1px;
}


/* ===== Guided Onboarding ===== */
.ob.hidden { display: none; }

.ob {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.ob-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(2px);
}

.ob-card {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
   background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.05),
      rgba(255,255,255,0.015)
    );
  background-color: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.ob-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ob-progress { font-size: 12px; opacity: 0.8; }

.ob-skip {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: 0;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.ob-title { font-size: 18px; margin: 6px 0; }
.ob-text  { font-size: 14px; opacity: 0.9; margin: 0 0 14px; line-height: 1.35; }

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

/* Spotlight ring */
.ob-spotlight {
  position: absolute;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 0 200vmax rgba(0,0,0,0.45);
  border-color: var(--accent-strong);  pointer-events: none;
  transition: all 160ms ease;
}

@media (prefers-reduced-motion: reduce){
  .ob-spotlight{
    transition: none !important;
  }
}

/* ===============================
   Account — Guided onboarding button
   =============================== */

#screen-account .guided-onboarding-btn {
  width: fit-content;          /* 👈 key fix */
  max-width: none;
  padding: 12px 22px;
  margin: 14px auto 0;         /* centered */
  display: block;

  font-size: 14px;
  opacity: 0.92;
}

#screen-account .guided-onboarding-btn {
  font-size: 13.5px;
  letter-spacing: 0.02em;
}


/* ===============================
   AUTH — Logout button (final authority)
   =============================== */

#screen-auth #btnLogout{
  grid-column: 1 / -1;        /* own row */
  justify-self: center;       /* centered */
  width: fit-content;         /* 👈 key fix */
  max-width: none;
  padding: 10px 18px;
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.92;
}

/* Mobile: still easy to tap, but centered */
@media (max-width: 520px){
  #screen-auth #btnLogout{
    width: min(360px, 100%);
  }
}


/* =========================================================
   Patch 06 — Empty state card (Sleep recent entries)
========================================================= */

.empty-state {
  margin: 10px 0 18px;
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
}

.empty-state__kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 6px;
}

.empty-state__title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
}

.empty-state__body {
  font-size: 14px;
  line-height: 1.45;
  opacity: 0.92;
  margin-bottom: 8px;
}

.empty-state__tiny {
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.70;
}

#sleepLogList.log-list {
  padding: 0; /* let the empty-state control spacing */
  background: transparent;
  border: none;
}

/* Patch 06 — Trends chart empty hints */
.chart-empty {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
}

.chart-empty__title {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.95;
  margin-bottom: 4px;
}

.chart-empty__body {
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.75;
}

.btn-danger {
  background: rgba(255, 80, 80, 0.16);
  border-color: rgba(255, 80, 80, 0.35);
  color: rgba(255, 235, 235, 0.98);
}
.btn-danger:active {
  opacity: 0.92;
}

/* ===============================
   Patch-18A — iPhone fix for home science tiles
   Final override
   =============================== */

#screen-home .systems-row {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  overflow: visible !important;
  padding-bottom: 0 !important;
}

#screen-home .system-card {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 12px 12px !important;
  border-radius: 16px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  gap: 8px !important;
}

#screen-home .system-card span {
  display: block !important;
  min-width: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  line-height: 1.2 !important;
  font-size: 0.86rem !important;
}

#screen-home .system-icon {
  width: 28px !important;
  height: 28px !important;
}

@media (min-width: 721px) {
  #screen-home .systems-row {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* =========================================
Landing Screen
========================================= */

.landing-screen{
	display:flex;
	align-items:center;
	justify-content:center;
	min-height:100vh;
	background:#0d0f14;
	color:#fff;
	text-align:center;
	padding:40px;
}

.landing-hero{
	max-width:480px;
}

.landing-title{
	font-size:42px;
	font-weight:700;
	margin-bottom:10px;
}

.landing-subtitle{
	font-size:18px;
	opacity:0.85;
	margin-bottom:20px;
}

.landing-description{
	font-size:15px;
	opacity:0.7;
	line-height:1.6;
	margin-bottom:30px;
}

.landing-button{
	background:#6b7cff;
	border:none;
	color:white;
	padding:14px 28px;
	font-size:16px;
	border-radius:10px;
	cursor:pointer;
}

.landing-button:hover{
	background:#5a6af0;
}

/* =========================================
Landing Sections — Patch-20B
========================================= */

.landing-sections{
  margin-top: 42px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.landing-section-card{
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.05),
    rgba(255,255,255,0.015)
  );
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 20px 18px;
  text-align: left;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

.landing-section-kicker{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.7;
  margin-bottom: 8px;
}

.landing-section-title{
  font-size: 22px;
  line-height: 1.2;
  margin-bottom: 10px;
}

.landing-section-text{
  font-size: 15px;
  line-height: 1.7;
  opacity: 0.78;
}

.landing-feature-list{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.landing-feature-item{
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 640px){
  .landing-feature-list{
    grid-template-columns: 1fr;
  }
}

/* =========================================
Landing Premium CTA — Patch-20C
========================================= */

.landing-premium-card{
  margin-top: 22px;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.06),
    rgba(255,255,255,0.02)
  );
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  padding: 22px 20px;
  text-align: left;
  box-shadow: 0 22px 60px rgba(0,0,0,0.42);
}

.landing-plan-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.landing-plan-box{
  padding: 16px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.landing-plan-box-premium{
  background: linear-gradient(
    135deg,
    rgba(120,130,255,0.18),
    rgba(255,255,255,0.04)
  );
  border-color: rgba(140,150,255,0.24);
}

.landing-plan-name{
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.landing-plan-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-plan-list li{
  font-size: 14px;
  line-height: 1.45;
  opacity: 0.86;
}

.landing-cta-row{
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.landing-cta-row .landing-button{
  flex: 1 1 220px;
}

.landing-button-secondary{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: #fff;
}

.landing-button-secondary:hover{
  background: rgba(255,255,255,0.10);
}

.landing-trust-note{
  margin-top: 14px;
  font-size: 13px;
  opacity: 0.66;
  text-align: center;
}

@media (max-width: 720px){
  .landing-plan-grid{
    grid-template-columns: 1fr;
  }
}

/* =========================================
Landing Footer — Patch-20D
========================================= */

.landing-footer{
  margin-top: 50px;
  padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

.landing-footer-inner{
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.landing-footer-title{
  font-size: 18px;
  font-weight: 700;
}

.landing-footer-tagline{
  font-size: 13px;
  opacity: 0.6;
}

.landing-footer-links{
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.landing-footer-links a{
  font-size: 14px;
  opacity: 0.75;
  text-decoration: none;
  color: inherit;
}

.landing-footer-links a:hover{
  opacity: 1;
}

.landing-footer-copy{
  margin-top: 16px;
  font-size: 12px;
  opacity: 0.55;
}

@media (max-width:640px){

  .landing-footer-inner{
    flex-direction: column;
    text-align:center;
  }

}

/* =========================================
Patch-20D.1 — landing width + footer alignment fix
========================================= */

.landing-screen{
  display: block;
  min-height: 100vh;
  padding: 40px 20px 56px;
}

.landing-hero{
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.landing-footer{
  width: 100%;
  max-width: 760px;
  margin: 50px auto 0;
}

.landing-footer-inner{
  justify-content: space-between;
  align-items: center;
}

.landing-footer-brand{
  min-width: 0;
}

.landing-footer-links{
  justify-content: center;
}

.landing-footer-links a{
  white-space: nowrap;
}

@media (max-width: 768px){
  .landing-screen{
    padding: 28px 16px 44px;
  }

  .landing-hero,
  .landing-footer{
    max-width: 100%;
  }

  .landing-footer-inner{
    flex-direction: column;
    text-align: center;
  }
}