/* =========================================================
   PROFILE LAYOUT — grid system + /me/layout editor chrome
   ========================================================= */

/* ---------------------------------------------------------
   EDITOR SHELL
   /me/layout is an app frame, not a document: the page itself
   never scrolls, and the three workspace columns each own
   their own scroll region.
   --------------------------------------------------------- */

.me-layout-shell {
  --edit-surface: rgba(255, 255, 255, 0.032);
  --edit-surface-hi: rgba(255, 255, 255, 0.06);
  --edit-line: rgba(255, 255, 255, 0.085);
  --edit-line-soft: rgba(255, 255, 255, 0.05);
  --edit-text: var(--color-fg, #f0e6d3);
  --edit-muted: rgba(240, 230, 211, 0.5);
  --edit-faint: rgba(240, 230, 211, 0.3);
  --edit-accent: var(--color-accent, #7ec8e3);
  --edit-accent-soft: rgba(126, 200, 227, 0.14);
  --edit-rail-w: 268px;
  --edit-inspector-w: 322px;
  --edit-radius: 12px;

  background: var(--color-bg, #0a0a14);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Full-bleed: the shared 1120px document column would waste half the screen
   on a tool whose whole job is showing a wide canvas next to two rails. */
.me-layout-shell .arcade-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.me-layout-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 clamp(10px, 1.4vw, 22px) clamp(10px, 1.4vw, 18px);
}

.me-layout-stage__nav {
  padding: 0.5rem 0 0.35rem;
  flex-shrink: 0;
}

/* --- Top Bar --- */

.me-layout-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0 0.7rem;
  border-bottom: 1px solid var(--edit-line-soft);
  margin-bottom: 0.7rem;
  flex-shrink: 0;
}

.me-layout-topbar__lead {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.me-layout-topbar__center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: center;
}

.me-layout-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-end;
  min-width: 0;
}

.me-layout-topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--edit-muted);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 0.32rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.me-layout-topbar__back:hover {
  color: var(--edit-text);
  background: var(--edit-surface-hi);
}

.me-layout-topbar__title {
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-layout-topbar__dirty {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-warn, #f0c040);
  border: 1px solid rgba(240, 192, 64, 0.32);
  background: rgba(240, 192, 64, 0.1);
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  white-space: nowrap;
}

.me-layout-topbar__status {
  font-size: 0.72rem;
  color: var(--edit-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  margin-right: 0.15rem;
}

/* --- Toolbar buttons --- */

.me-layout-toolgroup {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--edit-line);
  border-radius: 8px;
  background: var(--edit-surface);
}

.me-layout-toolbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--edit-surface);
  border: 1px solid var(--edit-line);
  border-radius: 7px;
  color: var(--edit-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  padding: 0.36rem 0.72rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.me-layout-toolbtn:hover {
  background: var(--edit-surface-hi);
  border-color: rgba(255, 255, 255, 0.16);
}

/* Inside a toolgroup the group owns the frame, so members go borderless. */
.me-layout-toolgroup .me-layout-toolbtn {
  border-color: transparent;
  background: transparent;
}

.me-layout-toolgroup .me-layout-toolbtn:hover {
  background: var(--edit-surface-hi);
}

.me-layout-toolbtn__icon {
  display: inline-flex;
  width: 13px;
  height: 13px;
}

.me-layout-toolbtn__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.me-layout-toolbtn--icon {
  width: 28px;
  padding: 0.36rem 0;
  font-size: 0.95rem;
  line-height: 1;
}

.me-layout-toolbtn--zoom {
  min-width: 58px;
  font-variant-numeric: tabular-nums;
  color: var(--edit-muted);
}

.me-layout-toolbtn--zoom:hover {
  color: var(--edit-text);
}

.me-layout-toolbtn[aria-pressed="true"] {
  background: var(--edit-accent-soft);
  border-color: rgba(126, 200, 227, 0.3);
  color: var(--edit-accent);
}

.me-layout-toolgroup .me-layout-toolbtn[aria-pressed="true"] {
  border-color: transparent;
}

.me-layout-toolbtn--link {
  color: var(--edit-muted);
}

.me-layout-toolbtn--link:hover {
  color: var(--edit-text);
}

.me-layout-toolbtn--primary {
  background: rgba(126, 200, 227, 0.16);
  border-color: rgba(126, 200, 227, 0.42);
  color: var(--edit-accent);
  font-weight: 600;
}

.me-layout-toolbtn--primary:hover {
  background: rgba(126, 200, 227, 0.26);
  border-color: rgba(126, 200, 227, 0.6);
}

.me-layout-toolbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Workspace: rail | canvas | inspector --- */

.me-layout-workspace {
  display: grid;
  grid-template-columns: var(--edit-rail-w) minmax(0, 1fr) var(--edit-inspector-w);
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.me-layout-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--edit-surface);
  border: 1px solid var(--edit-line);
  border-radius: var(--edit-radius);
  overflow: hidden;
}

