.rail {
  position: fixed;
  top: 50%;
  width: 76px;
  height: 100vh;
  padding: 12px 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 0px;
  background: rgba(9,18,22,.72);
  box-shadow: 0 18px 60px rgba(0,0,0,.3);
  backdrop-filter: blur(15px);
  transform: translateY(-50%);
  justify-content: flex-start;
  align-items: stretch;
  gap: 8px;
  overflow: hidden;
  transition: width 280ms cubic-bezier(.2,.8,.2,1), background 280ms ease;
}

.rail:hover,
.rail:focus-within { width: 228px; background: rgba(9,18,22,.88); }

.rail-brand {
  flex: 0 0 76px;
  display: grid;
  place-items: center;
  margin: -8px -4px 4px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.rail-brand img { display: block; width: 54px; height: 54px; object-fit: contain; }
.rail-brand b { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.45); font: 24px Georgia, serif; }
.rail-menu { display: grid; align-content: center; gap: 6px; flex: 1; }

.rail button {
  flex: none;
  width: 210px;
  height: 58px;
  min-height: 58px;
  padding: 0 17px;
  border: 0;
  border-left: 0;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.035);
  text-align: left;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.rail button:hover,
.rail button:focus-visible,
.rail button.active { color: #fff; background: rgba(255,255,255,.13); border-left: 0; transform: translateX(2px); }
.rail button:focus-visible { outline: 2px solid var(--brand-focus, #27a8c5); outline-offset: -2px; }
.rail button svg { display: none; }
.rail button::before { content: ""; flex: 0 0 24px; width: 24px; height: 24px; background: center/contain no-repeat; filter: invert(1); opacity: .72; transition: opacity 160ms ease, transform 220ms ease; }
.rail-menu button:nth-child(1)::before { background-image: url('../project-icon/159.svg'); }
.rail-menu button:nth-child(2)::before { background-image: url('../project-icon/248.svg'); }
.rail-menu button:nth-child(3)::before { background-image: url('../project-icon/203.svg'); }
.rail-menu button:nth-child(4)::before { background-image: url('../project-icon/15.svg'); }
.rail-actions { flex: none; display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.rail-actions small { padding: 0 18px 2px; color: rgba(255,255,255,.48); font-size: 8px; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; opacity: 0; transition: opacity 160ms ease; }
.rail:hover .rail-actions small,.rail:focus-within .rail-actions small { opacity: 1; }
.rail-actions button:first-of-type::before { background-image: url('../project-icon/200.svg'); }
.rail-actions button:last-of-type::before { background-image: url('../project-icon/211.svg'); }
.rail-sound::before { background-image: url('../project-icon/53.svg'); }
.rail button:hover::before,.rail button:focus-visible::before,.rail button.active::before { opacity: 1; transform: scale(1.06); }
.rail button span { opacity: 0; white-space: nowrap; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; transform: translateX(-8px); transition: opacity 160ms ease 50ms, transform 220ms ease; }
.rail:hover button span,.rail:focus-within button span { opacity: 1; transform: none; }
.rail-sound { position: relative; margin-top: auto; }
.rail-sound.is-muted::before { opacity: .42; }
.rail-sound.is-muted::after { content: ""; position: absolute; left: 19px; width: 26px; height: 1px; background: currentColor; transform: rotate(-45deg); transform-origin: center; }

@media (max-width: 760px) {
  .rail { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; height: 62px; padding: 5px; border-radius: 24px; transform: none; flex-direction: row; }
  .rail:hover,.rail:focus-within { width: auto; }
  .rail-brand { display: none; }
  .rail-menu { display: flex; flex: 4; gap: 2px; }
  .rail-actions { display: flex; flex: 2; gap: 2px; padding: 0; border: 0; }
  .rail-actions small { display: none; }
  .rail button { width: auto; height: 50px; min-height: 50px; flex: 1; padding: 0; justify-content: center; border-radius: 17px; transform: none !important; }
  .rail button span { display: none; }
  .rail-sound { margin: 0; flex: 0 0 50px !important; }
}
