/* Fluid Typographic Scaling Variables */
:root {
  --fluid-1: clamp(0.75rem, 0.71rem + 0.2vw, 0.88rem);
  --fluid-2: clamp(1rem, 0.93rem + 0.35vw, 1.25rem);
  --fluid-3: clamp(1.33rem, 1.2rem + 0.65vw, 1.78rem);
  --fluid-4: clamp(1.78rem, 1.54rem + 1.2vw, 2.53rem);
  --fluid-5: clamp(2.37rem, 1.95rem + 2.1vw, 3.58rem);
}

body {
  font-family: "Inter", sans-serif;
  background: linear-gradient(
    to right,
    #f3f4f6 0%,
    #ede9fe 20%,
    #ede9fe 80%,
    #f3f4f6 100%
  );
  color: #1f2937; /* Gray-800 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; /* Adds elite crispness on high-res displays */
  overflow-x: hidden;
}

/* --- High-Fidelity Texture --- */
.noise-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.015;
  background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

/* --- The "Breathing" Environment --- */
@keyframes breathe {
  0%,
  100% {
    transform: scale(1) translate(0, 0);
    opacity: 0.8;
  }
  33% {
    transform: scale(1.05) translate(20px, -10px);
    opacity: 1;
  }
  66% {
    transform: transform(0.95) translate(-15px, 15px);
    opacity: 0.9;
  }
}

.ambient-glow-purple {
  position: fixed;
  top: -20%;
  right: -10%;
  width: 70vw;
  height: 70vw;
  max-width: 800px;
  max-height: 800px;
  background: radial-gradient(
    circle,
    rgba(168, 85, 247, 0.08) 0%,
    rgba(236, 72, 153, 0.03) 40%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  animation: breathe 18s ease-in-out infinite alternate;
}

html {
  /* ... existing styles ... */
  scrollbar-gutter: stable; /* Prevents horizontal jump */
  overflow-x: hidden;
}

/* Add this utility class for the JS to toggle */
body.modal-open {
  overflow: hidden !important;
  height: 100vh; /* Ensures no scrolling on iOS */
  touch-action: none; /* Disables touch scrolling on mobile */
}

/* --- UNIVERSAL SPLASH SCREEN --- */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    to right,
    #f3f4f6 0%,
    #ede9fe 20%,
    #ede9fe 80%,
    #f3f4f6 100%
  );
  z-index: 100000; /* Extremely high to cover everything */
  display: flex;
  justify-content: center;
  align-items: center;
  transition:
    opacity 0.5s ease-out,
    visibility 0.5s ease-out;
}
#splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: pulse-splash 1.5s infinite;
}
.splash-content img {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  border: 2px solid #a855f7;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
@keyframes pulse-splash {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.98);
  }
}

.topic-card {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.question-chip,
.action-chip {
  display: block;
  align-items: initial;
  justify-content: initial;
  gap: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.9rem 0.9rem;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  margin-bottom: 0.5rem;
  position: relative;
}
.question-chip:active,
.action-chip:active {
  transform: scale(0.98) rotate(-0.5deg) !important;
  transition: transform 0.05s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}
.question-chip:hover,
.action-chip:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.selected-chip {
  background: linear-gradient(
    135deg,
    #ffffff 0%,
    var(--highlight-color) 100%
  ) !important;
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.15),
    0 0 0 2px rgba(168, 85, 247, 0.3);
  z-index: 10;
}

.question-chip .question-text,
.action-chip .action-text {
  flex-grow: 1;
  text-align: left;
  min-width: 0;
  color: #1f2937;
  letter-spacing: -0.01em;
  text-wrap: balance;
  transition: all 0.2s ease;
}

.selected-chip .question-text,
.selected-chip .action-text {
  font-size: clamp(1rem, 1.15rem, 1.5rem);
  font-weight: 500;
  color: #1f2937;
  line-height: 1.4;
}

.question-chip .top-row,
.action-chip .top-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
}

.question-chip .question-actions,
.action-chip .action-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 40px;
}

.question-chip .number-badge {
  font-size: 0.75rem;
  color: #6b7280;
  background: #eef2ff;
  border: 1px solid #e5e7eb;
  padding: 2px 6px;
  border-radius: 9999px;
  line-height: 1;
  opacity: 0.85;
}

.question-actions button,
.action-actions button {
  border-radius: 9999px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition:
    transform 0.1s ease-in-out,
    box-shadow 0.15s ease-in-out;
  flex-shrink: 0;
}
.question-actions button:active,
.action-actions button:active {
  transform: scale(0.98);
}

