
/* V9 — polished Study Session + iOS-style More bubble + readable 5-tab nav. */
nav:not(.glass-dock){
  display:grid!important;
  grid-template-columns:repeat(5,minmax(0,1fr))!important;
  gap:8px!important;
  flex-wrap:nowrap!important;
  overflow:visible!important;
  padding:7px!important;
}
nav:not(.glass-dock) .tab{
  min-width:0!important;
  width:100%!important;
  padding:11px 7px!important;
  white-space:nowrap!important;
  font-size:13px!important;
  border-radius:16px!important;
}
@media(max-width:430px){
  nav:not(.glass-dock){gap:6px!important;padding:6px!important}
  nav:not(.glass-dock) .tab{font-size:11.5px!important;padding:10px 4px!important}
}

/* Restore the Study Session scene: controls on top, full animated scene underneath. */
#study .study-session-zone{
  min-height:370px!important;
  margin:0 0 18px!important;
  padding:18px 14px 14px!important;
  border-radius:26px!important;
  overflow:hidden!important;
  position:relative!important;
  background:linear-gradient(145deg,rgba(255,255,255,.58),rgba(236,244,255,.40))!important;
  border:1px solid rgba(255,255,255,.82)!important;
  box-shadow:0 18px 50px rgba(48,73,112,.13),inset 0 1px 0 rgba(255,255,255,.92)!important;
  backdrop-filter:blur(22px) saturate(150%)!important;
  -webkit-backdrop-filter:blur(22px) saturate(150%)!important;
}
#study .study-session-head{position:relative!important;z-index:10!important;justify-content:flex-start!important;align-items:center!important;text-align:left!important;gap:8px!important}
#study .study-session-btn{padding:10px 16px!important;font-size:15px!important;border-radius:16px!important}
#study .study-history-btn{position:relative!important;z-index:10!important;margin:7px auto 0!important;display:block!important;padding:7px 12px!important;font-size:11px!important}
#study .study-session-options{position:relative!important;z-index:10!important;margin-top:9px!important}
#study .study-session-status{position:relative!important;z-index:10!important;text-align:center!important;font-size:12px!important;min-height:18px!important;margin-top:5px!important;color:#304a72!important}
#study .study-session-stage{
  left:10px!important;right:10px!important;bottom:10px!important;height:190px!important;
  z-index:2!important;border-radius:21px!important;
  background:linear-gradient(180deg,rgba(249,252,255,.55),rgba(231,239,249,.50))!important;
  border:1px solid rgba(255,255,255,.78)!important;
  backdrop-filter:blur(9px)!important;-webkit-backdrop-filter:blur(9px)!important;
}
#study .study-library,#study .study-chair,#study .study-desk,#study .study-lamp,#study .study-bear{z-index:4!important}
#study .study-library{transform:scale(.82)!important;transform-origin:left bottom!important;left:4%!important;bottom:16px!important}
#study .study-chair{transform:scale(.82)!important;transform-origin:left bottom!important;left:25%!important;bottom:16px!important}
#study .study-desk{transform:scale(.82)!important;transform-origin:right bottom!important;right:4%!important;bottom:16px!important}
#study .study-lamp{transform:scale(.82)!important;transform-origin:center bottom!important;right:22%!important;bottom:90px!important}
#study .study-bear,#study .study-bear.idle,#study .study-bear.paused{transform:scale(.60)!important;transform-origin:50% 100%!important;left:25%!important;bottom:17px!important}
#study .study-bear.active{animation:v9StudyWalk 28s ease-in-out infinite!important}
#study .bear-bravo{left:35%!important;bottom:120px!important;font-size:13px!important;padding:6px 10px!important}
@keyframes v9StudyWalk{
  0%,12%{left:25%;transform:translateY(0) scale(.60)}
  24%{left:10%;transform:translateY(-2px) scale(.60)}
  32%{left:10%;transform:translateY(0) scale(.60)}
  46%{left:68%;transform:translateY(-2px) scale(.60)}
  55%{left:68%;transform:translateY(0) scaleX(-.60) scaleY(.60)}
  70%{left:31%;transform:translateY(-2px) scaleX(-.60) scaleY(.60)}
  82%{left:68%;transform:translateY(0) scale(.60)}
  100%{left:25%;transform:translateY(0) scale(.60)}
}
@media(max-width:600px){
  #study .study-session-zone{min-height:355px!important;padding:16px 11px 12px!important}
  #study .study-session-stage{left:8px!important;right:8px!important;height:178px!important;bottom:9px!important}
  #study .study-library{transform:scale(.74)!important;left:3%!important;bottom:14px!important}
  #study .study-chair{transform:scale(.74)!important;left:24%!important;bottom:14px!important}
  #study .study-desk{transform:scale(.74)!important;right:3%!important;bottom:14px!important}
  #study .study-lamp{transform:scale(.74)!important;right:21%!important;bottom:83px!important}
  #study .study-bear,#study .study-bear.idle,#study .study-bear.paused{transform:scale(.54)!important;left:24%!important;bottom:15px!important}
}

