body {
  --rail-width: 216px;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
}
body[data-sidebar=compact] { --rail-width: 74px; }
.site-rail {
  position: sticky; top: 0; height: 100dvh;
  grid-row: 1 / 4; grid-column: 1;
  display: grid; grid-template-rows: auto 1fr; align-content: start; min-width: 0;
  background: #141820; border-right: 1px solid #333948; z-index: 3;
}
.rail-top { min-height: 71px; display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 9px 10px; border-bottom: 1px solid #303644; }
.rail-top .rail-brand { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 1.46rem; letter-spacing: -.05em; }
.rail-top .rail-mark {
  width: 31px; height: 31px; display: grid; place-items: center; flex: none;
  background: #d5fa83; color: #171d14; box-shadow: 2px 2px #708653;
}
.rail-top .rail-word { color: #f6edf5; }
.rail-collapse { flex: none; padding: 0; min-width: 32px; min-height: 35px; }
.rail-nav { display: grid; align-content: start; gap: 5px; padding: 15px 9px; }
.rail-nav a {
  position: relative;
  min-height: 45px; display: flex; align-items: center; padding: 6px 9px; gap: 10px;
  border: 1px solid transparent; color: #cac8d7; text-decoration: none; font-size: .91rem; font-weight: 630;
  white-space: nowrap;
}
.rail-nav a:hover { color: var(--ink); background: #252b37; }
.rail-nav a[aria-current=page] { color: var(--lime); background: #252f29; border-color: #576b54; }
.rail-nav a[aria-current=page]::before {
  content: ""; position: absolute; inset: 3px auto 3px -1px; width: 3px; background: var(--lime);
}
.nav-mobile { display:none; }
.nav-icon { display: block; width: 18px; height: 18px; flex: none; background: currentColor; clip-path: var(--shape); }
.icon-lobby { --shape: polygon(6% 13%, 94% 13%, 94% 70%, 37% 70%, 37% 82%, 18% 95%, 18% 70%, 6% 70%); }
.icon-play { --shape: polygon(21% 9%, 37% 9%, 37% 19%, 53% 19%, 53% 30%, 69% 30%, 69% 40%, 83% 40%, 83% 59%, 69% 59%, 69% 70%, 53% 70%, 53% 80%, 37% 80%, 37% 91%, 21% 91%); }
.icon-rooms { --shape: polygon(6% 7%, 94% 7%, 94% 90%, 6% 90%, 6% 20%, 18% 20%, 18% 78%, 81% 78%, 81% 20%, 6% 20%, 6% 7%, 43% 7%, 43% 90%, 57% 90%, 57% 7%); }
.icon-home { --shape: polygon(5% 42%, 45% 9%, 55% 9%, 95% 42%, 95% 55%, 83% 55%, 83% 92%, 60% 92%, 60% 64%, 40% 64%, 40% 92%, 17% 92%, 17% 55%, 5% 55%); }
.icon-people { --shape: polygon(12% 7%, 47% 7%, 47% 40%, 12% 40%, 12% 7%, 57% 17%, 83% 17%, 83% 45%, 57% 45%, 57% 17%, 48% 77%, 48% 92%, 5% 92%, 5% 55%, 13% 55%, 13% 49%, 45% 49%, 45% 56%, 55% 56%, 55% 92%, 94% 92%, 94% 59%, 87% 59%, 87% 52%, 64% 52%, 64% 60%, 55% 60%, 55% 92%); }
.icon-download { --shape: polygon(44% 6%, 56% 6%, 56% 53%, 68% 42%, 77% 51%, 50% 77%, 23% 51%, 32% 42%, 44% 53%, 44% 6%, 5% 66%, 17% 66%, 17% 83%, 83% 83%, 83% 66%, 95% 66%, 95% 94%, 5% 94%, 5% 66%); }
.icon-split { --shape: polygon(10% 14%,90% 14%,90% 86%,10% 86%,10% 26%,21% 26%,21% 74%,79% 74%,79% 26%,10% 26%,10% 14%,36% 14%,36% 86%,47% 86%,47% 14%); }
.nav-count { margin-left: auto; background: var(--pink); color: #231522; padding: 1px 4px; min-width: 21px; text-align: center; font-size: .76rem; }
body[data-sidebar=compact] .rail-top { flex-direction: column; justify-content: center; padding-block: 10px; }
body[data-sidebar=compact] .rail-word, body[data-sidebar=compact] .nav-desktop { display: none; }
body[data-sidebar=compact] .rail-nav a { justify-content: center; padding-inline: 0; }
body[data-sidebar=compact] .nav-count { position: absolute; top: 1px; right: 1px; }

.workspace-bar { grid-column: 2; grid-row: 1; border-bottom: 1px solid #323845; background: #141821; }
.workspace-header { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 11px; }
.workspace-header h1 { font-size: clamp(1.55rem,3vw,2.25rem); line-height: .98; }
.workspace-header h1:focus { outline: none; }
.workspace-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.workspace-main { grid-column: 2; grid-row: 2; padding-block: 17px 28px; min-width: 0; }
.workspace-view { max-width: 1370px; margin-inline: auto; }
.site-footer { grid-column: 2; grid-row: 3; min-height: 66px; margin-top: 0; justify-content: flex-end; }
.screen-box {
  border: 1px solid var(--line); background: var(--sheet); padding: clamp(13px,3vw,26px);
  display: grid; justify-items: start; align-content: start; gap: 10px; min-height: 170px;
}
.screen-box p { color: var(--soft); max-width: 45ch; }
.screen-box .section-title { margin-bottom: 0; }

.context-title { font-size: 1.52rem; line-height: 1.1; padding: 2px 0 8px; }
.room-layout, .community-layout { align-items: start; }
.room-layout:has(.session-context:not([open])) { grid-template-columns: minmax(0,1fr) auto; }
.file-list { border: 1px solid var(--line); background: var(--sheet); }
.file-list > p { padding: 13px; color: var(--soft); }
.file-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px; }
.file-row + .file-row { border-top: 1px solid var(--line); }
.file-mark { width: 44px; height: 44px; display: grid; place-items: center; background: var(--inset); color: var(--violet); }
.file-mark img { width: 100%; height: 100%; object-fit: cover; }
.file-copy { overflow-wrap: anywhere; }
.file-copy h2 { font-size: 1rem; }
.file-copy p { margin-top: 4px; color: var(--soft); font-size: .875rem; }
@media (max-width: 820px) {
  body, body[data-sidebar=compact] { display: block; padding-bottom: calc(61px + env(safe-area-inset-bottom)); }
  .site-rail {
    position: fixed; inset: auto 0 0; height: auto; width: 100%;
    display: block; border-right: 0; border-top: 1px solid #51614b;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .rail-top { display: none; }
  .rail-nav { grid-template-columns: repeat(6,minmax(0,1fr)); padding:4px 2px; gap: 1px; }
  .rail-nav a, body[data-sidebar=compact] .rail-nav a { min-height: 51px; flex-direction:column; justify-content:center; gap: 4px; padding:4px 0; }
  .rail-nav a[aria-current=page]::before { inset: auto 8px 0; height: 2px; width: auto; }
  .rail-nav .nav-icon { width: 16px; height: 16px; }
  .nav-desktop { display: none; }
  .nav-mobile { display: inline; font-size: clamp(.56rem,2.55vw,.72rem); }
  .nav-count { position:absolute; top: 0; right: 1px; min-width: 15px; font-size: .65rem; }
  .workspace-header { min-height: 61px; }
  .workspace-main { padding-block: 12px 15px; }
  .workspace-actions .button { min-height: 40px; font-size: .78rem; padding-inline: 6px; }
}
@media (max-width: 485px) {
  .workspace-header { align-items: center; }
  .workspace-header h1 { font-size: 1.48rem; }
  .resume-link { white-space: nowrap; }
  .file-row { gap: 8px; }
}