.note-container {
  margin-top: 0.75rem;
  display: none;
}
body.notes-visible .note-container {
  display: block;
}
.note-textarea {
  width: 100%;
  font-size: 0.9rem;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.5rem;
  resize: none;
  min-height: 38px;
  height: 38px;
  overflow-y: hidden;
  background: #f9fafb;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background-color 0.15s;
  line-height: 1.4;
  box-sizing: border-box;
}
.note-textarea::placeholder {
  color: #9ca3af;
}
.note-textarea:focus {
  background: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
  outline: none;
}

.reflection-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.2s;
}
.reflection-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.reflection-header {
  margin-bottom: 0.75rem;
}
.reflection-topic-badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7c3aed;
  background: #f3e8ff;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.reflection-question {
  font-size: clamp(1rem, 1.05rem, 1.5rem);
  color: #1f2937;
  font-weight: 600;
  line-height: 1.5;
}
.reflection-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: #fafafa;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #374151;
  resize: vertical;
  transition: all 0.2s;
  font-family: "Inter", sans-serif;
}
.reflection-textarea:focus {
  background: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  outline: none;
}

/* Make the expand/compact button a perfect circle */
#toggle-expand-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Ensure the icon sits perfectly centered without margins */
#toggle-expand-btn i {
  margin: 0;
}

.pill {
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: #4b5563;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pill:hover {
  background-color: #f3f4f6;
}

.focus-glass-btn {
  background-color: rgba(255, 255, 255, 0.5);
  color: #4b5563;
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  display: none;
}
.selected-chip .focus-glass-btn {
  display: inline-flex;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.focus-glass-btn:hover {
  background-color: #ffffff;
  color: #7c3aed;
  border-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.danger {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.danger:hover {
  background-color: #fecaca;
}
.primary {
  background-color: #8b5cf6;
  color: #ffffff;
  border-color: #8b5cf6;
}
.primary:hover {
  background-color: #7c3aed;
}
.success {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}
.success:hover {
  background-color: #a7f3d0;
}
.info {
  background-color: #e0f2fe;
  color: #075985;
  border-color: #bae6fd;
}
.info:hover {
  background-color: #bae6fd;
}
.muted {
  background-color: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.muted:hover {
  background-color: #e5e7eb;
}

.labs {
  background-color: #fdf4ff;
  color: #9333ea;
  border-color: #e9d5ff;
}
.labs:hover {
  background-color: #fae8ff;
}
.labs.active {
  background-color: #9333ea;
  color: #ffffff;
  border-color: #7e22ce;
}
.labs.active:hover {
  background-color: #7e22ce;
}

.section-title {
  color: #6b46c1;
}
.subtle {
  color: #6b7280;
}

.empty-state {
  background: transparent;
  border: none;
  padding: 0;
  color: #6b7280;
  text-align: center;
}

.search-input {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.6rem 2.25rem 0.6rem 0.8rem;
  width: 100%;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.search-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.badge {
  background: #ede9fe;
  color: #6b46c1;
  border-radius: 9999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.toolbar {
  z-index: 10;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #e5e7eb;
}

.mode-switch {
  display: flex;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.75rem;
  width: 100%;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.mode-btn {
  flex: 1;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: transparent;
}
.mode-btn.active {
  background: #ffffff;
  color: #6b46c1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transform: scale(1.02);
}

/* --- BACK TO TOP BUTTON --- */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background-color: rgba(255, 255, 255, 0.95);
  color: #6b7280;
  font-size: 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: all 0.3s ease-in-out;
  z-index: 1000;
}
#back-to-top:hover {
  background-color: #ffffff;
  color: #7c3aed;
  border-color: #d8b4fe;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  opacity: 1;
}

/* --- FLOATING DICE --- */
#floating-dice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background-color: rgba(255, 255, 255, 0.95);
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 1100;
  opacity: 0.85;
  transition: all 0.3s ease-in-out;
}
#floating-dice i {
  font-size: 1.25rem;
}
#floating-dice:hover,
#floating-dice:focus {
  background-color: #ffffff;
  color: #7c3aed;
  border-color: #d8b4fe;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  outline: none;
  opacity: 1;
}
#floating-dice:active {
  transform: translateY(0) scale(0.98);
}

/* --- FLOATING JOIN --- */
#floating-join {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  color: #ffffff;
  display: none !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  z-index: 1120;
  transition:
    transform 0.15s ease-in-out,
    box-shadow 0.2s ease-in-out,
    filter 0.2s,
    bottom 0.2s ease-in-out;
}
#floating-join i {
  font-size: 1.17rem;
}
#floating-join:hover,
#floating-join:focus {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
  outline: none;
  filter: brightness(1.05);
}
#floating-join:active {
  transform: translateY(0) scale(0.98);
}

