/* V49: desktop consistency, hangar hero, unclipped updates, profile controls. */
html[data-theme] .merkaz-games-launcher .new-tag {
  background:#d8f3df!important;color:#175b38!important;-webkit-text-fill-color:#175b38!important;
  border:1px solid #83be96;border-radius:999px;font-size:12px;font-weight:800;
  line-height:1.35;padding:4px 9px;flex:none;box-shadow:0 1px 3px #102d2520;
}
@media(min-width:681px){
  html[data-theme] .topbar.menu-header-v20>:is(.games-return,.donation-trigger,.support-trigger) {
    box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:8px;
    width:156px;min-width:156px;height:46px;min-height:46px;flex:0 0 156px;
    margin:0;padding:10px 12px;border:1px solid;border-radius:14px;
    font:700 14px/1.35 RubikLocal,Rubik,Arial,sans-serif;white-space:nowrap;
    text-decoration:none;transition:background-color .18s,border-color .18s,box-shadow .18s!important;
  }
  html[data-theme] .topbar.menu-header-v20>:is(.games-return,.donation-trigger,.support-trigger)>span {font:inherit;display:inline;}
  html[data-theme] .topbar.menu-header-v20>:is(.games-return,.donation-trigger,.support-trigger)>svg {width:20px;height:20px;flex:0 0 20px;margin:0;}
  html[data-theme="light"] .topbar.menu-header-v20>.games-return {background:#e6eee5!important;color:#315a42!important;border-color:#b9cdbb!important;}
  html[data-theme="light"] .topbar.menu-header-v20>.support-trigger {background:#e6edf2!important;color:#345771!important;border-color:#becedb!important;}
  html[data-theme="light"] .topbar.menu-header-v20>.donation-trigger {background:#f7e6dd!important;color:#8e4637!important;border-color:#dfbdaf!important;}
  html[data-theme="light"] .topbar.menu-header-v20>.games-return:hover {background:#d6e5d6!important;}
  html[data-theme="light"] .topbar.menu-header-v20>.support-trigger:hover {background:#d8e5ed!important;}
  html[data-theme="light"] .topbar.menu-header-v20>.donation-trigger:hover {background:#f0d8cc!important;}
}
/* At narrow desktop/tablet widths give the three equal controls their own row. */
@media(min-width:681px) and (max-width:1000px){
  .games-site-header>.topbar.menu-header-v20 {flex-wrap:wrap;justify-content:center;}
  .games-site-header>.topbar.menu-header-v20>.brand {flex:1 1 calc(100% - 64px);}
}
/* Apply the photo through CSS so text and the mascot remain sharp. */
html[data-theme] .games-page .world-hero {
  position:relative;isolation:isolate;overflow:hidden;background:#f4e8d5!important;
}
html[data-theme] .games-page .world-hero .hero-photo-v50::before {
  content:"";position:absolute;inset:-8px;z-index:-2;pointer-events:none;
  background:url('/assets/game-hangar-v49.jpg') center 48% / cover no-repeat!important;
  filter:blur(2px) sepia(.34) saturate(.6);opacity:1!important;
  mask-image:none!important;-webkit-mask-image:none!important;transform:none;
}
html[data-theme] .games-page .world-hero .hero-photo-v50::after {
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(270deg,rgba(255,241,220,.98) 0%,rgba(255,241,220,.93) 29%,rgba(248,225,193,.62) 58%,rgba(151,88,45,.2) 100%),linear-gradient(0deg,rgba(222,178,123,.5),transparent 65%);
}
html[data-theme="dark"] .games-page .world-hero {background:#242732!important;}
html[data-theme="dark"] .games-page .world-hero .hero-photo-v50::before {filter:blur(2px) sepia(.25) saturate(.55) brightness(.76);}
html[data-theme="dark"] .games-page .world-hero .hero-photo-v50::after {
  background:linear-gradient(270deg,rgba(36,39,50,.98) 0%,rgba(36,39,50,.95) 28%,rgba(43,40,45,.67) 60%,rgba(67,46,36,.29)),linear-gradient(0deg,rgba(27,29,38,.7),transparent 70%);
}
@media(max-width:680px){
  html[data-theme] .games-page .world-hero .hero-photo-v50::after {background:linear-gradient(180deg,rgba(255,241,220,.97) 0%,rgba(255,241,220,.95) 35%,rgba(248,225,193,.64) 70%,rgba(215,172,119,.4));}
  html[data-theme="dark"] .games-page .world-hero .hero-photo-v50::after {background:linear-gradient(180deg,rgba(36,39,50,.98) 0%,rgba(36,39,50,.95) 35%,rgba(43,40,45,.69) 75%,rgba(35,32,37,.5));}
}
/* The content list scrolls while its footer keeps enough room for the border and focus ring. */
html[data-theme] .updates-overlay:not([data-drawer-embedded="true"]) {box-sizing:border-box;padding:24px;}
html[data-theme] .updates-overlay:not([data-drawer-embedded="true"]) .updates-shell {
  display:flex;flex-direction:column;box-sizing:border-box;min-height:0;
  max-height:calc(100dvh - 48px);padding:22px;overflow:hidden;
}
html[data-theme] .updates-shell .updates-head {flex:0 0 auto;}
html[data-theme] .updates-shell .updates-list {min-width:0;min-height:0;}
html[data-theme] .updates-shell .updates-footer {
  box-sizing:border-box;flex:0 0 auto;min-width:0;width:100%;margin:16px 0 0;
  padding:14px 4px 4px;gap:12px;align-items:center;
}
html[data-theme] .updates-shell .updates-dismiss-area {
  box-sizing:border-box;flex:1 1 0;min-width:0;max-width:100%;padding:12px;
}
html[data-theme] .updates-shell .updates-dismiss-area label {white-space:normal;overflow-wrap:anywhere;}
html[data-theme] .updates-shell .updates-confirm {box-sizing:border-box;flex:0 0 auto;min-width:84px;min-height:44px;}
html[data-theme] #siteMenuRanksView .updates-shell {overflow:visible;}
html[data-theme] #siteMenuRanksView .updates-footer {padding:14px 4px 6px;align-items:stretch;}
html[data-theme] #siteMenuRanksView .updates-dismiss-area {flex:none;width:100%;}
@media(max-width:520px){
  html[data-theme] .updates-overlay:not([data-drawer-embedded="true"]) {padding:12px;}
  html[data-theme] .updates-overlay:not([data-drawer-embedded="true"]) .updates-shell {padding:16px;max-height:calc(100dvh - 24px);}
  html[data-theme] .updates-shell .updates-footer {flex-direction:column;align-items:stretch;}
  html[data-theme] .updates-shell .updates-dismiss-area {flex:none;}
}
/* Menus own their own transition; buttons don't move on hover during screen changes. */
.games-page :is(button,a,.topic-card,.game-card,.game-answer) {
  transition-property:background-color,border-color,color,box-shadow!important;transition-duration:.18s!important;
}
.games-page :is(.game-card,.topic-card,.game-answer,.mission-node):hover {transform:none!important;}
html[data-theme] .site-menu-drawer :is(.updates-nav-button,.admin-nav-button,.cloud-account-button) {
  display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:54px;
  text-align:right;white-space:normal;font:700 14px/1.5 RubikLocal,Rubik,Arial,sans-serif;
}
html[data-theme] .site-menu-drawer [hidden] {display:none!important;}
#siteMenuMainView {display:flex;flex-direction:column;min-height:calc(100dvh - 102px);}
#siteMenuMainView[hidden],#siteMenuRanksView[hidden] {display:none!important;}
.site-menu-logout-slot {margin-top:auto;padding:14px 0 4px;border-top:1px solid var(--surface-line,#dfceba);}
html[data-theme] #siteMenuLogout {display:flex;align-items:center;gap:12px;background:var(--error-bg,#f7e5df)!important;color:var(--error-ink,#934938)!important;border:1px solid var(--surface-line,#dfceba);border-radius:14px;min-height:48px;}
.cloud-profile-actions {display:grid;gap:10px;margin:18px 0;}
.cloud-profile-actions button {margin:0;}
.cloud-profile-identity {padding:16px;border:1px solid var(--surface-line,#dfceba);border-radius:16px;background:var(--surface-2,#fbf2e4);margin:12px 0;}
.cloud-profile-identity .cloud-email {margin:0;direction:ltr;unicode-bidi:plaintext;text-align:right;overflow-wrap:anywhere;font-weight:700;}
.cloud-profile-identity .cloud-status {margin:8px 0 0;font-size:12px;color:var(--text-muted,#685d50);}
.cloud-profile-danger {padding-top:16px;margin-top:20px;border-top:1px solid var(--surface-line,#dfceba);}
html[data-theme] .cloud-danger {display:block;width:100%;box-sizing:border-box;padding:12px 16px;min-height:46px;border-radius:12px;border:1px solid var(--error-ink,#934938);background:var(--error-bg,#f7e5df)!important;color:var(--error-ink,#934938)!important;font:700 14px/1.5 RubikLocal,Rubik,Arial,sans-serif;cursor:pointer;}
.cloud-danger:disabled {opacity:.55;cursor:not-allowed;}
.cloud-delete-warning {color:var(--error-ink,#934938);line-height:1.8;}
.cloud-modal form label {display:grid;gap:8px;margin:14px 0;}
.cloud-modal form input {width:100%;box-sizing:border-box;}
.cloud-profile-actions .cloud-secondary {color:var(--text,#48392b);}
@media(prefers-reduced-motion:reduce){
  html body.games-page :is(button,a,.topic-card,.game-card,.game-answer){transition:none!important;}
}

.cloud-notice[hidden] {display:none!important;}

/* V50: one clipped background layer; the image cannot paint outside the card. */
html[data-theme] .games-page .world-hero {overflow:hidden!important;border-radius:30px;isolation:isolate;}
html[data-theme] .games-page .world-hero::before,
html[data-theme] .games-page .world-hero::after {content:none!important;display:none!important;}
html[data-theme] .games-page .world-hero>.hero-photo-v50 {
  display:block;position:absolute;inset:0;z-index:0;pointer-events:none;
  border-radius:inherit;overflow:hidden;contain:paint;isolation:isolate;
  -webkit-clip-path:inset(0 round 30px);clip-path:inset(0 round 30px);
}
html[data-theme] .games-page .world-hero .hero-photo-v50::before {z-index:0;}
html[data-theme] .games-page .world-hero .hero-photo-v50::after {z-index:1;}
html[data-theme] .games-page .world-hero>:is(.hero-copy,.world-companion) {position:relative;z-index:2;}
/* Match the rest of the menu, including the two formerly unframed icons. */
html[data-theme] #siteMenuDrawer :is(#cloudAccountButton,#merkazUpdatesButton,#merkazAdminButton,#drawerSyncButton) {
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  box-sizing:border-box;width:100%;min-height:56px;margin:0;padding:10px 12px;
  border:1px solid var(--surface-line)!important;border-radius:14px;
  background:var(--surface)!important;color:var(--text)!important;
  -webkit-text-fill-color:currentColor!important;box-shadow:none!important;
  font:700 14px/1.5 RubikLocal,Rubik,Arial,sans-serif;text-align:right;
}
html[data-theme] #siteMenuDrawer :is(#cloudAccountButton,#merkazUpdatesButton,#merkazAdminButton,#drawerSyncButton):hover {
  background:var(--surface-2)!important;border-color:var(--accent)!important;
}
html[data-theme] #siteMenuDrawer .menu-icon {
  display:grid;place-items:center;box-sizing:border-box;width:34px;height:34px;
  flex:0 0 34px;border-radius:12px;background:var(--accent-soft)!important;
  color:var(--accent)!important;border:1px solid var(--surface-line)!important;
}
#siteMenuDrawer .menu-icon svg {display:block;width:20px;height:20px;}
#drawerSyncButton[aria-busy="true"] .menu-icon svg {animation:sync-turn-v50 1s linear infinite;}
@keyframes sync-turn-v50 {to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){#drawerSyncButton .menu-icon svg {animation:none!important;}}

#siteMenuAccountSection .site-menu-account-slot {margin-bottom:0;}

/* V51: topic-colored, framed icons; button surfaces remain neutral. */
html[data-theme] #siteMenuDrawer #cloudAccountButton .menu-icon {background:#e5edf9!important;color:#3866a2!important;border-color:#bed0e9!important;}
html[data-theme] #siteMenuDrawer #merkazUpdatesButton .menu-icon {background:#fbedcf!important;color:#916019!important;border-color:#e5cea0!important;}
html[data-theme] #siteMenuDrawer #drawerSyncButton .menu-icon {background:#dff1ee!important;color:#267769!important;border-color:#acd4ca!important;}
html[data-theme] #siteMenuDrawer #merkazAdminButton .menu-icon {background:#eee6f8!important;color:#7b4fab!important;border-color:#d3bfe7!important;}
html[data-theme="dark"] #siteMenuDrawer #cloudAccountButton .menu-icon {background:#2d3e58!important;color:#a1c8ff!important;border-color:#4a648a!important;}
html[data-theme="dark"] #siteMenuDrawer #merkazUpdatesButton .menu-icon {background:#493e29!important;color:#f4cc83!important;border-color:#77623d!important;}
html[data-theme="dark"] #siteMenuDrawer #drawerSyncButton .menu-icon {background:#29453f!important;color:#8cddcb!important;border-color:#476f63!important;}
html[data-theme="dark"] #siteMenuDrawer #merkazAdminButton .menu-icon {background:#40334f!important;color:#d6b0ff!important;border-color:#685281!important;}
html[data-theme] #siteMenuDrawer #drawerSyncButton:disabled {opacity:1;cursor:wait;}
#drawerSyncButton [data-menu-sync-status] {display:block;white-space:normal;overflow-wrap:anywhere;}
html[data-theme] #siteMenuDrawer #drawerSyncButton [data-state="success"] {color:#26705b!important;}
html[data-theme="dark"] #siteMenuDrawer #drawerSyncButton [data-state="success"] {color:#98ddbd!important;}
html[data-theme] #siteMenuDrawer #drawerSyncButton [data-state="error"] {color:var(--error-ink)!important;}
