/* =========================================================
   赛博打工人命运模拟器 · 视觉样式
   霓虹赛博朋克 × 办公室工牌美学；移动端优先
   ========================================================= */

:root {
  --bg: #07070d;
  --bg-2: #0d0c1d;
  --panel: rgba(16, 16, 34, 0.72);
  --panel-solid: #12122a;
  --line: rgba(0, 240, 255, 0.18);
  --line-strong: rgba(0, 240, 255, 0.5);
  --text: #e8ecff;
  --muted: #8f95bf;
  --dim: rgba(232, 236, 255, 0.6);
  --cyan: #00f0ff;
  --pink: #ff2e88;
  --yellow: #f5ff3b;
  --green: #39ff9f;
  --red: #ff3b5c;
  --accent: var(--cyan);
  --font: 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'SFMono-Regular', Consolas, 'Menlo', monospace;
  --cut: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button,
input,
a {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

[tabindex='-1']:focus {
  outline: none;
}

.mono {
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.dim {
  color: var(--dim);
}

.noscript {
  padding: 40px 20px;
  text-align: center;
}

/* ---------- 背景 ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -10%;
  height: 60%;
  background-image: linear-gradient(rgba(255, 46, 136, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 46, 136, 0.35) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(380px) rotateX(62deg);
  transform-origin: center top;
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
  animation: grid-move 6s linear infinite;
  opacity: 0.45;
}

@keyframes grid-move {
  to {
    background-position: 0 48px;
  }
}

.bg-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 40% at 85% 5%, rgba(255, 46, 136, 0.22), transparent 70%),
    radial-gradient(50% 40% at 0% 40%, rgba(0, 240, 255, 0.14), transparent 70%),
    radial-gradient(80% 50% at 50% 100%, rgba(120, 60, 255, 0.18), transparent 70%);
}

/* 扫描线 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px);
}

/* ---------- 页面容器与过渡 ---------- */

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 18px 18px calc(28px + var(--safe-b));
  display: flex;
  flex-direction: column;
}

.screen-enter {
  animation: screen-in 0.45s var(--ease) both;
}

.screen-leave {
  animation: screen-out 0.2s ease-in both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(4px);
  }
}

@keyframes screen-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
    filter: blur(3px);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--cyan);
  border: 1px solid var(--line-strong);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

.blink {
  animation: blink 1.4s steps(1) infinite;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.08);
}

/* ---------- 按钮 ---------- */

.btn {
  --bc: var(--cyan);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 22px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-decoration: none;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  transition: transform 0.15s var(--ease), filter 0.2s, background 0.2s, color 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.btn:active {
  transform: scale(0.97) translateY(1px);
}

.btn i {
  font-style: normal;
  transition: transform 0.25s var(--ease);
}

.btn:hover i {
  transform: translateX(4px);
}

.btn-primary {
  color: #05050b;
  background: linear-gradient(100deg, var(--cyan), #6af7ff 45%, var(--cyan));
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.35);
}

.btn-primary::before {
  /* 扫光 */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.65) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sweep 3.2s ease-in-out infinite;
}

.btn-primary:hover {
  filter: brightness(1.08) saturate(1.1);
}

@keyframes sweep {
  0%,
  60% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

.btn-ghost {
  color: var(--text);
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
    linear-gradient(120deg, var(--line-strong), rgba(255, 46, 136, 0.5)) border-box;
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--cyan);
}

.btn-ghost b {
  color: var(--cyan);
  font-weight: 600;
}

.btn-danger {
  color: #fff;
  background: var(--red);
}

.btn-text {
  min-height: 40px;
  font-size: 13px;
  font-weight: 400;
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-sm {
  min-height: 46px;
  font-size: 15px;
  padding: 0 18px;
  --cut: 10px;
}

/* ---------- 首页 ---------- */

.home {
  gap: 22px;
}

.hero {
  margin-top: 4vh;
}

.kicker {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--pink);
}