.me-layout-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--edit-line-soft);
  flex-shrink: 0;
}

.me-layout-rail__heading {
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--edit-faint);
  white-space: nowrap;
}

.me-layout-rail__add {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid rgba(126, 200, 227, 0.28);
  border-radius: 6px;
  background: rgba(126, 200, 227, 0.08);
  color: var(--edit-accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.24rem 0.5rem;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s;
}

.me-layout-rail__add:hover {
  background: rgba(126, 200, 227, 0.18);
  border-color: rgba(126, 200, 227, 0.5);
}

/* --- Rail search --- */

.me-layout-rail__search {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.6rem 0.4rem;
  flex-shrink: 0;
}

.me-layout-rail__search-icon {
  position: absolute;
  left: 1.15rem;
  width: 12px;
  height: 12px;
  fill: var(--edit-faint);
  pointer-events: none;
}

.me-layout-rail__search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--edit-line);
  border-radius: 7px;
  background: rgba(7, 6, 18, 0.6);
  color: var(--edit-text);
  font: inherit;
  font-size: 0.76rem;
  padding: 0.36rem 0.5rem 0.36rem 1.85rem;
  transition: border-color 0.14s;
}

.me-layout-rail__search-input::placeholder {
  color: var(--edit-faint);
}

.me-layout-rail__search-input:focus {
  outline: none;
  border-color: rgba(126, 200, 227, 0.5);
}

.me-layout-rail__search-input::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.4);
  cursor: pointer;
}

/* --- Panel list --- */

.me-layout-panel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0.45rem 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.me-layout-panel-list::-webkit-scrollbar {
  width: 9px;
}

.me-layout-panel-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.me-layout-panel-list__empty {
  margin: 1rem 0.4rem;
  font-size: 0.76rem;
  color: var(--edit-faint);
  font-style: italic;
  line-height: 1.5;
}

/* --- Groups --- */

.me-layout-group + .me-layout-group {
  margin-top: 2px;
}

/* Sticky so the section a row belongs to stays named while the rail scrolls.
   The fade matches the rail surface (page bg + --edit-surface) so rows scroll
   out under it cleanly. */
.me-layout-group__toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  border-radius: 6px;
  color: var(--edit-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 0.42rem 0.35rem;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(to bottom, #11111a 78%, rgba(17, 17, 26, 0));
}

.me-layout-group__toggle:hover {
  color: var(--edit-text);
}

.me-layout-group__chevron {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transform: rotate(90deg);
  transition: transform 0.14s ease;
  opacity: 0.75;
}

.me-layout-group--collapsed .me-layout-group__chevron {
  transform: rotate(0deg);
}

.me-layout-group__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-layout-group__count {
  flex-shrink: 0;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--edit-faint);
  font-variant-numeric: tabular-nums;
}

.me-layout-group__rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 0.3rem;
}

.me-layout-group--collapsed .me-layout-group__rows {
  display: none;
}

/* --- Panel rows --- */

.me-layout-panel-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: 6px;
}

.me-layout-panel-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.me-layout-panel-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--edit-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.775rem;
  letter-spacing: 0.01em;
  padding: 0.36rem 0.45rem;
  text-align: left;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.me-layout-panel-item--selected {
  background: var(--edit-accent-soft);
  border-color: rgba(126, 200, 227, 0.4);
  color: var(--edit-accent);
}

.me-layout-panel-item--hidden {
  color: var(--edit-faint);
}

.me-layout-panel-item__dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.me-layout-panel-item--hidden .me-layout-panel-item__dot {
  background: none;
  box-shadow: inset 0 0 0 1px currentColor;
}

/* Long element names wrap to a second line instead of truncating to "He…". */
.me-layout-panel-item__label {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.me-layout-panel-item__vis {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--edit-faint);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s, background 0.12s;
}

.me-layout-panel-item__vis svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.me-layout-panel-item__vis:hover {
  color: var(--edit-text);
  background: rgba(255, 255, 255, 0.07);
}

.me-layout-panel-item__vis[aria-pressed="true"] {
  color: rgba(240, 230, 211, 0.68);
}

.me-layout-panel-item__vis--locked {
  color: rgba(255, 121, 183, 0.5);
  cursor: default;
}

.me-layout-panel-item__vis--locked:hover {
  background: none;
  color: rgba(255, 121, 183, 0.5);
}

/* --- Inspector --- */