/* --- FLOATING LOOKUP --- */
#floating-lookup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  z-index: 1150;
  transition:
    transform 0.15s ease-in-out,
    box-shadow 0.2s ease-in-out,
    filter 0.2s,
    bottom 0.2s ease-in-out;
  cursor: pointer;
}
#floating-lookup i {
  font-size: 1.17rem;
}
#floating-lookup:hover,
#floating-lookup:focus {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
  outline: none;
  filter: brightness(1.05);
}
#floating-lookup:active {
  transform: translateY(0) scale(0.98);
}

/* --- FLOATING COPY --- */
#floating-copy {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  z-index: 1140;
  transition:
    transform 0.15s ease-in-out,
    box-shadow 0.2s ease-in-out,
    filter 0.2s,
    bottom 0.2s ease-in-out;
  cursor: pointer;
}
#floating-copy i {
  font-size: 1.15rem;
}
#floating-copy:hover,
#floating-copy:focus {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
  outline: none;
  filter: brightness(1.05);
}
#floating-copy:active {
  transform: translateY(0) scale(0.98);
}

@media (max-width: 480px) {
  .question-chip,
  .action-chip {
    padding-left: 0.75rem;
    padding-right: 0.5rem;
  }

  #floating-dice,
  #floating-join,
  #floating-lookup,
  #floating-copy,
  #back-to-top {
    width: 52px;
    height: 52px;
    right: 16px;
  }

  #floating-dice,
  #floating-lookup,
  #back-to-top {
    bottom: 16px;
  }

  #floating-join,
  #floating-copy {
    bottom: 80px;
  }

  #back-to-top {
    font-size: 1.15rem;
  }
  #floating-dice i {
    font-size: 1.17rem;
  }
  #floating-join i {
    font-size: 1.15rem;
  }
  #floating-lookup i {
    font-size: 1.15rem;
  }
  #floating-copy i {
    font-size: 1.05rem;
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10050; /* Fix: Elevate above the 9999 bottom nav */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease-in-out,
    visibility 0.3s ease-in-out;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background-color: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 360px;
  width: 90%;
  transform: translateY(-20px);
  transition: transform 0.3s ease-in-out;
  /* Accessibility constraints for large text scaling */
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-overlay.show .modal-content {
  transform: translateY(0);
}
.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.modal-button {
  padding: 0.6rem 1.2rem;
  border-radius: 9999px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}
.modal-button.cancel {
  background: #e2e8f0;
  color: #4a5568;
}
.modal-button.cancel:hover {
  background: #cbd5e0;
}
.modal-button.confirm {
  background-color: #c53030;
  color: white;
}
.modal-button.confirm:hover {
  background-color: #9b2c2c;
}

.modal-button.primary {
  background-color: #8b5cf6;
  color: white;
}
.modal-button.primary:hover {
  background-color: #7c3aed;
}

.getting-started-list {
  list-style: none;
  padding-left: 0;
  text-align: left;
  counter-reset: step-counter;
}
.getting-started-list li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
}
.getting-started-list li::before {
  content: counter(step-counter);
  counter-increment: step-counter;
  position: absolute;
  left: 0;
  top: 0;
  background-color: #9f7aea;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.description-link-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #6b46c1;
  gap: 0.1rem;
}
.description-link {
  display: inline-flex;
  align-items: center;
  color: #6b46c1;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.description-link:hover {
  color: #805ad5;
  text-decoration: underline;
}
.description-link i {
  margin-right: 0.35rem;
}

.separator {
  display: inline-flex;
  align-items: center;
  margin: 0 0.45rem;
  color: #6b46c1;
  font-size: 1em;
  height: 1em;
  opacity: 0.5;
}

.header-separator {
  border-top: 1px solid #e5e7eb;
  margin: 0.5rem 0 1rem 0;
}

.bottom-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #4b5563;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: 9999px;
  padding: 0.5rem 0.875rem;
  font-size: 0.9rem;
  margin-top: 0.75rem;
  user-select: none;
}
.bottom-tip i {
  color: #f59e0b;
}

.nowrap {
  white-space: nowrap;
}
.wrap-anywhere {
  overflow-wrap: anywhere;
}

.modal-subheading {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  text-align: center;
  border-bottom: none;
  padding-bottom: 0;
}

.utility-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

