:root {
  --highlight-color: #00f9ff;
}
html,
body {
  margin: 0;
  padding: 0;
}
/* 1. Body Texture (Dot Grid Paper) */
body {
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  min-width: 100vw;
  margin: 0;
  padding: 1rem 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;

  /* "Cafe Builder" Texture: A subtle dot grid over a warm/cool mix */
  background-color: #f9fafb;
  background-image:
    radial-gradient(#e0e7ff 1.5px, transparent 1.5px),
    radial-gradient(#f3f4f6 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  background-position:
    0 0,
    12px 12px;
}

/* Hide Number Input Arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* --- TOGGLE SWITCH STYLES --- */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  margin-right: 0.5rem;
  vertical-align: middle;
  transform: scale(0.9);
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 22px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #a855f7;
}
input:checked + .slider:before {
  transform: translateX(16px);
}

/* --- 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); }
}

/* Font Utility Classes */
.font-sans {
  font-family: "Inter", sans-serif;
}
.font-serif {
  font-family: "Merriweather", serif;
}
.font-hand {
  font-family: "Patrick Hand", cursive;
}

/* 2. Container Softness */
.container {
  background-color: #ffffff;
  /* Soften the corners significantly (was 0.75rem) */
  border-radius: 1.5rem;
  /* Soften the shadow to be more diffuse/dreamy */
  box-shadow:
    0 20px 40px -5px rgba(107, 70, 193, 0.15),
    0 10px 15px -5px rgba(107, 70, 193, 0.05);
  padding: 2rem;
  width: 100%;
  max-width: 28rem;
  min-height: 650px;
  margin-top: 1rem;
  margin-bottom: 1rem; /* Bulletproof spacer to scroll past the desktop dock */
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
  /* Add a very subtle border for definition against the dot grid */
  border: 1px solid rgba(255, 255, 255, 0.8);
  position: relative;
  z-index: 10; /* Keep the builder card floating above the ambient vibe background */
}
h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #6b46c1;
  text-align: center;
  margin-bottom: 0.5rem;
}

/* Toggle Button Styles */
.mode-toggle-group {
  display: inline-flex;
  background-color: #f3f4f6;
  border-radius: 9999px;
  padding: 0.25rem;
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}
.mode-btn {
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mode-btn.active {
  background-color: #7c3aed;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.mode-btn.inactive {
  background-color: transparent;
  color: #6b7280;
}
.mode-btn.inactive:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #374151;
}

.import-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.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: all 0.15s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pill:hover {
  background-color: #f3f4f6;
}

