/* Layout & App Shell */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Sidebar navigation */
#sidebar {
  width: var(--sidebar-width);
  height: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: relative;
  z-index: 50;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform var(--transition-normal);
}

/* Boundary Circular Toggle Button (Astra inspired) */
.sidebar-boundary-toggle {
  position: absolute;
  top: 18px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.sidebar-boundary-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--text-muted);
  transform: scale(1.08);
}

.sidebar-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  transition: padding 0.2s ease;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.brand-badge img {
  width: 22px;
  height: 22px;
}

.brand-name {
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
}

.version-tag {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-weight: 500;
}

.sidebar-search-box {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.8rem;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.search-input-wrapper input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
}

.search-icon {
  position: absolute;
  left: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 6px;
  font-size: 0.65rem;
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 24px;
}

/* Add subtle top border above each category except first */
.nav-category + .nav-category {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.nav-category {
  margin-bottom: 2px;
}

/* Category accordion header */
.category-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  margin-bottom: 1px;
}

.category-title:hover {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.cat-title-icon {
  display: flex;
  align-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
}

.cat-title-text {
  flex: 1;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
}

.cat-count {
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 18px;
  text-align: center;
}

.cat-chevron {
  display: flex;
  align-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

/* Collapsed accordion state */
.category-title.cat-collapsed .cat-chevron {
  transform: none;
}

/* Tools list container with smooth slide animation */
.nav-tools-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  opacity: 1;
  margin-bottom: 6px;
}

.nav-tools-list.nav-tools-hidden {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.815rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 1px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--bg-input-focus);
  color: var(--text-main);
  font-weight: 500;
  border: 1px solid var(--border-strong);
}

.nav-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.nav-item:hover .nav-item-icon,
.nav-item.active .nav-item-icon {
  color: var(--text-main);
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.nav-item.active .nav-dot {
  background: var(--text-main);
}

/* Collapsed Sidebar Rail Mode */
#sidebar.collapsed {
  width: 68px;
}

#sidebar.collapsed .sidebar-header {
  padding: 14px 0;
  justify-content: center;
}

#sidebar.collapsed .brand-name,
#sidebar.collapsed .version-tag {
  display: none;
}

#sidebar.collapsed .sidebar-search-box {
  padding: 10px 8px;
}

#sidebar.collapsed .search-input-wrapper input {
  display: none;
}

#sidebar.collapsed .search-shortcut {
  display: none;
}

#sidebar.collapsed .search-input-wrapper {
  justify-content: center;
}

#sidebar.collapsed .search-icon {
  position: static;
  padding: 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
  pointer-events: auto;
}

/* Collapsed rail: hide all accordion header children */
#sidebar.collapsed .cat-title-icon,
#sidebar.collapsed .cat-title-text,
#sidebar.collapsed .cat-count,
#sidebar.collapsed .cat-chevron {
  display: none;
}

#sidebar.collapsed .category-title {
  height: 1px;
  background: var(--border);
  margin: 10px 10px;
  padding: 0;
  cursor: default;
  pointer-events: none;
}

/* In rail mode, always show all tools regardless of accordion state */
#sidebar.collapsed .nav-tools-list.nav-tools-hidden {
  max-height: 600px !important;
  opacity: 1 !important;
  margin-bottom: 0;
}

#sidebar.collapsed .nav-item {
  padding: 9px 0;
  justify-content: center;
}

#sidebar.collapsed .nav-item .nav-text,
#sidebar.collapsed .nav-item .nav-dot {
  display: none;
}

/* Floating Sleek Tooltip for Collapsed Sidebar */
#sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: #18181b;
  color: #f4f4f5;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid #27272a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1000;
}

#sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

body.theme-light #sidebar.collapsed .nav-item::after {
  background: #ffffff;
  color: #09090b;
  border: 1px solid #e4e4e7;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* Main workspace area */
#workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-app);
}

.top-bar {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  z-index: 20;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.825rem;
}