.me-layout-inspector {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.75rem 0.8rem 1.2rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.me-layout-inspector::-webkit-scrollbar {
  width: 9px;
}

.me-layout-inspector::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.me-layout-inspector__empty {
  font-size: 0.78rem;
  color: var(--edit-faint);
  margin: 0.4rem 0 0;
  line-height: 1.55;
}

.me-layout-inspector__panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.me-layout-inspector__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.me-layout-inspector__panel-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--edit-text);
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.me-layout-inspector__kind {
  flex-shrink: 0;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--edit-faint);
  border: 1px solid var(--edit-line);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.me-layout-inspector__meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.22rem 0.7rem;
  font-size: 0.73rem;
  margin: 0;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--edit-line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.me-layout-inspector__meta dt {
  color: var(--edit-faint);
  font-weight: normal;
}

.me-layout-inspector__meta dd {
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.me-layout-inspector__locked {
  font-size: 0.72rem;
  color: var(--edit-faint);
  margin: 0;
  font-style: italic;
}

/* Visibility switch */

.me-layout-inspector__toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--edit-text);
  cursor: pointer;
  user-select: none;
}

.me-layout-inspector__visible-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.me-layout-inspector__toggle-track {
  flex-shrink: 0;
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--edit-line);
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.15s, border-color 0.15s;
}

.me-layout-inspector__toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--edit-faint);
  transition: transform 0.15s, background 0.15s;
}

.me-layout-inspector__visible-toggle:checked + .me-layout-inspector__toggle-track {
  background: rgba(126, 200, 227, 0.28);
  border-color: rgba(126, 200, 227, 0.5);
}

.me-layout-inspector__visible-toggle:checked + .me-layout-inspector__toggle-track::after {
  transform: translateX(14px);
  background: var(--edit-accent);
}

.me-layout-inspector__visible-toggle:focus-visible + .me-layout-inspector__toggle-track {
  outline: 2px solid rgba(126, 200, 227, 0.6);
  outline-offset: 2px;
}

/* --- Child (panel contents) editor --- */

.me-layout-child-editor {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--edit-line-soft);
}

.me-layout-child-editor__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.4rem;
  border: 1px solid var(--edit-line-soft);
  border-radius: 6px;
}

.me-layout-child-editor__row--selected {
  border-color: rgba(153, 255, 255, 0.34);
  background: rgba(153, 255, 255, 0.06);
}

.me-layout-child-editor__select {
  min-width: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  padding: 0;
  text-align: left;
}