.title {
  position: relative;
  margin: 0;
  font-size: clamp(48px, 15vw, 70px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff 30%, #a9f7ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.25);
}

.title-sub {
  display: flex;
  gap: 10px;
  margin: 10px 0 0;
  font-size: clamp(22px, 7vw, 30px);
  font-weight: 800;
  letter-spacing: 0.3em;
}

.title-sub span:first-child {
  color: #05050b;
  background: var(--pink);
  padding: 0 4px 0 10px;
  box-shadow: 0 0 22px rgba(255, 46, 136, 0.5);
}

.title-sub span:last-child {
  color: var(--pink);
}

.tagline {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.tagline del {
  color: var(--yellow);
  text-decoration-thickness: 2px;
}

/* 故障字效果 */
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
}

.glitch::before {
  color: var(--pink);
  -webkit-text-fill-color: var(--pink);
  opacity: 0.8;
  animation: glitch-a 4s infinite steps(1);
  mix-blend-mode: screen;
}

.glitch::after {
  color: var(--cyan);
  -webkit-text-fill-color: var(--cyan);
  opacity: 0.8;
  animation: glitch-b 4s infinite steps(1);
  mix-blend-mode: screen;
}

@keyframes glitch-a {
  0%,
  88%,
  100% {
    clip-path: inset(0 0 100% 0);
    transform: none;
  }
  89% {
    clip-path: inset(20% 0 55% 0);
    transform: translate(-4px, 0);
  }
  92% {
    clip-path: inset(60% 0 10% 0);
    transform: translate(3px, 0);
  }
  95% {
    clip-path: inset(40% 0 40% 0);
    transform: translate(-2px, 0);
  }
}

@keyframes glitch-b {
  0%,
  88%,
  100% {
    clip-path: inset(0 0 100% 0);
    transform: none;
  }
  90% {
    clip-path: inset(65% 0 5% 0);
    transform: translate(4px, 0);
  }
  93% {
    clip-path: inset(10% 0 70% 0);
    transform: translate(-3px, 0);
  }
}

/* 工牌 */
.badge-card {
  position: relative;
  align-self: center;
  width: min(100%, 330px);
  margin-top: 46px;
  padding: 26px 18px 14px;
  background: linear-gradient(160deg, rgba(30, 28, 66, 0.95), rgba(12, 12, 28, 0.95));
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 46, 136, 0.15) inset, 0 0 40px rgba(0, 240, 255, 0.12);
  transform: rotate(-3deg);
  animation: badge-swing 5s ease-in-out infinite;
  transform-origin: 50% -40px;
}

@keyframes badge-swing {
  50% {
    transform: rotate(2deg);
  }
}

.badge-clip {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 54px;
  height: 22px;
  transform: translateX(-50%);
  background: linear-gradient(#b8bdd8, #6c7193);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.badge-clip::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 16px;
  height: 36px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(45deg, var(--pink) 0 6px, #b3175f 6px 12px);
}

.badge-inner {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: center;
}

.badge-photo {
  width: 76px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(255, 46, 136, 0.18)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 4px);
  border: 1px solid var(--line-strong);
  font-size: 40px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 14px var(--cyan);
}

.badge-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.badge-org {
  font-size: 10px;
  color: var(--pink);
}

.badge-name {
  font-size: 22px;
  margin: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-dept {
  font-size: 12px;
  color: var(--muted);
}

.badge-id {
  font-size: 12px;
  color: var(--cyan);
  margin-top: 4px;
}

.badge-level {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #05050b;
  background: var(--yellow);
}

.barcode {
  height: 22px;
  margin-top: 12px;
  opacity: 0.55;
  background: repeating-linear-gradient(
    90deg,
    var(--text) 0 2px,
    transparent 2px 4px,
    var(--text) 4px 5px,
    transparent 5px 9px,
    var(--text) 9px 12px,
    transparent 12px 14px
  );
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}

.foot {
  font-size: 12px;
  line-height: 1.7;
  color: var(--dim);
  text-align: center;
}

/* ---------- 通用面板/标题 ---------- */

.page-title {
  margin: 18px 0 4px;
  font-size: 30px;
  font-weight: 900;
}

.page-desc {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.page-desc.small {
  font-size: 13px;
}

.panel {
  position: relative;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
}

/* ---------- 入职登记 ---------- */

.contract {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-weight: 700;
}

.field-label small {
  margin-left: 6px;
  font-weight: 400;
  color: var(--dim);
  font-size: 12px;
}

.field input {
  height: 52px;
  padding: 0 16px;
  font-size: 17px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.18), 0 0 20px rgba(0, 240, 255, 0.2);
}

.field input::placeholder {
  color: var(--dim);
}

.clauses {
  margin: 0;
  padding-left: 1.4em;
  font-size: 13px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.clauses em {
  font-style: normal;
  font-weight: 700;
}

.c-wealth {
  color: var(--yellow);
}
.c-health {
  color: var(--green);
}
.c-happy {
  color: var(--pink);
}
.c-career {
  color: var(--cyan);
}

/* ---------- 游戏 HUD ---------- */

.play {
  padding-top: 10px;
  gap: 14px;
}

.hud {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 -18px;
  padding: 8px 18px 12px;
  background: linear-gradient(to bottom, var(--bg) 70%, rgba(7, 7, 13, 0));
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-top .icon-btn {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.progress {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  gap: 3px;
}

.progress i {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  transform: skewX(-20deg);
  transition: background 0.4s, box-shadow 0.4s;
}

.progress i.on {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.step {
  font-size: 12px;
  color: var(--cyan);
  min-width: 40px;
  text-align: right;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-top: 12px;
}

.stat {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr 26px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.stat-label {
  color: var(--c);
  font-weight: 700;
}

.bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
}

.bar i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--c) 0 6px, transparent 6px 8px);
  box-shadow: 0 0 10px var(--c);
  transition: width 0.7s var(--ease);
}

.stat-val {
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.3s;
}

.stat.up .stat-val {
  animation: pop 0.6s var(--ease);
}

.stat.down .stat-val {
  animation: shake 0.45s;
  color: var(--red);
}

@keyframes pop {
  40% {
    transform: scale(1.5);
    color: var(--c);
  }
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-3px);
  }
  40%,
  80% {
    transform: translateX(3px);
  }
}

.float {
  position: absolute;
  right: 0;
  top: -6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--c);
  text-shadow: 0 0 8px var(--c);
  pointer-events: none;
  animation: float-up 1.2s var(--ease) forwards;
}

