:root{
  color-scheme:light only;
  --app-bg:#B49ABA;
  --primary:#54233F;
  --accent:#54233F;
  --glass:rgba(255,255,255,0.18);
  --glass-strong:rgba(255,255,255,0.24);
  --surface-1:rgba(255,255,255,0.11);
  --surface-2:rgba(255,255,255,0.16);
  --surface-dark:rgba(9,20,38,0.28);
  --border-soft:rgba(255,255,255,0.22);
  --text:#ffffff;
  --motion-fast:.26s;
  --motion-medium:.44s;
  --motion-slow:.6s;
  --ease-smooth:cubic-bezier(.22,.61,.36,1);
  --ease-soft:cubic-bezier(.25,.46,.45,.94);
  --ease-gentle:cubic-bezier(.18,.8,.22,1);
}

:root[data-theme="glacier"]{
  --app-bg:#9BC8E8;
  --primary:#123B5D;
  --accent:#1D5278;
}

:root[data-theme="nature"]{
  --app-bg:#B8C9B0;
  --primary:#2F5D50;
  --accent:#3F735E;
}

html,body{
  margin:0;
  padding:0;
  height:100%;
  width:100%;
  font-family:'Segoe UI',sans-serif;
  color:var(--text);
  line-height:1.35;
  scroll-behavior:smooth;
  background-color:#ffffff;
  background-image:linear-gradient(0deg,var(--app-bg),var(--app-bg));
  overflow-x:hidden;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-color-scheme: dark){
  body{
    background-color:#0d0d0d;
  }
}

#appBackGuard{
  position:fixed;
  inset:0;
  pointer-events:none;
  background:none;
  z-index:0;
}

/* SPLASH */
#splash{
  position:fixed;
  inset:0;
  background:#FFFFFF;
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:9999;
  transition:opacity .85s var(--ease-soft), transform .85s var(--ease-soft);
}
#splash.hide{
  opacity:0;
  transform:translateY(-40px);
  pointer-events:none;
}
#splash img{
  width:450px;
  max-width:80%;
  animation:popIn 1.2s ease;
}

body.splash-active .crash-banner{
  display:none !important;
}
@keyframes popIn{
  from{opacity:0;transform:scale(.85)}
  to{opacity:1;transform:scale(1)}
}

@keyframes modalIn{
  from{opacity:0;transform:translateY(12px) scale(.98)}
  to{opacity:1;transform:translateY(0) scale(1)}
}

@keyframes panelIn{
  from{opacity:0;transform:translate(-50%,-48%) scale(.98)}
  to{opacity:1;transform:translate(-50%,-50%) scale(1)}
}

@keyframes themeBubbleFloatOne{
  0%,100%{transform:translate3d(0,0,0) rotate(0deg)}
  50%{transform:translate3d(22px,-18px,0) rotate(8deg)}
}

@keyframes themeBubbleFloatTwo{
  0%,100%{transform:translate3d(0,0,0) rotate(0deg)}
  50%{transform:translate3d(-18px,20px,0) rotate(-7deg)}
}

@keyframes themeBubbleFloatThree{
  0%,100%{transform:translate3d(0,0,0) scale(1)}
  50%{transform:translate3d(16px,12px,0) scale(1.08)}
}

#themeSetupModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(14,28,45,.66);
  justify-content:center;
  align-items:center;
  z-index:10040;
  padding:16px;
  overflow:hidden;
}

.theme-setup-card{
  position:relative;
  width:min(560px, calc(100vw - 24px));
  overflow:hidden;
  border:1px solid rgba(255,255,255,.4);
  border-radius:24px;
  background:linear-gradient(145deg,rgba(255,255,255,.42),rgba(190,225,255,.2));
  box-shadow:0 22px 58px rgba(8,35,62,.34);
  backdrop-filter:blur(18px);
  animation:modalIn var(--motion-medium) var(--ease-gentle);
}