#search-google-choice-btn,
#search-bing-choice-btn,
#search-duckduckgo-choice-btn,
#search-brave-choice-btn,
#search-qwant-choice-btn,
#translate-google-choice-btn,
#translate-bing-choice-btn,
#translate-deepl-choice-btn,
#copy-question-btn {
  color: white;
  font-weight: bold;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 9999px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}
#search-google-choice-btn {
  background-color: #4285f4;
}
#search-google-choice-btn:hover {
  background-color: #357ae8;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#search-google-choice-btn i {
  margin-right: 0.5rem;
}

#search-bing-choice-btn {
  background-color: #008ad6;
}
#search-bing-choice-btn:hover {
  background-color: #006fb7;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#search-bing-choice-btn i {
  margin-right: 0.5rem;
}

#search-duckduckgo-choice-btn {
  background-color: #e3722a;
}
#search-duckduckgo-choice-btn:hover {
  background-color: #c96024;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#search-duckduckgo-choice-btn i {
  margin-right: 0.5rem;
}

#search-brave-choice-btn {
  background-color: #fb542b;
}
#search-brave-choice-btn:hover {
  background-color: #d14424;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#search-brave-choice-btn i {
  margin-right: 0.5rem;
}

#search-qwant-choice-btn {
  background-color: #000000;
}
#search-qwant-choice-btn:hover {
  background-color: #333333;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#search-qwant-choice-btn i {
  margin-right: 0.5rem;
}

#translate-google-choice-btn {
  background-color: #60a5fa;
}
#translate-google-choice-btn:hover {
  background-color: #3b82f6;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#translate-google-choice-btn i {
  margin-right: 0.5rem;
}

#translate-bing-choice-btn {
  background-color: #008ad6;
}
#translate-bing-choice-btn:hover {
  background-color: #006fb7;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#translate-bing-choice-btn i {
  margin-right: 0.5rem;
}

#translate-deepl-choice-btn {
  background-color: #0f2b46;
}
#translate-deepl-choice-btn:hover {
  background-color: #0a1e31;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#translate-deepl-choice-btn i {
  margin-right: 0.5rem;
}

#copy-question-btn {
  background-color: #48bb78;
}
#copy-question-btn:hover {
  background-color: #38a169;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.qr-code-link {
  font-size: 0.875rem;
  color: #6b46c1;
  text-decoration: none;
  transition:
    color 0.2s ease-in-out,
    text-decoration 0.2s ease-in-out;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  justify-content: center;
}
.qr-code-link:hover {
  color: #805ad5;
  text-decoration: underline;
}
#qr-modal-content {
  max-width: 350px;
  padding: 1.5rem;
  position: relative;
}
#qr-modal-content img {
  width: 100%;
  height: auto;
  max-width: 250px;
  margin: 0 auto 1rem auto;
  display: block;
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.qr-modal-close-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #4a5568;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 50%;
  transition:
    background-color 0.2s,
    color 0.2s;
}
.qr-modal-close-button:hover {
  background-color: #e2e8f0;
  color: #2d3748;
}
.qr-actions-row button,
.qr-actions-row a {
  color: #2563eb;
  font-size: 0.875rem;
}
.qr-actions-sep {
  color: #9ca3af;
  font-size: 0.875rem;
  user-select: none;
}