.stat.down .float {
  color: var(--red);
  text-shadow: 0 0 8px var(--red);
}

@keyframes float-up {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-22px);
  }
}

/* ---------- 场景卡片 ---------- */

.stage {
  flex: 1;
}

.scene-card {
  animation: card-in 0.5s var(--ease) both;
}

.card-leave {
  animation: card-out 0.26s ease-in both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes card-out {
  to {
    opacity: 0;
    transform: translateX(-28px);
  }
}

.scene-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.age {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(245, 255, 59, 0.4);
}

.age small {
  font-size: 14px;
  margin-left: 2px;
  font-family: var(--font);
}

.chapter {
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #05050b;
  background: var(--pink);
}

.dept {
  margin-left: auto;
  font-size: 11px;
}

.scene-title {
  margin: 14px 0 8px;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.3;
}

.scene-text {
  min-height: 4.95em;
  margin: 0 0 20px;
  font-size: 16px;
  color: #cfd3f2;
}

.scene-text.typing::after {
  content: '▍';
  color: var(--cyan);
  animation: blink 0.8s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.options li {
  animation: opt-in 0.45s var(--ease) both;
  animation-delay: calc(0.12s + var(--d) * 0.07s);
}

@keyframes opt-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.option {
  position: relative;
  width: 100%;
  min-height: 60px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 12px;
  text-align: left;
  font-size: 16px;
  line-height: 1.45;
  background: linear-gradient(rgba(18, 18, 40, 0.85), rgba(18, 18, 40, 0.85)) padding-box,
    linear-gradient(110deg, rgba(0, 240, 255, 0.35), rgba(255, 46, 136, 0.25)) border-box;
  border: 1px solid transparent;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: transform 0.18s var(--ease), background 0.25s, opacity 0.3s, filter 0.3s;
  overflow: hidden;
}

.option::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.14), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s var(--ease);
}

.option:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.option:hover:not(:disabled) .opt-key {
  background: var(--cyan);
  color: #05050b;
}

.option:active:not(:disabled) {
  transform: scale(0.98);
}

.opt-key {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
  border: 1px solid var(--line-strong);
  transition: background 0.2s, color 0.2s;
}

.opt-text small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.option.locked {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(0.8);
}

.option.locked .opt-key {
  border-style: dashed;
}

.lock {
  color: var(--red);
}

.chosen .option:not(.picked) {
  opacity: 0.28;
  filter: grayscale(1);
}

.option.picked {
  background: linear-gradient(110deg, rgba(0, 240, 255, 0.22), rgba(255, 46, 136, 0.18)) padding-box,
    linear-gradient(110deg, var(--cyan), var(--pink)) border-box;
  animation: picked 0.5s var(--ease);
}

.option.picked .opt-key {
  background: var(--cyan);
  color: #05050b;
}

@keyframes picked {
  0% {
    transform: scale(0.97);
    filter: brightness(1.8);
  }
  30% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  100% {
    transform: none;
  }
}