.theme-setup-content{position:relative;z-index:1;padding:28px 24px 24px;text-align:center}
.theme-setup-eyebrow{margin:0 0 6px;font-size:12px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;color:rgba(255,255,255,.86)}
.theme-setup-content h2{margin:0;color:#fff;font-size:28px}
.theme-setup-subtitle{max-width:390px;margin:8px auto 22px;color:rgba(255,255,255,.9);font-size:14px}
.theme-choice-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.theme-choice{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;width:100%;min-height:96px;box-sizing:border-box;padding:12px 8px;border:1px solid transparent;border-radius:16px;background:transparent !important;color:#fff;font:inherit;cursor:pointer;box-shadow:none !important;transform:none !important;filter:none !important}
.theme-choice::before,.theme-choice::after{display:none}
.theme-choice:hover,.theme-choice:focus-visible,.theme-choice:active{background:rgba(255,255,255,.14) !important;border-color:rgba(255,255,255,.34);box-shadow:0 8px 18px rgba(21,55,81,.14) !important;transform:none !important;filter:none !important}
.theme-choice-swatch{width:48px;height:48px;border-radius:50%;border:2px solid rgba(255,255,255,.72);box-shadow:0 7px 14px rgba(21,55,81,.2),inset 0 2px 7px rgba(255,255,255,.55);transition:transform .24s ease,box-shadow .24s ease}
.theme-choice:hover .theme-choice-swatch,.theme-choice:focus-visible .theme-choice-swatch,.theme-choice.selected .theme-choice-swatch{transform:translateY(-5px) scale(1.06);box-shadow:0 16px 26px rgba(21,55,81,.28),0 0 0 4px rgba(255,255,255,.24),inset 0 2px 10px rgba(255,255,255,.55)}
.theme-choice-label{font-size:14px;font-weight:800;text-shadow:0 1px 8px rgba(23,50,72,.22)}
.theme-choice-description{font-size:11px;opacity:.86}
.theme-bubble{position:absolute;border-radius:50%;pointer-events:none;background:linear-gradient(135deg,rgba(226,247,255,.74),rgba(158,216,244,.48));box-shadow:inset 0 2px 8px rgba(255,255,255,.72),0 10px 24px rgba(91,173,215,.15)}
.theme-bubble-one{width:130px;height:130px;top:-48px;right:58px;animation:themeBubbleFloatOne 7s ease-in-out infinite}
.theme-bubble-two{width:76px;height:76px;left:28px;bottom:20px;animation:themeBubbleFloatTwo 8s ease-in-out infinite}
.theme-bubble-three{width:46px;height:46px;right:22px;bottom:44px;animation:themeBubbleFloatThree 6s ease-in-out infinite}

@media (max-width:640px){
  .theme-setup-content h2{font-size:24px}
  .theme-choice-grid{gap:2px}
  .theme-choice-swatch{width:42px;height:42px}
}

/* SIGN-IN / SIGN-UP MODAL */
#signInModal {
  display: none; 
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

#googleIdentityModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.85);
  justify-content:center;
  align-items:center;
  z-index:10020;
}

#googleIdentityModal .identity-setup-note{
  margin:0 0 12px;
  font-size:13px;
  line-height:1.45;
  opacity:.94;
}

#googleIdentityModal .identity-setup-actions{
  display:flex;
  gap:10px;
  margin-top:10px;
}

#googleIdentityModal .identity-setup-actions button{
  width:calc(50% - 5px);
  margin-top:0;
}

#googleIdentityCancelBtn{
  background:rgba(255,255,255,0.28) !important;
}

#googleIdentityError{
  margin-top:10px;
  font-size:13px;
  color:#ff6b6b;
  display:none;
}
.modal-content {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(14px);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
  animation:modalIn var(--motion-medium) var(--ease-gentle);
}
.modal-content input {
  display:block;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  max-width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: rgba(255,255,255,0.22);
  color: #fff;
  font-size: 16px;
}