/* --- TOP LEFT BACK BUTTON --- */
.top-left-back-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-radius: 9999px;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
  z-index: 50;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.top-left-back-btn:hover {
  background: #ffffff;
  color: #7c3aed; /* Purple-600 */
  border-color: #d8b4fe; /* Purple-300 */
  transform: translateX(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* --- TOP RIGHT STAR BUTTON --- */
.top-right-star-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 50;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.top-right-star-btn:hover {
  background: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

@keyframes starPop {
  0% {
    transform: scale(0.8);
  }
  40% {
    transform: scale(1.4) rotate(15deg);
  }
  70% {
    transform: scale(0.95) rotate(-5deg);
  }
  100% {
    transform: scale(1.1) rotate(0deg);
  }
}

.top-right-star-btn.is-starred {
  color: #eab308;
  border-color: #fef08a;
  background: #fef9c3;
  animation: starPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Apply bouncy pop to solid stars rendered inside the collection lists */
.fa-solid.fa-star {
  animation: starPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 768px) {
  .top-left-back-btn {
    top: 1rem;
    left: 1rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }
  .top-right-star-btn {
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}

#copy-notification-modal .modal-buttons {
  flex-direction: column;
  gap: 0.75rem;
}
#share-from-copy-modal-btn {
  background-color: #ffffff;
  color: #a855f7;
  border: 2px solid #e9d5ff;
}
#share-from-copy-modal-btn:hover {
  background-color: #f3e8ff;
  border-color: #d8b4fe;
}

#feedback-from-copy-modal-btn {
  background-color: #64748b;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#feedback-from-copy-modal-btn:hover {
  background-color: #475569;
}

#join-session-from-copy-modal-btn {
  background: linear-gradient(to right, #10b981, #06b6d4);
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#join-session-from-copy-modal-btn:hover {
  background-color: #2563eb;
}

.mindful-highlight {
  border-color: #a855f7 !important;
  background-color: #f3e8ff !important;
  transform: scale(1.02);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
  transition: all 0.2s ease-in-out;
  position: relative;
  z-index: 10;
}

.reflection-filters {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #e5e7eb;
}

.filter-chip {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #6b7280;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-chip.active {
  background-color: #ede9fe;
  color: #6b46c1;
  border-color: #8b5cf6;
}

.reflection-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f3f4f6;
}
.word-count {
  font-size: 0.75rem;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

.card-tool-btn {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.85rem;
  border-radius: 4px;
  transition:
    color 0.2s,
    background 0.2s;
}
.card-tool-btn:hover {
  background-color: #f3f4f6;
  color: #4b5563;
}
.card-tool-btn.accent:hover {
  color: #7c3aed;
  background-color: #f3e8ff;
}

body.mode-reflection #saved-items-actions,
body.mode-reflection #saved-items-utility {
  display: none !important;
}
#reflection-controls {
  display: none;
}
body.mode-reflection #reflection-controls {
  display: block;
}
.reflection-card {
  border-left: 4px solid #8b5cf6;
  background: linear-gradient(to right, #ffffff, #fafaff);
}

.reflection-card.pinned-card {
  border-left-color: #f59e0b; /* amber-500 */
}

/* --- Custom Note Colors --- */
.card-color-default {
  background: linear-gradient(to right, #ffffff, #fafaff);
  border-left-color: #8b5cf6;
}
.card-color-blue {
  background: linear-gradient(to right, #eff6ff, #dbeafe);
  border-left-color: #3b82f6;
}
.card-color-green {
  background: linear-gradient(to right, #f0fdf4, #dcfce7);
  border-left-color: #22c55e;
}
.card-color-yellow {
  background: linear-gradient(to right, #fefce8, #fef9c3);
  border-left-color: #eab308;
}
.card-color-pink {
  background: linear-gradient(to right, #fdf2f8, #fce7f3);
  border-left-color: #ec4899;
}

.reflection-tools-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 perfectly uniform columns */
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 350px) {
  .reflection-tools-row {
    grid-template-columns: repeat(
      2,
      1fr
    ); /* Drop to 2 columns on extra-narrow viewports */
  }
}

.tool-chip {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center; /* Center contents inside the grid block */
  gap: 6px;
  font-weight: 500;
  width: 100%;
}
.tool-chip:hover {
  background: #f3e8ff;
  color: #7c3aed;
  border-color: #d8b4fe;
}
.tool-chip i {
  font-size: 0.8rem;
}

.journal-progress-container {
  background-color: #f3f4f6;
  border-radius: 9999px;
  height: 8px;
  width: 100%;
  margin: 0.5rem 0 1.5rem 0;
  overflow: hidden;
  position: relative;
}
.journal-progress-bar {
  background: linear-gradient(90deg, #a855f7, #ec4899);
  height: 100%;
  border-radius: 9999px;
  transition: width 0.5s ease-in-out;
}
.journal-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 4px;
}
.blur-content {
  filter: blur(5px);
  transition: filter 0.3s;
  cursor: pointer;
}
.blur-content:hover {
  filter: blur(0);
}
.zen-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.zen-toggle-btn {
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.zen-toggle-btn:hover {
  background: #f3f4f6;
  color: #1f2937;
}
.zen-toggle-btn.active {
  background: #ede9fe;
  color: #6b46c1;
  border-color: #c4b5fd;
}

.zen-theme-light {
  --zen-bg: #ffffff;
  --zen-text: #374151;
  --zen-ui-bg: #f9fafb;
  --zen-border: #e5e7eb;
}
.zen-theme-sepia {
  --zen-bg: #fdf6e3;
  --zen-text: #5f4b32;
  --zen-ui-bg: #fdf6e3;
  --zen-border: #e6dbbf;
}
.zen-theme-dark {
  --zen-bg: #1f2937;
  --zen-text: #e5e7eb;
  --zen-ui-bg: #111827;
  --zen-border: #374151;
}

/* Hide recently updated section completely when in compact mode to save vertical space */
body.compact-mode .topic-card[data-topic-key="virtual_recent"] {
  display: none !important;
}

/* Ensure Zen Mode sits on top of the back button if z-index is an issue, 
though JS display toggle below is the primary fix. */
#zen-writer-modal {
  z-index: 10050 !important; /* Ensure it covers everything */
}

#zen-writer-modal .modal-content {
  background-color: var(--zen-bg, #ffffff);
  transition:
    background-color 0.3s,
    color 0.3s;
}

#zen-writer-modal .bg-gray-50 {
  background-color: var(--zen-ui-bg, #f9fafb);
  border-color: var(--zen-border, #e5e7eb);
}
#zen-writer-modal h3,
#zen-writer-modal span {
  color: var(--zen-text, #374151);
}

#zen-textarea {
  background-color: var(--zen-bg, #ffffff);
  color: var(--zen-text, #374151);
  transition:
    background-color 0.3s,
    color 0.3s;
}
#zen-textarea::placeholder {
  color: var(--zen-text);
  opacity: 0.4;
}

.font-serif-mode {
  font-family: "Merriweather", "Georgia", serif;
}
.font-sans-mode {
  font-family: "Inter", sans-serif;
}

.save-status {
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.save-status.visible {
  opacity: 1;
}
.reflection-controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2 perfectly matched columns */
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

/* Force the filter chips container to occupy the entire top row */
.reflection-controls-row .reflection-filters {
  grid-column: span 2;
  justify-content: center;
  margin-bottom: 0.25rem;
}

/* Ensure the selectors fully stretch to fit their grid areas uniformly */
.reflection-controls-row .sort-select {
  width: 100%;
  max-width: none !important;
}

.sort-select {
  padding: 0.3rem 1.5rem 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background-color: white;
  font-size: 0.8rem;
  color: #4b5563;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1em;
}
.sort-select:focus {
  outline: none;
  border-color: #8b5cf6;
}

.zen-timer-display {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: #f3f4f6;
  display: none;
}
.zen-timer-display.active {
  display: inline-block;
  color: #7c3aed;
  background: #ede9fe;
}
.zen-timer-display.finished {
  color: #dc2626;
  background: #fee2e2;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

.welcome-banner {
  background: linear-gradient(to bottom, #ffffff, #f9fafb);
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.05),
    0 8px 10px -6px rgba(0, 0, 0, 0.01);
  margin-top: 1rem;
}
.welcome-icon-wrapper {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #d8b4fe, #818cf8);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem auto;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}
.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  margin: 0 auto;
}
.step-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: white;
  border: 1px solid #f3f4f6;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
  text-decoration: none;
}
a.step-card:hover {
  transform: translateX(4px);
  border-color: #d8b4fe;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.step-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all 0.2s;
}
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.animate-fade-in {
  animation: fadeInScale 0.4s ease-out forwards;
}
.empty-state {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
}
/* Add to your <style> block */
#template-modal,
#mood-modal,
#spark-modal,
#tag-edit-modal,
#custom-alert-modal {
  z-index: 10060 !important; /* Ensure it floats above Zen Mode and other base modals */
}
/* Mood Picker Styles */
.mood-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}
.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}
.mood-btn:hover {
  background: #f3e8ff;
  border-color: #d8b4fe;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.mood-emoji {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}
.mood-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
}

/* Spark Card Styles */
.spark-card-container {
  background: linear-gradient(135deg, #fdfbf7 0%, #fff 100%);
  border: 2px solid #f3e8ff;
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  margin: 1rem 0;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  position: relative;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spark-text {
  font-size: 1.25rem;
  font-weight: 500;
  color: #4c1d95;
  font-family: "Merriweather", serif;
  line-height: 1.5;
}
.spark-icon {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: #8b5cf6;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: 0 4px 6px rgba(139, 92, 246, 0.3);
}
.spark-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}
/* Framework Toolkit Styles */
#template-modal .modal-content {
  max-width: 600px; /* Make it wider for the grid */
  width: 95%;
}

.framework-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
/* On larger screens, show 2 columns */
@media (min-width: 500px) {
  .framework-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.framework-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.framework-card:hover {
  border-color: #8b5cf6;
  background-color: #fbf8ff; /* Very subtle purple tint */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.framework-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background-color: #f3f4f6;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}

.framework-card:hover .framework-icon-wrapper {
  background-color: #8b5cf6;
  color: white;
}

.framework-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.framework-desc {
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.4;
}
/* === MOBILE KEYBOARD FIXES === */

/* When the keyboard is open, hide floating action buttons (excluding dice and back button) */
body.keyboard-open #floating-join,
body.keyboard-open #floating-lookup,
body.keyboard-open #floating-copy,
body.keyboard-open #back-to-top,
body.keyboard-open .bottom-tip {
  display: none !important;
}

/* Ensure the modal content aligns strictly with the top of the screen on mobile */
#zen-writer-modal.show .modal-content {
  transform: none; /* Reset any centering transforms */
  margin: 0;
  border-radius: 0; /* Full screen look */
}

/* Smooth Mode Transition Classes */
.view-transition-item {
  transition: opacity 0.2s ease-in-out;
  opacity: 1;
}
.view-transition-item.fade-out {
  opacity: 0;
}

/* --- 3D Flashcard Flip (X-Axis) --- */
.card-flip-out-x {
  animation: flipOutX 0.2s ease-in forwards;
  pointer-events: none;
}

.card-flip-in-x {
  animation: flipInX 0.3s ease-out forwards;
}

@keyframes flipOutX {
  0% {
    transform: perspective(1000px) rotateX(0deg);
    opacity: 1;
  }
  100% {
    transform: perspective(1000px) rotateX(90deg);
    opacity: 0;
  }
}

@keyframes flipInX {
  0% {
    transform: perspective(1000px) rotateX(-90deg);
    opacity: 0;
  }
  100% {
    transform: perspective(1000px) rotateX(0deg);
    opacity: 1;
  }
}

/* --- Cinematic Focus Mode (Floating Text) --- */
#focus-text-content {
  color: #111827;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important;
  max-width: 90vw !important;
  width: 800px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-wrap: balance;
  /* A soft ambient glow to lift the text cleanly off the blurred background */
  text-shadow:
    0 4px 16px rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

#focus-text-content .focus-subtitle {
  color: #4b5563 !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em !important;
  border-top-color: rgba(156, 163, 175, 0.3) !important;
  width: 100%;
  text-shadow: none !important;
}
/* --- Facilitator Lock UI --- */
.locked-feature {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(1);
  position: relative;
  cursor: not-allowed;
}

.lock-wrapper {
  display: inline-flex; /* Changed to inline-flex to work with the toolbar */
  position: relative;
  cursor: pointer;
}

/* 1. Base Lock Positioning (Top-Right for Note, Include Notes, etc.) */
.lock-wrapper::after {
  content: "\f023";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  position: absolute;

  top: -6px; /* Set to Top */
  right: -6px; /* Set to Right */
  left: auto;
  margin-top: 0;

  background: #fbbf24;
  color: white;
  width: 20px;
  height: 20px;
  font-size: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 50;
  transition: transform 0.2s;
}

/* 2. Journal Tab Override (Top-Left to straddle the gap) */
.mode-switch .lock-wrapper::after {
  top: -9px; /* Moves it to the top edge */
  margin-top: 0; /* Removes the vertical centering */
  left: -8px; /* Keeps it on the left edge between the tabs */
  right: auto; /* Clears the right positioning */
}
.lock-wrapper:hover::after {
  transform: scale(1.1);
}

/* ADD THIS NEW RULE */
.lock-wrapper.no-icon::after {
  display: none !important;
}

#shared-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#shared-auth-modal.show {
  display: flex;
  opacity: 1;
}

.auth-box {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  width: 90%;
  max-width: 350px;
  text-align: center;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}
#shared-auth-modal.show .auth-box {
  transform: scale(1);
}

.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-5px);
  }
  40%,
  80% {
    transform: translateX(5px);
  }
}
.tag-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  color: #5b21b6; /* Deep Purple */
  background-color: #f3e8ff; /* Light Purple */
  padding: 2px 8px;
  border-radius: 9999px;
  margin-right: 6px;
  margin-top: 6px;
  border: 1px solid #e9d5ff;
  text-transform: lowercase;
}