/* 选择反馈 */
.feedback {
  margin-top: 16px;
  padding: 16px;
  border-left: 3px solid var(--yellow);
  background: linear-gradient(90deg, rgba(245, 255, 59, 0.08), rgba(245, 255, 59, 0.01));
  animation: fb-in 0.45s var(--ease) both;
}

@keyframes fb-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.fb-text {
  margin: 0 0 12px;
  font-size: 15px;
}

.fb-text::before {
  content: '> ';
  font-family: var(--mono);
  color: var(--yellow);
}

.deltas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.delta {
  padding: 2px 8px;
  font-size: 12px;
  font-family: var(--mono);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--muted);
}

.delta.pos {
  color: var(--c);
  border-color: var(--c);
}

.delta.neg {
  color: var(--red);
  border-color: rgba(255, 59, 92, 0.6);
}

.feedback .btn {
  width: 100%;
}

/* ---------- 结算动画 ---------- */

.settle {
  justify-content: center;
}

.terminal {
  padding: 22px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line);
}

.terminal p {
  margin: 0 0 8px;
  animation: fb-in 0.3s both;
}

.ok {
  color: var(--green);
}

.settle-bar {
  height: 4px;
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.settle-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  animation: settle 1.9s var(--ease) forwards;
}

@keyframes settle {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* ---------- 结局页 ---------- */

.ending {
  gap: 16px;
}

.report-head {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 12px;
  color: var(--accent);
  border-bottom: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
}

.ending-hero {
  position: relative;
  padding: 18px 0 6px;
}

.ending-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.rarity {
  display: inline-block;
  padding: 1px 10px;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 13px;
  color: #05050b;
  background: var(--muted);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}

.r-SSR {
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--cyan));
  background-size: 200% 100%;
  animation: rainbow 3s linear infinite;
}
.r-SR {
  background: var(--pink);
}
.r-R {
  background: var(--cyan);
}
.r-N {
  background: #9aa0c8;
}

@keyframes rainbow {
  to {
    background-position: 200% 0;
  }
}

.stamp {
  position: absolute;
  right: 4px;
  top: -2px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--red);
  border: 3px double var(--red);
  border-radius: 50%;
  transform: rotate(14deg);
  opacity: 0.9;
  animation: stamp 0.6s 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(14deg) scale(2.4);
  }
}

.ending-who {
  margin: 14px 0 4px;
  font-size: 14px;
  color: #b4b9dc;
  padding-right: 72px;
}

.ending-title {
  position: relative;
  margin: 0;
  font-size: clamp(34px, 10.5vw, 48px);
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 0 26px color-mix(in srgb, var(--accent) 70%, transparent);
  text-wrap: balance;
  animation: title-in 0.8s var(--ease) both;
}

@keyframes title-in {
  from {
    opacity: 0;
    letter-spacing: 0.4em;
    filter: blur(8px);
  }
}

.ending-title.glitch::before,
.ending-title.glitch::after {
  -webkit-background-clip: initial;
  background: none;
}

/* 称号：做成一枚发光的"认证铭牌" */
.ending-badge {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  margin: 16px 0 0;
  padding: 8px 16px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 22%, transparent), rgba(16, 16, 34, 0.6));
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 25%, transparent), inset 0 0 14px color-mix(in srgb, var(--accent) 12%, transparent);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  animation: fb-in 0.5s 0.35s var(--ease) both;
}

.badge-label {
  font-size: 12px;
  color: var(--accent);
}

.ending-badge b {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 80%, transparent);
}

/* 金句：分享时最常被截图的部分 */
.ending-quote {
  position: relative;
  margin: 26px 0 0;
  padding: 18px 18px 16px;
  font-size: 20px;
  text-wrap: pretty;
  font-weight: 800;
  line-height: 1.55;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 75%);
  border-left: 3px solid var(--accent);
  animation: fb-in 0.5s 0.5s var(--ease) both;
}

.q-mark {
  position: absolute;
  right: 12px;
  top: -30px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 76px;
  line-height: 1;
  color: var(--accent);
  opacity: 0.4;
  pointer-events: none;
}

.story p {
  margin: 0 0 12px;
  font-size: 15px;
  color: #d4d8f5;
}

.story p:last-child {
  margin: 0;
}

/* 雷达图在上、四项数值 2×2 在下：窄屏也不会把图表压得太小 */
.final-grid {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.radar {
  display: block;
  width: min(100%, 240px);
  overflow: visible;
}

.radar text {
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font);
}

.radar-grid {
  fill: none;
  stroke: rgba(0, 240, 255, 0.2);
  stroke-width: 1;
}

