:root {
  --ui-bg: rgba(16, 30, 56, 0.7);
  --ui-border: rgba(255,255,255,0.1);
  --ui-text: #e6f0ff;
  --accent: #FFEAA6; /* Yellow for user stars */
  --glow: #fff7c2;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-image: radial-gradient(ellipse at center, rgb(7 23 38 / 90%), rgb(5 14 29 / 95%)), url(./assets/images/Hospice-House-landscape-bw.jpg);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: #000; /* fallback */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--ui-text);
  overflow: hidden; /* no scrollbars; canvas is full-viewport */
}
#app {
  position: fixed;
  inset: 0;
}
a {
  color: var(--accent);
}
/* Header content container (better structure) */
.header-content {
  position: absolute;
  top: 30px;
  left: 30px;
  z-index: 11;
}
/* Header images wrapper */
.header-images {
  position: relative;
  margin-bottom: 0;
}
/* Top-left logo */
.site-logo {
  position: relative;
  display: block;
  height: 120px;
  width: auto;
  margin-bottom: 30px;
  pointer-events: none;
}
/* Title image below logo */
.title-image {
  position: relative;
  display: block;
  max-width: 400px;
  width: auto;
  height: auto;
  margin-bottom: 0;
  opacity: 0.98;
  pointer-events: none;
}
/* Logo text description */
.desc-text {
  position: relative;
  margin-top: 20px;
  margin-left: 5px;
  max-width: 450px;
  font-size: 18px;
  line-height: 1.4;
  opacity: 0.95;
  transition: opacity 0.3s ease;
}
.desc-text strong {
  color: var(--accent);
  font-weight: 600;
}
/* Hide mobile info icon on desktop */
.mobile-info-icon {
  display: none; /* Hidden on desktop */
}
/* Hide mobile search icon on desktop */
.mobile-search-icon {
  display: none; /* Hidden on desktop */
}
/* CTA Button (Desktop only) */
.cta-button {
  display: none; /* Hidden by default, shown on desktop */
}
/* Desktop Search Button */
.search-button {
  display: none; /* Hidden by default, shown on desktop */
}
@media (min-width: 769px) {
  /* Hide tutorial elements on desktop */
  .tutorial-overlay,
  .tutorial-tooltip,
  .tutorial-highlight {
    display: none !important;
  }
  
  /* Desktop Tooltip */
  .desktop-tooltip {
    display: none;
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 14, 28, 0.98);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 213, 74, 0.6);
    border-radius: 16px;
    padding: 16px 24px;
    color: var(--ui-text);
    font-size: 16px;
    text-align: center;
    z-index: 200;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .desktop-tooltip.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }
  .desktop-tooltip.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  .desktop-tooltip p {
    margin: 0 0 12px 0;
    line-height: 1.5;
  }
  .desktop-tooltip-dismiss {
    appearance: none;
    border: 1px solid var(--ui-border);
    background: var(--accent);
    color: #010610;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .cta-button {
    display: block;
    position: relative;
    margin-top: 40px;
    margin-left: 5px;
    appearance: none;
    border: 0;
    background: var(--accent);
    color: #010610;
    font-weight: 600;
    font-size: 17px;
    padding: 14px 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
  }
  .cta-button:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
  }
  .cta-button:active {
    transform: translateY(0);
  }
  .search-button {
    display: inline-block;
    position: relative;
    margin-top: 40px;
    margin-left: 12px;
    appearance: none;
    border: 1px solid rgb(255 255 255 / 80%);
    background: transparent;
    color: var(--ui-text);
    font-weight: 500;
    font-size: 17px;
    padding: 14px 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .search-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
  }
  .search-button:active {
    transform: scale(0.98);
  }
  .star-count-message {
    position: relative;
    margin-top: 12px;
    margin-left: 5px;
    font-size: 13px;
    color: var(--ui-text);
    opacity: 0.8;
    font-style: italic;
  }
}
/* Header content visibility control */
.header-content.hidden {
  opacity: 0;
  pointer-events: none;
}
.header-content.hidden .header-images,
.header-content.hidden .desc-text,
.header-content.hidden .cta-button,
.header-content.hidden .star-count-message {
  opacity: 0;
  pointer-events: none;
}
/* Footer */
.site-footer {
  position: absolute;
  bottom: 16px;
  left: 35px;
  z-index: 11;
  text-align: left;
  pointer-events: none;
}
.site-footer p {
  margin: 0;
  font-size: 11px;
  color: var(--ui-text);
  opacity: 0.6;
  font-weight: 400;
  letter-spacing: 0.3px;
}
.site-footer a {
  pointer-events: auto;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}
