/* Enhanced styles.css for Kindness Constellation */

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(143,211,255,0.6)); }
  50% { filter: drop-shadow(0 0 16px rgba(143,211,255,0.9)); }
}

:root {
  --bg: #0a0e14;
  --bg-gradient-1: #1a2136;
  --bg-gradient-2: #05070a;
  --panel: #12161d;
  --panel-elevated: #1a1f28;
  --text: #e3ebf5;
  --muted: #a0b0c8;
  --accent: #8fd3ff;
  --accent-warm: #ffd75e;
  --radius: 12px;
  --shadow: 0 20px 90px rgba(0,0,0,0.5);
}

* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  overflow: hidden;
  margin: 0;
  background: var(--bg);
  background: radial-gradient(ellipse at top, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Disable pull-to-refresh and overscroll on mobile */
  overscroll-behavior: none;
  /* Prevent text selection during touch interactions */
  -webkit-user-select: none;
  user-select: none;
  /* Prevent touch callouts on iOS */
  -webkit-touch-callout: none;
}

/* Sky container with vignette effect */
#sky-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  animation: fadeIn 1.5s ease;
}

#sky-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(2,5,10,0.4) 100%);
  pointer-events: none;
  z-index: 3;
}

#sky-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: grab;
}

#sky-canvas:active {
  cursor: grabbing;
}

/* Header styling */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  backdrop-filter: blur(12px) saturate(180%);
  background: rgba(10,14,20,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 100;
  animation: slideUp 0.6s ease;
  gap: 20px;
}

.header-info {
  flex: 1;
  display: flex;
  justify-content: center;
}

.star-count {
  background: linear-gradient(135deg, rgba(64,224,208,0.15), rgba(64,224,208,0.05));
  border: 1px solid rgba(64,224,208,0.3);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: slideUp 0.6s ease 0.2s both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.3px;
}

.brand-mark {
  animation: glow 3s ease-in-out infinite;
  transition: transform 0.3s ease;
}

.brand:hover .brand-mark {
  transform: rotate(20deg) scale(1.1);
}

.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Enhanced buttons */
.button {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.2);
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.03));
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.button:hover:not(:disabled)::before {
  opacity: 1;
}

.button:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(143,211,255,0.15);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button--ghost {
  background: transparent;
  color: var(--muted);
  border-color: rgba(255,255,255,0.12);
}

.button--ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.add-btn {
  background: linear-gradient(135deg, #ffd75e 0%, #ffb800 100%);
  color: #1a1410;
  font-weight: 700;
  padding: 11px 20px;
  border: none;
  box-shadow: 0 4px 16px rgba(255,215,94,0.3);
  position: relative;
  overflow: hidden;
}

.add-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.3) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.add-btn:hover::after {
  opacity: 1;
}

.add-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(255,215,94,0.5);
}

.kofi-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff5e5e 0%, #ff3838 100%);
  color: #fff;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(255,94,94,0.25);
}

.kofi-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(255,94,94,0.4);
  background: linear-gradient(135deg, #ff7676 0%, #ff5e5e 100%);
}

/* Modal animations and styling */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  backdrop-filter: blur(0);
}

.modal[aria-hidden="false"] {
  display: flex;
  animation: modalFadeIn 0.3s ease;
}

.modal[aria-hidden="false"] .modal-card {
  animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card {
  width: min(560px, 92vw);
  background: var(--panel-elevated);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--accent) 50%, 
    transparent 100%);
}

.modal-card h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.modal-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  padding: 10px;
  background: rgba(64,224,208,0.08);
  border-left: 3px solid rgba(64,224,208,0.4);
  border-radius: 4px;
}

/* Enhanced form elements */
textarea {
  width: 100%;
  min-height: 140px;
  background: rgba(0,0,0,0.3);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 14px 16px;
  resize: vertical;
  font: 16px/1.6 system-ui, -apple-system, sans-serif;
  transition: all 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 3px rgba(143,211,255,0.1);
}

textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.spacer { 
  flex: 1; 
}

#charCount {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* Read star modal styling */
.note-wrap {
  padding: 1.5rem 1rem;
  text-align: center;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#noteText {
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.5;
  margin: 0 0 1.25rem 0;
  color: var(--text);
  animation: fadeIn 0.6s ease;
}

#noteMeta {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2rem;
  gap: 10px;
}

/* Enhanced nova burst effect */
@keyframes nova-burst {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    transform: scale(4) rotate(180deg);
    opacity: 0;
  }
}

@keyframes nova-ring {
  0% {
    transform: scale(0);
    opacity: 0.8;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

.nova {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  z-index: 300;
  pointer-events: none;
  transform-origin: center;
}

.nova.visible {
  background: radial-gradient(circle, 
    rgba(255,255,255,1) 0%, 
    rgba(255,230,150,0.9) 30%,
    rgba(255,200,100,0.6) 60%,
    rgba(255,180,50,0) 100%);
  animation: nova-burst 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 0 20px rgba(255,230,150,0.8),
    0 0 40px rgba(255,200,100,0.5),
    0 0 60px rgba(255,180,50,0.3);
}

.nova.visible::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(255,215,94,0.6);
  animation: nova-ring 0.5s ease-out;
}

/* Accessibility */
.sr-only {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .site-header {
    padding: 12px 16px;
  }
  
  .brand-name {
    font-size: 0.95rem;
  }
  
  .actions {
    gap: 8px;
  }
  
  .button {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  
  .add-btn {
    padding: 9px 16px;
  }
  
  .kofi-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  .modal-card {
    padding: 1.5rem;
  }
  
  #noteText {
    font-size: 1.15rem;
  }
}

/* Loading state (optional) */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.loading {
  animation: pulse 2s ease-in-out infinite;
}

/* Audio Player */
.audio-player {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 150;
  background: rgba(18, 22, 29, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.6s ease 0.8s both;
}

.audio-btn {
  appearance: none;
  background: linear-gradient(135deg, rgba(143, 211, 255, 0.2), rgba(143, 211, 255, 0.1));
  border: 1px solid rgba(143, 211, 255, 0.3);
  color: var(--accent);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.audio-btn:hover {
  background: linear-gradient(135deg, rgba(143, 211, 255, 0.3), rgba(143, 211, 255, 0.15));
  border-color: rgba(143, 211, 255, 0.5);
  transform: scale(1.05);
}

.audio-btn:active {
  transform: scale(0.95);
}

.audio-btn svg {
  display: block;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(143, 211, 255, 0.4);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 12px rgba(143, 211, 255, 0.6);
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(143, 211, 255, 0.4);
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 12px rgba(143, 211, 255, 0.6);
}

.volume-value {
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .audio-player {
    bottom: 80px;
    left: 12px;
    padding: 10px 12px;
    gap: 10px;
  }
  
  .audio-btn {
    width: 36px;
    height: 36px;
  }
  
  .audio-btn svg {
    width: 16px;
    height: 16px;
  }
  
  .volume-slider {
    width: 60px;
  }
  
  .volume-value {
    font-size: 0.8rem;
    min-width: 32px;
  }
}
/* Like button styling */
.like-star-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255, 94, 94, 0.2), rgba(255, 94, 94, 0.1));
  border-color: rgba(255, 94, 94, 0.3);
  transition: all 0.2s ease;
}

.like-star-btn:hover {
  background: linear-gradient(135deg, rgba(255, 94, 94, 0.3), rgba(255, 94, 94, 0.15));
  border-color: rgba(255, 94, 94, 0.5);
}

.like-star-btn svg {
  flex-shrink: 0;
}

#likeCount {
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}