.radar-shape {
  fill: color-mix(in srgb, var(--accent) 28%, transparent);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  transform-origin: 110px 110px;
  animation: radar-in 0.9s 0.3s var(--ease) both;
}

@keyframes radar-in {
  from {
    transform: scale(0);
    opacity: 0;
  }
}

.final-stats {
  list-style: none;
  width: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
}

.final-stats li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  font-size: 14px;
  font-weight: 700;
  color: var(--c);
}

.final-stats b {
  font-size: 22px;
  color: var(--text);
}

.epi {
  margin: 0;
  padding-left: 1.2em;
  font-size: 14px;
  color: #d4d8f5;
  display: grid;
  gap: 6px;
}

.timeline summary {
  cursor: pointer;
  list-style: none;
  margin: 0;
}

.timeline summary::-webkit-details-marker {
  display: none;
}

.timeline summary::after {
  content: ' ▾';
}

.timeline[open] summary::after {
  content: ' ▴';
}

.timeline ol {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.timeline li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  font-size: 14px;
}

.timeline li > span {
  color: var(--yellow);
}

.timeline li b {
  font-size: 14px;
}

.timeline li p {
  margin: 2px 0 0;
  color: #aeb3d8;
}

.collect {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
}

/* 操作区放在正常文档流中，不再悬浮覆盖属性面板 */
.ending-actions {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.ending-actions .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------- 图鉴 ---------- */

.collect-bar {
  height: 6px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.collect-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  box-shadow: 0 0 10px var(--pink);
}

.ending-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ending-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 118px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}

.ending-cell.on {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, transparent), var(--panel));
}

.ending-cell .rarity {
  align-self: flex-start;
  font-size: 11px;
}

.ending-cell.off .rarity {
  background: rgba(255, 255, 255, 0.12);
  color: var(--dim);
  animation: none;
}

.cell-no {
  position: absolute;
  right: 14px;
  top: 10px;
  font-size: 11px;
  color: var(--dim);
}

.ending-cell b {
  font-size: 15px;
  line-height: 1.35;
}

.ending-cell.off b {
  color: var(--dim);
  letter-spacing: 0.2em;
}

.ending-cell small {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.roadmap {
  margin-top: 28px;
}

.road-item {
  position: relative;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
}

.road-item b {
  display: block;
  padding-right: 100px;
  font-size: 15px;
}

.road-item p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.road-item .chip {
  position: absolute;
  right: 12px;
  top: 14px;
  font-size: 10px;
  color: var(--dim);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ---------- 弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 8, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s;
}

.modal-body {
  position: relative;
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px 18px 18px;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 60px rgba(0, 240, 255, 0.15);
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  transition: opacity 0.22s, transform 0.3s var(--ease);
}

.modal.open .modal-backdrop,
.modal.open .modal-body {
  opacity: 1;
  transform: none;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 20px;
}

.modal-text {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
}

.modal-text.center {
  text-align: center;
  margin: 12px 0 14px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1 1 auto;
}

.modal-x {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 36px;
  height: 36px;
  color: var(--muted);
  font-size: 16px;
}

.share-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 750 / 1334;
  max-height: 58dvh;
  margin: 0 auto;
  background: #05050b;
  border: 1px solid var(--line);
}

.share-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-touch-callout: default;
  animation: fb-in 0.4s both;
}

.loader {
  font-size: 13px;
  color: var(--cyan);
  animation: blink 1s steps(1) infinite;
}

/* ---------- 桌面端 ---------- */

@media (min-width: 768px) {
  .app {
    max-width: 520px;
  }

  .screen {
    padding-left: 28px;
    padding-right: 28px;
  }

  .hud {
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
  }

  .app::before,
  .app::after {
    /* 两侧的竖排装饰字 */
    position: fixed;
    top: 50%;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.5em;
    color: rgba(0, 240, 255, 0.25);
    writing-mode: vertical-rl;
    transform: translateY(-50%);
    pointer-events: none;
  }

  .app::before {
    content: 'CYBER WORKER FATE SIMULATOR // 2026';
    left: calc(50% - 330px);
  }

  .app::after {
    content: '加班 · 内卷 · 福报 · 躺平 · 摸鱼';
    right: calc(50% - 330px);
    font-family: var(--font);
    color: rgba(255, 46, 136, 0.28);
  }
}

@media (min-width: 768px) and (min-height: 760px) {
  .hero {
    margin-top: 6vh;
  }
}

/* ---------- 无障碍：减少动画 ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .glitch::before,
  .glitch::after {
    display: none;
  }
}
