/* Fonts loaded locally via <link> in HTML */

:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Prompt', sans-serif;
  --bg-dark: #060a12;
  --bg-gradient: radial-gradient(circle at 50% 30%, #0d1a2d 0%, #040810 100%);
  --accent-cyan: #00f3ff;
  --accent-teal: #00e5a3;
  --accent-gold: #ffb700;
  --accent-pink: #ff6b9d;
  --accent-purple: #c084fc;
  --glass-bg: rgba(10, 20, 35, 0.78);
  --glass-border: rgba(0, 243, 255, 0.2);
  --text-primary: #f0f6fc;
  --text-muted: #8b9bb4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow background */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ripple-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: pulseGlow 10s ease-in-out infinite alternate;
}

.glow-1 {
  width: 450px;
  height: 450px;
  background: #ff6b9d;
  top: 10%;
  left: 20%;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: #00f3ff;
  bottom: 10%;
  right: 15%;
  animation-delay: -5s;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9) translate(0, 0); opacity: 0.14; }
  100% { transform: scale(1.15) translate(30px, -20px); opacity: 0.25; }
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  z-index: 1;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.65rem 1rem;
  border-radius: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 10%, #ff80bf 60%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
}

.title-group .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.glass-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.glass-btn:hover {
  background: rgba(255, 107, 157, 0.15);
  border-color: var(--accent-pink);
  box-shadow: 0 0 12px rgba(255, 107, 157, 0.35);
  transform: translateY(-1px);
}

.glass-btn.active {
  background: rgba(0, 243, 255, 0.2);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

/* Stats */
.stats-group {
  display: flex;
  gap: 0.4rem;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
}

.stat-badge.highlight {
  border-color: rgba(255, 107, 157, 0.5);
  background: rgba(255, 107, 157, 0.1);
}

.stat-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Controls */
.game-controls {
  display: flex;
  justify-content: center;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.icon-btn {
  padding: 0.45rem 0.65rem;
}

.donate-btn {
  background: linear-gradient(135deg, rgba(255, 183, 0, 0.2), rgba(255, 107, 157, 0.2));
  border-color: rgba(255, 183, 0, 0.4);
  color: #ffe89e;
}

.donate-btn:hover {
  background: linear-gradient(135deg, rgba(255, 183, 0, 0.35), rgba(255, 107, 157, 0.35));
  border-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(255, 183, 0, 0.4);
}

/* Canvas Area */
.canvas-wrapper {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#game-canvas {
  width: 100%;
  max-width: 540px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: #080f1b;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.8), 0 0 16px rgba(0, 243, 255, 0.15);
  cursor: pointer;
  touch-action: manipulation;
}

.hint-banner {
  margin-top: 0.6rem;
  background: rgba(255, 183, 0, 0.15);
  border: 1px solid rgba(255, 183, 0, 0.4);
  color: #ffe699;
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  animation: fadeIn 0.3s ease;
  text-align: center;
}

.hint-banner.hidden {
  display: none;
}

/* Footer */
.game-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 0 0.5rem;
}

/* Modals */
.glass-modal {
  margin: auto;
  border: none;
  background: transparent;
  padding: 0;
  max-width: 480px;
  width: 90%;
  border-radius: 20px;
}

.glass-modal::backdrop {
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-content {
  background: rgba(11, 21, 38, 0.95);
  border: 1px solid rgba(255, 107, 157, 0.3);
  border-radius: 20px;
  padding: 1.5rem;
  color: var(--text-primary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 107, 157, 0.2);
  position: relative;
}

.modal-content.text-center {
  text-align: center;
}

.win-sparkle {
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
  animation: sparkleBounce 1.5s infinite alternate;
}

@keyframes sparkleBounce {
  0% { transform: scale(0.95) translateY(0); }
  100% { transform: scale(1.1) translateY(-6px); }
}

.win-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, #ff80bf, var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.win-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  margin-bottom: 1.2rem;
}

.win-stats-grid {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.win-stat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.7rem 1.2rem;
  border-radius: 12px;
  min-width: 100px;
}

.win-stat-box .label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.win-stat-box .value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.win-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.primary-btn {
  background: linear-gradient(135deg, #ff6b9d 0%, #a855f7 100%);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.primary-btn:hover {
  box-shadow: 0 0 20px rgba(255, 107, 157, 0.6);
  transform: translateY(-2px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  padding: 0.65rem 1.2rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}

/* Modal Headers */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-primary);
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 0.4rem;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--accent-pink);
}

/* Share Modal QR */
#share-qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffffff;
  padding: 0.75rem;
  border-radius: 12px;
  margin: 1rem auto;
  width: fit-content;
}

#share-qr-container img, #share-qr-container canvas {
  display: block;
}

.share-url-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.share-url-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 229, 163, 0.95);
  color: #040810;
  padding: 0.6rem 1.4rem;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 229, 163, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .app-container {
    gap: 0.65rem;
  }
  .title-group h1 {
    font-size: 1.05rem;
  }
  .glass-btn {
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
  }
  .stat-badge {
    min-width: 50px;
    padding: 0.25rem 0.5rem;
  }
}
