/* Box sizing to ensure padding does not push width beyond viewport */
.app-main,
.view-container,
.single-view,
.multi-view,
.swipe-container,
.current-card-slot,
.cards-grid,
.digital-card {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.digital-card * { -webkit-user-select: none; user-select: none; }

/* Ensure single view card is fully interactive */
.single-view .digital-card {
  pointer-events: auto;
}

/* Prevent horizontal overflow globally for this app */
html, body {
  overflow-x: hidden;
  width: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Digital Cards - Main Application Styles */

/* Consistent header height across breakpoints */
:root { --app-header-height: 56px; --single-card-max-desktop: 640px; --single-card-max-tablet: 600px; --brand1: #f59e0b; --brand2: #5c5c5c; --brand3: #06b6d4; --brand4: #ec4899; --nav-bg: var(--brand1); --accent-color: var(--brand2); }
@media (max-width: 480px) { :root { --app-header-height: 52px; } }

/* Mobile-focused body */
body.mobile-focused {
  padding: 0;
  margin: 0;
  user-select: none; /* Prevent text selection on mobile */
  -webkit-touch-callout: none; /* Disable callout on iOS */
  overflow-x: hidden;
}

/* Ensure full-height layout calculations work on mobile */
html, body {
  height: 100%;
  overflow: hidden; /* Prevent body scrolling */
}

.digital-cards-app {
  /* Create an app viewport and contain scrolling inside app-main */
  height: 100dvh;
  max-height: 100dvh; /* Strict constraint */
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  max-width: 100%;
  overflow: hidden; /* prevent page/body scrolling */
  padding-top: calc(var(--app-header-height) + 34px + env(safe-area-inset-top, 0px));
  box-sizing: border-box; /* Ensure padding is included in height */
}

/* Main Navigation Styles - Separated from card selection */
.main-nav {
  background: var(--nav-bg, #7A4FA0);
  color: white;
  padding: 0 0.9rem; /* vertical space comes from fixed height var */
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--app-header-height);
  z-index: 1000;
  max-width: 100%;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}

/* Sub nav state bar */
.sub-nav {
  position: fixed;
  top: var(--app-header-height);
  left: 0;
  right: 0;
  height: 34px;
  z-index: 999;
  /* Default: All cards/tiles state = Brand 3 (cyan) */
  background: var(--brand3, #06b6d4);
  color: #ffffff;
  display: flex;
  align-items: center;
}
.sub-nav.blue {
  /* Selected / live view states = green (product accent) */
  background: var(--accent-color, #2db36f);
  color: #ffffff;
}
.sub-nav .sub-nav-inner { max-width: none; margin: 0; width: 100%; padding: 0 8px; font-weight: 600; font-size: 14px; display:flex; align-items:center; justify-content:center; }
.sub-nav #sub-nav-label { opacity: 0.95; color: #ffffff; }
.sub-nav.blue #sub-nav-label { color: #ffffff; }

/* Prompt in non-hand view: show in sub-nav center */
.sub-nav:not(.blue) .prompt-text {
  display: inline-block !important;
  font-weight: 400;
  font-size: 28px;
  opacity: 0.8;
  margin-left: 0;
  max-width: 100%;
  word-wrap: break-word;
  white-space: normal;
  line-height: 1.4;
}

/* Prompt bar - expands above scrollable card grid */
.prompt-bar {
  flex: 0 0 auto; /* Don't shrink or grow - fixed size based on content */
  position: relative; /* normal flow so it sits above the scrollable grid */
  min-height: 80px;
  background: #e5e7eb;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  margin: 0; /* sit flush under the sub-nav on all devices */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Hide prompt bar when welcome panel is visible */
.welcome-panel.visible ~ .app-main .prompt-bar {
  display: none;
}

/* In hand view, show grey bar under green bar */
/* Prompt bar is now always shown inside app-main, so no special hand-view rule needed */

/* Hide sub-nav prompt now that dedicated prompt bar is used */
.sub-nav .prompt-text { display: none !important; }

.prompt-bar .prompt-text {
  font-weight: 400;
  font-size: 20px;
  opacity: 0.8;
  max-width: 100%;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
  box-sizing: border-box;
}

.main-nav .nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.main-nav .nav-logo svg {
  width: 24px;
  height: 24px;
  color: white;
}

.main-nav .nav-logo-image {
  height: 32px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

.main-nav .nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Hide legacy show-hand nav button in v2; hand/all toggle is via sub-nav tap */
.main-nav .nav-links #show-selected-btn {
  display: none !important;
}

.main-nav .nav-links button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

/* Remove hover translate to prevent button jumping */
.main-nav .nav-links button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  /* no transform */
}

/* Reduce click/tap flash and control focus styles */
.main-nav .nav-links button {
  -webkit-tap-highlight-color: transparent;
}
.main-nav .nav-links button:focus {
  outline: none;
}
/* Keep accessible focus for keyboard users */
.main-nav .nav-links button:focus-visible {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: 2px;
}

/* Stabilize view toggle icon layout */
/* View toggle button (single/multi) */
.main-nav .nav-links .view-toggle {
  position: relative;
  overflow: hidden;
}

/* Filter button icon swap: show-selected vs show-all */
.filter-btn {
  position: relative;
}
.filter-btn .show-selected-icon,
.filter-btn .show-all-icon {
  transition: opacity 0.2s ease;
}
.filter-btn:not(.active) .show-selected-icon { opacity: 1; }
.filter-btn:not(.active) .show-all-icon { opacity: 0; }
.filter-btn.active .show-selected-icon { opacity: 0; }
.filter-btn.active .show-all-icon { opacity: 1; }

/* App header styles */
.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.catalyst-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.header-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Loading state */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.loading-state.hidden {
  display: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #7A4FA0;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Facilitation load feedback */
.action-btn.loading svg { animation: spin 0.8s linear 2; }

/* Language Selector - Floating circular button in bottom left */
.language-selector-btn.floating {
  position: fixed;
  bottom: 10px;
  left: 10px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(0, 0, 0, 0.1);
  color: #333;
  padding: 0;
  font-size: 105px; /* Large enough to completely fill and overflow the circle */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 999;
  overflow: hidden; /* Clip the flag to the circle */
  padding: 6px 0 0 2px; /* Offset to position the flag within the circle */
}

.language-selector-btn.floating:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.language-selector-btn.floating.open {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Account for safe area on mobile devices */
@supports (padding: max(0px)) {
  .language-selector-btn.floating {
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
  }
}

.language-selector-dropdown {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 4px;
  min-width: 140px;
  margin-top: 4px;
}

.language-option {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  color: #333;
  transition: background 0.15s;
}

.language-option:hover {
  background: #f0f0f0;
}

.language-option.active {
  background: #e3f2fd;
  color: #1976d2;
  font-weight: 600;
}

.language-option.active::after {
  content: ' ✓';
  float: right;
}
.cards-grid.flash-highlight { animation: gridFlash 800ms ease; background-color: rgba(122,79,160,0.08); border-radius: 12px; }
@keyframes gridFlash {
  0% { background-color: rgba(122,79,160,0.18); }
  100% { background-color: transparent; }
}

.app-main {
  flex: 1 1 0%;             /* Use 0% base to force proper flex shrinking */
  display: flex;            /* ensure child views can center within remaining height */
  flex-direction: column;
  padding: 0.5rem 0.5rem 0 0.5rem; /* Desktop/tablet padding; bottom 0 to prevent overflow */
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;         /* Prevent app-main from scrolling - children handle their own overflow */
  min-height: 0;            /* Allow flex children to shrink below content size */
  max-height: 100%;         /* Constrain to parent - should be remaining space after header */
  box-sizing: border-box;  /* Ensure padding is included in calculations */
}

body.mobile-focused .app-main {
  /* On mobile, remove top padding so grid sits flush under the blue/green bar */
  padding: 0 0.25rem 0 0.25rem;
}

/* View containers */
.view-container {
  display: none;
  width: 100%;
  position: relative;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden; /* Container itself doesn't scroll */
  min-height: 0; /* Allow flex child to shrink */
}

.view-container.active {
  display: flex; /* Use flex to allow child to control scrolling */
  flex: 1 1 0%; /* Take remaining space - use 0% base to force shrink */
  min-height: 0; /* Allow shrinking */
  flex-direction: column;
  overflow: hidden; /* Constrain height so child can scroll */
}

/* Ensure inactive views are completely hidden */
.view-container:not(.active) {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Ensure proper stacking and prevent overlap */
.app-main {
  position: relative;
  /* min-height removed - let flex container manage height */
}

/* Single view styles */
.single-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0%;          /* fill remaining height - use 0% base to force shrink */
  min-height: 0;         /* avoid forcing extra page height */
  padding: 0.5rem;
  max-width: 100%;
  max-height: 100%;      /* Constrain to parent */
  overflow-x: hidden;
  overflow-y: auto;      /* Allow single-view to scroll if needed */
  -webkit-overflow-scrolling: touch;
  pointer-events: auto; /* ensure interactions are enabled */
}

.swipe-container {
  position: relative;
  width: 100%;
  max-width: var(--single-card-max-desktop);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
@media (min-width: 769px) and (max-width: 1024px) {
  .swipe-container { max-width: var(--single-card-max-tablet); }
}
/* Allow single-card container to expand on desktop when we size the card explicitly */
@media (min-width: 1025px) {
  .swipe-container { max-width: none; }
}

.current-card-slot {
  width: 100%;
  max-width: 100%;
  aspect-ratio: var(--card-ar, 3/4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 16px;
  margin-bottom: 1rem;
  /* allow single-view card shadow to render outside the slot */
  overflow: visible;
  position: relative;
  pointer-events: auto;
}

/* Prevent giant single card in hand view on desktop by clamping size */
/* Clamp overly large single-hand card on very wide screens */
@media (min-width: 1200px) {
  .single-view .digital-card { max-width: 640px; }
}

/* Swipe animations (use higher specificity to override base rule) */
.current-card-slot .digital-card { transform: translateX(0); opacity: 1; will-change: transform, opacity; transition: transform 360ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 360ms ease; backface-visibility: hidden; -webkit-font-smoothing: antialiased; }
.current-card-slot .digital-card.swipe-enter-left { transform: translateX(100%) !important; opacity: 0 !important; }
.current-card-slot .digital-card.swipe-enter-right { transform: translateX(-100%) !important; opacity: 0 !important; }
.current-card-slot .digital-card.swipe-leave-left { transform: translateX(-100%) !important; opacity: 0 !important; }
.current-card-slot .digital-card.swipe-leave-right { transform: translateX(100%) !important; opacity: 0 !important; }

.swipe-indicator {
  text-align: center;
  color: #6c757d;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.swipe-hint {
  opacity: 0.7;
  animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* Multi view styles */
.multi-view {
  padding: 0; /* No padding - spacing handled elsewhere */
  flex: 1 1 0%;         /* fill remaining height - use 0% base to force shrink */
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;      /* Make multi-view scrollable instead of app-main */
  -webkit-overflow-scrolling: touch;
  min-height: 0;         /* Allow flex child to shrink and enable scrolling */
  max-height: 100%;      /* Constrain to parent */
}

/* Single-list mode: reuse grid, but single column and large cards */
.digital-cards-app.single-list #cards-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  row-gap: 18px !important;
  touch-action: pan-y !important;
  overscroll-behavior: contain;
}
.digital-cards-app.single-list #cards-grid .digital-card { margin: 0 auto; max-width: min(720px, 96vw); }
.digital-cards-app.single-list .single-view { display: none !important; }
.digital-cards-app.single-list .multi-view { display: block !important; height: 100%; }
.digital-cards-app.single-list .app-main {
  overflow: hidden !important;
  min-height: 0 !important;
}
/* Make the grid itself the scroll container on mobile to avoid body scroll conflicts */
.digital-cards-app.single-list .multi-view #cards-grid {
  height: 100%;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 48px);
}
/* Spacer removed - was causing layout issues */

/* Hide all single-view related elements in multi view - more comprehensive rules */
.multi-view .swipe-indicator,
.multi-view .swipe-container,
.multi-view .current-card-slot,
.multi-view .swipe-hint,
.multi-view .swipe-container * {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
}

/* Ensure multi view takes full height and removes extra space */
.multi-view.active {
  /* Don't override display - maintain flex item status for proper scrolling */
  /* display: block; */ /* Removed - breaks flex scrolling */
  min-height: auto;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 0.5rem 0 0 0; /* Small top padding for spacing from prompt bar */
  margin: 0 auto;       /* center grid within container */
  justify-content: center; /* center tracks when space available */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;    /* guard against 1px rounding overflow */
}
/* Two-up size baseline on desktop/tablet */
@media (min-width: 769px) {
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .main-nav {
    padding: 0 0.75rem; /* use height var for vertical spacing */
  }

  .main-nav .nav-links {
    gap: 0.25rem;
  }

  .main-nav .nav-links button {
    min-width: 36px;
    height: 36px;
    padding: 0.4rem;
  }

  .app-main { padding: 0.5rem; padding-top: calc(var(--app-header-height) + 30px); }

  .single-view {
    /* keep full-height centering on mobile without causing scroll */
    min-height: 0;
  }

  .current-card-slot {
    min-height: 350px;
    margin-bottom: 0.5rem;
  }

  .swipe-indicator {
    margin-top: 0.25rem;
  }

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

@media (max-width: 480px) {
  .main-nav .nav-links button {
    min-width: 32px;
    height: 32px;
    padding: 0.3rem;
  }

  .main-nav .nav-links button svg {
    width: 18px;
    height: 18px;
  }

  .single-view {
    padding: 0.25rem;
    min-height: 0; /* avoid forcing scroll on very small screens */
  }

  .current-card-slot {
    min-height: 300px;
    margin-bottom: 0.25rem;
  }

  .swipe-indicator {
    margin-top: 0.25rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    width: 100%;
  }
}

/* Facilitator invitation (QR) view */
.invite-view {
  flex: 1 1 auto;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.invite-view .invite-inner {
  width: min(420px, 80vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: rgba(255,255,255,0.94);
  border-radius: 16px;
  padding: 20px 20px 24px;
  box-shadow: 0 14px 40px rgba(15,23,42,0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.invite-view .invite-qr {
  width: 72%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.invite-view .invite-qr canvas,
.invite-view .invite-qr img {
  width: 100%;
  height: 100%;
}
.invite-view .invite-url {
  font-size: 14px;
  color: #4b5563;
  text-align: center;
  word-break: break-all;
}

/* Facilitator eye icon state - use data attribute to persist state */
#fac-visibility-btn[data-fac-hidden="true"] #fac-eye-open {
  display: none !important;
  visibility: hidden !important;
}
#fac-visibility-btn[data-fac-hidden="true"] #fac-eye-closed {
  display: block !important;
  visibility: visible !important;
}
#fac-visibility-btn:not([data-fac-hidden="true"]) #fac-eye-open {
  display: block !important;
  visibility: visible !important;
}
#fac-visibility-btn:not([data-fac-hidden="true"]) #fac-eye-closed {
  display: none !important;
  visibility: hidden !important;
}

/* Tablet tuning reset: keep header same height between 769-1024 */
@media (min-width: 769px) and (max-width: 1024px) {
  .main-nav { height: var(--app-header-height); padding: 0 1rem; }
}

/* Nav buttons: enforce square shape and consistent sizing */
.main-nav .nav-links button,
.main-nav .nav-links .view-toggle,
.main-nav .nav-links .filter-btn,
.main-nav .nav-links .action-btn,
.main-nav .nav-links #show-selected-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

/* Active state mimic: highlight background for toggled buttons */
.main-nav .nav-links button.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Facilitator action buttons: green when toggled on */
.main-nav .nav-links .action-btn.active {
  background-color: var(--accent-color, #2db36f);
  border-color: var(--accent-color, #2db36f);
  color: #ffffff;
}

/* Participant single/multi view toggle: green when single view is active */
.main-nav .nav-links .view-toggle.active {
  background-color: var(--accent-color, #2db36f);
  border-color: var(--accent-color, #2db36f);
  color: #ffffff;
}

/* Make the single-card icon in the view toggle larger */
.main-nav .nav-links .view-toggle svg {
  width: 28px;
  height: 28px;
}

@media (max-width: 480px) {
  .main-nav .nav-links .view-toggle svg {
    width: 24px;
    height: 24px;
  }
}

/* Guide-style overlapping cards icon styling */
.filter-btn .cards-hand-toggle-icon { color: white; width: 26px; height: 26px; }
.filter-btn.active .cards-hand-toggle-icon { color: #fff; }

/* Distinct active state for filter (selected-only) */
.main-nav .nav-links .filter-btn {
  color: white; /* base icon color via currentColor */
}
.main-nav .nav-links .filter-btn svg {
  color: inherit; /* icons inherit button color */
}
/* Distinct active state for filter (match main site's active nav style) */
.main-nav .nav-links .filter-btn.active,
.main-nav .nav-links #show-selected-btn.active {
  background-color: var(--accent-color, #2db36f); /* match card add-to-hand green */
  border-color: var(--accent-color, #2db36f);
  color: #ffffff; /* icon color (fill=currentColor) */
}
.main-nav .nav-links .filter-btn.active svg {
  color: inherit; /* ensure icon flips to purple */
}

@media (max-width: 768px) {
  .main-nav .nav-links button,
  .main-nav .nav-links .view-toggle,
  .main-nav .nav-links .filter-btn,
  .main-nav .nav-links .action-btn,
  .main-nav .nav-links #show-selected-btn {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .main-nav .nav-links button,
  .main-nav .nav-links .view-toggle,
  .main-nav .nav-links .filter-btn,
  .main-nav .nav-links .action-btn,
  .main-nav .nav-links #show-selected-btn {
    width: 32px;
    height: 32px;
  }
}

/* Ensure SVGs align consistently inside square buttons */
.main-nav .nav-links button svg {
  display: block;
}

/* Desktop: slightly larger view-toggle icons for clarity */
@media (min-width: 1025px) {
  .main-nav .nav-links .view-toggle .single-view-icon,
  .main-nav .nav-links .view-toggle .multi-view-icon {
    width: 26px;
    height: 26px;
  }
}

/* Mobile: slightly larger hand icon for better tap target/readability */
@media (max-width: 768px) {
  .main-nav .nav-links #show-selected-btn .cards-hand-toggle-icon {
    width: 27px;
    height: 27px;
    transform: translateY(-1px);
  }
}

/* Ensure hand icon uses currentColor stroke */
.main-nav .nav-links .filter-btn svg path,
.main-nav .nav-links .filter-btn svg rect,
.main-nav .nav-links .filter-btn svg circle,
.main-nav .nav-links .filter-btn svg line {
  stroke: currentColor;
}

/* Always show the hand icon */
.filter-btn .hand-icon { opacity: 1; }

/* Fine-tune vertical alignment for the active tick */
.main-nav .nav-links .filter-btn.active svg {
  transform: translateY(1px);
}

/* Onboarding: temporarily highlight the target button */
.main-nav .nav-links button.onboard-highlight,
.main-nav .nav-links .view-toggle.onboard-highlight,
.main-nav .nav-links .filter-btn.onboard-highlight,
.main-nav .nav-links .action-btn.onboard-highlight {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 6px 16px rgba(122,79,160,0.25);
}

/* Ensure active single-view toggle stays green even during onboarding highlight */
.main-nav .nav-links .view-toggle.active,
.main-nav .nav-links .view-toggle.active.onboard-highlight {
  background-color: var(--accent-color, #2db36f);
  border-color: var(--accent-color, #2db36f);
  color: #ffffff;
}

/* Hand pulse when a card is taken */
.main-nav .nav-links #show-selected-btn.hand-pulse {
  animation: handPulse 650ms ease;
}
@keyframes handPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Badge bump when count changes */
.nav-badge.badge-bump {
  animation: badgeBump 650ms ease;
}
@keyframes badgeBump {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-2px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

/* Center the tick vertically in all states with a small, consistent nudge */
.filter-btn svg {
  transform: translateY(1px);
}
/* Remove extra movement on toggle */
.main-nav .nav-links .filter-btn.active svg {
  transform: translateY(1px);
}

/* Onboarding tooltips for nav icons */
.onboard-tip {
  position: fixed;
  z-index: 2000;
  background: transparent; /* text-only, like flip hint */
  color: #FFFFFF; /* brighter for readability */
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap; /* keep single line */
  text-shadow:
    0 1px 3px rgba(0,0,0,0.65),
    0 0 1px rgba(0,0,0,0.85); /* stronger outline for contrast */
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}
.onboard-tip.visible { opacity: 1; transform: translateY(0); }
.onboard-tip .onboard-tip-inner { display:inline-block; white-space: nowrap; animation: wiggle-once 1.2s ease; }
.onboard-tip::after { content: none; }
.onboard-tip.bottom::after { content: none; }
.onboard-tip.top::after { content: none; }


/* Playful wiggle inspired by flip hint */
@keyframes wiggle-once {
  0% { transform: translateX(0); }
  20% { transform: translateX(-2px) rotate(-1deg); }
  40% { transform: translateX(2px) rotate(1deg); }
  60% { transform: translateX(-1px) rotate(-0.5deg); }
  80% { transform: translateX(1px) rotate(0.5deg); }
  100% { transform: translateX(0); }
}