.me-layout-child-editor__meta {
  color: var(--edit-faint);
  font-size: 0.65rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.me-layout-child-editor__hint {
  margin: 0.1rem 0 0;
  color: var(--edit-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

/* --- Style editor --- */

.me-layout-style-editor {
  display: grid;
  gap: 0.6rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--edit-line-soft);
}

.me-layout-style-editor__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
}

.me-layout-style-editor__title {
  margin: 0;
  color: var(--edit-muted);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.me-layout-style-editor__group {
  display: grid;
  gap: 0.45rem;
  padding: 0.55rem 0.55rem 0.6rem;
  border: 1px solid var(--edit-line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.me-layout-style-editor__reset {
  border: 1px solid var(--edit-line);
  border-radius: 5px;
  background: var(--edit-surface);
  color: var(--edit-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  padding: 0.22rem 0.5rem;
  transition: background 0.14s, color 0.14s;
}

.me-layout-style-editor__reset:hover {
  background: var(--edit-surface-hi);
  color: var(--edit-text);
}

.me-layout-style-editor__reset--danger {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-color: rgba(255, 80, 80, 0.26);
  background: rgba(255, 80, 80, 0.07);
  color: rgba(255, 170, 170, 0.9);
}

.me-layout-style-editor__reset--danger:hover {
  background: rgba(255, 80, 80, 0.16);
  color: rgba(255, 200, 200, 1);
}

.me-layout-style-control {
  display: grid;
  gap: 0.3rem;
  color: var(--edit-muted);
  font-size: 0.73rem;
  letter-spacing: 0.02em;
}

.me-layout-style-control--color {
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 0.5rem;
}

.me-layout-style-control--range .me-layout-style-control__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.me-layout-style-control input[type="color"] {
  width: 40px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.me-layout-style-control input[type="range"] {
  width: 100%;
  height: 16px;
  accent-color: var(--edit-accent);
  cursor: pointer;
}

.me-layout-style-control__text {
  width: 100%;
  min-height: 32px;
  box-sizing: border-box;
  border: 1px solid var(--edit-line);
  border-radius: 6px;
  background: rgba(7, 6, 18, 0.74);
  color: rgba(255, 255, 255, 0.86);
  font: inherit;
  font-size: 0.78rem;
  padding: 0 0.5rem;
}

.me-layout-style-control__text:focus {
  outline: none;
  border-color: rgba(126, 200, 227, 0.5);
}

.me-layout-style-control output {
  color: var(--edit-faint);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

/* --- Canvas viewport --- */

.me-layout-canvas-wrap {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--edit-line);
  border-radius: var(--edit-radius);
  padding: 18px;
  /* A faint dot field reads as "workspace" and makes the profile canvas itself
     legible as an object sitting on top of it. */
  background:
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 22px 22px,
    #08070f;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.55);
  display: grid;
  justify-content: safe center;
  align-content: safe center;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  /* clicking the wrap background triggers deselect */
  cursor: default;
}

.me-layout-canvas-wrap::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.me-layout-canvas-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* Sized to the *scaled* canvas so zooming out shrinks the scroll area
   instead of leaving a tall empty gutter under the layout. */
.me-layout-canvas-stage {
  position: relative;
}

.me-layout-canvas-stage > .profile-layout-grid {
  transform-origin: top left;
}

.me-layout-loading {
  color: var(--edit-faint);
  font-size: 0.85rem;
  padding: 2rem;
  text-align: center;
}

/* --- Narrower screens --- */

@media (max-width: 1320px) {
  .me-layout-shell {
    --edit-rail-w: 232px;
    --edit-inspector-w: 288px;
  }
}

@media (max-width: 1100px) {
  .me-layout-shell {
    height: auto;
    overflow: auto;
  }

  .me-layout-shell .arcade-shell {
    height: auto;
  }

  .me-layout-topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .me-layout-topbar__center,
  .me-layout-topbar__actions {
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .me-layout-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .me-layout-rail {
    max-height: 320px;
  }

  /* Stacked rails are wide and short, so rows flow into columns instead of
     stretching one name across the whole screen. */
  .me-layout-group__rows {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2px 8px;
  }

  .me-layout-canvas-wrap {
    min-height: 60vh;
  }
}


/* --- Profile Layout Grid --- */

.profile-layout-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: var(--profile-layout-row-height);
  gap: var(--profile-layout-gap);
  min-width: 640px;
  position: relative;
}

/* Real grid overlay: cells sit on the same CSS grid tracks as the panels. */
.profile-layout-grid__overlay-cells {
  display: contents;
}

.profile-layout-grid__overlay-cell {
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(126, 200, 227, 0.025) inset;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.profile-layout-grid--overlay .profile-layout-grid__overlay-cell {
  opacity: 1;
}

/* --- Panel Tiles (layout editor) --- */

.profile-layout-tile {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 220, 187, 0.06), transparent 28%),
    linear-gradient(var(--layout-tile-gradient-angle, 180deg), rgba(var(--layout-tile-custom-rgb, 21, 14, 55), var(--layout-tile-custom-opacity, 0)), rgba(var(--layout-tile-custom-rgb-2, 7, 7, 22), var(--layout-tile-custom-opacity, 0))),
    linear-gradient(var(--layout-tile-gradient-angle, 180deg), rgba(var(--layout-tile-base-rgb, 21, 14, 55), var(--layout-tile-base-opacity, 0.92)), rgba(var(--layout-tile-base-rgb-2, 7, 7, 22), var(--layout-tile-base-opacity, 0.92)));
  border: 1.5px solid rgba(255, 214, 189, 0.18);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}

.profile-layout-tile--edit {
  cursor: pointer;
}

.profile-layout-tile--edit:hover {
  border-color: rgba(126, 200, 227, 0.35);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(126, 200, 227, 0.1) inset;
}

.profile-layout-grid--has-selection .profile-layout-tile--edit:not(.profile-layout-tile--selected) {
  opacity: 0.55;
}

.profile-layout-grid--has-selection .profile-layout-tile--edit:not(.profile-layout-tile--selected):hover {
  opacity: 0.82;
}

.profile-layout-tile--selected {
  z-index: 6;
  border-color: rgba(126, 200, 227, 0.75) !important;
  box-shadow:
    0 0 0 2px rgba(126, 200, 227, 0.2),
    0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

.profile-layout-tile--selected .profile-layout-tile__label {
  color: rgba(126, 200, 227, 0.9);
}

.profile-layout-tile--live-preview {
  padding: 0;
  border-color: rgba(255, 214, 189, 0.18);
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.profile-layout-tile--live-preview:hover {
  box-shadow: none;
}

.profile-layout-tile__live-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  pointer-events: none;
}

.profile-layout-tile--live-preview .profile-layout-tile__drag-handle,
.profile-layout-tile--live-preview .profile-layout-tile__resize-handle,
.profile-layout-tile--live-preview .profile-layout-tile__size-badge {
  z-index: 4;
}

.profile-layout-tile--live-preview .profile-layout-tile__drag-handle,
.profile-layout-tile--live-preview .profile-layout-tile__resize-handle {
  color: rgba(255, 255, 255, 0.54);
  background: rgba(7, 6, 18, 0.42);
  backdrop-filter: blur(8px);
}

.profile-layout-tile--live-preview .profile-layout-tile__size-badge {
  padding: 0.12rem 0.28rem;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.48);
  background: rgba(7, 6, 18, 0.5);
}

.profile-layout-tile--child-editing .profile-layout-tile__drag-handle,
.profile-layout-tile--child-editing .profile-layout-tile__resize-handle,
.profile-layout-tile--child-editing .profile-layout-tile__size-badge {
  display: none;
}

.profile-layout-child-grid {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(var(--profile-child-columns, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--profile-child-rows, 5), minmax(0, 1fr));
  gap: 0;
  padding: 0;
  pointer-events: none;
}

.profile-layout-child-grid__cell {
  border: 1px solid rgba(153, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(153, 255, 255, 0.025);
}

.profile-layout-child-grid__slot {
  position: absolute;
  z-index: 2;
  min-width: 0;
  min-height: 0;
  border: 1.5px dashed rgba(153, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(153, 255, 255, 0.025);
  pointer-events: none;
}

.profile-layout-child-grid__slot--selected {
  border-color: rgba(255, 220, 187, 0.72);
  background: rgba(255, 220, 187, 0.04);
}

.profile-layout-child-grid__box {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0.25rem;
  border: 1.5px solid rgba(153, 255, 255, 0.46);
  border-radius: 8px;
  background: rgba(7, 6, 18, 0.36);
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  font: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.profile-layout-child-grid__label {
  pointer-events: none;
}

.profile-layout-child-grid__resize {
  position: absolute;
  right: 0.25rem;
  bottom: 0.25rem;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(7, 6, 18, 0.62);
  cursor: se-resize;
}

.profile-layout-child-grid__resize svg {
  width: 8px;
  height: 8px;
  pointer-events: none;
}

.profile-layout-child-grid__box--selected {
  border-color: rgba(255, 220, 187, 0.9);
  color: #fff8ff;
  box-shadow:
    0 0 0 2px rgba(255, 220, 187, 0.16),
    0 0 18px rgba(153, 255, 255, 0.16);
}

.profile-layout-tile--locked {
  border-color: rgba(255, 121, 183, 0.22);
  cursor: default;
}

.profile-layout-tile--locked:hover {
  border-color: rgba(255, 121, 183, 0.32);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.profile-layout-composition-element {
  position: absolute;
  z-index: 5;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  overflow: visible;
}

.profile-layout-composition-element--surface {
  z-index: 2;
}

.profile-layout-composition-element--portrait,
.profile-layout-composition-element--metrics,
.profile-layout-composition-element--title {
  z-index: 6;
}

.profile-layout-composition-element--edit {
  cursor: pointer;
}

.profile-layout-composition-element--edit:hover {
  outline: 1.5px solid rgba(126, 200, 227, 0.55);
  outline-offset: 2px;
}

.profile-layout-composition-element--selected {
  outline: 2px solid rgba(126, 200, 227, 0.9);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(126, 200, 227, 0.18);
}

.profile-layout-composition-element__drag-handle,
.profile-layout-composition-element__resize-handle {
  position: absolute;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 4px;
  background: rgba(7, 6, 18, 0.58);
  color: rgba(255, 255, 255, 0.62);
  padding: 0;
  backdrop-filter: blur(8px);
}

.profile-layout-composition-element__drag-handle {
  top: 0.25rem;
  left: 0.25rem;
  cursor: grab;
}

.profile-layout-composition-element__resize-handle {
  right: 0.25rem;
  bottom: 0.25rem;
  cursor: se-resize;
}

.profile-layout-composition-element__drag-handle svg {
  width: 8px;
  height: 12px;
  pointer-events: none;
}

.profile-layout-composition-element__resize-handle svg {
  width: 8px;
  height: 8px;
  pointer-events: none;
}

.profile-layout-composition-element--surface {
  border-radius: var(--profile-radius-lg, 22px);
  border: 2px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.24);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(var(--profile-panel-custom-rgb, 255, 220, 187), 0.12), transparent 28%),
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0))),
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-base-rgb, 21, 14, 55), var(--profile-panel-base-opacity, 0.96)), rgba(var(--profile-panel-base-rgb-2, 7, 7, 22), var(--profile-panel-base-opacity, 0.96)));
}

.profile-layout-composition-element .me-hero-card__portrait-panel,
.profile-layout-composition-element .me-hero-card__metrics-panel {
  position: relative;
  inset: auto;
  min-width: 0;
  min-height: 0;
}

.profile-layout-composition-element__scale-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  will-change: transform;
  pointer-events: none;
}

