:root {
  color-scheme: dark;
  --page: #171b18;
  --rail: #1c241f;
  --panel: #222d25;
  --line: #39483d;
  --ink: #f2eee0;
  --muted: #b9c0b2;
  --gold: #d9bf8d;
  --rail-width: 70px;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  display: grid;
  direction: ltr;
  grid-template-columns: calc(var(--rail-width) + env(safe-area-inset-left)) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

button { color: inherit; font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:where(a, button):focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
:where(a, button) { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.site-icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-rail {
  --expanded-width: min(228px, calc(100vw - 48px - env(safe-area-inset-left)));
  --rail-open: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-self: start;
  justify-self: start;
  gap: 22px;
  width: calc(var(--rail-width) + (var(--expanded-width) - var(--rail-width)) * var(--rail-open) + env(safe-area-inset-left));
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: calc(13px + env(safe-area-inset-top)) 6px calc(11px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
  border-inline-end: 1px solid var(--line);
  background: var(--rail);
  box-shadow: 16px 0 34px rgb(8 14 10 / calc(.38 * var(--rail-open)));
  transition: width 180ms ease, box-shadow 180ms ease;
}

.site-rail:has(:focus-visible) { --rail-open: 1; }
@media (hover: hover) {
  .site-rail:hover { --rail-open: 1; }
}

.site-rail :is(.rail-brand, .rail-button) {
  display: grid;
  grid-template-columns: calc(var(--rail-width) - 15px) max-content;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow: hidden;
  text-align: start;
}

.site-rail :is(.rail-brand, .rail-button) > :is(img, svg) { justify-self: center; }

.rail-brand {
  flex: none;
  height: 48px;
  border-radius: 10px;
  color: #f6e7c7;
  font-weight: 680;
}
.rail-brand img { display: block; border-radius: 9px; }

.rail-label {
  white-space: nowrap;
  opacity: var(--rail-open);
  transform: translateX(calc(-5px * (1 - var(--rail-open))));
  transition: opacity 130ms ease, transform 160ms ease;
  pointer-events: none;
}

.rail-nav, .rail-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.rail-footer {
  margin-top: auto;
  gap: 2px;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #c5d2c6;
}

.site-rail .rail-button { justify-items: start; font-size: .91rem; }
.site-rail .rail-art { display: block; width: 34px; height: 34px; }
.rail-footer img:not(.rail-art) { opacity: .76; }
.rail-button:hover, .rail-button:focus-visible { background: #303e32; color: var(--ink); }
.rail-button:is(:hover,:focus-visible) img { opacity: 1; }
.rail-button[aria-current="page"] {
  border-color: #5c6e55;
  background: #354638;
  color: #f1d5a1;
  box-shadow: inset 2px 0 #d9bf8d;
}
.rail-support { margin-top: 4px; border-top-color: var(--line); border-radius: 0 0 9px 9px; }

body:has(.site-drawer[open]) { overflow: hidden; }

.site-drawer {
  position: fixed;
  inset: 0 auto 0 calc(var(--rail-width) + env(safe-area-inset-left));
  width: min(326px, calc(100vw - var(--rail-width) - env(safe-area-inset-left)));
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-inline-end: 1px solid #4d5a4c;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 18px 0 60px #0b100c7a;
}

.site-drawer[open] { animation: drawer-in 160ms ease-out; }
.site-drawer::backdrop { background: #0c120a9e; }

@keyframes drawer-in {
  from { transform: translateX(-18px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-panel { padding: calc(19px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom)); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-header :is(h1, h2) { margin: 0; font-size: 1.23rem; }
.drawer-header .rail-button { border-color: var(--line); }
.guide-rules { margin: 22px 0; color: var(--muted); line-height: 1.75; }
.guide-privacy { display: inline-block; padding-block: 9px; font-size: .88rem; color: var(--gold); }

.site-rail .rail-language {
  grid-template-columns: calc(var(--rail-width) - 15px) minmax(0, 1fr);
  margin-bottom: 5px;
  border-color: var(--line);
  color: var(--gold);
}
.rail-language .rail-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .82rem; }
.language-options { display: grid; gap: 4px; margin-top: 15px; }
.language-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: start;
}
.language-options button:hover { background: #303e32; }
.language-options button[aria-pressed="true"] { background: #354638; border-color: #5c6e55; color: #f1d5a1; }
.language-options button[aria-pressed="true"]::after { content: "✓"; }
[dir="rtl"] :is(.drawer-panel, .download-copy, .app-themes > div) { direction: rtl; }

@media (max-width: 680px) {
  :root { --rail-width: 55px; }
  .site-rail { gap: 14px; padding-inline: calc(4px + env(safe-area-inset-left)) 4px; }
  .site-rail :is(.rail-brand, .rail-button) { grid-template-columns: calc(var(--rail-width) - 11px) max-content; }
  .site-rail .rail-language { grid-template-columns: calc(var(--rail-width) - 11px) minmax(0, 1fr); }
  .rail-brand { height: 43px; }
  .rail-brand img { width: 34px; height: 34px; border-radius: 8px; }
  .rail-button { width: 44px; height: 44px; }
  .site-rail .rail-art { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-drawer[open] { animation: none; }
  .site-rail, .rail-label { transition: none; }
}