.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;
}
.primary {
  background-color: #8b5cf6;
  color: #ffffff;
  border-color: #8b5cf6;
}
.primary:hover {
  background-color: #7c3aed;
}
.magic {
  background: linear-gradient(135deg, #fce7f3 0%, #e0e7ff 100%);
  color: #7e22ce;
  border-color: #e9d5ff;
}
.magic:hover {
  background: linear-gradient(135deg, #fbcfe8 0%, #c7d2fe 100%);
}
.muted {
  background-color: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.muted:hover {
  background-color: #e5e7eb;
}
.accent {
  background-color: #ccfbf1;
  color: #115e59;
  border-color: #99f6e4;
}
.accent:hover {
  background-color: #84f1d9;
}

/* NEW PRINT STYLE - Dark Slate (High contrast from muted gray) */
.print-style {
  background-color: #334155;
  color: #ffffff;
  border-color: #1e293b;
}
.print-style:hover {
  background-color: #1e293b;
  border-color: #0f172a;
  color: #ffffff;
}

/* 3. Textarea Wrapper Softness & Glow */
.textarea-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid #d1d5db;
  /* Increased radius (was 0.5rem) */
  border-radius: 1rem;
  background-color: white;
  margin-bottom: 1rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  position: relative;
  min-height: 400px;
  height: 55vh; /* Dynamically caps height at 55% of the screen */
  max-height: 800px; /* Prevents stretching too far on ultra-wide/tall desktop monitors */
  overflow: hidden;
  resize: vertical; /* Allows desktop users to drag the entire box taller */
}
/* Enhanced Focus State (The Glow) */
.textarea-wrapper:focus-within {
  border-color: #a855f7;
  /* A softer, wider purple glow */
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
}

/* Updated padding to sit nicely under toolbar */
textarea {
  width: 100%;
  flex-grow: 1;
  padding: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 1.5rem;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: none; /* Let the wrapper handle the resizing */
  margin-bottom: 0;
  box-shadow: none;
  white-space: pre;
  overflow-x: auto;
  overflow-y: auto; /* Ensure standard text mode gets an inner scrollbar */
  box-sizing: border-box;
  background-color: transparent;
}
textarea:focus {
  outline: none;
}

/* Visually disable the text editor in Hosted Mode */
.textarea-wrapper.disabled-mode {
  opacity: 0.6;
  pointer-events: none;
  filter: grayscale(100%);
  position: relative;
}

/* Add a clear overlay message */
.textarea-wrapper.disabled-mode::after {
  content: "Text Editor disabled. Using Hosted Link below.";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(107, 70, 193, 0.9); /* Matches your purple theme */
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 100;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  pointer-events: auto; /* Allows users to see it clearly */
}

/* LIST EDITOR STYLES */
.q-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: relative;
}
.q-card:hover {
  border-color: #d8b4fe;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.q-card.selected-card {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(168, 85, 247, 0.3);
  border-color: rgba(0, 0, 0, 0.05);
  background: linear-gradient(135deg, #ffffff 0%, var(--highlight-color) 100%);
  z-index: 10;
}

.q-card .focus-btn {
  display: none;
}
.q-card.selected-card .focus-btn {
  display: flex;
}
.q-card textarea {
  min-height: 2.5rem;
  height: auto;
  resize: none;
  border-bottom: 1px dashed #e5e7eb;
  padding: 0.25rem;
  font-size: clamp(0.9rem, 0.95rem, 1.4rem);
  margin-bottom: 0;
  box-shadow: none !important;
  border: none !important;
  border-bottom: 1px dashed #e5e7eb !important;
  white-space: pre-wrap; /* Enables word wrap */
  overflow-x: hidden; /* Removes horizontal scrollbar */
}

/* Medium screens (tablets/smaller laptops) - approx 2 lines */
@media (max-width: 1024px) {
  .q-card textarea {
    min-height: 3.5rem;
  }
}

/* Small screens (mobile) - approx 3 lines */
@media (max-width: 640px) {
  .q-card textarea {
    min-height: 4.5rem;
  }
}
.q-card textarea:focus {
  border-bottom-color: #a855f7 !important;
  background-color: rgba(255, 255, 255, 0.6);
  border-radius: 4px;
}

.q-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.q-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.75rem;
}
.q-btn:hover {
  background-color: #f3f4f6;
  color: #6b46c1;
}
.q-btn.delete:hover {
  background-color: #fee2e2;
  color: #ef4444;
}

.q-btn.star-btn i.fa-solid {
  color: #facc15;
  animation: starPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.q-btn.star-btn:hover i.fa-regular {
  color: #facc15;
}

@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); }
}

.tag-toggle {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  user-select: none;
  opacity: 0.6;
  filter: grayscale(1);
  transition: all 0.2s;
  /* ACCESSIBILITY FIX: Reset native button styles */
  background-color: white;
  font-family: inherit;
  appearance: none;
}
.tag-toggle:hover {
  opacity: 1;
}
.tag-toggle.active {
  opacity: 1;
  filter: grayscale(0);
  border-color: currentColor;
  background-color: rgba(255, 255, 255, 0.8);
}

#limit-meter-container {
  height: 4px;
  width: 100%;
  background-color: #f3f4f6;
  position: absolute;
  bottom: 30px;
  left: 0;
  z-index: 10;
}
#limit-meter-fill {
  height: 100%;
  background-color: #4ade80;
  width: 0%;
  transition:
    width 0.3s ease,
    background-color 0.3s ease;
}

.status-bar {
  flex-shrink: 0;
  background-color: #f9fafb;
  color: #6b7280;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-family: monospace;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.5rem;
  user-select: none;
  cursor: default;
  border-top: 1px solid #e5e7eb;
  position: relative;
  z-index: 20;
}

.main-actions-area {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  align-items: stretch;
}
.btn {
  padding: 0.75rem 1rem;
  border-radius: 9999px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
}
.btn-action-share {
  background: linear-gradient(to right, #8b5cf6, #ec4899);
  color: white;
  font-size: 1rem;
}
.btn-action-share:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-secondary {
  background-color: #ffffff;
  color: #6b46c1;
  border: 1px solid #d1d5db;
  font-weight: 600;
  font-size: 0.9rem;
}
.btn-secondary:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
  color: #553c9a;
}

.btn-tertiary {
  background: transparent;
  color: #9ca3af;
  border: none;
  box-shadow: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem;
}
.btn-tertiary:hover {
  color: #ef4444;
  background-color: #fef2f2;
}