.profile-layout-composition-element__scale-stage--portrait {
  width: 176px;
}

.profile-layout-composition-element__scale-stage--metrics {
  width: 260px;
}

.profile-layout-composition-element__scale-stage--title {
  min-width: 180px;
}

.profile-layout-composition-element__scale-stage--text {
  width: 280px;
}

.profile-layout-composition-element__scale-stage--badges {
  width: 280px;
}

.profile-layout-composition-element__scale-stage--friend-code {
  width: 340px;
}

.profile-layout-composition-element__scale-stage--gallery-link {
  min-width: 180px;
}

.profile-layout-composition-element__scale-stage--identity-field {
  width: 300px;
}

.profile-layout-composition-element__scale-stage--player-action {
  width: 320px;
}

.profile-layout-composition-element__scale-stage--thoughts-composer {
  width: 360px;
}

.profile-layout-composition-element__scale-stage--text .me-about-copy-wrap {
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid rgba(255, 214, 189, 0.14);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
}

.profile-layout-composition-element__scale-stage--badges .me-badge-box {
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
}

.profile-layout-composition-element__scale-stage--text .me-about-copy {
  display: grid;
  place-items: center;
  min-height: 92px;
}

.profile-layout-composition-element__scale-stage--badges .me-badge-box {
  display: grid;
  place-items: center;
}