/* More: real iOS-like floating bubble above the dock. Hidden until tapped. */
.more-menu{
  right:14px!important;
  bottom:88px!important;
  width:min(285px,calc(100vw - 28px))!important;
  padding:9px!important;
  border-radius:24px!important;
  background:linear-gradient(145deg,rgba(255,255,255,.88),rgba(232,242,255,.70))!important;
  border:1px solid rgba(255,255,255,.92)!important;
  backdrop-filter:blur(30px) saturate(170%)!important;
  -webkit-backdrop-filter:blur(30px) saturate(170%)!important;
  box-shadow:0 22px 60px rgba(28,53,92,.24),inset 0 1px 0 rgba(255,255,255,.98)!important;
  transform-origin:bottom right!important;
}
.more-menu:after{
  content:"";position:absolute;right:28px;bottom:-9px;width:18px;height:18px;
  background:rgba(236,244,255,.82);border-right:1px solid rgba(255,255,255,.88);border-bottom:1px solid rgba(255,255,255,.88);
  transform:rotate(45deg);backdrop-filter:blur(20px);
}
.more-menu button{
  margin:4px 0!important;padding:13px 12px!important;border-radius:18px!important;
  background:rgba(255,255,255,.64)!important;color:#102f59!important;
  border:1px solid rgba(255,255,255,.84)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.92),0 5px 16px rgba(55,81,120,.07)!important;
}
.more-menu button b{font-size:14px!important}.more-menu button span{font-size:20px!important}.more-menu button i{font-size:22px!important;color:#2b5b91!important}

/* Profile modal: make the existing profile control actually usable. */
#profileModal{z-index:60000!important;background:rgba(8,20,40,.48)!important;backdrop-filter:blur(16px) saturate(140%)!important;-webkit-backdrop-filter:blur(16px) saturate(140%)!important}
#profileModal .profile-card{
  width:min(390px,calc(100vw - 32px))!important;
  border-radius:28px!important;
  padding:22px!important;
  background:linear-gradient(145deg,rgba(255,255,255,.90),rgba(235,244,255,.78))!important;
  border:1px solid rgba(255,255,255,.92)!important;
  box-shadow:0 28px 80px rgba(24,49,88,.28),inset 0 1px 0 rgba(255,255,255,.98)!important;
  backdrop-filter:blur(30px) saturate(160%)!important;-webkit-backdrop-filter:blur(30px) saturate(160%)!important;
}
#profileModal .profile-card h2{color:#102f59!important;font-weight:950!important}
#profileModal .profile-value{color:#0a2243!important}
#profileModal .profile-label{color:#243f60;font-size:14px;font-weight:700;line-height:1.5}
#profileModal .profile-row p,#profileModal #passkeyList{color:#203954}