/* --- Onboarding Spotlight Overlay --- */
#spotlight-tour-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 10050;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  cursor: pointer;
}

#spotlight-tour-overlay.show {
  opacity: 1;
  visibility: visible;
}

#tour-close-hint {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes tour-radar-pulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(168, 85, 247, 0.7),
      0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }
  70% {
    box-shadow:
      0 0 0 15px rgba(168, 85, 247, 0),
      0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(168, 85, 247, 0),
      0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }
}

.tour-highlight {
  position: relative !important;
  z-index: 10051 !important; /* Must be 1 higher than the overlay */
  background-color: white;
  border-radius: 0.5rem;
  animation: tour-radar-pulse 1.5s infinite ease-out !important;
}

/* Ensure the logo has a background when highlighted */
a[href="../"] img.tour-highlight {
  background-color: white;
}

/* --- Fix for stacking context trapping the tour highlight --- */
body.tour-active .toolbar,
body.tour-active .view-transition-item,
body.tour-active .max-w-md.transition-transform,
body.tour-active .animate-fade-in {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transform: none !important;
  z-index: auto !important;
  animation: none !important;
  transition: none !important;
}

/* =========================================================
   PWA BOTTOM NAVIGATION BAR
   ========================================================= */

/* 1. The Tab Bar Container */
.mobile-bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 448px; /* Matches Tailwind max-w-md to align with your app card */
  height: 65px;
  background-color: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  z-index: 9999;
  /* iOS Safe Area Padding */
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: content-box;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* 2. Prevent the main app card from hiding behind the tab bar */
body {
  padding-bottom: calc(75px + env(safe-area-inset-bottom)) !important;
}