.bc-segment {
  color: var(--text-muted);
  transition: color var(--transition-fast);
  cursor: default;
}

.bc-brand {
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.bc-brand:hover {
  background: var(--bg-hover);
}

.bc-sep {
  color: var(--text-dim);
  font-size: 0.75rem;
  user-select: none;
}

.bc-cat {
  color: var(--text-dim);
  font-weight: 500;
}

.bc-active {
  color: var(--text-main);
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Command Palette Trigger Button (HeroUI / shadcn block style) */
.top-cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.top-cmd-trigger:hover {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.top-cmd-placeholder {
  white-space: nowrap;
  font-size: 0.78rem;
}

@media (max-width: 960px) {
  .top-cmd-placeholder {
    display: none;
  }
}

/* Responsive Device Preview Bar */
.device-preview-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-input);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.device-btn {
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  cursor: pointer;
}

.device-btn:hover {
  color: var(--text-main);
}

.device-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}

.device-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Center stage split layout */
.workspace-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Stage Wrapper & Floating Stage Toolbar */
.stage-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg-app);
}

.stage-wrapper.stage-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: 100vw;
  height: 100vh;
}

.stage-floating-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(24, 24, 27, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
}

body.theme-light .stage-floating-toolbar {
  background: rgba(255, 255, 255, 0.9);
}

.stage-view-segmented {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-input);
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.stage-view-segmented .stage-tool-btn {
  padding: 3px 9px;
  gap: 4px;
}

.stage-bg-toggles,
.stage-state-tester {
  display: flex;
  align-items: center;
  gap: 2px;
}

.stage-toolbar-sep {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
  margin: 0 4px;
}

.stage-tool-btn {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stage-tool-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.stage-tool-btn.active {
  background: var(--text-main);
  color: var(--bg-app);
  font-weight: 600;
}

/* Left preview canvas */
#preview-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
  padding: 64px 24px 24px;
  transition: background var(--transition-normal);
}

/* Background canvas options */
.bg-dot-matrix {
  background-color: var(--bg-app);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 20px 20px;
}

.bg-grid-wireframe {
  background-color: var(--bg-app);
  background-image: 
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
}

.bg-solid-dark {
  background: #09090b !important;
  background-image: none !important;
}

.bg-solid-light {
  background: #ffffff !important;
  background-image: none !important;
}

.bg-checker {
  background-color: #121214;
  background-image: 
    linear-gradient(45deg, #18181b 25%, transparent 25%),
    linear-gradient(-45deg, #18181b 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #18181b 75%),
    linear-gradient(-45deg, transparent 75%, #18181b 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Device Mockup Frames */
.device-frame-mobile {
  width: 375px;
  height: 640px;
  border: 1px solid var(--border-strong);
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--bg-card);
  margin: auto;
}

.device-frame-tablet {
  width: 768px;
  height: 540px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--bg-card);
  margin: auto;
}

.device-frame-laptop {
  width: 980px;
  max-width: 96%;
  height: 520px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--bg-card);
  margin: auto;
}

/* Right sidebar Controls + Code Column */
#controls-stage {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

.controls-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.controls-section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Code Panel docked at bottom of controls */
#code-stage {
  height: var(--code-panel-height);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.code-header {
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.code-tabs {
  display: flex;
  gap: 2px;
}

.code-tab {
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  cursor: pointer;
}

.code-tab:hover {
  color: var(--text-main);
}

.code-tab.active {
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
}

.code-body {
  flex: 1;
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--bg-card);
}

/* Collapsible Docked Code Panel */
#code-stage.collapsed {
  height: 38px !important;
}

#code-stage.collapsed .code-body {
  display: none !important;
}

/* Full-Bleed Center Stage Code Inspector */
.stage-code-view {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  padding-top: 64px;
  animation: fadeIn 0.15s ease;
}

