:root {
  --glass: #141c28;
  --glass-deep: #0b1017;
  --brass: #c4a574;
  --brass-dim: #8a7349;
  --porcelain: #e8eef2;
  --ivory: #f3ede4;
  --ivory-dim: #c8c0b4;
  --wine: #8b3a4a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--glass-deep);
  color: var(--ivory);
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  overflow: hidden;
}

.frame {
  position: relative;
  height: 100%;
  margin: 14px;
  border: 1px solid color-mix(in srgb, var(--brass) 70%, transparent);
  background: #0e1520;
  box-shadow:
    inset 0 0 0 7px var(--glass-deep),
    inset 0 0 0 8px color-mix(in srgb, var(--brass) 40%, transparent);
}

.glow {
  position: absolute;
  top: 10%;
  bottom: 10%;
  width: 2px;
  z-index: 8;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    color-mix(in srgb, var(--porcelain) 55%, transparent),
    transparent
  );
  opacity: 0.45;
}
.glow-l { left: 11px; }
.glow-r { right: 11px; }

.brand {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 7;
  pointer-events: none;
}
.mark {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.12em;
  line-height: 1;
}
.sub {
  margin-top: 6px;
  color: var(--ivory-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #070b10;
}
.stage video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  z-index: 5;
  color: var(--ivory);
  background: color-mix(in srgb, var(--glass-deep) 70%, transparent);
  font-size: 14px;
  white-space: nowrap;
}

.rail {
  position: absolute;
  top: 86px;
  right: 26px;
  bottom: 86px;
  width: 112px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--brass-dim) transparent;
}
.rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--brass), transparent);
  opacity: 0.5;
  pointer-events: none;
}

.item {
  position: relative;
  width: 86px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.5));
  transform: scale(0.96);
  opacity: 0.82;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}
.item img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 128px;
  object-fit: contain;
  pointer-events: none;
}
.item:hover,
.item:focus-visible {
  opacity: 1;
  transform: scale(1);
  outline: none;
}
.item.selected {
  opacity: 1;
  transform: scale(1.08);
}
.item.selected::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 18px;
  height: 1px;
  background: var(--brass);
  transform: translateX(-50%);
}

.bar {
  position: absolute;
  left: 28px;
  right: 150px;
  bottom: 22px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 22px;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.now {
  font-size: 15px;
  color: var(--ivory);
  min-width: 8em;
}
.size {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ivory-dim);
  font-size: 13px;
}
.size input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 2px;
  background: color-mix(in srgb, var(--brass) 55%, transparent);
  outline: none;
}
.size input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 0;
  border: 1px solid var(--brass);
  background: var(--glass-deep);
  cursor: pointer;
}

.btn {
  appearance: none;
  border: 1px solid var(--brass-dim);
  background: transparent;
  color: var(--ivory);
  font: inherit;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
}
.btn:hover,
.btn:focus-visible {
  border-color: var(--brass);
  outline: none;
}
.btn.primary {
  background: var(--ivory);
  color: var(--glass-deep);
  border-color: var(--ivory);
  padding: 10px 22px;
  font-size: 15px;
}
.btn.primary:hover {
  background: var(--porcelain);
}

.gate {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 40%, #1a2433 0%, var(--glass-deep) 70%);
}
.gate[hidden] { display: none; }
.gate-inner {
  width: min(420px, calc(100% - 80px));
  text-align: center;
}
.gate-inner .mark {
  font-size: 48px;
  margin-bottom: 20px;
}
.gate-inner p {
  margin: 0 0 28px;
  color: var(--ivory-dim);
  line-height: 1.7;
  font-size: 15px;
}
.gate-inner .note {
  margin-top: 18px;
  margin-bottom: 0;
  font-size: 13px;
  color: #d7b4b4;
}
.gate-inner .note[hidden] { display: none; }

.credits {
  position: absolute;
  left: 30px;
  bottom: 4px;
  z-index: 8;
  color: color-mix(in srgb, var(--ivory-dim) 60%, transparent);
  font-size: 11px;
  text-decoration: none;
}
.credits:hover { color: var(--ivory-dim); }

@media (max-width: 740px) {
  .rail {
    top: auto;
    right: 0;
    left: 0;
    bottom: 70px;
    width: auto;
    height: 120px;
    flex-direction: row;
    padding: 0 16px;
    gap: 16px;
  }
  .rail::before {
    top: 50%;
    left: 8px;
    right: 8px;
    bottom: auto;
    width: auto;
    height: 1px;
  }
  .bar { right: 20px; bottom: 14px; }
  .item img { max-height: 96px; }
}