.description-link-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: -0.3rem;
  margin-bottom: 0.7rem;
  font-size: 0.9rem;
  color: #6b46c1;
}
.description-link {
  display: inline-flex;
  align-items: center;
  text-align: center;
  color: #6b46c1;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease-in-out;
  border: none;
  background: 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;
}

/* --- UPDATED HOSTED PANEL STYLES --- */
#hosted-tools-panel {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-bottom: 0;
  transform: translateY(-10px);
}

#hosted-tools-panel.active {
  max-height: 600px;
  opacity: 1;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(145deg, #ffffff 0%, #fcfaff 100%);
  border: 1px solid #e9d5ff;
  border-radius: 1rem;
  box-shadow: 0 4px 20px -2px rgba(139, 92, 246, 0.08);
  transform: translateY(0);
}

.step-card {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}

.step-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: #8b5cf6;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
  margin-top: 2px;
}

.step-content {
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.5;
  width: 100%;
}
/* ---------------------------------- */

/* --- MODAL SYSTEM --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  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,
    visibility 0.3s;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 380px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(-20px);
  transition: transform 0.3s;
  position: relative;
  overflow-y: auto; /* Ensures overflowing scaled text remains scrollable */
}
@media (max-width: 480px) {
  .modal-content {
    padding: 1.25rem;
  }
}
.modal-overlay.show .modal-content {
  transform: translateY(0);
}

/* Generic Message Modal Styles */
#generic-message-modal,
#qr-gate-modal {
  z-index: 10060; /* Forces alerts and auth gates to sit on top of standard modals (10050) */
}

.msg-modal-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
.msg-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 0.5rem;
}
.msg-modal-body {
  color: #4b5563;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  text-align: left;
}
.msg-modal-body ul,
.msg-modal-body ol {
  margin-left: 1.5rem;
  list-style-type: disc;
  margin-bottom: 0.5rem;
}
.msg-modal-body li {
  margin-bottom: 0.25rem;
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #374151;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  z-index: 10100; /* Elevate above bottom nav (9999) and modals (10050) */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
#toast-container.show {
  opacity: 1;
  visibility: visible;
  bottom: 50px;
}

/* --- TOP RIGHT CONTROLS WRAPPER --- */
.top-right-controls {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  z-index: 50;
}

/* Top right button visibility is now smoothly managed via JS in updateMeter() */

/* --- RETURN TO VIEW BUTTON STYLES --- */
.return-to-view-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #e5e7eb;
  color: #7c3aed; /* Purple-600 */
  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;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.return-to-view-btn:hover {
  background: #ffffff;
  border-color: #d8b4fe; /* Purple-300 */
  transform: translateX(2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* --- 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 {
  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;
  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);
}

/* --- 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 Override --- */
#focus-text-content {
  color: #111827 !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important; 
  text-shadow: 0 4px 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

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

@keyframes attention-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 25px 10px rgba(139, 92, 246, 0.5);
    filter: brightness(1.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    filter: brightness(1);
  }
}
.btn-attention-grabber {
  animation: attention-pulse 1s ease-in-out 2;
  z-index: 50;
  position: relative;
}

@keyframes ai-wiggle-glow {
  0% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  20% {
    transform: scale(1.1) rotate(-3deg);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
  }
  40% {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.7);
  }
  60% {
    transform: scale(1.1) rotate(-3deg);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
  }
  80% {
    transform: scale(1.05) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
}
.ai-intro-anim {
  animation: ai-wiggle-glow 1.2s ease-in-out;
  position: relative;
  z-index: 10;
}