.site-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}
/* Full-viewport background photo layer (behind canvas) - Background now on body, this is just a placeholder */
.photo-bg {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 0;
}
.canvas-area {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}
canvas#tree {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  object-fit: contain;
}
.bottom-controls {
  display: none;
}
@media (min-width: 769px) {
  .bottom-controls {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
  }
  .bottom-controls > * {
    pointer-events: auto;
  }
  .bottom-controls .mobile-bottom-row {
    display: none;
  }
  .pagination-container {
    position: relative;
    width: 100%;
  }
}
/* Desktop modal overlay */
.desktop-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.desktop-modal-overlay.active {
  display: block;
  opacity: 1;
}
/* Top-right message panel - Desktop as modal (left side) */
.panel {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: min(400px, 90vw);
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  padding: 24px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  z-index: 10;
}
/* Desktop modal panel (left side) */
@media (min-width: 769px) {
  .panel.desktop-modal {
    position: fixed;
    top: 50%;
    left: 50px;
    bottom: auto;
    right: auto;
    transform: translateY(-50%) translateX(-100%);
    width: min(450px, 40vw);
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    z-index: 21;
    display: block; /* Ensure it's visible when active */
  }
  .panel.desktop-modal.active {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  /* Desktop modal close button */
  .desktop-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--ui-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 22;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .desktop-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
  }
  .desktop-modal-close:active {
    transform: scale(0.95);
  }
}
.panel h2 {
  margin: 0 0 16px 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 17px;
  opacity: 0.85;
  margin-bottom: 12px;
}
.form-error {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(255, 87, 87, 0.15);
  border: 1px solid rgba(255, 87, 87, 0.4);
  border-radius: 6px;
  color: #ffb3b3;
  font-size: 14px;
  line-height: 1.5;
  display: none;
}
.form-error.show {
  display: block;
}
.field input, .field textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  color: var(--ui-text);
  padding: 10px 12px;
  outline: none;
  font-size: 17px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 100px; max-height: 180px; }
.row {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
}
button {
  appearance: none; border: 0;
  background: var(--accent);
  color: #010610; font-weight: 600;
  font-size: 17px;
  padding: 10px 12px; border-radius: 6px;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
/* Pagination Container (underneath tree) - Desktop only */
.pagination-container {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}
.pagination-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  /* background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 14px; */
  padding: 12px 20px;
  /* backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); */
}
.pagination-btn {
  appearance: none;
  border: 1px solid var(--ui-border);
  background: transparent;
  color: var(--ui-text);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pagination-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}
.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pagination-info {
  margin: 0 8px;
  font-size: 13px;
  color: var(--ui-text);
  opacity: 0.8;
  min-width: 100px;
  text-align: center;
}
/* Load More Container (underneath tree) */
.load-more-container {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}
.load-more-btn {
  appearance: none;
  border: 1px solid var(--ui-border);
  background: transparent;
  color: var(--ui-text);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.load-more-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}