.profile-layout-composition-element__scale-stage--friend-code .friend-code-card {
  width: 100%;
  min-height: 190px;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
}

.profile-layout-composition-element__scale-stage--friend-code .friend-code-card__label,
.profile-layout-composition-element__scale-stage--friend-code .friend-code-form__label,
.profile-layout-composition-element__scale-stage--friend-code .friend-code-card__helper,
.profile-layout-composition-element__scale-stage--friend-code .friend-code-form__flash {
  color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.84);
}

.profile-layout-composition-element__scale-stage--friend-code .friend-code-form__input,
.profile-layout-composition-element__scale-stage--friend-code .friend-code-form__submit {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.28);
}

.profile-layout-composition-element--gallery-grid {
  display: grid;
  align-content: start;
  justify-items: stretch;
  overflow: hidden auto;
  padding: 10px 12px;
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
}

.profile-layout-composition-element--gallery-grid .gallery-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(3px, 1.3%, 8px);
  padding: clamp(4px, 1.8%, 10px);
  align-content: start;
  justify-content: start;
  box-sizing: border-box;
}

.profile-layout-composition-element--gallery-grid .gallery-item {
  min-width: 0;
  gap: 2px;
}

.profile-layout-composition-element--gallery-grid .gallery-item__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.profile-layout-composition-element--gallery-grid .gallery-item__counts {
  gap: 3px;
  padding: 2px 3px;
}

.profile-layout-composition-element--gallery-grid .gallery-item__count {
  font-size: clamp(0.42rem, 1.5cqw, 0.62rem);
}

.profile-layout-composition-element--gallery-grid .gallery-item__img-frame {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.24);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.08), rgba(0, 0, 0, 0.18)),
    rgba(9, 8, 22, 0.42);
}

.profile-layout-composition-element--gallery-grid .gallery-item__caption,
.profile-layout-composition-element--gallery-grid .me-panel__empty,
.profile-layout-composition-element--gallery-grid .player-panel__empty,
.profile-layout-composition-element__scale-stage--gallery-link .gallery-view-all {
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
}

.profile-layout-composition-element--gallery-grid .gallery-item__caption {
  font-size: clamp(0.42rem, 1.7cqw, 0.68rem);
  line-height: 1.15;
}

.profile-layout-composition-element--gallery-photo {
  display: grid;
  align-content: start;
  overflow: hidden;
  padding: 4px;
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.2)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.2))),
    rgba(9, 8, 22, 0.18);
}

.profile-layout-composition-element--gallery-photo .gallery-item {
  min-width: 0;
  gap: 2px;
}

.profile-layout-composition-element--gallery-photo .gallery-item__img-frame {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.24);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.08), rgba(0, 0, 0, 0.18)),
    rgba(9, 8, 22, 0.42);
}

.profile-layout-composition-element--gallery-photo .gallery-item__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.profile-layout-composition-element--gallery-photo .gallery-item__caption {
  color: rgba(var(--profile-panel-text-rgb, 255, 248, 255), 0.84);
  font-size: clamp(0.42rem, 1.8cqw, 0.68rem);
  line-height: 1.15;
}

.profile-layout-composition-element__scale-stage--identity-field .me-hero-card__identity-field,
.profile-layout-composition-element__scale-stage--identity-field .player-hero-card__identity-field,
.profile-layout-player-action-preview {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
}

.profile-layout-player-action-preview {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px 16px;
  color: rgba(var(--profile-panel-text-rgb, 255, 248, 255), 0.84);
  text-align: center;
  text-transform: uppercase;
}

.profile-layout-player-action-preview button {
  min-height: 34px;
  border: 1px solid rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.3);
  border-radius: var(--profile-radius-pill, 999px);
  background: rgba(9, 8, 22, 0.82);
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer,
.profile-layout-composition-element--thoughtsFeed .thoughts-feed {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
}

.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer {
  min-height: 210px;
}

.profile-layout-composition-element--thoughtsFeed {
  overflow: hidden;
}