/* PRINT STYLES */
@media print {
  html,
  body {
    height: auto !important;
    min-height: auto !important;
  }
  @page {
    size: A4;
    margin: 10mm;
  }
  body {
    background: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    display: block;
    overflow: visible;
  }
  .container,
  .modal-overlay,
  #toast-container,
  .import-toolbar,
  .description-link-container,
  .main-actions-area,
  h1,
  hr,
  h2,
  p,
  .mode-toggle-group,
  .flex.justify-center,
  #open-privacy-link {
    display: none !important;
  }
  /* Explicitly hide the root container contents except print area */
  body > *:not(#print-area) {
    display: none !important;
  }

  #print-area {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    visibility: visible;
  }

  #print-area.print-cols-2 .print-card {
    width: calc(50% - 10px);
  }
  #print-area.print-cols-3 .print-card {
    width: calc(33.333% - 10px);
  }

  /* Print Card Structure */
  .print-card {
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* CHANGED: Use min-height instead of fixed height for robustness */
    min-height: 290px;
    height: auto;

    break-inside: avoid;
    page-break-inside: avoid;
    position: relative;
    box-sizing: border-box;
  }

  /* Cover Card Special Styling */
  .print-card.cover-card {
    border-style: double;
    border-width: 4px;
    background-color: #faf5ff; /* faint purple tint */
  }

  .print-card-content {
    font-weight: 600;
    color: #333;
    line-height: 1.4;
  }
  .print-card-type {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.8rem;
    color: #999;
  }

  .print-card-deck-title {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    text-align: center;
    color: #6b46c1;
    font-weight: bold;
    opacity: 0.85;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Tag-specific title colors */
  .print-card-deck-title.title-lite {
    color: #15803d;
  } /* Solid Green */
  .print-card-deck-title.title-deep {
    color: #2563eb;
  } /* Royal Blue */
  .print-card-deck-title.title-action {
    color: #d97706;
  } /* Deep Amber */

  /* Footer */
  .print-card-subfooter {
    position: absolute;
    bottom: 20px;
    font-size: 0.6rem;
    color: #ccc;
  }

  /* --- PRINT MODIFIERS (Applied by JS) --- */

  /* B&W / Eco Mode */
  .print-bw .print-card {
    border-color: #4b5563 !important;
    background-color: white !important;
  }
  .print-bw .print-card-deck-title {
    color: #333 !important;
  }
  .print-bw .print-card-type span {
    color: #333 !important;
    font-weight: normal;
  } /* Override colorful tags */

  /* Hide Footer Mode */
  .print-hidden-footer .print-card-subfooter {
    display: none !important;
  }

  /* NEW: Ensure QR codes scale safely inside the print grid */
  .print-card canvas,
  .print-card img {
    max-width: 100%;
    max-height: 120px; /* Matches the JS generation size */
    object-fit: contain;
    margin: 0 auto;
  }
}
/* --- NEW TOOLBAR STYLES --- */
.toolbar-group {
  position: relative;
  display: inline-block;
}

/* Dropdown Content (Hidden by default) */
.toolbar-dropdown-content {
  display: none;
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background-color: white;
  min-width: 160px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-radius: 0.75rem;
  padding: 0.5rem;
  z-index: 100; /* FIXED: Higher z-index to stay above locked buttons */
  border: 1px solid #e5e7eb;
  flex-direction: column;
  gap: 0.5rem;
}

/* Show dropdown on hover (for desktop) or via JS class */
.toolbar-group:hover .toolbar-dropdown-content,
.toolbar-group.active .toolbar-dropdown-content {
  display: flex;
}

/* Neutralize colors when inside dropdown (Cleaner look) */
.import-toolbar:not(.classic-mode) .toolbar-dropdown-content .pill {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border: none;
  color: #4b5563;
  box-shadow: none;
}
.import-toolbar:not(.classic-mode) .toolbar-dropdown-content .pill:hover {
  background-color: #f3f4f6;
  color: #6b46c1;
}

.github-btn {
  background-color: #24292e;
  color: #ffffff;
  border-color: #24292e;
}
.github-btn:hover {
  background-color: #000000;
  color: #ffffff;
}
/* Ensure text stays white inside the dropdown on non-classic mode */
.import-toolbar:not(.classic-mode) .toolbar-dropdown-content .github-btn {
  color: #24292e;
}
.import-toolbar:not(.classic-mode) .toolbar-dropdown-content .github-btn:hover {
  background-color: #f3f4f6;
  color: #000000;
}

/* Proxy Buttons (The Gray "Import" and "Tools" buttons) */
.btn-proxy {
  background-color: white;
  border: 1px solid #d1d5db;
  color: #4b5563;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-proxy:hover {
  border-color: #a855f7;
  color: #6b46c1;
}

/* Fix for Dropdown Disappearing (The Invisible Bridge) */
.toolbar-dropdown-content::before {
  content: "";
  position: absolute;
  /* Position it exactly on top of the dropdown */
  bottom: 100%;
  left: 0;
  width: 100%;
  /* Make it tall enough to reach the button above */
  height: 1.5rem;
  /* Transparent so you can't see it, but the mouse detects it */
  background: transparent;
}
/* 4. Update Folder Tabs to match new Wrapper Radius */
.folder-tab {
  padding: 0.5rem 1.1rem; /* Slightly wider click area */
  font-size: 0.85rem;
  font-weight: 600;
  /* Increased top radius to match wrapper (was 0.5rem) */
  border-top-left-radius: 0.85rem;
  border-top-right-radius: 0.85rem;
  border: 1px solid #d1d5db;
  border-bottom: none;
  background-color: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.folder-tab.active {
  background-color: white;
  color: #6b46c1; /* Purple */
  border-bottom: 1px solid white; /* "Erase" the border line */
  z-index: 10; /* Sit on top */
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.02);
}

