:root {
  --ink: #161018;
  --muted: #4a3a46;
  --line: rgba(90, 50, 80, .16);
  --paper: rgba(255,255,255,.34);
  --paper2: rgba(255,246,250,.28);
  --rose: #c42a74;
  --rose2: #a81d60;
  --night: #1a1220;
  --shadow: 0 16px 40px rgba(20, 8, 24, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 15px/1.55 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #1b1322;
}
button, input, select { font: inherit; }
a { color: var(--rose2); text-decoration: none; }
.muted { color: var(--muted); }
.kicker { margin: 0 0 6px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--rose); font-weight: 700; }
h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.03em; color: var(--ink); font-weight: 800; }
h2 { margin: 0 0 12px; font-size: 18px; }
.err { color: #b4234a; background: #ffe8ef; padding: 10px 12px; border-radius: 12px; }
.pill {
  display: inline-flex; min-width: 28px; height: 24px; padding: 0 8px;
  align-items: center; justify-content: center; border-radius: 999px;
  background: #ffe3ef; color: var(--rose2); font-size: 12px;
}

.btn {
  border: 1px solid rgba(40, 16, 32, .08); border-radius: 999px; padding: 9px 16px; cursor: pointer;
  background: rgba(255,255,255,.72); color: var(--ink); box-shadow: 0 6px 16px rgba(20, 8, 24, .12);
}
.btn.primary { background: linear-gradient(180deg, #e85a96, #c42a74); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.tiny { padding: 6px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: #fff; color: var(--ink); cursor: pointer; font-size: 22px;
}

.petals { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.petal {
  position: absolute; top: -20px; width: 10px; height: 14px;
  background: radial-gradient(circle at 30% 30%, #fff, #f4a0c2);
  border-radius: 70% 10% 70% 10%;
  animation: fall linear infinite;
  opacity: .55;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(280deg); opacity: .1; }
}

.scene {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #1b1322;
}
.scene img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  animation: sceneFade 50s infinite;
}
.scene img:nth-child(1) { animation-name: sceneFadeFirst; animation-delay: 0s; }
.scene img:nth-child(2) { animation-delay: 10s; }
.scene img:nth-child(3) { animation-delay: 20s; }
.scene img:nth-child(4) { animation-delay: 30s; }
.scene img:nth-child(5) { animation-delay: 40s; }
.scene::after { content: none; }
@keyframes sceneFade {
  0% { opacity: 0; }
  4% { opacity: 1; }
  18% { opacity: 1; }
  22% { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes sceneFadeFirst {
  0% { opacity: 1; }
  18% { opacity: 1; }
  22% { opacity: 0; }
  96% { opacity: 0; }
  100% { opacity: 1; }
}

body.app {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  min-height: 100vh;
  background: #1b1322;
  transition: grid-template-columns .28s ease;
}
body.app.rail-shut { grid-template-columns: 0 minmax(0, 1fr); }

.rail,
.stage { position: relative; z-index: 1; }

.rail {
  min-width: 0;
  overflow: hidden;
  padding: 28px 18px;
  display: flex; flex-direction: column; gap: 22px;
  background: rgba(255, 248, 252, .18);
  border-right: 1px solid rgba(255,255,255,.35);
}
body.app.rail-shut .rail { padding: 0; border-right-width: 0; pointer-events: none; }
.rail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 152px; }
.rail-shut {
  border: 0; border-radius: 999px; padding: 4px 10px; cursor: pointer;
  background: rgba(255,255,255,.55); color: var(--ink); font-size: 12px;
}
.rail-pull {
  position: fixed; z-index: 4; left: 0; top: 42%;
  border: 0; border-radius: 0 16px 16px 0; padding: 16px 8px;
  background: rgba(255,248,252,.86); color: var(--ink); cursor: pointer;
  writing-mode: vertical-rl; letter-spacing: .22em; font-weight: 800;
  box-shadow: 4px 10px 24px rgba(20, 8, 24, .18);
  transform: translateX(-120%);
  transition: transform .28s ease;
}
body.app.rail-shut .rail-pull { transform: translateX(0); }
.brand {
  font-weight: 800; color: var(--ink); font-size: 20px; letter-spacing: -.04em;
  white-space: nowrap;
}
.nav-block { display: flex; flex-direction: column; gap: 8px; }
.nav-block.account { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.nav-label { margin: 0 4px 2px; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.rail nav a {
  padding: 10px 12px; border-radius: 14px; color: var(--ink);
}
.rail nav a.on, .rail nav a:hover { background: rgba(255,228,239,.72); color: var(--rose2); }
.who { font-size: 13px; color: var(--ink); font-weight: 700; padding: 0 4px; }

.stage { padding: 16px; min-width: 0; min-height: 100vh; }
.sheet {
  min-height: calc(100vh - 32px);
  background: rgba(255, 248, 252, .12);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 24px;
  padding: 28px 32px 36px;
}
.sheet h1, .sheet h2, .sheet p, .sheet .kicker,
.rail .brand, .rail .nav-label, .rail .who, .rail nav a {
  text-shadow: 0 0 10px rgba(255,248,252,.95), 0 1px 0 #fff;
}

.banner {
  display: flex; justify-content: space-between; gap: 20px; align-items: flex-end;
  margin-bottom: 28px;
}
.banner-act, .sel { display: flex; gap: 8px; align-items: center; }
.sel select, select, input {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(255,255,255,.7);
}
label { display: block; margin: 12px 0; color: var(--muted); font-size: 13px; }
label input { width: 100%; margin-top: 6px; }

.board-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-weight: 700; }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.qq-card {
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(90, 50, 80, .1);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(20, 8, 24, .08);
  animation: up .35s ease both;
  animation-delay: calc(var(--i) * 40ms);
}
@keyframes up { from { opacity: 0; transform: translateY(10px); } }
.tile-top { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.tile-top b { display: block; font-size: 20px; }
.avatar {
  width: 56px; height: 56px; border-radius: 18px; font-size: 18px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #ffd3e6, #f19ab8); color: #fff; font-weight: 800;
}
.tag { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.offleft { color: var(--rose2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c9b8c4; display: inline-block; }
.dot.on { background: #3ecf8e; box-shadow: 0 0 0 4px rgba(62,207,142,.16); }
.acc { margin: 0 0 14px; }
.acc-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.ops { display: grid; gap: 8px; }
.op { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; align-items: center; }
.op > span, .op-name { font-size: 12px; color: var(--muted); }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.actions .btn { width: 100%; }
.sec { margin: 8px 0 12px; }
.empty {
  grid-column: 1 / -1; padding: 48px 20px; text-align: center;
  background: var(--paper2); border-radius: 24px; border: 1px dashed var(--line);
}

.hud {
  display: grid;
  grid-template-columns: 140px 1fr;
  grid-template-rows: auto auto;
  gap: 18px 24px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 28px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.hud-ring { position: relative; width: 140px; height: 140px; grid-row: span 2; }
.hud-ring svg { width: 140px; height: 140px; transform: rotate(-90deg); }
.hud-ring circle { fill: none; stroke-width: 10; }
.hud-ring .track { stroke: #f3d7e4; }
.hud-ring .fill { stroke: var(--rose); stroke-dasharray: 326.73; stroke-dashoffset: 326.73; stroke-linecap: round; }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-num b { font-size: 32px; }
.ring-num em { font-style: normal; color: var(--muted); }
.hud-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hud-stats div { background: rgba(255,255,255,.28); border-radius: 16px; padding: 12px; }
.hud-stats span { display: block; color: var(--muted); font-size: 12px; }
.hud-stats b { font-size: 22px; }
.hud-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar { grid-column: 1 / -1; height: 8px; background: #f3d7e4; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f3a0c2, var(--rose)); }

.quests { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 88px; }
.quests > div { background: rgba(255,246,250,.16); border: 1px solid rgba(255,255,255,.35); border-radius: 22px; padding: 16px; }
.quest { padding: 10px 0; border-bottom: 1px solid var(--line); }
.quest:last-child { border-bottom: 0; }
.quest-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.mini { height: 6px; background: #f3d7e4; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.mini i { display: block; height: 100%; background: var(--rose); }

.plan {
  display: grid;
  gap: 14px;
  max-width: 520px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(90, 50, 80, .1);
  border-radius: 20px;
  padding: 22px;
}
.plan label { margin: 0; }
.clock { display: inline-flex; gap: 8px; align-items: center; margin-top: 8px; }
.chk { display: flex; align-items: center; gap: 8px; }

.dock {
  position: sticky; bottom: 12px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: rgba(255,248,252,.42);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 18px;
  padding: 10px 12px;
  backdrop-filter: blur(10px);
}

.mask {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(28, 16, 28, .42);
  padding: 20px;
}
.mask[hidden] { display: none !important; }
.mask.on .modal { transform: none; opacity: 1; }
.modal {
  width: min(560px, 100%);
  background: #fff8fb;
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  opacity: 0;
  transition: .2s ease;
}
.modal-hd { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.challenge iframe { width: 100%; min-height: 360px; border: 0; border-radius: 16px; background: #fff; }
.qr { text-align: center; }
.qr img { max-width: 220px; border-radius: 12px; }
.challenge-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

body.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #1b1322;
}
.gate-card {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 32px));
  margin: 24px;
  background: rgba(255,248,252,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 18px 40px rgba(20, 8, 24, .22);
}
.switch { margin-top: 14px; }

@media (prefers-reduced-motion: reduce) {
  .scene img { animation: none; opacity: 0; }
  .scene img:nth-child(1) { opacity: 1; }
}

@media (max-width: 980px) {
  body.app, body.app.rail-shut { grid-template-columns: 1fr; }
  body.app.rail-shut .rail { display: none; }
  .rail { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail nav { flex-direction: row; align-items: center; }
  .nav-block.account { margin-top: 0; margin-left: auto; padding-top: 0; border-top: 0; }
  .sheet { min-height: auto; padding: 20px; }
  .tiles { grid-template-columns: 1fr; }
  .gate-card { margin: 24px 16px; }
  .quests { grid-template-columns: 1fr; }
  .hud { grid-template-columns: 1fr; }
  .hud-ring { grid-row: auto; margin: 0 auto; }
}