.stage-code-header {
  padding: 8px 18px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-code-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stage-code-tab {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stage-code-tab:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.stage-code-tab.active {
  color: var(--text-main);
  background: var(--bg-input);
  border-color: var(--border-strong);
  font-weight: 600;
}

.stage-code-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-code-container {
  flex: 1;
  overflow: auto;
  padding: 24px 28px 48px;
  background: var(--bg-card);
}

.stage-code-pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Command Palette Modal (HeroUI / shadcn cmdk inspired) */
.cmd-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.15s ease;
}

body.theme-light .cmd-dialog-overlay {
  background: rgba(0, 0, 0, 0.35);
}

@keyframes cmdEnter {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cmd-dialog-box {
  width: 100%;
  max-width: 620px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: cmdEnter 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.cmd-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.cmd-search-icon {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cmd-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-main);
  font-family: inherit;
}

.cmd-search-input::placeholder {
  color: var(--text-dim);
}

.cmd-kbd {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.cmd-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.cmd-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 8px 10px 4px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cmd-item:hover,
.cmd-item.selected {
  background: var(--bg-hover);
  color: var(--text-main);
}

.cmd-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmd-item-icon {
  color: var(--text-dim);
  display: flex;
  align-items: center;
}

.cmd-item:hover .cmd-item-icon,
.cmd-item.selected .cmd-item-icon {
  color: var(--text-main);
}

.cmd-item-cat {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

.cmd-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.cmd-footer-shortcuts {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cmd-footer-shortcut {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Mobile bottom navigation (Default hidden on desktop) */
.mobile-bottom-nav {
  display: none;
}

/* Mobile responsive layout */
@media (max-width: 768px) {
  #app {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 500;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .sidebar-boundary-toggle {
    display: none;
  }

  /* Top bar elements on mobile */
  .top-bar {
    padding: 0 12px;
  }

  .device-preview-bar,
  .status-pill,
  #view-landing-btn,
  .top-bar a[href*="github"] {
    display: none !important;
  }

  .breadcrumb-trail {
    max-width: 170px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .bc-cat, .bc-sep:nth-of-type(2) {
    display: none;
  }

  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 54px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    flex-shrink: 0;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .mobile-nav-btn.active {
    color: var(--text-main);
  }

  .mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-nav-label {
    font-size: 0.68rem;
    font-weight: 500;
  }

  .mobile-nav-btn.active .mobile-nav-label {
    font-weight: 700;
  }

  /* Workspace Layout on Mobile */
  .workspace-content {
    flex-direction: column;
    flex: 1;
    height: calc(100% - var(--header-height) - 54px);
    overflow: hidden;
    position: relative;
  }

  #stage-wrapper {
    width: 100% !important;
    height: 100% !important;
    display: flex;
    position: relative;
  }

  #controls-stage {
    width: 100% !important;
    height: 100% !important;
    display: none;
    border-left: none;
    border-top: none;
  }

  /* Mobile Active Tab Switching */
  body.mob-tab-preview #stage-wrapper {
    display: flex !important;
  }
  body.mob-tab-preview #controls-stage {
    display: none !important;
  }
  body.mob-tab-preview .stage-code-view {
    display: none !important;
  }

  body.mob-tab-controls #stage-wrapper {
    display: none !important;
  }
  body.mob-tab-controls #controls-stage {
    display: flex !important;
    height: 100% !important;
  }
  body.mob-tab-controls #code-stage {
    display: none !important;
  }

  body.mob-tab-code #stage-wrapper {
    display: flex !important;
  }
  body.mob-tab-code #preview-stage {
    display: none !important;
  }
  body.mob-tab-code .stage-floating-toolbar {
    display: none !important;
  }
  body.mob-tab-code .stage-code-view {
    display: flex !important;
    padding-top: 0;
  }
  body.mob-tab-code #controls-stage {
    display: none !important;
  }

  /* Floating stage toolbar touch adjustments */
  .stage-floating-toolbar {
    top: 10px;
    max-width: 95vw;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 3px 6px;
  }
  .stage-floating-toolbar::-webkit-scrollbar {
    display: none;
  }

  #preview-stage {
    padding: 56px 14px 20px;
  }
}