.modal-content h2 + input,
.modal-content input + input {
  margin-top: 14px;
}
.modal-content button {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
  padding: 12px;
  margin-top: 10px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg,var(--primary),var(--accent));
  color: #fff;
  font-weight: bold;
  font-size: 16px;
}
.google-btn{
  background: rgba(255,255,255,0.28) !important;
}
.modal-content p {margin-top: 10px; font-size: 14px; cursor: pointer;}

#importTransferModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.78);
  justify-content:center;
  align-items:center;
  z-index:10035;
  padding:16px;
}

#addFriendModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.78);
  justify-content:center;
  align-items:center;
  z-index:10036;
  padding:16px;
}

#reverseFriendRequestModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.78);
  justify-content:center;
  align-items:center;
  z-index:10037;
  padding:16px;
}

#bedtimeReminderModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.78);
  justify-content:center;
  align-items:center;
  z-index:10038;
  padding:16px;
}

#wellnessScoreInfoModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.78);
  justify-content:center;
  align-items:center;
  z-index:10038;
  padding:16px;
}

#reportRedirectConfirmModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.78);
  justify-content:center;
  align-items:center;
  z-index:10039;
  padding:16px;
}

.import-transfer-card{
  width:min(420px, calc(100vw - 24px));
  max-width:100%;
  box-sizing:border-box;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.26);
  border-radius:16px;
  padding:16px;
  backdrop-filter:blur(14px);
  box-shadow:0 14px 34px rgba(0,0,0,.35);
  animation:modalIn var(--motion-medium) var(--ease-gentle);
}

.import-transfer-card h3{
  margin:0 0 8px;
  color:#fff;
}

.import-transfer-note{
  margin:0 0 10px;
  font-size:12px;
  line-height:1.4;
  opacity:.92;
}

.import-transfer-card input{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  margin:8px 0;
  padding:10px;
  border-radius:10px;
  border:none;
  background:rgba(255,255,255,.22);
  color:#fff;
  font-size:14px;
}

.import-transfer-error{
  display:none;
  margin:6px 0 0;
  color:#ffb3b3;
  font-size:12px;
  line-height:1.35;
}

.import-transfer-actions{
  display:flex;
  gap:8px;
  margin-top:10px;
}

.import-transfer-actions button{
  flex:1;
}

.import-transfer-cancel{
  background:rgba(255,255,255,.24) !important;
}

.friends-list-box{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.friend-row{
  padding:11px 12px;
  border-radius:12px;
  border:1px solid var(--border-soft);
  background:linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.08));
  box-shadow:0 8px 18px rgba(0,0,0,.18);
  transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.friend-row:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,.34);
  box-shadow:0 12px 22px rgba(0,0,0,.22);
}

.friend-row strong{
  display:block;
  font-size:13px;
  margin-bottom:4px;
}

.friend-row small{
  display:block;
  font-size:12px;
  line-height:1.45;
  opacity:.95;
}

.friend-row .friend-actions{
  display:flex;
  gap:6px;
  margin-top:8px;
}

.friend-row .friend-actions button{
  flex:1;
}

.friend-row .friend-actions .import-transfer-cancel{
  background:linear-gradient(135deg,var(--primary),var(--accent)) !important;
}

#friendRequestsList .friend-row .friend-actions .import-transfer-cancel{
  background:rgba(255,255,255,.24) !important;
}

#bedtimeReminderModal .import-transfer-actions .import-transfer-cancel{
  background:linear-gradient(135deg,var(--primary),var(--accent)) !important;
}

#wellnessScoreInfoModal .import-transfer-actions .import-transfer-cancel{
  background:linear-gradient(135deg,var(--primary),var(--accent)) !important;
}

#welcomeGuideModal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.72);
  justify-content:center;
  align-items:center;
  z-index:10040;
  padding:16px;
}

