/* Layout (2026-11-10): full-height side menu for pages with sub-sections, and a right column per page.
   Loaded last. While the side menu is open, the main sidebar folds to an icon rail, so the content keeps its width. */

/* ---------- Shell with side menu ---------- */
.app-shell.has-subnav { grid-template-columns: 72px 248px minmax(0, 1fr) 300px; gap: 24px; max-width: 1560px; }
@media (max-width: 1250px) { .app-shell.has-subnav { grid-template-columns: 72px 224px minmax(0, 1fr); gap: 20px; } }

/* Folded main sidebar: icons only, the label shows as a tooltip. */
/* Both .side and .subnav are sticky (own stacking contexts); lift the rail so its tooltips paint over the side menu. */
.has-subnav .side { padding-right: 0; align-items: center; z-index: 25; }
.has-subnav .brand { margin: 10px 0 24px; justify-content: center; }
.has-subnav .brand-name, .has-subnav .side-foot, .has-subnav .nav-text, .has-subnav .small-profile > span:not(.avatar), .has-subnav .small-profile .chevron { display: none; }
.has-subnav .nav { width: 100%; align-items: center; overflow: visible; }
.has-subnav .nav-group { justify-items: center; width: 100%; }
.has-subnav .nav-section { font-size: 0; padding: 0; width: 28px; height: 1px; background: var(--hairline); margin: 2px 0 6px; }
.has-subnav .nav-group:first-child .nav-section { display: none; }
.has-subnav .nav-item { position: relative; width: 48px; min-height: 48px; padding: 0; justify-content: center; gap: 0; border-radius: 16px; }
.has-subnav .nav-item.active { background: var(--accent-soft); }
.has-subnav .nav-item .nav-hint { position: absolute; top: 6px; right: 5px; min-width: 9px; height: 9px; padding: 0; font-size: 0; border-radius: 99px; box-shadow: 0 0 0 2px var(--bg); }
.has-subnav .nav-item[data-tip]::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-4px, -50%); opacity: 0; pointer-events: none;
  padding: 6px 10px; border-radius: 10px; background: #2f2834; color: var(--ink); font-size: 13px; font-weight: 650; white-space: nowrap;
  box-shadow: 0 8px 24px #0007; transition: opacity .14s var(--ease), transform .14s var(--ease); z-index: 30;
}
.has-subnav .nav-item:hover::after, .has-subnav .nav-item:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.has-subnav .small-profile { padding: 4px; justify-content: center; }
.has-subnav .side-bottom { width: 100%; display: grid; justify-items: center; }

