html[data-rail-state="labeled"] { --rail-w: 244px; }
html[data-rail-state="icons"],
html[data-rail-state="tab"] { --rail-w: 66px; }
html[data-rail-state],
html[data-rail-peek] {
  --gutter: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (min-width: 900px) {
  html[data-rail="labeled"] .site-hop-zone,
  html[data-rail="icons"] .site-hop-zone { display: none; }

  html[data-rail-dock="labeled"] .section-nav,
  html[data-rail-dock="icons"] .section-nav {
    top: auto;
    bottom: 14px;
    left: 50%;
    grid-auto-flow: column;
    transform: translateX(-50%);
  }
  html[data-rail-dock="labeled"] .section-nav a,
  html[data-rail-dock="labeled"] .section-nav a:hover,
  html[data-rail-dock="labeled"] .section-nav a:focus-visible,
  html[data-rail-dock="labeled"] .section-nav:hover a:not(.disabled),
  html[data-rail-dock="labeled"] .section-nav:focus-within a:not(.disabled),
  html[data-rail-dock="icons"] .section-nav a,
  html[data-rail-dock="icons"] .section-nav a:hover,
  html[data-rail-dock="icons"] .section-nav a:focus-visible,
  html[data-rail-dock="icons"] .section-nav:hover a:not(.disabled),
  html[data-rail-dock="icons"] .section-nav:focus-within a:not(.disabled) { width: 38px; }
}

.poka-rail {
  position: fixed;
  z-index: 45;
  left: var(--gutter, 20px);
  top: var(--gutter, 20px);
  bottom: var(--gutter, 20px);
  width: var(--rail-w, 244px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border: 2px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: width .32s var(--ease), transform .24s var(--ease), box-shadow .2s, visibility 0s;
}
html[data-rail="hide"]:not([data-rail-peek]) .poka-rail { display: none; }

html[data-rail-state="tab"] .poka-rail {
  transform: translateX(calc(-100% - var(--gutter) - 12px));
  visibility: hidden;
  transition: width .32s var(--ease), transform .24s var(--ease), box-shadow .2s, visibility 0s .24s;
}
html:not([data-rail-page="home"]) .poka-rail { z-index: 65; box-shadow: 5px 6px 0 var(--ink), 0 18px 44px rgba(0, 0, 0, .2); }
html[data-rail-page="home"] .poka-rail { z-index: 4; }
html[data-rail-peek] .poka-rail { z-index: 65; box-shadow: 5px 6px 0 var(--ink), 0 18px 44px rgba(0, 0, 0, .2); animation: poka-rail-peek-in .24s var(--ease, ease) both; }
html[data-rail-peek="leaving"] .poka-rail { pointer-events: none; animation: poka-rail-peek-out .24s var(--ease, ease) both; }
@keyframes poka-rail-peek-in { from { transform: translateX(calc(-100% - var(--gutter, 20px) - 12px)); } }
@keyframes poka-rail-peek-out { to { transform: translateX(calc(-100% - var(--gutter, 20px) - 12px)); } }
body.game-is-active .poka-rail,
body.game-is-active .poka-rail-tab { pointer-events: none; }
.poka-rail button { font: inherit; color: inherit; cursor: pointer; }
.poka-rail button[hidden] { display: none !important; }
.poka-rail input { font: inherit; color: inherit; }

.poka-rail kbd,
.poka-rail-settings-pop kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 5px;
  border: 1px solid #bab3a5;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--ink);
  font: 700 .6rem/1.2 Inter, system-ui, sans-serif;
  text-align: center;
}
:root[data-theme="dark"] .poka-rail kbd,
:root[data-theme="dark"] .poka-rail-settings-pop kbd { border-color: #4b5449; }

.poka-rail-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.poka-rail-head { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 14px 12px 10px 16px; overflow: hidden; border-radius: 22px 22px 0 0; }
.poka-rail-logo { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; border-radius: 8px; color: inherit; text-decoration: none; }
.poka-rail-logo img { display: block; height: 27px; width: auto; }
.poka-rail-logo .poka-rail-logo-dark { display: none; }
:root[data-theme="dark"] .poka-rail-logo .poka-rail-logo-light { display: none; }
:root[data-theme="dark"]:not([data-rail-state="icons"]) .poka-rail-logo .poka-rail-logo-dark { display: block; }
.poka-rail-logo .poka-rail-mark { display: none; width: 40px; height: 40px; }

.poka-rail-icon-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background .12s, color .12s, border-color .12s, transform .1s;
}
.poka-rail-icon-button:hover { background: var(--soft); color: var(--ink); border-color: var(--line); }
.poka-rail-icon-button:active { transform: translate(1px, 1px); }
.poka-rail-icon-button[aria-expanded="true"],
.poka-rail-icon-button[aria-pressed="true"] { background: var(--soft); color: var(--ink); border-color: var(--ink); }
.poka-rail-icon-button svg { width: 17px; height: 17px; }

.poka-rail-search { padding: 0 12px 10px; overflow: hidden; }
.poka-rail-find {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 8px 0 11px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  transition: background .12s, box-shadow .12s;
}
.poka-rail-find:focus-within { background: var(--paper); box-shadow: 2px 2px 0 var(--ink); }
.poka-rail-find > svg { flex: 0 0 auto; width: 15px; height: 15px; }
.poka-rail-find input { flex: 1 1 auto; width: auto; min-width: 0; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: 0; color: var(--ink); font-family: inherit; font-size: .74rem; font-weight: 700; }
.poka-rail-find input::-webkit-search-cancel-button { display: none; }
.poka-rail-find input::placeholder { color: var(--muted); font-weight: 650; }
.poka-rail-find kbd { flex: 0 0 auto; }
.poka-rail-find:focus-within kbd { visibility: hidden; }
.poka-rail-find-clear { width: 22px; height: 22px; border-radius: 6px; }
.poka-rail-find-clear svg { width: 12px; height: 12px; }
.poka-rail-find-clear[hidden] { display: none; }
.poka-rail-find-icon { display: none; }

.poka-rail-scroll { min-height: 0; padding: 2px 10px 12px; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
.poka-rail-group + .poka-rail-group { margin-top: 8px; }
.poka-rail-group-label { display: flex; align-items: center; justify-content: space-between; height: 24px; margin: 0; padding: 0 8px; color: var(--muted); font-size: .56rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; white-space: nowrap; }
.poka-rail-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.poka-rail-item { position: relative; }
.poka-rail-row {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 7px;
  border: 1.5px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  transition: background .12s, border-color .12s, box-shadow .1s, transform .1s;
}
.poka-rail-row:hover { background: var(--soft); }
.poka-rail-row:active { transform: translate(2px, 2px); box-shadow: none; }
.poka-rail-row:focus-visible { outline-offset: 0; }
.poka-rail-row[aria-current="page"] { background: var(--paper); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.poka-rail-row[aria-current="page"]::before { content: ""; position: absolute; left: -11px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--row-color, var(--accent)); }
.poka-rail-row.is-match { background: color-mix(in srgb, var(--row-color, var(--accent)) 16%, var(--paper)); border-color: var(--line); }

.poka-rail-chip {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--row-color, var(--accent));
  color: var(--row-fg, var(--ink-fixed));
  transition: transform .16s var(--ease);
}
:root[data-theme="dark"] .poka-rail-chip { border-color: #0e1411; }
.poka-rail-chip svg { width: 17px; height: 17px; }
.poka-rail-row:hover .poka-rail-chip { transform: rotate(-4deg); }
.poka-rail-row[aria-current="page"] .poka-rail-chip { transform: rotate(-3deg); box-shadow: 1.5px 1.5px 0 var(--ink); }
.poka-rail-copy { display: grid; min-width: 0; }
.poka-rail-copy strong { overflow: hidden; font-size: .78rem; font-weight: 850; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.poka-rail-copy small { margin-top: 1px; overflow: hidden; color: var(--muted); font-size: .62rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.poka-rail-pin {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
}
.poka-rail-pin svg { width: 14px; height: 14px; }
.poka-rail-item:hover .poka-rail-pin,
.poka-rail-pin:focus-visible { opacity: 1; }
.poka-rail-pin:hover { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.poka-rail-item:hover .poka-rail-copy { padding-right: 24px; }
.poka-rail-item.is-pinned .poka-rail-pin { color: var(--ink); }

.poka-rail-empty { margin: 14px 8px; padding: 14px; border: 1.5px dashed var(--line); border-radius: 13px; color: var(--muted); font-size: .68rem; font-weight: 650; line-height: 1.45; }
.poka-rail-empty strong { color: var(--ink); font-size: .74rem; font-weight: 850; overflow-wrap: anywhere; }

.poka-rail-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.poka-rail-foot .version { margin-right: auto; padding-left: 4px; color: var(--muted); font: 700 .6rem/1 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; letter-spacing: .02em; }

.poka-rail-theme:empty { display: none; }
.poka-rail .poka-rail-foot .poka-theme-toggle { position: relative; inset: auto; z-index: auto; display: block; margin: 0; }
.poka-rail .poka-rail-foot .poka-theme-trigger {
  width: 32px;
  height: 32px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  opacity: 1;
  box-shadow: none;
}
.poka-rail .poka-rail-foot .poka-theme-trigger svg { width: 17px; height: 17px; }
.poka-rail .poka-rail-foot .poka-theme-toggle:hover .poka-theme-trigger,
.poka-rail .poka-rail-foot .poka-theme-toggle[data-open="true"] .poka-theme-trigger { background: var(--soft); color: var(--ink); border-color: var(--line); }
.poka-rail .poka-rail-foot .poka-theme-menu { position: absolute; z-index: 70; right: -6px; bottom: calc(100% + 10px); width: max-content; }
.poka-rail .poka-rail-foot .poka-theme-option { min-width: 168px; height: 30px; font-size: .68rem; }
.poka-rail .poka-rail-foot .poka-theme-option svg { width: 14px; height: 14px; }
html[data-rail-state="icons"] .poka-rail .poka-rail-foot .poka-theme-menu { right: auto; left: calc(100% + 18px); bottom: -40px; }

html[data-rail-state="icons"] .poka-rail-head { flex-direction: column; gap: 8px; padding: 12px 0 8px; }
html[data-rail-state="icons"] .poka-rail-logo { flex: 0 0 auto; }
html[data-rail-state="icons"] .poka-rail-logo > img:not(.poka-rail-mark) { display: none; }
html[data-rail-state="icons"] .poka-rail-logo .poka-rail-mark { display: block; }
html[data-rail-state="icons"] .poka-rail-search { display: grid; place-items: center; padding: 0 0 8px; }
html[data-rail-state="icons"] .poka-rail-find { display: none; }
html[data-rail-state="icons"] .poka-rail-find-icon { display: grid; }
html[data-rail-state="icons"] .poka-rail-scroll { padding: 2px 0 10px; scrollbar-gutter: auto; scrollbar-width: none; }
html[data-rail-state="icons"] .poka-rail-scroll::-webkit-scrollbar { display: none; }
html[data-rail-state="icons"] .poka-rail-group + .poka-rail-group { margin: 6px 12px 0; padding-top: 6px; border-top: 1px solid var(--line); }
html[data-rail-state="icons"] .poka-rail-group-label { display: none; }
html[data-rail-state="icons"] .poka-rail-list { justify-items: center; gap: 1px; }
html[data-rail-state="icons"] .poka-rail-chip { width: 28px; height: 28px; }
html[data-rail-state="icons"] .poka-rail-row { width: 42px; min-height: 38px; grid-template-columns: 1fr; justify-items: center; padding: 5px; }
html[data-rail-state="icons"] .poka-rail-row[aria-current="page"]::before { left: -9px; }
html[data-rail-state="icons"] .poka-rail-copy,
html[data-rail-state="icons"] .poka-rail-pin,
html[data-rail-state="icons"] .poka-rail-empty { display: none; }
html[data-rail-state="icons"] .poka-rail-foot { flex-direction: column; padding: 10px 0 12px; }
html[data-rail-state="icons"] .poka-rail-foot .version { display: none; }

.poka-rail-tab {
  position: fixed;
  z-index: 66;
  left: 0;
  top: 50%;
  width: 22px;
  height: 48px;
  margin-top: -24px;
  display: none;
  place-items: center;
  padding: 0 2px 0 0;
  border: 2px solid var(--ink);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: width .14s var(--ease, ease), background .12s;
}
html[data-rail-state="tab"] .poka-rail-tab { display: grid; }
.poka-rail-tab:hover { width: 26px; background: var(--soft); }
.poka-rail-tab:focus-visible { outline: 3px solid var(--blue, #77bcd2); outline-offset: 2px; }
.poka-rail-tab svg { width: 14px; height: 14px; }

.poka-railview-button {
  display: none;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font: inherit;
  font-size: .72rem;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, background .15s;
}
@media (min-width: 900px) {
  html[data-rail="hide"] .poka-railview-button { display: inline-flex; }
}
.poka-railview-button:hover { background: var(--soft); }
.poka-railview-button:active { transform: translate(3px, 3px); box-shadow: none; }
.poka-railview-button:focus-visible { outline: 3px solid var(--blue, #77bcd2); outline-offset: 3px; }
.poka-railview-button svg { width: 18px; height: 18px; }

.site-header .poka-railview-button { height: 40px; margin-left: auto; }
.site-header .poka-railview-button + .developer-note-button { margin-left: 8px; }

.poka-rail-settings-pop {
  position: fixed;
  z-index: 70;
  width: 252px;
  padding: 8px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, .1), 0 10px 24px rgba(0, 0, 0, .16);
}
:root[data-theme="dark"] .poka-rail-settings-pop { box-shadow: 2px 3px 0 rgba(0, 0, 0, .3), 0 10px 24px rgba(0, 0, 0, .45); }
.poka-rail-pop-title { padding: 6px 9px 3px; color: var(--muted); font-size: .56rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.poka-rail-pop-title:first-child { padding-top: 3px; }
.poka-rail-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; margin: 2px 2px 6px; padding: 3px; border: 1.5px solid var(--ink); border-radius: 11px; background: var(--soft); }
.poka-rail-seg button { height: 28px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .66rem; font-weight: 800; white-space: nowrap; cursor: pointer; transition: background .12s, color .12s; }
.poka-rail-seg button:hover { color: var(--ink); }
.poka-rail-seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 1.5px 1.5px 0 var(--ink); }
.poka-rail-check { display: flex; align-items: center; gap: 9px; min-height: 32px; padding: 3px 9px 0; color: var(--ink); font-size: .72rem; font-weight: 800; cursor: pointer; }
.poka-rail-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.poka-rail-check input:disabled, .poka-rail-check input:disabled + span { cursor: default; opacity: .6; }
.poka-rail-check input:focus-visible { outline: 3px solid var(--blue, #77bcd2); outline-offset: 2px; }
.poka-rail-pop-note { margin: -2px 9px 6px; color: var(--muted); font-size: .6rem; font-weight: 650; line-height: 1.35; }
.poka-rail-pop-sep { height: 1px; margin: 3px 4px; background: var(--line); }
.poka-rail-keys { display: grid; gap: 6px; margin: 2px 0 4px; padding: 6px 9px 4px; color: var(--muted); font-size: .64rem; font-weight: 650; }
.poka-rail-keys div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.poka-rail-keys span:last-child { display: inline-flex; gap: 3px; }
.poka-rail-pop-item { width: 100%; height: 32px; display: flex; align-items: center; gap: 9px; padding: 0 10px 0 9px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-size: .72rem; font-weight: 750; text-align: left; white-space: nowrap; cursor: pointer; }
.poka-rail-pop-item svg { flex: 0 0 auto; width: 15px; height: 15px; color: var(--muted); }
.poka-rail-pop-item:hover { background: var(--soft); }
.poka-rail-pop-item:focus-visible { outline: 0; background: var(--soft); box-shadow: inset 0 0 0 2px var(--blue, #77bcd2); }
.poka-rail-pop-leave { --leave: #c2413a; --leave-soft: #fbe8e5; color: var(--leave); }
:root[data-theme="dark"] .poka-rail-pop-leave { --leave: #ff8f86; --leave-soft: rgba(255, 128, 118, .13); }
.poka-rail-pop-leave svg { color: var(--leave); }
.poka-rail-pop-leave:hover { background: var(--leave-soft); }
.poka-rail-pop-leave:focus-visible { background: var(--leave-soft); box-shadow: inset 0 0 0 2px var(--leave); }

.poka-rail-tip {
  position: fixed;
  z-index: 75;
  padding: 6px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--row-color, var(--accent));
  font-size: .68rem;
  font-weight: 750;
  white-space: nowrap;
  pointer-events: none;
  animation: poka-rail-tip-in .12s var(--ease, ease) both;
}
.poka-rail-tip small { display: block; margin-top: 1px; color: var(--muted); font-size: .6rem; font-weight: 650; }
@keyframes poka-rail-tip-in { from { opacity: 0; transform: translateX(-4px); } }

@media (max-width: 899px) {
  .poka-rail, .poka-rail-tab, .poka-railview-button { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .poka-rail, html[data-rail-state="tab"] .poka-rail, .poka-rail-chip, .poka-rail-row, .poka-rail-tab { transition: none; }
  .poka-rail-tip, html[data-rail-peek] .poka-rail { animation: none; }
  .poka-rail-row:hover .poka-rail-chip,
  .poka-rail-row[aria-current="page"] .poka-rail-chip { transform: none; }
}
