/* ---------- Mobile action bar ---------- */
#mobileActions{
  position:fixed; bottom:0; left:0; right:0; z-index:35;
  display:none; align-items:center; justify-content:center; gap:4px;
  padding:8px 12px; padding-bottom:max(8px, env(safe-area-inset-bottom));
  background:color-mix(in srgb,var(--panel) 92%,transparent);
  backdrop-filter:blur(12px); border-top:1px solid var(--panel-border);
}
#mobileActions button{
  min-width:44px; min-height:44px; padding:8px 12px;
  background:var(--panel); border:1px solid var(--panel-border);
  border-radius:10px; color:var(--text); font-size:13px; font-weight:600;
  cursor:pointer; display:flex; align-items:center; justify-content:center; gap:4px;
  font-family:inherit;
}
#mobileActions button:active{background:var(--accent); color:#fff}
#mobileActions button svg{width:18px; height:18px; fill:currentColor}

/* ---------- Mobile menu ---------- */
#mobileMenuBtn{display:none}
#mobileMenuOverlay{
  position:fixed; inset:0; z-index:45; background:rgba(0,0,0,.4);
  display:none;
}
#mobileMenuOverlay.show{display:block}
#mobileMenu{
  position:fixed; top:0; right:0; bottom:0; width:280px; max-width:85vw; z-index:46;
  background:var(--panel); border-left:1px solid var(--panel-border);
  padding:16px; overflow-y:auto; transform:translateX(100%); transition:transform .2s ease;
}
#mobileMenu.show{transform:translateX(0)}
#mobileMenu .menu-header{display:flex; justify-content:space-between; align-items:center; margin-bottom:16px}
#mobileMenu .menu-header h3{margin:0; font-size:16px}
#mobileMenu .menu-close{font-size:22px; cursor:pointer; color:var(--muted); background:none; border:none}
#mobileMenu .menu-section{margin-bottom:16px}
#mobileMenu .menu-section-title{font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); margin-bottom:8px}
#mobileMenu .menu-item{
  display:flex; align-items:center; gap:10px; padding:10px 12px;
  border-radius:8px; cursor:pointer; font-size:14px; color:var(--text);
  background:none; border:none; width:100%; text-align:left; font-family:inherit;
}
#mobileMenu .menu-item:hover, #mobileMenu .menu-item:active{background:rgba(127,127,127,.1)}
#mobileMenu .menu-themes{display:flex; gap:8px; padding:8px 12px}
#mobileMenu .menu-themes .swatch{width:28px; height:30px}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  #topbar{
    gap:6px; padding:0 8px;
  }
  #topbar .desktop-only{display:none !important}
  #mobileMenuBtn{
    display:inline-flex; align-items:center; justify-content:center;
    width:36px; height:36px; background:var(--panel); border:1px solid var(--panel-border);
    border-radius:9px; cursor:pointer; font-size:18px; color:var(--text);
  }
  #docName{min-width:80px; max-width:160px; font-size:13px}
  #zoombar{left:8px; bottom:60px}
  #help{right:8px; bottom:68px; width:calc(100vw - 16px); max-width:360px}
  #signupHint{bottom:68px; right:8px}
}

@media (max-width: 900px) {
  #mobileActions{display:flex}
}

@media (max-width: 480px) {
  #topbar{height:46px; gap:4px; padding:0 6px}
  #canvas{top:46px}
  #docName{min-width:60px; max-width:120px; font-size:12px; padding:4px 6px}
  .btn{padding:5px 8px; font-size:12px}
  #newBtn{font-size:12px; padding:5px 10px}
}

/* Ad rail - desktop only */
#adRail{
  position:fixed; top:52px; right:0; bottom:0; width:0; z-index:2;
  background:var(--bg); border-left:1px solid var(--panel-border);
  overflow:hidden; transition:width .2s;
}
#adRail.active{width:300px}
#adRail .ad-slot{padding:16px; text-align:center}

/* Ad anchor - mobile */
#adAnchor{
  position:fixed; bottom:0; left:0; right:0; z-index:34;
  display:none; text-align:center; background:var(--bg);
  border-top:1px solid var(--panel-border);
}
@media (max-width: 900px){
  #adAnchor.active{display:block}
  #adRail{display:none !important}
  #mobileActions{bottom:50px}
}
@media (min-width: 901px){
  #adRail.active ~ #canvas{right:300px}
}