.profile-layout-composition-element--thoughtsFeed .thoughts-feed {
  display: grid;
  align-content: start;
  gap: 12px;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  padding: 10px 12px;
}

.profile-layout-composition-element--thoughtsFeed .thought-card {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.28);
  background:
    linear-gradient(135deg, rgba(var(--profile-panel-button-rgb, 255, 197, 228), 0.1), transparent 30%),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 33, 14, 60), 0.92), rgba(var(--profile-panel-element-rgb, 10, 8, 26), 0.72)),
    rgba(10, 8, 26, 0.94);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.22);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__subject,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__body,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__field-input,
.profile-layout-composition-element--thoughtsFeed .thought-card__share-input {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.34);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 6, 4, 18), 0.24), rgba(0, 0, 0, 0.3)),
    rgba(var(--profile-panel-element-rgb, 6, 4, 18), 0.5);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__subject::placeholder,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__body::placeholder,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__field-input::placeholder,
.profile-layout-composition-element--thoughtsFeed .thought-card__share-input::placeholder {
  color: rgba(var(--profile-panel-text-rgb, 255, 247, 252), 0.5);
}

.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__submit,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__attach-label,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__photo-clear,
.profile-layout-composition-element--thoughtsFeed .thought-card__action,
.profile-layout-composition-element--thoughtsFeed .thought-card__share-button,
.profile-layout-composition-element--thoughtsFeed .thought-card__reaction-chip,
.profile-layout-composition-element--thoughtsFeed .thought-card__comment-dismiss {
  border-color: rgba(var(--profile-panel-button-rgb, 255, 197, 228), 0.42);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-button-rgb, 255, 197, 228), 0.18), rgba(var(--profile-panel-button-rgb, 255, 121, 183), 0.08)),
    rgba(9, 8, 22, 0.76);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__photo-card,
.profile-layout-composition-element--thoughtsFeed .thought-card__comment,
.profile-layout-composition-element--thoughtsFeed .thought-card__quoted-thought {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.24);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.08), rgba(0, 0, 0, 0.24)),
    rgba(var(--profile-panel-element-rgb, 10, 8, 26), 0.42);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-layout-composition-element--thoughtsFeed .thought-card__author,
.profile-layout-composition-element--thoughtsFeed .thought-card__meta,
.profile-layout-composition-element--thoughtsFeed .thought-card__topic-kicker,
.profile-layout-composition-element--thoughtsFeed .thought-card__reactions,
.profile-layout-composition-element--thoughtsFeed .thought-card__share-label,
.profile-layout-composition-element--thoughtsFeed .thought-card__quoted-kicker,
.profile-layout-composition-element--thoughtsFeed .thought-card__quoted-author,
.profile-layout-composition-element--thoughtsFeed .thought-card__quoted-date,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__photo-name,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__field-label,
.profile-layout-composition-element__scale-stage--thoughts-composer .thought-composer__toggle-copy {
  color: rgba(var(--profile-panel-text-rgb, 255, 247, 252), 0.88);
}

.profile-layout-composition-element--thoughtsFeed .thought-card__summary,
.profile-layout-composition-element--thoughtsFeed .thought-card__date,
.profile-layout-composition-element--thoughtsFeed .thought-card__comment-body,
.profile-layout-composition-element--thoughtsFeed .thought-card__comment-empty,
.profile-layout-composition-element--thoughtsFeed .thought-card__quoted-summary {
  color: rgba(var(--profile-panel-text-rgb, 255, 247, 252), 0.82);
}

.profile-layout-composition-element__scale-stage .me-hero-card__portrait-panel,
.profile-layout-composition-element__scale-stage .me-hero-card__metrics-panel {
  width: 100%;
  height: auto;
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 7, 6, 20), 0.16)),
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0))),
    linear-gradient(180deg, rgba(var(--profile-panel-custom-rgb, 21, 14, 55), 0.08), rgba(11, 8, 28, 0.94) 34%, rgba(7, 6, 20, 0.98)),
    rgba(9, 8, 22, 0.94);
}

.profile-layout-composition-element__scale-stage .me-hero-card__portrait {
  width: 100%;
}

.profile-layout-composition-element__scale-stage .me-hero-card__metrics-panel {
  align-content: center;
  padding: 12px;
}

.profile-layout-composition-element__scale-stage .me-hero-card__metrics-grid {
  width: 100%;
  min-width: 0;
  gap: 8px;
}

.profile-layout-composition-element__scale-stage .me-hero-card__metrics-stat {
  min-width: 0;
  min-height: 0;
}

.profile-layout-composition-element .me-panel__title {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.profile-layout-tile__label {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  color: var(--layout-tile-label-color, rgba(255, 255, 255, 0.5));
  line-height: 1.2;
  pointer-events: none;
}

.profile-layout-tile__size-badge {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* --- Drag handle --- */

.profile-layout-tile__drag-handle {
  position: absolute;
  top: 0.35rem;
  left: 0.4rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.25);
  cursor: grab;
  padding: 0;
  transition: color 0.12s, background 0.12s;
  z-index: 1;
}

.profile-layout-tile__drag-handle:hover {
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.07);
}