.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Click bubble */
.bubble {
  position: absolute;
  min-width: 280px;
  max-width: min(400px, 90vw);
  background: var(--accent);
  color: #1a0f00;
  border: 2px solid rgb(255, 240, 189);
  border-radius: 16px;
  padding: 22px 26px;
  pointer-events: none;
  transform: translate(-50%, -110%);
  z-index: 15;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: normal;
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.bubble.visible { 
  opacity: 1; 
  transform: translate(-50%, -110%) scale(1);
  pointer-events: auto;
}
.bubble::after {
  content: '';
  position: absolute;
  top: 0;
  right: -1rem;
  width: 90%;
  height: 90%;
  background: url('./assets/images/hospice-icon.svg') right top / auto 90% no-repeat;
  filter: brightness(0) invert(1);
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}
.bubble h3 {
  margin: 0 0 14px 0;
  font-size: 17px;
  font-weight: 700;
  color: #1a0f00;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}
.bubble .bubble-section {
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.bubble .bubble-section:last-of-type {
  margin-bottom: 0;
}
.bubble .bubble-label {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 8px;
  display: block;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #3d2500;
}
.bubble .bubble-value {
  font-size: 15px;
  line-height: 1.6;
  display: block;
  color: #1a0f00;
  font-weight: 500;
}
.bubble .bubble-message {
  margin-top: 10px;
}
.bubble .bubble-message .bubble-value {
  font-style: italic;
  color: #2d1800;
  font-weight: 400;
}
.bubble time {
  font-size: 11px;
  opacity: 0.75;
  display: block;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(61, 37, 0, 0.3);
  color: #3d2500;
  font-weight: 500;
  position: relative;
  z-index: 1;
}
.bubble-close {
  position: absolute;
  top: 12px;
  right: 12px;
  appearance: none;
  border: 0;
  background: rgba(61, 37, 0, 0.15);
  color: #3d2500;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-sizing: border-box;
}
.bubble-close:hover {
  opacity: 1;
  background: rgba(61, 37, 0, 0.1);
  transform: scale(1.1);
}
.bubble-close:active {
  transform: scale(0.95);
}
/* Small helper for highlighting user's newest star */
/* Toast (opening donation) */
.toast {
  position: fixed;
  left: 50%; bottom: 20px;
  transform: translate(-50%, 10px);
  background: rgba(10, 14, 28, 0.92);
  color: var(--ui-text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 12; font-size: 13px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes ping {
  0%   { box-shadow: 0 0 0 0px rgba(255,213,74,0.6); }
  70%  { box-shadow: 0 0 0 16px rgba(255,213,74,0.0); }
  100% { box-shadow: 0 0 0 0px rgba(255,213,74,0.0); }
}
/* Mobile Splash Modal */
.mobile-splash-modal {
  display: none; /* Hidden on desktop */
}
@media (max-width: 768px) {
  .mobile-splash-modal {
    display: flex;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    background: radial-gradient(ellipse at center, rgba(12, 43, 72, 0.3), rgba(15, 30, 54, 0.4));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px 0;
    box-sizing: border-box;
  }
  .mobile-splash-modal.hidden {
    display: none;
  }
  .mobile-splash-content {
    max-width: 90%;
    max-height: calc(100dvh - 40px);
    text-align: center;
    color: var(--ui-text);
    padding: 10px;
    margin: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    /* box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); */
  }
  .mobile-splash-images {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
  }
  .mobile-splash-images .site-logo {
    height: 80px;
    width: auto;
  }
  .mobile-splash-images .title-image {
    max-width: 100%;
    max-height: 60px;
    width: auto;
    height: auto;
  }
  .mobile-splash-desc {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 32px;
    opacity: 0.95;
  }
  .mobile-splash-desc strong {
    color: var(--accent);
    font-weight: 600;
  }
  .mobile-splash-continue {
    appearance: none;
    border: 0;
    background: var(--accent);
    color: #010610;
    font-weight: 600;
    font-size: 17px;
    padding: 14px 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
  }
  .mobile-splash-continue:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
  }
  .mobile-splash-continue:active {
    transform: translateY(0);
  }
  .mobile-splash-copyright {
    margin-top: 24px;
    text-align: center;
  }
  .mobile-splash-copyright p {
    margin: 0;
    font-size: 10px;
    color: var(--ui-text);
    opacity: 0.6;
    font-weight: 400;
  }
  .mobile-splash-copyright a {
    color: var(--accent);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
  }
  .mobile-splash-copyright a:hover {
    opacity: 1;
    text-decoration: underline;
  }
}
/* Mobile Responsive Styles (Option C: Adaptive Stacking) */
@media (max-width: 768px) {
  /* Hide desktop tooltip on mobile */
  .desktop-tooltip {
    display: none !important;
  }
  
  html {
    overflow: hidden !important;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    position: fixed;
    width: 100%;
  }
  body {
    overflow: hidden !important;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    width: 100%;
  }
  
  #app {
    position: fixed !important;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .canvas-area {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    z-index: 1;
    overflow: hidden;
    display: flex;
    align-items: stretch;
  }
  
  .photo-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
  }
  
  canvas#tree {
    position: relative;
    flex: 1 1 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    z-index: 1;
  }
  
  .bottom-controls {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 100%;
    z-index: 2;
    background: transparent;
    pointer-events: none;
  }
  
  /* Ensure all child elements in bottom-controls are transparent on mobile */
  .bottom-controls .pagination-container,
  .bottom-controls .mobile-bottom-row {
    background: transparent;
  }
  
  .bottom-controls > * {
    pointer-events: auto;
  }
  
  .mobile-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 12px;
  }
  /* Hide main content initially on mobile until splash is dismissed */
  .header-content.mobile-hidden,
  .header-content.mobile-hidden ~ .canvas-area,
  .header-content.mobile-hidden ~ .bottom-controls {
    display: none;
  }
  /* Hide Add My Star button when splash modal is shown */
  .mobile-splash-modal:not(.hidden) ~ * .modal-open-btn {
    display: none !important;
  }
  /* Mobile: Header content container */
  .header-content {
    position: relative;
    top: 0;
    left: 0;
    margin: 0 auto;
    width: 100%;
    z-index: 2;
    flex-shrink: 0; /* Don't shrink, take only needed space */
    background: transparent;
  }
  
  /* Hide desktop star count message in header on mobile */
  .header-content .star-count-message {
    display: none;
  }
  /* Mobile: Info Icon */
  .mobile-info-icon {
    display: flex;
    position: fixed;
    top: 16px;
    left: 16px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: none;
    color: var(--ui-text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    appearance: none;
  }
  
  /* Mobile: Search Icon */
  .mobile-search-icon {
    display: flex;
    position: fixed;
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: none;
    color: var(--ui-text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    appearance: none;
  }
  .mobile-search-icon:hover,
  .mobile-search-icon:active {
    background: rgb(255 255 255 / 10%);
    transform: scale(0.95);
  }
  
  /* Mobile: Search Modal adjustments */
  .search-modal-container {
    top: 50%;
    left: 50%;
    width: calc(100% - 32px);
    max-height: 70vh;
    padding: 20px;
  }
  .search-results {
    max-height: 300px;
  }
  .mobile-info-icon:hover {
    background: rgba(10, 14, 28, 0.95);
    transform: scale(1.05);
  }
  .mobile-info-icon:active {
    transform: scale(0.95);
  }
  .mobile-info-icon svg {
    width: 20px;
    height: 20px;
  }
  
  /* Tutorial Overlay */
  .tutorial-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }
  .tutorial-overlay.active {
    display: block;
    opacity: 1;
    background: none;
    pointer-events: auto;
  }
  .tutorial-tooltip {
    position: fixed;
    background: rgba(10, 14, 28, 0.98);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 213, 74, 0.6);
    border-radius: 16px;
    padding: 15px;
    color: var(--ui-text);
    font-size: 16px;
    text-align: center;
    z-index: 1001;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    min-width: 300px;
    max-width: 360px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
  }
  .tutorial-tooltip.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }
  .tutorial-tooltip h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: var(--accent);
    font-weight: 600;
  }
  .tutorial-tooltip p {
    margin: 0 0 20px 0;
    line-height: 1.5;
  }
  .tutorial-tooltip .tutorial-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
  }
  .tutorial-btn {
    appearance: none;
    border: 1px solid var(--ui-border);
    background: transparent;
    color: var(--ui-text);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
  }
  .tutorial-btn.primary {
    background: var(--accent);
    color: #010610;
    border-color: var(--accent);
  }
  .tutorial-highlight {
    position: fixed;
    border: 3px solid var(--accent);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 213, 74, 0.5);
    z-index: 1000;
    pointer-events: none;
    transition: all 0.3s ease;
    display: none;
  }
  /* Hide desc-text on mobile by default */
  .desc-text {
    display: none;
  }
  /* Mobile: Header images wrapper - flexbox for side by side */
  .header-images {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px auto 12px;
    width: 100%;
  }
  /* Mobile: Smaller logo at top center - above canvas */
  .site-logo {
    position: relative;
    top: 0;
    left: 0;
    height: 70px;
    width: auto;
    margin: 0;
    display: block;
    opacity: 0.98;
    z-index: 2; /* Above canvas but below modal */
  }
  /* Mobile: Title image next to logo, centered - above canvas */
  .title-image {
    position: relative;
    top: 0;
    left: 0;
    max-width: calc(90vw - 100px);
    max-height: 70px;
    width: auto;
    height: auto;
    margin: 0;
    display: block;
    opacity: 0.98;
    z-index: 2; /* Above canvas but below modal */
  }
  /* Mobile: Description text below title image, centered - above canvas */
  .desc-text {
    position: relative;
    top: 0;
    left: 0;
    max-width: 90%;
    margin: 0 auto 20px;
    font-size: 17px;
    line-height: 1.5;
    text-align: center;
    padding: 16px;
    z-index: 2; /* Above canvas but below modal */
    background: transparent;
  }
  /* Mobile: Hide panel (will be in modal) */
  .panel {
    display: none;
  }
  .panel h2 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  /* Mobile: Larger touch targets */
  .field {
    margin-bottom: 18px;
  }
  .field label {
    font-size: 13px;
    margin-bottom: 10px;
  }
  .field input,
  .field textarea {
    padding: 14px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 12px;
    min-height: 44px; /* Touch target size */
  }
  .field textarea {
    min-height: 100px;
    max-height: 180px;
  }
  /* Mobile: Larger buttons */
  button {
    padding: 14px 20px;
    font-size: 16px;
    min-height: 44px;
    border-radius: 12px;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
  }
  .row {
    flex-wrap: wrap;
    gap: 10px;
  }
  /* Mobile: Bubble adjustments */
  .bubble {
    min-width: 280px;
    max-width: calc(100vw - 40px);
    width: calc(100vw - 40px);
    padding: 20px 22px;
    border-radius: 14px;
    box-sizing: border-box;
    position: fixed;
    border-width: 2px;
  }
  .bubble .bubble-label {
    font-size: 10px;
    margin-bottom: 7px;
  }
  .bubble .bubble-value {
    font-size: 14px;
    line-height: 1.5;
  }
  .bubble time {
    font-size: 10px;
    margin-top: 14px;
    padding-top: 12px;
  }
  .bubble-close {
    top: 10px;
    right: 10px;
    font-size: 18px;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    max-width: 26px;
    max-height: 26px;
    padding: 0;
    margin: 0;
  }
  /* Mobile: Toast positioning */
  .toast {
    bottom: 80px; /* Above mobile keyboard */
    font-size: 14px;
    padding: 12px 16px;
    max-width: 90%;
  }
  /* Mobile: Footer - Hidden on mobile (copyright moved to splash modal) */
  .site-footer {
    display: none;
  }
  /* Mobile: Pagination controls - Pure flexbox, no absolute positioning */
  .pagination-container {
    position: static;
    width: 100%;
    padding: 8px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: none;
    left: auto;
    bottom: auto;
    z-index: auto;
  }
  .pagination-controls {
    gap: 8px;
    padding: 8px 12px;
    width: 100%;
    flex-direction: row;
    align-items: center;
    display: flex;
    justify-content: center;
  }
  .pagination-btn {
    flex: none;
    min-width: auto;
    padding: 8px 12px;
    font-size: 12px;
  }
  .pagination-info {
    font-size: 11px;
    min-width: auto;
    text-align: center;
  }
  
  /* Mobile: Star count message */
  .star-count-message-mobile {
    display: block;
    font-size: 11px;
    color: var(--ui-text);
    opacity: 0.8;
    font-style: italic;
    text-align: left;
    line-height: 1.3;
    flex: 1;
    max-width: 180px;
  }
  /* Mobile: Load More button */
  .load-more-container {
    bottom: 20px;
    width: calc(100% - 32px);
    max-width: 400px;
  }
  .load-more-btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
  }
}
/* Small mobile devices (< 480px) */
@media (max-width: 480px) {
  .header-images {
    gap: 8px;
    margin: 12px auto 10px;
  }
  .site-logo {
    height: 60px;
    margin: 0;
  }
  .title-image {
    max-width: calc(90vw - 80px);
    max-height: 60px;
    margin: 0;
  }
  .desc-text {
    font-size: 16px;
    margin-bottom: 16px;
    padding: 0 12px;
  }
  .panel {
    padding: 16px 12px;
    border-radius: 14px 14px 0 0;
  }
  .panel h2 {
    font-size: 16px;
  }
  .field input,
  .field textarea {
    padding: 12px 14px;
    font-size: 16px; /* Still 16px to prevent zoom */
  }
}
/* Prevent text selection during touch interactions */
canvas {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
/* Allow scrolling on mobile */
@media (max-width: 768px) {
  canvas {
    touch-action: pan-y; /* Allow vertical scrolling */
  }
}
/* Mobile Modal Styles */
.modal-open-btn {
  display: none; /* Hidden on desktop */
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #010610;
  font-weight: 600;
  font-size: 17px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.modal-open-btn:hover {
  filter: brightness(1.05);
}
.modal-open-btn:active {
  transform: scale(0.95);
}
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* background: rgba(0, 0, 0, 0.7); */
  backdrop-filter: blur(4px);
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
}
.modal-container {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  background: rgba(10, 14, 28, 0.98);
  backdrop-filter: blur(12px);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  z-index: 21;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-overflow-scrolling: touch;
}
.modal-container.active {
  transform: translateY(0);
}
/* Search Modal */
.search-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  backdrop-filter: blur(4px);
  z-index: 25;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.search-modal-overlay.active {
  display: block;
  opacity: 1;
}
.search-modal-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: min(500px, 90vw);
  max-height: 80vh;
  background: rgba(10, 14, 28, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 26;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow-y: auto;
}
.search-modal-container.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ui-border);
}
.search-modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--ui-text);
}
.search-modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ui-text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}
.search-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}
.search-input-container {
  margin-bottom: 20px;
}
.search-input-container input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  color: var(--ui-text);
  font-size: 16px;
  appearance: none;
  box-sizing: border-box;
}
.search-input-container input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}
.search-input-container input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
.search-results {
  max-height: 400px;
  overflow-y: auto;
}
.search-result-item {
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.search-result-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
}
.search-result-item:active {
  transform: scale(0.98);
}
.search-result-name {
  font-weight: 600;
  color: var(--ui-text);
  margin-bottom: 4px;
}
.search-result-dedication {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}
.search-result-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}
.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}
/* Success Modal */
.success-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.success-modal-overlay.active {
  display: block;
  opacity: 1;
}
.success-modal-container {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: min(500px, 90vw);
  max-height: 80vh;
  background: rgba(10, 14, 28, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 31;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow-y: auto;
}
.success-modal-container.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.success-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ui-border);
}
.success-modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--ui-text);
}
.success-modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ui-text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}
.success-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}
.success-modal-content {
  margin-bottom: 24px;
}
.success-message {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ui-text);
  margin: 0;
}
.success-modal-footer {
  display: flex;
  justify-content: center;
}
.donation-cta-button {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #010610;
  font-weight: 600;
  font-size: 17px;
  padding: 14px 32px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}
.donation-cta-button:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}
.donation-cta-button:active {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
.modal-close-btn {
  appearance: none;
  border: 1px solid var(--ui-border);
  background: transparent;
  color: var(--ui-text);
  font-weight: 500;
  font-size: 16px;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  margin-left: 8px;
}
.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}
.modal-close-btn:active {
  transform: scale(0.98);
}
@media (max-width: 768px) {
  /* Show modal button on mobile */
  .modal-open-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  /* Show modal overlay and container */
  .modal-overlay.active,
  .modal-container.active {
    display: block;
  }
}