/* 3. Tab Button Styling */
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af; /* Tailwind Gray-400 */
  text-decoration: none;
  height: 100%;
  transition:
    color 0.2s ease-in-out,
    transform 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-tab i {
  font-size: 1.25rem;
  margin-bottom: 3px;
  transition: transform 0.2s ease;
}

.nav-tab span {
  font-size: 0.65rem;
  font-weight: 600;
}

/* Active State (Brand Purple) */
.nav-tab.active {
  color: #6b46c1;
}

.nav-tab.active i {
  transform: translateY(-2px);
}

.nav-tab:hover {
  color: #8b5cf6;
}

/* =========================================================
   FAB COLLISION PREVENTION OVERRIDES (FIXED)
   ========================================================= */
/* We use margin-bottom instead of bottom so we don't break your Javascript's dynamic stacking math! */

#floating-dice,
#floating-join,
#floating-copy,
#floating-lookup,
#back-to-top,
.toast-notification,
#toast-notification,
#global-host-timer {
  margin-bottom: calc(65px + env(safe-area-inset-bottom)) !important;
}

/* Force Toast to sit above everything (nav is 9990, modals are 10050) */
#toast-notification {
  z-index: 10100 !important;
  bottom: 2rem !important; /* Overrides Tailwind to use our dynamic margin-bottom math safely */
}

