/* Shared creator workspace bar — same height and layout on My Games, Story, Build, Library, Analytics.
   Uses the tokens from builder.css (loaded first on every creator page). */

.ws-bar {
  height: var(--topbar-h, 40px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 10px 0 12px;
  background: #1f1f1f;
  border-bottom: 1px solid var(--border, #383838);
  position: relative;
  z-index: 60;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  color: var(--text, #e0e0e0);
  min-width: 0;
}
.ws-bar.is-leaving { cursor: progress; }

.ws-left {
  display: flex;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.ws-brand {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--accent, #4c9eff);
  text-decoration: none;
  padding: 5px 6px;
  margin-left: -6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.ws-brand:hover { background: var(--panel2, #2c2c2c); }

.ws-page-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #e0e0e0);
  margin-left: 8px;
}

/* Game switcher */
.ws-game { position: relative; margin-left: 4px; min-width: 0; }
.ws-game-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(220px, 100%);   /* shortens with its slot (title ellipsis) instead of spilling over the tabs */
  height: 28px;
  padding: 0 7px 0 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text, #e0e0e0);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ws-game-btn:hover,
.ws-game-btn[aria-expanded="true"] { background: var(--panel2, #2c2c2c); border-color: var(--border, #383838); }
.ws-game-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* First visit: hold the title's place until it arrives (never an empty slot) */
.ws-game-btn.is-loading .ws-game-title {
  display: block;
  width: 104px;
  height: 11px;
  border-radius: 3px;
  background: linear-gradient(90deg, #2c2c2c 0%, #3a3a3a 50%, #2c2c2c 100%);
  background-size: 200% 100%;
  animation: ws-shimmer 1.1s linear infinite;
}
@keyframes ws-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.ws-game-btn svg { width: 10px; height: 10px; flex-shrink: 0; color: var(--text-dim, #888); }

.ws-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-width: 320px;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  background: var(--panel, #242424);
  border: 1px solid var(--border, #383838);
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 10000;
}
.ws-menu[hidden] { display: none; }
.ws-menu-label {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim, #888);
}
.ws-menu-note { padding: 6px 12px; color: var(--text-dim, #888); }
.ws-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  color: var(--text, #e0e0e0);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
}
.ws-menu-item:hover, .ws-menu-item:focus-visible { background: var(--accent, #4c9eff); color: #fff; }
.ws-menu-item.is-current { cursor: default; color: var(--text, #e0e0e0); }
.ws-menu-item.is-current:hover { background: none; color: var(--text, #e0e0e0); }
.ws-menu-check { width: 14px; height: 14px; display: inline-flex; flex-shrink: 0; color: var(--accent, #4c9eff); }
.ws-menu-check svg { width: 14px; height: 14px; }
.ws-menu-text { overflow: hidden; text-overflow: ellipsis; }
.ws-menu-sep { height: 1px; background: var(--border, #383838); margin: 4px 0; }

.ws-sep {
  width: 1px;
  height: 20px;
  background: var(--border, #383838);
  margin: 0 10px 0 8px;
  flex-shrink: 0;
}
.ws-sep-tight { margin: 0 2px; }

/* Section tabs */
.ws-tabs { display: flex; align-items: stretch; height: 100%; flex-shrink: 0; }
.ws-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: var(--text-dim, #888);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.12s;
}
/* Reserve the bold width on every tab so the active (bold) tab never nudges its neighbours */
.ws-tab::before {
  content: attr(data-label);
  font-weight: 600;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}
.ws-tab:hover { color: var(--text, #e0e0e0); }
.ws-tab.is-active { color: #fff; font-weight: 600; }
.ws-tab.is-active::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent, #4c9eff);
}

/* Jump-to (quick switcher) button, right after the tabs */
.ws-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin-left: 6px;
  padding: 0 7px;
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-dim, #888);
  font: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.ws-jump svg { width: 13px; height: 13px; }
.ws-jump:hover { background: var(--panel2, #2c2c2c); border-color: var(--border, #383838); color: var(--text, #e0e0e0); }
.ws-jump-kbd, .ws-qs kbd {
  font: 500 10px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-dim, #888);
  border: 1px solid var(--border, #383838);
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1.3;
  background: #262626;
}

/* Quick switcher */
.ws-qs-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
  animation: ws-fade 0.1s ease-out;
}
.ws-qs {
  width: 560px;
  max-width: calc(100vw - 32px);
  background: var(--panel, #242424);
  border: 1px solid var(--border, #383838);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text, #e0e0e0);
  overflow: hidden;
  animation: ws-pop 0.12s ease-out;
}
.ws-qs-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 48px;
  border-bottom: 1px solid var(--border, #383838);
}
.ws-qs-field svg { width: 15px; height: 15px; color: var(--text-dim, #888); flex-shrink: 0; }
.ws-qs-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font: 400 15px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.ws-qs-input::placeholder { color: #6a6a6a; }
.ws-qs-list { max-height: min(380px, 56vh); overflow-y: auto; padding: 4px 0; }
.ws-qs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
.ws-qs-item.is-active { background: rgba(76, 158, 255, 0.16); }
.ws-qs-kind {
  width: 54px;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-dim, #888);
}
.ws-qs-item[data-kind="level"] .ws-qs-kind { color: #8fb8ff; }
.ws-qs-item[data-kind="room"] .ws-qs-kind { color: #7fd3a0; }
.ws-qs-item[data-kind="item"] .ws-qs-kind { color: #e8b86a; }
.ws-qs-gap { display: inline-block; width: 12px; }
.ws-qs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ws-qs-here {
  font-size: 10px;
  color: var(--accent, #4c9eff);
  border: 1px solid rgba(76, 158, 255, 0.4);
  border-radius: 3px;
  padding: 0 4px;
  flex-shrink: 0;
}
.ws-qs-detail { margin-left: auto; padding-left: 12px; color: var(--text-dim, #888); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.ws-qs-empty { padding: 18px 14px; color: var(--text-dim, #888); font-size: 13px; }
.ws-qs-foot {
  display: flex;
  gap: 16px;
  padding: 7px 14px;
  border-top: 1px solid var(--border, #383838);
  font-size: 11px;
  color: var(--text-dim, #888);
}
.ws-qs-foot kbd { margin-right: 3px; }

/* Right side: page actions, then Play */
.ws-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ws-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px 0 10px;
  background: var(--panel2, #2c2c2c);
  border: 1px solid var(--border, #383838);
  border-radius: 4px;
  color: var(--text, #e0e0e0);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.ws-play svg { width: 11px; height: 11px; color: var(--green, #56b870); }
.ws-play:hover { background: #38383a; color: #fff; }
.ws-play[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* Page actions that live in the bar share one height so nothing jumps between pages */
.ws-right .story-action-btn,
.ws-right .view-toggle-btn,
.ws-right .btn-test,
.ws-right .btn-publish,
.ws-right .mg-topbar-btn { height: 28px; display: inline-flex; align-items: center; }
/* Story's buttons carried their own purple tint; in the shared bar they use the same neutral
   buttons as the builder so the right side reads the same on every page. */
.ws-right .story-action-btn {
  padding-top: 0;
  padding-bottom: 0;
  background: var(--panel2, #2c2c2c);
  border-color: var(--border, #383838);
  border-radius: 4px;
  color: var(--text, #e0e0e0);
}
.ws-right .story-action-btn:hover { background: #38383a; color: #fff; }
.ws-right .view-toggle-group { border-color: var(--border, #383838); border-radius: 4px; }
.ws-right .view-toggle-btn { padding-top: 0; padding-bottom: 0; background: var(--panel2, #2c2c2c); color: var(--text-dim, #888); }
.ws-right .view-toggle-btn:hover:not(.active) { background: #38383a; color: var(--text, #e0e0e0); }
.ws-right .view-toggle-btn.active { background: rgba(76, 158, 255, 0.15); color: var(--accent, #4c9eff); }

.ws-bar a:focus-visible,
.ws-bar button:focus-visible {
  outline: 2px solid var(--accent, #4c9eff);
  outline-offset: -2px;
  border-radius: 4px;
}

/* Builder: its own menus, breadcrumb and tools sit on a quieter second strip under the shared bar */
.builder-topbar.builder-toolstrip {
  height: 34px;
  background: #1a1a1a;
  padding: 0 8px 0 4px;
}
.builder-toolstrip .toolstrip-right { display: flex; align-items: center; gap: 6px; }
.builder-toolstrip .topbar-btn { width: 26px; height: 26px; }
.builder-toolstrip .topbar-btn-text { width: auto; line-height: 24px; }
.builder-toolstrip .topbar-breadcrumb { margin-left: 6px; }

/* Builder: Level › Room crumbs are menus */
.bc-crumb { position: relative; display: flex; align-items: center; }
.bc-crumb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  max-width: 200px;
  padding: 0 6px 0 7px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-dim, #888);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.bc-crumb-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#bc-room-btn { color: var(--text, #e0e0e0); font-weight: 600; }
.bc-crumb-btn svg { width: 9px; height: 9px; flex-shrink: 0; opacity: 0.7; }
/* Build's crumb before its names are known: an empty pill, never a placeholder name */
.bc-crumb-btn.is-pending span { display: inline-block; min-width: 54px; height: 10px; border-radius: 3px; background: var(--panel2, #2c2c2c); }
.bc-crumb-btn:hover, .bc-crumb-btn[aria-expanded="true"] { background: var(--panel2, #2c2c2c); border-color: var(--border, #383838); color: var(--text, #e0e0e0); }
.bc-crumb-btn:focus-visible { outline: 2px solid var(--accent, #4c9eff); outline-offset: -2px; }
.bc-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 250px;
  max-width: 340px;
  max-height: min(440px, 70vh);
  overflow-y: auto;
  background: var(--panel, #242424);
  border: 1px solid var(--border, #383838);
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 10000;
  font-size: 12px;
}
.bc-menu[hidden] { display: none; }
.bc-menu-label {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bc-menu-group { padding: 8px 12px 3px 30px; font-size: 11px; color: #9a9a9a; font-weight: 600; }
.bc-menu-note { padding: 6px 12px; color: var(--text-dim, #888); }
.bc-menu-sep { height: 1px; background: var(--border, #383838); margin: 4px 0; }
.bc-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 6px 12px 6px 8px;
  background: none;
  border: none;
  color: var(--text, #e0e0e0);
  font: inherit;
  text-align: left;
  cursor: pointer;
  outline: none;
}
.bc-menu-item:hover, .bc-menu-item:focus-visible { background: var(--accent, #4c9eff); color: #fff; }
.bc-menu-item:hover .bc-menu-meta, .bc-menu-item:focus-visible .bc-menu-meta { color: rgba(255, 255, 255, 0.75); }
.bc-check { width: 16px; height: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent, #4c9eff); font-weight: 700; }
.bc-check svg { width: 13px; height: 13px; }
.bc-menu-item:hover .bc-check, .bc-menu-item:focus-visible .bc-check { color: #fff; }
.bc-menu-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-menu-meta { color: var(--text-dim, #888); font-size: 11px; flex-shrink: 0; }
.bc-menu-add .bc-check { color: var(--text-dim, #888); }
.bc-menu-row { display: flex; align-items: center; padding-right: 6px; min-height: 30px; }
.bc-menu-row .bc-menu-item { flex: 1; }
.bc-row-act {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #777;
  cursor: pointer;
  padding: 0;
}
.bc-row-act svg { width: 12px; height: 12px; }
.bc-row-act:hover:not(:disabled), .bc-row-act:focus-visible { color: var(--text, #e0e0e0); background: var(--panel2, #2c2c2c); border-color: var(--border, #383838); outline: none; }
.bc-row-del:hover:not(:disabled), .bc-row-del:focus-visible { color: #ff8a8a; border-color: rgba(224, 82, 82, 0.5); }
.bc-row-act:disabled { opacity: 0.3; cursor: not-allowed; }
.bc-menu-row.is-editing, .bc-menu-row.is-confirming { gap: 6px; padding: 4px 8px 4px 30px; }
.bc-rename-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 7px;
  background: #161616;
  border: 1px solid var(--accent, #4c9eff);
  border-radius: 4px;
  color: #fff;
  font: inherit;
  outline: none;
}
.bc-row-hint { font-size: 10px; color: var(--text-dim, #888); white-space: nowrap; }
.bc-confirm-text { flex: 1; min-width: 0; font-size: 11px; color: #ddd; line-height: 1.3; }
.bc-confirm-btn {
  height: 24px;
  padding: 0 9px;
  border-radius: 4px;
  border: 1px solid var(--border, #383838);
  background: var(--panel2, #2c2c2c);
  color: var(--text, #e0e0e0);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
}
.bc-menu-row.is-confirming { flex-wrap: wrap; row-gap: 4px; }
.bc-confirm-note { flex-basis: 100%; order: 3; font-size: 11px; line-height: 1.35; color: #f0c674; }
.bc-confirm-note:empty { display: none; }
.bc-confirm-del { background: #8a2c2c; border-color: #a33a3a; color: #fff; }
.bc-confirm-del:hover { background: #a33a3a; }
.bc-confirm-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
/* Reorder in the room menu: a grip at the row's edge on hover; drag the row, or Alt+Up / Alt+Down */
.bc-menu-row.is-movable { position: relative; }
.bc-row-grip {
  position: absolute;
  left: 1px;
  top: 50%;
  width: 6px;
  height: 12px;
  margin-top: -6px;
  opacity: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #9a9a9a 1px, transparent 1.3px);
  background-size: 3px 4px;
  z-index: 1;
}
.bc-menu-row.is-movable:hover .bc-row-grip { opacity: 0.8; }
.bc-menu.is-reordering, .bc-menu.is-reordering * { cursor: grabbing !important; user-select: none; }
.bc-menu-row.is-dragging { opacity: 0.45; }
.bc-menu-row.is-drop-before { box-shadow: inset 0 2px 0 var(--accent, #4c9eff); }
.bc-menu-row.is-drop-after { box-shadow: inset 0 -2px 0 var(--accent, #4c9eff); }

/* Builder: palette rows for library categories with nothing in them yet */
.lib-row-empty { font-size: 10px; color: #666; padding: 6px 2px; }

/* Builder: Selected panel link to the Library item an object or tile came from */
.sel-lib-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 9px;
  background: rgba(76, 158, 255, 0.08);
  border: 1px solid rgba(76, 158, 255, 0.28);
  border-radius: 6px;
}
.sel-lib-link[hidden] { display: none; }
.sel-lib-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sel-lib-kind { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim, #888); }
.sel-lib-name { font-size: 12px; font-weight: 600; color: var(--text, #e0e0e0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-lib-edit {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--accent, #4c9eff);
  border-radius: 4px;
  padding: 4px 8px;
  text-decoration: none;
}
.sel-lib-edit:hover { background: #3a8ee0; }

/* Builder: once published, the button is a link to the public page, not an action */
.ws-right .btn-publish.is-published {
  gap: 6px;
  background: var(--panel2, #2c2c2c);
  border: 1px solid var(--border, #383838);
  color: var(--text, #e0e0e0);
  font-weight: 500;
}
.ws-right .btn-publish.is-published:hover { background: #38383a; color: #fff; }
.btn-publish .pub-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green, #56b870); box-shadow: 0 0 0 2px rgba(86, 184, 112, 0.2); }
.btn-publish svg { width: 11px; height: 11px; opacity: 0.75; }

/* Unsaved-work dialog */
.ws-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ws-fade 0.12s ease-out;
}
.ws-dialog {
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--panel, #242424);
  border: 1px solid var(--border, #383838);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  padding: 20px 20px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text, #e0e0e0);
  animation: ws-pop 0.14s ease-out;
}
.ws-dialog-title { font-size: 15px; font-weight: 700; margin: 0 0 6px; color: #fff; }
.ws-dialog-msg { font-size: 13px; line-height: 1.45; color: #b8b8b8; margin: 0 0 18px; }
.ws-dialog-actions { display: flex; align-items: center; gap: 8px; }
.ws-dialog-spacer { flex: 1; }
.ws-dlg-btn {
  height: 30px;
  padding: 0 14px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border, #383838);
  background: var(--panel2, #2c2c2c);
  color: var(--text, #e0e0e0);
}
.ws-dlg-btn:hover { background: #38383a; color: #fff; }
.ws-dlg-cancel { background: none; color: var(--text-dim, #888); }
.ws-dlg-discard:hover { border-color: var(--red, #e05252); color: #ff8a8a; background: rgba(224, 82, 82, 0.08); }
.ws-dlg-save { background: var(--accent, #4c9eff); border-color: var(--accent, #4c9eff); color: #fff; }
.ws-dlg-save:hover { background: #3a8ee0; border-color: #3a8ee0; }
.ws-dlg-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.ws-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 20001;
  background: #2a4a3a;
  color: #b6f0c8;
  padding: 8px 18px;
  border-radius: 8px;
  font: 600 13px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: opacity 0.3s;
}
.ws-toast.is-error { background: #4a2a2a; color: #ffb0b0; }
.ws-toast.is-out { opacity: 0; }
.ws-toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 6px 8px 6px 16px; background: #2b2d33; color: #e8e8ea; max-width: calc(100vw - 24px); box-sizing: border-box; }
.ws-toast-act { flex: none; min-height: 32px; padding: 0 14px; border: 1px solid #4c9eff; border-radius: 6px; background: transparent; color: #8cc2ff; font: 700 13px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; cursor: pointer; }
.ws-toast-act:hover { background: rgba(76, 158, 255, 0.14); color: #fff; }
.ws-toast-act:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (pointer: coarse) { .ws-toast.has-action { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } .ws-toast-act { min-height: 44px; } }

@keyframes ws-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ws-pop { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ws-dialog-overlay, .ws-dialog { animation: none; }
}

/* Narrow windows: tighten before anything can spill off the right edge */
@media (max-width: 1100px) {
  .ws-game-btn { max-width: min(160px, 100%); }
  .ws-tab { padding: 0 8px; }
  .ws-sep { margin: 0 6px 0 4px; }
  .ws-jump-kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-game-btn.is-loading .ws-game-title { animation: none; }
  .ws-qs-overlay, .ws-qs { animation: none; }
}

/* Library: way back to Build (shown when opened from the builder, ?from=build) */
.lib-editor .lib-editor-back { display: flex; align-items: center; gap: 8px; }
.lib-editor-back-spacer { flex: 1; }
.lib-back-build {
  display: inline-flex;
  align-items: center;
  height: 29px;
  padding: 0 12px;
  border-radius: 4px;
  background: var(--accent, #4c9eff);
  border: 1px solid var(--accent, #4c9eff);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.lib-back-build:hover { background: #3a8ee0; border-color: #3a8ee0; }
.lib-back-build[hidden] { display: none; }
.lib-back-build:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lib-browse-header .lib-back-build { margin-right: 14px; }
.lib-browse-header .lib-browse-title { flex: 1; }
.lib-editor .lib-new-from-editor { color: var(--text, #e0e0e0); }

.lib-next-step {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  background: #1f2b3a;
  border: 1px solid rgba(76, 158, 255, 0.45);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  font: 13px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #dfe9f5;
  animation: ws-pop 0.14s ease-out;
}
.lib-next-text strong { color: #fff; }
.lib-next-btn {
  background: var(--accent, #4c9eff);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 5px;
  white-space: nowrap;
}
.lib-next-btn:hover { background: #3a8ee0; }
.lib-next-close {
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  color: #8aa0b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}
.lib-next-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
body.nav-switching .builder-canvas-area { cursor: progress; }
.bc-menu:focus { outline: none; }

/* Loading placeholder: the shimmer the bar's title uses, for any block that is on its way */
.ws-skel {
  background: linear-gradient(90deg, #22222a 0%, #2e2e38 50%, #22222a 100%);
  background-size: 200% 100%;
  animation: ws-shimmer 1.1s linear infinite;
  border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) { .ws-skel { animation: none; } }

/* Library: the editor while an item opens (never blank) */
.lib-editor-skeleton[hidden] { display: none; }
.lib-skel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -24px -24px 16px;
  padding: 12px 24px;
  border-bottom: 1px solid #222228;
  background: #121217;
  min-height: 54px;
}
.lib-skel-thumb {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  overflow: hidden;
}
.lib-skel-thumb img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.lib-skel-name { flex: 1; min-width: 0; }
.lib-skel-name-text { display: block; font-size: 16px; font-weight: 600; color: var(--text, #e0e0e0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-editor-skeleton:not(.has-name) .lib-skel-name-text {
  width: 160px; height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, #22222a 0%, #2e2e38 50%, #22222a 100%);
  background-size: 200% 100%;
  animation: ws-shimmer 1.1s linear infinite;
}
.lib-skel-status { font-size: 12px; color: var(--text-dim, #888); }
.lib-skel-body { display: flex; gap: 16px; }
.lib-skel-canvas { width: min(420px, 60%); aspect-ratio: 1; }
.lib-skel-side { flex: 1; display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.lib-skel-line { height: 30px; }
.lib-skel-line.short { width: 60%; }
@media (max-width: 640px) {
  .lib-skel-body { flex-direction: column; }
  .lib-skel-canvas { width: 100%; }
}

/* ── Phones: two rows (brand, game, jump, More, Play / the four tabs), page actions under More ── */
.ws-more { position: relative; display: flex; }
.ws-more[hidden] { display: none; }
.ws-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text, #e0e0e0);
  cursor: pointer;
}
.ws-more-btn svg { width: 16px; height: 16px; }
.ws-more-btn:hover, .ws-more-btn[aria-expanded="true"] { background: var(--panel2, #2c2c2c); border-color: var(--border, #383838); }
.ws-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  max-width: calc(100vw - 16px);
  padding: 6px 0;
  background: var(--panel, #242424);
  border: 1px solid var(--border, #383838);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.ws-more-menu[hidden] { display: none; }
/* Each page action becomes a full-width row, whatever it looked like in the bar */
.ws-more-menu > button,
.ws-more-menu > a,
.ws-more-menu > .mg-auth-area > button,
.ws-more-menu > .view-toggle-group > button {
  display: flex !important;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  height: auto !important;
  margin: 0;
  padding: 0 16px !important;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--text, #e0e0e0) !important;
  font: 400 14px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  text-align: left;
  text-decoration: none;
  justify-content: flex-start;
  cursor: pointer;
}
.ws-more-menu > button:hover, .ws-more-menu > a:hover,
.ws-more-menu > .mg-auth-area > button:hover,
.ws-more-menu > .view-toggle-group > button:hover { background: rgba(76, 158, 255, 0.14) !important; }
.ws-more-menu > button svg { width: 16px !important; height: 16px !important; flex-shrink: 0; }
.ws-more-menu .view-toggle-group { display: flex; border: none; margin: 0 0 4px; border-bottom: 1px solid var(--border, #383838); }
.ws-more-menu .view-toggle-group > button { flex: 1; justify-content: center; }
.ws-more-menu .view-toggle-group > button.active { color: var(--accent, #4c9eff) !important; font-weight: 600 !important; }
.ws-more-menu .topbar-divider { display: none; }
.ws-more-menu .mg-auth-area { display: flex; flex-direction: column; align-items: stretch; border-top: 1px solid var(--border, #383838); margin-top: 4px; padding-top: 4px; }
.ws-more-menu .mg-username { padding: 8px 16px 2px; color: var(--text-dim, #888); font-size: 12px; }
.ws-more-label { display: none; font-size: 14px; }
.ws-more-menu .ws-more-label { display: inline; }

/* is-narrow is set by workspace-nav.js: at 640px and below, or whenever the one-row bar does not fit */
.ws-bar.is-narrow {
  height: auto;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0;
  padding: 0 6px 0 12px;
}
.ws-bar.is-narrow > .ws-left { display: contents; }
.ws-bar.is-narrow .ws-brand { order: 1; height: 44px; display: inline-flex; align-items: center; }
.ws-bar.is-narrow .ws-page-title { order: 2; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-bar.is-narrow .ws-game { order: 2; flex: 1 1 auto; min-width: 0; margin-left: 2px; }
.ws-bar.is-narrow .ws-game-btn { max-width: 100%; height: 34px; font-size: 14px; }
.ws-bar.is-narrow > .ws-left > .ws-sep { display: none; }
.ws-bar.is-narrow .ws-jump { order: 3; width: 38px; height: 34px; margin-left: 2px; justify-content: center; padding: 0; }
.ws-bar.is-narrow .ws-jump svg { width: 15px; height: 15px; }
.ws-bar.is-narrow .ws-jump-kbd { display: none; }
.ws-bar.is-narrow .ws-right { order: 4; height: 44px; margin-left: auto; gap: 4px; }
.ws-bar.is-narrow .ws-right .ws-sep-tight { display: none; }
.ws-bar.is-narrow .ws-play { height: 34px; padding: 0 12px; }
.ws-bar.is-narrow .ws-play span { display: none; }
.ws-bar.is-narrow .ws-play svg { width: 13px; height: 13px; }
.ws-bar.is-narrow .ws-tabs {
  order: 10;
  flex: 1 0 calc(100% + 18px);   /* edge to edge: the bar's 12px + 6px padding are taken back by the margins */
  height: 42px;
  margin: 0 -6px 0 -12px;
  border-top: 1px solid var(--border, #383838);
}
.ws-bar.is-narrow .ws-tab { flex: 1 1 0; padding: 0 4px; font-size: 13px; }
.ws-bar.is-narrow .ws-tab.is-active::after { left: 18%; right: 18%; }
.ws-bar.is-narrow .ws-menu { max-width: calc(100vw - 24px); }

/* More menu: "Keyboard shortcuts" at its foot (screens with a keyboard and a mouse) */
.ws-more-menu > .ws-more-sep { height: 1px; margin: 4px 0; background: var(--border, #383838); }
.ws-more-menu > .ws-more-fixed[hidden] { display: none !important; }
.ws-more-menu > .ws-more-keys kbd { margin-left: auto; }
.ws-more-menu kbd, .ws-keys kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box;
  border: 1px solid var(--border, #383838); border-bottom-width: 2px; border-radius: 4px;
  background: var(--panel2, #2c2c2c); color: var(--text, #e0e0e0);
  font: 600 11px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* The keyboard shortcuts sheet (?), generated from the shortcut registry in workspace-nav.js */
.ws-keys-overlay {
  position: fixed; inset: 0; z-index: 20000;
  background: rgba(0, 0, 0, 0.45);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 10vh 16px 16px;
  animation: ws-fade 0.1s ease-out;
}
.ws-keys {
  width: 620px; max-width: 100%; max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--panel, #242424);
  border: 1px solid var(--border, #383838);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text, #e0e0e0);
  animation: ws-pop 0.12s ease-out;
}
.ws-keys-head { display: flex; align-items: center; padding: 6px 6px 6px 18px; border-bottom: 1px solid var(--border, #383838); }
.ws-keys-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 700; color: #fff; }
.ws-keys-head h2 span { font-weight: 500; color: var(--text-dim, #888); }
.ws-keys-close {
  width: 44px; height: 44px; border: none; border-radius: 6px; background: none;
  color: var(--text-dim, #888); font-size: 22px; line-height: 1; cursor: pointer;
}
.ws-keys-close:hover { background: var(--panel2, #2c2c2c); color: #fff; }
.ws-keys-close:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.ws-keys-body { overflow: auto; padding: 6px 18px 16px; columns: 2 260px; column-gap: 28px; }
.ws-keys-group { break-inside: avoid; padding-top: 10px; }
.ws-keys-group h3 { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim, #888); }
.ws-keys-group dl { margin: 0; }
.ws-keys-row { display: flex; align-items: center; gap: 12px; min-height: 28px; }
.ws-keys-row dt { flex: 1; font-size: 13px; color: var(--text, #e0e0e0); }
.ws-keys-row dd { margin: 0; display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.ws-keys-or { margin: 0 4px; font-size: 11px; color: var(--text-dim, #888); }
@media (prefers-reduced-motion: reduce) { .ws-keys-overlay, .ws-keys { animation: none; } }