.profile-layout-tile__drag-handle:active {
  cursor: grabbing;
}

.profile-layout-tile__drag-handle svg {
  width: 8px;
  height: 12px;
  pointer-events: none;
  flex-shrink: 0;
}

/* --- Resize handle (bottom-right corner) --- */

.profile-layout-tile__resize-handle {
  position: absolute;
  bottom: 0.3rem;
  right: 0.35rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.22);
  cursor: se-resize;
  padding: 0;
  transition: color 0.12s, background 0.12s;
  z-index: 1;
}

.profile-layout-tile__resize-handle:hover {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.07);
}

.profile-layout-tile__resize-handle svg {
  width: 8px;
  height: 8px;
  pointer-events: none;
  flex-shrink: 0;
}

.profile-layout-tile__resize-handle--height-only {
  cursor: s-resize;
  right: 50%;
  bottom: 0.3rem;
  transform: translateX(50%);
}

/* --- Dragging tile (source stays, dimmed) --- */

.profile-layout-tile--dragging {
  opacity: 0.3;
  pointer-events: none;
}

/* --- Resizing tile (source stays, dimmed) --- */

.profile-layout-tile--resizing {
  opacity: 0.3;
  pointer-events: none;
}

.profile-layout-composition-element,
.profile-layout-composition-element .me-panel,
.profile-layout-composition-element .player-panel,
.profile-layout-composition-element .me-about-copy,
.profile-layout-composition-element .player-about-copy,
.profile-layout-composition-element .me-badge-empty,
.profile-layout-composition-element .player-badge-empty,
.profile-layout-composition-element .me-badge-chip,
.profile-layout-composition-element .player-badge-chip,
.profile-layout-composition-element .me-card-item__value,
.profile-layout-composition-element .player-card-item__value,
.profile-layout-composition-element .me-card-item__link,
.profile-layout-composition-element .player-card-item__link,
.profile-layout-composition-element .me-link__url,
.profile-layout-composition-element .player-link__url,
.profile-layout-composition-element .me-panel__title,
.profile-layout-composition-element .player-panel__title,
.profile-layout-composition-element .gallery-panel__title {
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
}

.profile-layout-composition-element .me-card-item__title,
.profile-layout-composition-element .player-card-item__title {
  color: rgba(var(--profile-panel-text-rgb, 255, 215, 185), 0.88);
}

.profile-layout-composition-element .me-card-item__meta,
.profile-layout-composition-element .player-card-item__meta {
  color: rgba(var(--profile-panel-text-rgb, 255, 248, 255), 0.68);
}

/* --- Ghost panel (drop target preview) --- */

.profile-layout-ghost {
  border-radius: 10px;
  border: 2px dashed rgba(126, 200, 227, 0.55);
  background: rgba(126, 200, 227, 0.07);
  pointer-events: none;
  transition: border-color 0.1s, background 0.1s;
  z-index: 3;
}

.profile-layout-ghost--invalid {
  border-color: rgba(255, 80, 80, 0.55);
  background: rgba(255, 80, 80, 0.07);
}

.profile-layout-ghost--swap {
  border-color: rgba(255, 180, 50, 0.7);
  background: rgba(255, 180, 50, 0.09);
}

/* --- Mobile stacked --- */

@media (max-width: 899px) {
  .me-layout-canvas-wrap {
    width: 100%;
    padding: 10px;
  }

  .profile-layout-grid {
    min-width: unset;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .profile-layout-grid__overlay-cell {
    display: none;
  }

  .profile-layout-tile {
    width: 100%;
    min-height: 72px;
  }
}

@media (max-width: 600px) {
  .me-layout-stage {
    padding: 0 0.6rem 1.5rem;
  }
}

/* ---------- MOBILE: EDITOR UNAVAILABLE NOTICE ----------
   The editor canvas mirrors the live desktop page width and is drag-driven, so it
   has no mobile model. layout-wire.mjs replaces the whole workspace with this
   notice on coarse-pointer phones. */

.me-layout-blocked {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(100%, 560px);
  margin: 10vh auto 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--profile-radius-lg, 22px);
  background: var(--panel-strong);
  box-shadow: 0 24px 60px var(--shadow);
  text-align: center;
}

.me-layout-blocked__title {
  margin: 0;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.me-layout-blocked__copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.me-layout-blocked__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.me-layout-blocked__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--profile-radius-sm, 12px);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.me-layout-blocked__action--primary {
  border-color: rgba(255, 184, 77, 0.55);
  background: rgba(255, 184, 77, 0.14);
}