/* Adjust Host Timer if present */
#global-host-timer {
  bottom: calc(24px + 65px + env(safe-area-inset-bottom)) !important;
}

/* =========================================================
   RESPONSIVE ENHANCEMENTS FOR PWA BOTTOM NAV
   ========================================================= */

/* Tablet/Desktop View: Floating Pill Dock */
@media (min-width: 600px) {
  .mobile-bottom-nav {
    bottom: 2rem !important;
    border-radius: 9999px !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow:
      0 10px 25px -5px rgba(0, 0, 0, 0.1),
      0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    padding: 0 0.5rem !important;
  }

  body {
    padding-bottom: 120px !important;
  }

  /* Bumps existing floating buttons up to sit safely above the pill dock */
  #floating-dice,
  #floating-join,
  #floating-copy,
  #floating-lookup,
  #floating-collapse,
  #back-to-top,
  .toast-notification,
  #toast-notification,
  #global-host-timer {
    margin-bottom: 90px !important;
  }

  /* Keep floating buttons tethered to the main app container instead of the far screen edge */
  #floating-dice,
  #floating-join,
  #floating-copy,
  #floating-lookup,
  #floating-collapse,
  #back-to-top {
    right: calc(50% - 224px + 20px) !important;
  }
}

/* =========================================================
   LIVE BOARD BANNER (TLI) - PREVENTS TAILWIND TRUNCATION BUGS
   ========================================================= */
.tli-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}
.tli-dot-wrap {
  position: relative;
  display: flex;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}
.tli-dot-ping {
  position: absolute;
  display: inline-flex;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  opacity: 0.75;
  animation: tli-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.tli-dot {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}
.tli-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tli-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}
.tli-broadcast-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}
.tli-broadcast-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #e9d5ff;
  line-height: 1;
  margin-bottom: 2px;
}
.tli-broadcast-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: white;
}
.tli-interactive {
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  margin-left: -0.25rem;
}
.tli-interactive:hover {
  background-color: #7e22ce;
}
.tli-board-btn {
  background: #6b21a8;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #a855f7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.2s;
  font-size: 11px;
}
.tli-board-btn:hover {
  background: #581c87;
  color: white;
  text-decoration: none;
}
.tli-disconnect-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tli-disconnect-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
@keyframes tli-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