.welcome-guide-card{
  width:min(560px, calc(100vw - 24px));
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.26);
  border-radius:18px;
  backdrop-filter:blur(14px);
  box-shadow:0 14px 36px rgba(0,0,0,.35);
  padding:18px 18px 16px;
}

.welcome-guide-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.welcome-guide-title{
  margin:0;
  color:#fff;
  font-size:22px;
}

.welcome-guide-step{
  margin:0;
  font-size:12px;
  opacity:.9;
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.25);
  border-radius:999px;
  padding:5px 10px;
  white-space:nowrap;
}

.welcome-guide-body{
  margin-top:12px;
  padding:14px;
  border-radius:12px;
  background:rgba(255,255,255,.1);
}

.welcome-guide-body h3{
  margin:0 0 8px;
  color:#fff;
  font-size:18px;
}

.welcome-guide-body p{
  margin:0;
  font-size:14px;
  line-height:1.5;
  opacity:.96;
}

.welcome-guide-tip{
  margin-top:10px;
  font-size:13px;
  opacity:.95;
  padding:10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.2);
  background:rgba(255,255,255,.09);
}

.welcome-guide-tip.shortcut-mode{
  padding:12px;
}

.guide-shortcut-list{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
  max-height:220px;
  overflow:auto;
  padding-right:2px;
}

.guide-shortcut-item{
  border:1px solid rgba(255,255,255,.2);
  border-radius:10px;
  background:rgba(255,255,255,.1);
  padding:8px;
}

.guide-shortcut-keys{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:6px;
}

.guide-shortcut-key{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:24px;
  padding:2px 7px;
  border-radius:8px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.02em;
  color:#fff;
  border:1px solid rgba(255,255,255,.28);
  background:rgba(10,24,46,.35);
}

.guide-shortcut-label{
  font-size:12px;
  line-height:1.35;
  color:#fff;
  opacity:.96;
}

@media (max-width:640px){
  .guide-shortcut-list{
    grid-template-columns:1fr;
    max-height:200px;
  }
}

.welcome-guide-dots{
  display:flex;
  gap:7px;
  margin-top:12px;
}

.welcome-guide-dot{
  width:9px;
  height:9px;
  border-radius:999px;
  background:rgba(255,255,255,.35);
}

.welcome-guide-dot.active{
  background:linear-gradient(135deg,var(--primary),var(--accent));
  box-shadow:0 0 10px rgba(255,255,255,.4);
}

.welcome-guide-actions{
  margin-top:14px;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:10px;
}

.welcome-guide-actions button{
  border:none;
  border-radius:10px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
}

#guidePrevBtn,
#guideNextBtn,
#guideSkipBtn{
  background:rgba(255,255,255,.2);
  color:#fff;
}

#guidePrevBtn,
#guideNextBtn{
  min-width:104px;
}

#guideSkipBtn{
  width:100%;
}

#guidePrevBtn:disabled{
  opacity:.55;
  cursor:not-allowed;
}

#guideNextBtn{
  background:linear-gradient(135deg,var(--primary),var(--accent));
  color:#fff;
}

/* HEADER */
header{
  text-align:center;
  padding:30px;
  background:linear-gradient(180deg,var(--glass-strong),var(--glass));
  backdrop-filter:blur(14px);
  border-radius:20px;
  box-shadow:0 12px 30px rgba(0,0,0,.3);
  position:relative;
  margin:10px 10px 0;
  border:1px solid rgba(255,255,255,.28);
  z-index:1;
  animation:headerEnter .7s var(--ease-gentle) both;
}

@keyframes headerEnter{
  from{opacity:0;transform:translateY(-12px) scale(.985)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
header h1{
  margin:0;
  color:var(--primary);
  letter-spacing:.3px;
  text-shadow:none;
}
header p{margin:8px 0 0;opacity:.94}
#signOutBtn{
  width:100%;
  margin-top:8px;
}
