/* ===================================================================
   AquaPurr 3D · estilo del HUD (glassmorphism sobre escena WebGL)
   =================================================================== */
:root {
  --gold: #ffd66b; --gold-deep: #f2a73b;
  --aqua: #8ff6ff; --aqua-glow: #41e6ff; --leaf: #5fe0a8; --coral: #ff9bb3;
  --glass: rgba(8, 28, 52, 0.42); --glass-strong: rgba(8, 28, 52, 0.64);
  --glass-border: rgba(180, 240, 255, 0.22); --glass-hi: rgba(255, 255, 255, 0.16);
  --text: #eafaff; --text-dim: rgba(234, 250, 255, 0.66);
  --font-display: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  --shadow-pop: 0 6px 24px rgba(0, 8, 24, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; font-family: var(--font-body); color: var(--text); background: #06121f; overscroll-behavior: none; touch-action: none; }
button { font-family: var(--font-display); cursor: pointer; border: none; color: inherit; }
button:focus-visible { outline: 2px solid var(--aqua-glow); outline-offset: 2px; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }

#hud { position: fixed; inset: 0; z-index: 6; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#hud > * { pointer-events: auto; }

.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 1.6rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.brand-text h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; line-height: 1; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.brand-text h1 .d3 { color: var(--aqua-glow); margin-left: 2px; }
.brand-text p { font-size: .72rem; color: var(--text-dim); letter-spacing: .5px; margin-top: 2px; }

.wallet { margin-left: auto; display: flex; align-items: center; gap: 9px; padding: 8px 16px 8px 12px;
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--glass-border); border-radius: 999px; box-shadow: var(--shadow-pop), inset 0 1px 0 var(--glass-hi); }
.coin-icon { width: 22px; height: 22px; border-radius: 50%; flex: none; position: relative; overflow: hidden;
  background: radial-gradient(circle at 34% 30%, #fff6d0, var(--gold) 45%, var(--gold-deep) 100%);
  box-shadow: 0 0 10px rgba(255,200,80,.6), inset 0 0 4px rgba(180,100,0,.5); }
.coin-icon::after { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #6b3e00; text-shadow: 0 1px 0 rgba(255,245,210,.55); }
.coin-icon::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.7) 50%, transparent 62%); transform: translateX(-130%); animation: coinShine 6s ease-in-out infinite; }
@keyframes coinShine { 0%,72% { transform: translateX(-130%); } 86%,100% { transform: translateX(130%); } }
.coin-count { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.coin-count.bump { animation: bump .45s var(--ease); }
@keyframes bump { 0%{transform:scale(1)} 38%{transform:scale(1.16)} 100%{transform:scale(1)} }
.coin-rate { font-size: .7rem; color: var(--leaf); font-weight: 700; text-shadow: 0 1px 3px rgba(0,10,25,.7); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.2rem;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border); border-radius: 14px; box-shadow: var(--shadow-pop), inset 0 1px 0 var(--glass-hi);
  transition: transform .2s var(--ease), background .2s; }
.icon-btn:hover { background: var(--glass-strong); transform: translateY(-2px); }
.icon-btn:active { transform: scale(.94); }

.buy-btn { display: flex; align-items: center; gap: 8px; padding: 9px 16px; font-weight: 600; font-size: .95rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #3a2400; border-radius: 14px;
  box-shadow: 0 6px 20px rgba(242,167,59,.45), inset 0 1px 0 rgba(255,255,255,.5); transition: transform .2s var(--ease); }
.buy-btn:hover { transform: translateY(-2px); }
.buy-btn:active { transform: scale(.96); }
.buy-btn small { background: rgba(0,0,0,.18); padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.buy-btn.cant { filter: grayscale(.5) brightness(.85); }

.dock { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; flex-wrap: wrap; }
.feed-btn { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 26px 14px 18px;
  background: linear-gradient(135deg, rgba(65,230,255,.95), rgba(17,112,184,.95)); color: #00222e; border-radius: 20px;
  box-shadow: 0 10px 30px rgba(20,150,200,.5), inset 0 1px 0 rgba(255,255,255,.5); transition: transform .18s var(--ease); }
.feed-btn:hover { transform: translateY(-3px) scale(1.02); }
.feed-btn:active { transform: scale(.96); }
.feed-btn.cant { filter: grayscale(.6) brightness(.8); cursor: not-allowed; }
.feed-emoji { font-size: 1.7rem; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); animation: feedBob 3.2s ease-in-out infinite; }
@keyframes feedBob { 0%,100%{transform:translateY(0) rotate(-5deg)} 50%{transform:translateY(-3px) rotate(5deg)} }
.feed-label { display: flex; flex-direction: column; text-align: left; line-height: 1.05; }
.feed-label strong { font-size: 1.05rem; font-weight: 700; }
.feed-label small { font-size: .76rem; opacity: .85; font-weight: 600; }
.dock-hint { font-size: .8rem; color: var(--text-dim); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border); padding: 8px 14px; border-radius: 999px; animation: hintFloat 4s ease-in-out infinite; }
@keyframes hintFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }

/* FX */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.fx-coin { position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff6d0, var(--gold) 45%, var(--gold-deep) 100%); box-shadow: 0 0 8px rgba(255,200,80,.7); will-change: transform, opacity; }
.fx-float { position: absolute; font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--gold);
  text-shadow: 0 2px 6px rgba(0,0,0,.5); will-change: transform, opacity; animation: floatUp 1.1s var(--ease) forwards; }
.fx-float.spend { color: var(--coral); }
@keyframes floatUp { 0%{transform:translateY(0) scale(.6); opacity:0} 20%{opacity:1; transform:translateY(-6px) scale(1.1)} 100%{transform:translateY(-46px) scale(1); opacity:0} }

/* Toasts */
#toast-layer { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--glass-strong); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 10px 18px; font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-pop);
  animation: toastIn .35s var(--ease), toastOut .35s var(--ease) 2.4s forwards; max-width: 90vw; }
.toast.warn { border-color: rgba(255,160,80,.4); color: #ffd9a8; }
.toast.good { border-color: rgba(95,224,168,.4); color: #b6ffe0; }
@keyframes toastIn { from{opacity:0; transform:translateY(14px)} to{opacity:1; transform:none} }
@keyframes toastOut { to{opacity:0; transform:translateY(-10px)} }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 30%, rgba(6,30,55,.55), rgba(3,10,20,.82)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn .3s var(--ease); }
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal { width: min(420px, 100%); background: linear-gradient(160deg, rgba(14,44,78,.94), rgba(8,26,50,.96));
  border: 1px solid var(--glass-border); border-radius: 26px; box-shadow: 0 10px 40px rgba(0,10,30,.45), inset 0 1px 0 var(--glass-hi);
  text-align: center; padding: 30px 26px 26px; animation: popIn .35s var(--ease); }
@keyframes popIn { from{opacity:0; transform:translateY(18px) scale(.96)} to{opacity:1; transform:none} }
.welcome-art { font-size: 3.2rem; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0) rotate(-4deg)} 50%{transform:translateY(-8px) rotate(4deg)} }
.welcome h2 { font-family: var(--font-display); font-size: 1.5rem; margin: 8px 0; }
.welcome p { color: var(--text-dim); font-size: .92rem; }
.welcome-earn { font-family: var(--font-display); font-weight: 700; font-size: 2.4rem; color: var(--gold); margin: 14px 0 18px; text-shadow: 0 0 24px rgba(255,200,80,.5); }
.welcome-earn::before { content: "✦ "; font-size: 1.4rem; }
.primary-btn { padding: 13px 28px; font-size: 1rem; font-weight: 700; background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #3a2400;
  border-radius: 16px; box-shadow: 0 8px 24px rgba(242,167,59,.45), inset 0 1px 0 rgba(255,255,255,.5); transition: transform .2s var(--ease); }
.primary-btn:hover { transform: translateY(-2px) scale(1.02); }
.primary-btn:active { transform: scale(.97); }
.primary-btn.big { padding: 16px 40px; font-size: 1.15rem; }

/* Intro */
.intro { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: linear-gradient(180deg, #0a3a6e, #061226 70%); transition: opacity .7s var(--ease), visibility .7s; }
.intro.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-inner { text-align: center; padding: 20px; }
.intro-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(3rem, 14vw, 6rem); letter-spacing: 1px;
  background: linear-gradient(180deg, #fff, var(--aqua) 60%, var(--aqua-glow)); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; filter: drop-shadow(0 6px 30px rgba(65,230,255,.4)); }
.intro-title span { -webkit-text-fill-color: var(--aqua-glow); }
.intro-sub { color: var(--aqua); opacity: .85; margin: 4px 0 26px; font-size: clamp(.9rem,3.5vw,1.1rem); }
.intro-foot { margin-top: 20px; color: rgba(180,235,255,.5); font-size: .8rem; }

/* Loader */
.loader { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; background: #061226; transition: opacity .5s; color: var(--text-dim); }
.loader.hide { opacity: 0; pointer-events: none; }
.loader p { margin-top: 16px; font-size: .9rem; }
.loader-spin { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(143,246,255,.2); border-top-color: var(--aqua-glow); animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
.errbox { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: #061226; text-align: center; }
.errbox[hidden] { display: none; }
.errbox h2 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 8px; }
.errbox p { color: var(--text-dim); max-width: 420px; margin: 6px auto; }
.errbox .errhint { font-size: .82rem; opacity: .7; }

@media (max-width: 560px) {
  .brand-text { display: none; }          /* en móvil queda solo el logo */
  .buy-btn .buy-label { display: none; }
  .dock-hint { display: none; }
  .coin-rate { display: none; }
  .topbar { padding: 10px 10px; gap: 7px; }
  .buy-btn { padding: 9px 12px; }
  .wallet { padding: 8px 12px 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