/* ---------- The side menu itself ---------- */
.subnav {
  position: sticky; top: 12px; align-self: start; height: calc(100vh - 24px); margin-top: -4px;
  display: flex; flex-direction: column; min-width: 0;
  background: linear-gradient(180deg, #211b25, var(--surface) 38%); border-radius: 22px;
  box-shadow: inset 0 0 0 1px var(--hairline);
  padding: 22px 12px 12px; overflow: hidden;
}
.subnav-head { padding: 0 10px 18px; }
.subnav-kicker { display: block; font-size: 12px; font-weight: 600; color: var(--subtle); }
.subnav-head h2 { margin: 4px 0 6px; font: 750 22px/1.15 var(--font-display); letter-spacing: -.02em; color: var(--ink); }
.subnav-head p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.subnav-list { display: grid; align-content: start; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.subnav-list::-webkit-scrollbar { display: none; }
.subnav-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 12px 8px 10px;
  border: 0; border-radius: 14px; background: transparent; color: var(--muted); text-align: left; cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.subnav-item:hover { background: var(--surface-hover); color: var(--ink); }
.subnav-item.active { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px #ff9e5733; }
.subnav-item.active::before { content: ''; position: absolute; left: -2px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--accent); }
.subnav-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #ffffff08; color: inherit; }
.subnav-item.active .subnav-icon { background: var(--accent-soft); color: var(--accent); }
.subnav-text { display: grid; min-width: 0; flex: 1; }
.subnav-text b { font-size: 14px; font-weight: 650; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subnav-text small { font-size: 11.5px; line-height: 1.3; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subnav-item.active .subnav-text small { color: var(--muted); }
.subnav-item .studio2-dot, .subnav-badge { position: static; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.subnav-badge.is-ready { background: var(--live); box-shadow: 0 0 0 3px #5fd99a22; }
.subnav-foot { display: grid; gap: 8px; margin-top: 10px; padding: 12px; border-radius: 16px; background: #ffffff06; }
.subnav-balance { display: flex; align-items: center; gap: 8px; }
.subnav-balance b { font-size: 18px; font-weight: 750; color: var(--ink); }
.subnav-balance small { margin-left: auto; font-size: 12px; color: var(--subtle); }
.subnav-pending { font-size: 12px; font-weight: 700; color: var(--accent); }
.subnav-foot-link { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; color: var(--accent); font: 650 13px var(--font); cursor: pointer; text-align: left; }
.subnav-foot-link.is-quiet { color: var(--muted); }
.subnav-foot-link:hover { color: var(--ink); }
.subnav-claim { width: 100%; min-height: 38px; font-size: 13px; }

/* The page's own tabs give way to the side menu on larger screens. */
@media (min-width: 731px) {
  .has-subnav .studio2-tabs, .has-subnav .settings-tabs { display: none; }
  .has-subnav .studio2-body { padding-top: 0; }
  .has-subnav .settings-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 731px) and (max-width: 1180px) { .has-subnav .studio2-body { padding-top: 12px; } }

/* Phones: no side columns. The shop shows its sections as a sticky chip strip; studio and settings use their own tabs. */
.subnav-strip { display: none; }
@media (max-width: 730px) {
  .subnav { display: none; }
  .subnav-strip { display: flex; gap: 6px; position: sticky; top: 0; z-index: 12; margin: 0 -16px 14px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; background: #120e14f0; backdrop-filter: blur(10px); }
  .subnav-strip::-webkit-scrollbar { display: none; }
  .subnav-strip button { flex: none; border: 0; border-radius: 999px; min-height: 36px; padding: 6px 14px; background: var(--surface); color: var(--muted); font: 650 13px var(--font); white-space: nowrap; }
  .subnav-strip button.active { background: var(--ink); color: #1d1720; }
}

/* Studio tabs on phones and tablets: one scrolling row instead of two wrapped rows. */
.studio2-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.studio2-tabs::-webkit-scrollbar { display: none; }
.studio2-tabs button { flex: 1 0 auto; }

/* ---------- Right column cards ---------- */
.rail-card { padding: 16px; }
.rail-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rail-card-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.rail-count { font-style: normal; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: var(--on-accent); }
.rail-lede { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rail-sub { margin: 10px 0 0; font-size: 12px; line-height: 1.4; color: var(--subtle); }
.rail-meta { display: flex; align-items: center; gap: 8px; margin: 4px 4px 14px; font-size: 12px; color: var(--subtle); }
.rail-live { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px #5fd99a26; flex: none; }
.rail-wide { width: 100%; }
.rail-bar { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.rail-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff7a3d, var(--accent)); transition: width .4s var(--ease); }
.rail-chip { flex: none; margin-left: auto; border: 0; border-radius: 999px; padding: 6px 12px; min-height: 30px; background: var(--surface-2); color: var(--ink); font: 700 12px var(--font); cursor: pointer; transition: background-color .16s var(--ease); }
.rail-chip:hover { background: var(--surface-hover); }
.rail-chip.is-accent { background: var(--accent-soft); color: var(--accent); }
.rail-chip.is-accent:hover { background: #ff9e5733; }
.rail-row-actions { margin-left: auto; display: flex; gap: 4px; }
.rail-card .person-row { gap: 10px; padding: 7px 0; }
.rail-card .person-row > div { min-width: 0; }
.rail-card .person-row strong, .rail-card .person-row small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-actions { display: flex; gap: 8px; margin-top: 12px; }
.rail-actions .btn { flex: 1 1 0; min-width: 0; padding-inline: 10px; font-size: 13px; }
.rail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rail-tags span { font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink); }

/* Wallet */
.rail-wallet-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rail-wallet-top span { font-size: 13px; font-weight: 650; color: var(--muted); }
.rail-wallet-top strong { display: flex; align-items: center; gap: 6px; font: 750 24px var(--font-display); color: var(--ink); }
.rail-earn { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.rail-earn li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; color: var(--ink); border-top: 1px solid var(--hairline); }
.rail-earn li:first-child { border-top: 0; }
.rail-earn b { font-size: 12px; color: var(--subtle); font-weight: 700; }
.rail-earn em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); display: inline-flex; align-items: center; gap: 3px; }
.rail-earn li.is-done span { color: var(--subtle); text-decoration: line-through; text-decoration-color: #998c9766; }
.rail-earn li.is-done em { color: var(--subtle); }

/* Shop novelties, pins */
.rail-item, .rail-pin { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hairline); }
.rail-lede + .rail-item, .rail-lede + .rail-pin, .rail-pin:first-child { border-top: 0; }
.rail-item > div, .rail-pin > div { min-width: 0; flex: 1; }
.rail-item strong, .rail-pin strong { display: block; font-size: 13px; line-height: 1.3; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item small, .rail-pin small { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--subtle); }
.rail-item-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.rail-pin .avatar { width: 34px !important; height: 34px !important; flex: none; }
.rail-heat { color: color-mix(in oklab, var(--accent) calc(var(--heat, 1) * 100%), var(--ash)) !important; font-weight: 650; }
.rail-pin.is-mine { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 0; }

/* Profile check */
.rail-checks { margin: 10px 0 0; display: grid; gap: 2px; }
.rail-check { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 10px; font: 600 13px var(--font); color: var(--ink); }
.rail-check i { font-style: normal; width: 16px; text-align: center; color: var(--accent); }
.rail-check.is-done { color: var(--subtle); font-weight: 500; }
.rail-check.is-done i { color: var(--live); }
button.rail-check { border: 0; background: none; text-align: left; cursor: pointer; }
button.rail-check:hover { background: var(--surface-2); }
.rail-check em { margin-left: auto; font-style: normal; color: var(--subtle); }
.rail-vis { justify-content: space-between; }
.rail-vis b { color: var(--ink); }

/* Pinwall: what is asked for right now, as filters */
.rail-filters { display: grid; gap: 4px; }
.rail-filters button { display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 10px; padding: 9px 10px; background: var(--surface-2); color: var(--ink); font: 650 13px var(--font); cursor: pointer; transition: background-color .16s var(--ease); }
.rail-filters button:hover { background: var(--surface-hover); }
.rail-filters b { font-size: 12px; color: var(--accent); }
.rail-find { margin-bottom: 15px; }

/* Side menu pages: the title is in the menu, so the top bar drops the crumb and keeps the search compact. */
@media (min-width: 731px) {
  .has-subnav .topbar .crumb { display: none; }
  .has-subnav .topbar .search { min-width: 0; flex: 1 1 220px; max-width: 360px; }
}

/* Studio inside a narrow main column (side menu + right column on laptops): the same one-column layout as on tablets,
   decided by the space the studio really has instead of the window width. */
.studio2 { container: studio / inline-size; }
@container studio (max-width: 660px) {
  .studio2-grid { grid-template-columns: 1fr; }
  .studio2-side { display: contents; }
  .studio2-sticky { order: 0; position: sticky; top: 0; z-index: 9; padding: 6px 0 10px; background: linear-gradient(var(--bg) 88%, #120e1400); grid-template-columns: minmax(0, 1.25fr) minmax(200px, 1fr); align-items: end; }
  .studio2-panel { order: 1; }
  .studio2-loadout { order: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .studio2-loadout .control-label, .studio2-motion { grid-column: 1 / -1; }
  .studio2-slot { grid-template-columns: minmax(0, 1fr) auto; row-gap: 1px; background: #29222d; }
  .studio2-slot span { grid-column: 1 / -1; }
  .studio2-stage .studio-banner { height: 110px; }
}
@container studio (max-width: 480px) {
  .studio2-sticky { grid-template-columns: minmax(0, 1fr); }
}

/* Studio save bar: the main button may wrap onto two lines rather than grow out of its column. */
.studio2-actions .btn.studio2-main { display: flex; flex-wrap: wrap; width: 100%; max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; row-gap: 2px; }
.studio2-actions .studio2-actions-head { flex-wrap: wrap; row-gap: 2px; }
.studio2-actions .studio2-actions-head .studio2-status { white-space: normal; }
.studio2-actions .btn.studio2-main { gap: 4px 10px; align-items: center; }
.studio2-price { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 6px; border-radius: 99px; background: #1d0e0526; white-space: nowrap; font-weight: 800; }
.rail-card .person-row .rail-chip, .rail-card .rail-row-actions .rail-chip { margin-left: auto; font-size: 12px; color: var(--ink); background: var(--surface-2); }
.rail-card .person-row .rail-chip.is-accent { color: var(--accent); background: var(--accent-soft); }