.folder-tab.inactive:hover {
  background-color: #e5e7eb;
  color: #374151;
}

/* Helper to clean up the wrapper top corners if needed */
.textarea-wrapper {
  border-top-right-radius: 0; /* Align with right-side tabs */
  border-top-right-radius: 1rem; /* Match new radius */
  /* If tabs are on right, you might want 0 here, but standardizing to 1rem looks 'friendlier' even with gaps */
}
/* --- COMPACT EDITOR (Hosted Mode Fix) --- */
/* Shrink the editor to show the tools below it */
.textarea-wrapper.compact {
  min-height: 160px;
  height: 25vh; /* Override the 55vh to shrink and reveal hosted tools */
  border-bottom: 2px dashed #d8b4fe; /* Visual cue that flow continues downward */
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  resize: none; /* Disable manual resizing in compact mode */
}
.textarea-wrapper.compact #question-input {
  min-height: 130px;
}
/* Ensure List Editor also shrinks */
.textarea-wrapper.compact #list-editor-container {
  min-height: 130px !important;
}

/* Connect the Hosted Panel visually to the Editor above it */
#hosted-tools-panel.active {
  /* Remove top margin to attach to the editor */
  margin-top: -1rem;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
  /* Add specific animation */
  animation: slideUpSnap 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
/* Keeps the standalone lock indicator perfectly centered between toolbar groups */
#proxy-lock-indicator {
  flex-shrink: 0; /* Prevents it from squishing on tiny screens */
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  cursor: pointer;
  transition: transform 0.2s;
}
#proxy-lock-indicator:hover {
  transform: scale(1.1);
}

/* Scrollbar visibility: Hidden on touch (swipe), subtle/styled on desktop (mouse) */
@media (hover: none) and (pointer: coarse) {
  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .scrollbar-hide::-webkit-scrollbar {
    height: 6px;
  }
  .scrollbar-hide::-webkit-scrollbar-track {
    background: transparent;
  }
  .scrollbar-hide::-webkit-scrollbar-thumb {
    background-color: #e5e7eb; /* Subtle gray matching your UI */
    border-radius: 9999px;
  }
  .scrollbar-hide::-webkit-scrollbar-thumb:hover {
    background-color: #d1d5db; /* Darkens slightly on hover */
  }
  .scrollbar-hide {
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
  }
}

#bulk-action-bar {
  /* Ensure it sits above mobile browser toolbars */
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 50;
}

/* Hide Action tags/buttons for unauthenticated users */
body.hide-action-tags #btn-prefix-action,
body.hide-action-tags .tag-toggle[onclick*="'action'"],
body.hide-action-tags button[onclick*="setTagFilter('action')"] {
  display: none !important;
}

.locked-feature {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(1);
  position: relative;
  cursor: not-allowed;
}

.lock-wrapper {
  display: inline-block;
  position: relative;
  cursor: pointer;
}

.lock-wrapper::after {
  content: "\f023";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  position: absolute;
  top: -8px;
  left: -8px;
  right: auto;
  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;
}

/* NEW: Distinct color for Host-only locks */
.lock-wrapper.host-only::after {
  background: #db2777; /* Deep Pink */
}

.lock-wrapper:hover::after {
  transform: scale(1.1);
}

#share-choice-modal .lock-wrapper {
  display: block;
  width: 100%;
}
#share-choice-modal .lock-wrapper::after {
  left: auto;
  right: -6px;
  top: -6px;
}

.import-toolbar:not(.classic-mode) .toolbar-dropdown-content .lock-wrapper {
  display: block;
  width: 100%;
}
.import-toolbar:not(.classic-mode)
  .toolbar-dropdown-content
  .lock-wrapper::after {
  left: auto;
  right: -4px;
  top: -6px;
  transform: none;
}
.import-toolbar:not(.classic-mode)
  .toolbar-dropdown-content
  .lock-wrapper:hover::after {
  transform: scale(1.1);
}