/* V10: keep the top navigation on one horizontal scrolling row. */
nav:not(.glass-dock){
  display:flex!important;
  flex-wrap:nowrap!important;
  gap:8px!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  -webkit-overflow-scrolling:touch!important;
  scrollbar-width:none!important;
  padding:7px!important;
  align-items:center!important;
}
nav:not(.glass-dock)::-webkit-scrollbar{display:none!important}
nav:not(.glass-dock) .tab{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:max-content!important;
  white-space:nowrap!important;
  padding:11px 18px!important;
}
@media(max-width:600px){
  nav:not(.glass-dock){gap:7px!important;padding:7px 8px!important}
  nav:not(.glass-dock) .tab{font-size:13px!important;padding:11px 16px!important}
}

/* V10: Study Session belongs completely below the study card. */
#study{
  display:flex!important;
  flex-direction:column!important;
}
#study > .row{order:1!important}
#study > .card.study-card{order:2!important;margin-top:10px!important}
#study > .study-session-zone{order:3!important;margin-top:18px!important;margin-bottom:18px!important}
#study .study-session-zone{
  min-height:355px!important;
}
@media(max-width:600px){
  #study > .study-session-zone{min-height:345px!important;margin-top:18px!important}
}

/* V10: bottom dock ends with Import, not More. */
.glass-dock .dock-btn[data-dock="import"]{display:flex!important}
.glass-dock .more-btn{display:none!important}


/* V13: the Study page must not leak into Decks/Add/Import. */
section.hidden{display:none!important;}
#study.hidden{display:none!important;}

/* V13: keep the iOS-style bottom dock permanently visible on every page,
   including while the Study Session bubble is open. */
.glass-dock{
  position:fixed!important;
  left:10px!important;
  right:10px!important;
  bottom:9px!important;
  z-index:50000!important;
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
}
.study-session-float{
  z-index:55000!important;
  bottom:92px!important;
}
.study-session-bubble{z-index:45000!important;}
.study-session-bubble-panel{margin-bottom:78px;}

/* Keep enough page space behind the fixed dock so content/cards never sit
   underneath it when scrolling. */
.wrap{padding-bottom:120px!important;}

@media(max-width:600px){
  .glass-dock{left:10px!important;right:10px!important;bottom:9px!important;}
  .study-session-float{right:14px!important;bottom:88px!important;}
  .study-session-bubble-panel{margin-bottom:76px!important;}
}


/* V14: bottom navigation is a permanent app chrome. It must never disappear
   when changing sections or closing the Study Session bubble. */
html,body{min-height:100%;}
body{padding-bottom:0!important;}
body > .glass-dock{
  position:fixed!important;
  left:12px!important;
  right:12px!important;
  bottom:max(9px, env(safe-area-inset-bottom))!important;
  top:auto!important;
  width:auto!important;
  height:auto!important;
  min-height:70px!important;
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
  z-index:2147483000!important;
}
body > .study-session-float{
  position:fixed!important;
  right:14px!important;
  bottom:calc(max(9px, env(safe-area-inset-bottom)) + 84px)!important;
  z-index:2147483001!important;
}
@media(max-width:600px){
  body > .glass-dock{left:10px!important;right:10px!important;min-height:68px!important;}
  body > .study-session-float{right:14px!important;bottom:calc(max(9px, env(safe-area-inset-bottom)) + 82px)!important;}
}
/* The dock stays above normal page content, but the active-session bubble
   remains above both the dock and its timer pill. */
.study-session-bubble{z-index:2147483002!important;}
.study-session-bubble-panel{margin-bottom:82px!important;}


/* V15: active Study Session timer is a persistent floating pill. */
body > #studySessionFloat{
  position:fixed!important;
  right:14px!important;
  bottom:calc(max(9px, env(safe-area-inset-bottom)) + 84px)!important;
  z-index:2147483001!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
}
body > #studySessionFloat.hidden{display:none!important;}
@media(max-width:600px){
  body > #studySessionFloat{right:14px!important;bottom:calc(max(9px, env(safe-area-inset-bottom)) + 82px)!important;}
}