.main-actions-area > .btn,
.main-actions-area .lock-wrapper {
  flex: 1;
  display: flex;
  min-width: 0;
}
.main-actions-area .lock-wrapper .btn {
  width: 100%;
}
.main-actions-area .lock-wrapper::after {
  top: -4px;
  left: -4px;
}

/* Fix lock wrapper display for full-width language dropdowns */
.lock-wrapper:has(#ai-language),
.lock-wrapper:has(#remix-language) {
  display: block;
  width: 100%;
}

/* Position the lock icon on the top right for dropdowns */
.lock-wrapper:has(#ai-language)::after,
.lock-wrapper:has(#remix-language)::after {
  left: auto;
  right: -6px;
  top: -6px;
}

#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);
}

/* Smooth snap-back for swipe gestures */
.swipe-transition {
  transition:
    transform 0.2s ease-out,
    opacity 0.2s ease-out;
}

.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);
  }
}

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

/* --- 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);
}

/* Radar pulse animation to draw the eye to small spotlight targets */
@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);
  }
}

/* Class added to the target element to bring it forward */
.tour-highlight {
  position: relative !important;
  z-index: 10051 !important;
  background-color: white;
  border-radius: 0.5rem;
  animation: tour-radar-pulse 1.5s infinite ease-out !important;
}

/* --- 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,
#back-to-top:focus {
  background-color: #ffffff;
  color: #7c3aed;
  border-color: #d8b4fe;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  opacity: 1;
  outline: none;
}
#back-to-top:active {
  transform: translateY(0) scale(0.98);
}

/* --- 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 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, opacity 0.2s ease-in-out;
  cursor: pointer;
  border: none;
  opacity: 0.85;
}
#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);
  opacity: 1;
}
#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, opacity 0.2s ease-in-out;
  cursor: pointer;
  border: none;
  opacity: 0.85;
}
#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);
  opacity: 1;
}
#floating-copy:active {
  transform: translateY(0) scale(0.98);
}

@media (max-width: 480px) {
  #floating-dice,
  #floating-lookup,
  #floating-copy,
  #back-to-top {
    width: 52px;
    height: 52px;
    right: 16px;
  }
  #floating-dice,
  #floating-lookup,
  #back-to-top {
    bottom: 16px;
  }
  #floating-copy {
    bottom: 80px;
  }
}

@media (max-width: 480px) {
  #floating-lookup,
  #floating-copy {
    width: 52px;
    height: 52px;
    right: 16px;
  }
  #floating-lookup {
    bottom: 16px;
  }
  #floating-copy {
    bottom: 80px;
  }
}

/* =========================================================
   GLOBAL BOTTOM NAVIGATION BAR
   ========================================================= */

/* 1. Base Tab Bar Styling (Shared) */
.mobile-bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 448px; /* Matches Tailwind max-w-md to align perfectly 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;
  box-sizing: border-box; /* CRITICAL: keeps inner padding from breaking the 448px width constraint */
}

/* 2. Tab Button Styling */
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  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;
}

.nav-tab.active {
  color: #6b46c1;
}
.nav-tab.active i {
  transform: translateY(-2px);
}
.nav-tab:hover {
  color: #8b5cf6;
}

/* Mobile View: Anchored flat to the exact bottom edge */
@media (max-width: 599px) {
  .mobile-bottom-nav {
    bottom: 0 !important;
    border-radius: 0 !important;
    border-top: 1px solid #e5e7eb;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
  }

  body {
    padding-bottom: calc(75px + env(safe-area-inset-bottom)) !important;
  }

  /* Bumps existing floating buttons up to sit safely above the navigation */
  #floating-dice,
  #floating-join,
  #floating-copy,
  #floating-lookup,
  #back-to-top,
  #toast-container,
  #global-host-timer,
  #filter-toast {
    margin-bottom: calc(65px + env(safe-area-inset-bottom)) !important;
  }
}

/* Tablet/Desktop View: Floating Pill Dock */
@media (min-width: 600px) {
  .mobile-bottom-nav {
    bottom: 2rem !important; /* Forces the float beautifully above the bottom edge */
    border-radius: 9999px !important; /* Forces the pill shape */
    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; /* Slight inner padding for the pill */
  }

  /* Prevent the app card from hitting the floating dock on small monitors */
  body {
    padding-bottom: 120px !important;
  }

  /* Bumps existing floating buttons up to sit safely above the navigation */
  #floating-dice,
  #floating-join,
  #floating-copy,
  #floating-lookup,
  #back-to-top,
  #toast-container,
  #global-host-timer {
    margin-bottom: 90px !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;
  }
}

