/* ============================================================
   AI防痨，健康同行 · 寝室里的结核恶魔
   赛博朋克 / 暗黑 · 纯 CSS，无任何外部图片
   ============================================================ */

:root {
  --bg: #04060b;
  --bg-2: #070c14;
  --panel: #0a0f18;
  --line: rgba(53, 240, 224, 0.22);
  --line-soft: rgba(120, 170, 190, 0.14);
  --cyan: #35f0e0;
  --cyan-dim: #1d8f89;
  --mag: #ff3ea5;
  --amber: #ffc247;
  --red: #ff4d5e;
  --ink: #d6e6ea;
  --ink-dim: #7f959e;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 78% -10%, rgba(255, 62, 165, 0.16), transparent 62%),
    radial-gradient(820px 560px at 8% 108%, rgba(53, 240, 224, 0.14), transparent 60%),
    linear-gradient(180deg, #05080f, var(--bg) 55%);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 网格底纹 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(53, 240, 224, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 240, 224, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

/* 扫描线 + 噪点 */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0 2px,
    rgba(0, 0, 0, 0.22) 2px 4px
  );
  opacity: 0.5;
  mix-blend-mode: multiply;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 59;
  pointer-events: none;
  opacity: 0.05;
  background-image: radial-gradient(#fff 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

/* ------------------------------------------------------------ 顶部 HUD */

.hud {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(4, 6, 11, 0.94), rgba(4, 6, 11, 0.55));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}

.hud__left, .hud__right { display: flex; align-items: center; gap: 10px; min-width: 0; }

.hud__brand {
  font-weight: 900;
  font-size: clamp(13px, 1.5vw, 16px);
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(53, 240, 224, 0.45);
  white-space: nowrap;
}

.hud__sep { color: var(--line); }

.hud__chapter {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud__hplabel {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.hpbar {
  position: relative;
  width: clamp(96px, 18vw, 200px);
  height: 10px;
  background: #0b1520;
  border: 1px solid rgba(53, 240, 224, 0.3);
  overflow: hidden;
}

.hpbar__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--mag), var(--cyan));
  box-shadow: 0 0 16px rgba(53, 240, 224, 0.55);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s;
}

.hpbar.is-low .hpbar__fill {
  background: linear-gradient(90deg, #ff8a3d, var(--red));
  box-shadow: 0 0 16px rgba(255, 77, 94, 0.6);
}

.hpbar.is-shake { animation: hpShake 0.45s ease-out; }

@keyframes hpShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

.hpbar__ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 11px, rgba(3, 6, 11, 0.85) 11px 13px);
  pointer-events: none;
}

.hud__hpnum {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  min-width: 2.4em;
  text-align: right;
}

/* ---------------------------------------------------------------- 舞台 */

.stage {
  position: relative;
  z-index: 10;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(20px, 5vh, 56px) clamp(14px, 4vw, 28px) 96px;
}

.panel {
  position: relative;
  padding: clamp(20px, 3.4vw, 36px);
  background: linear-gradient(180deg, rgba(12, 20, 32, 0.92), rgba(6, 10, 17, 0.96));
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 80px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* 四角括号 */
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid var(--cyan);
  opacity: 0.75;
}
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.panel__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px dashed rgba(53, 240, 224, 0.18);
}

.panel__scene {
  font-family: var(--mono);
  font-size: clamp(15px, 2.2vw, 19px);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--amber);
  text-shadow: 0 0 16px rgba(255, 194, 71, 0.35);
}

.panel__code {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
}

.text {
  font-size: clamp(15px, 1.55vw, 17px);
  line-height: 2;
  letter-spacing: 0.02em;
  color: #cfdfe4;
  min-height: 6.5em;
  cursor: pointer;
  outline: none;
}

.text p { margin: 0 0 1.05em; }
.text p:last-child { margin-bottom: 0; }

.text .typing::after {
  content: "▌";
  color: var(--cyan);
  animation: caret 1s steps(1) infinite;
}

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

/* 防痨笔记 */
.note {
  position: relative;
  margin: 22px 0 4px;
  padding: 14px 16px 14px 18px;
  background: rgba(53, 240, 224, 0.06);
  border-left: 2px solid var(--cyan);
  animation: noteIn 0.4s ease-out;
}

@keyframes noteIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}

.note__tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  color: var(--cyan);
  margin-bottom: 7px;
}

.note__body {
  margin: 0;
  font-size: clamp(13px, 1.35vw, 14.5px);
  line-height: 1.9;
  color: #a9c6cc;
}

/* ---------------------------------------------------------------- 选项 */

.choices {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.choice {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line-soft);
  border-left: 2px solid rgba(53, 240, 224, 0.35);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.14s, box-shadow 0.16s;
  animation: choiceIn 0.32s ease-out backwards;
}

@keyframes choiceIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.choice:hover, .choice:focus-visible {
  background: rgba(53, 240, 224, 0.08);
  border-color: var(--cyan);
  border-left-color: var(--cyan);
  transform: translateX(4px);
  box-shadow: -4px 0 24px rgba(53, 240, 224, 0.16);
  outline: none;
}

.choice__idx {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan-dim);
  letter-spacing: 0.08em;
}

.choice__body { min-width: 0; }

.choice__label {
  display: block;
  font-size: clamp(14px, 1.45vw, 15.5px);
  line-height: 1.55;
}

.choice__sub {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-dim);
}

.choice__cost {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
  white-space: nowrap;
}

.choice.is-done { opacity: 0.35; pointer-events: none; }

/* --------------------------------------------------------- 左下角校名 */

.corner-school {
  position: fixed;
  left: clamp(14px, 3vw, 28px);
  bottom: clamp(12px, 2.4vh, 22px);
  /* 必须压在所有弹层之上，任何界面都能看见 */
  z-index: 70;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.42em;
  color: rgba(214, 230, 234, 0.55);
  text-shadow: 0 0 12px rgba(53, 240, 224, 0.22);
  pointer-events: none;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.06em;
  padding: 12px 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.btn:hover { border-color: var(--cyan); color: #fff; box-shadow: 0 0 24px rgba(53, 240, 224, 0.2); }

.btn--primary {
  color: #04060b;
  background: var(--cyan);
  border-color: var(--cyan);
  font-weight: 700;
  box-shadow: 0 0 28px rgba(53, 240, 224, 0.35);
}

.btn--primary:hover { background: #6ffff2; color: #04060b; box-shadow: 0 0 40px rgba(53, 240, 224, 0.55); }

.btn__key { font-size: 11px; }

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

/* ---------------------------------------------------------------- 弹层 */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(3, 5, 9, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.boot, .over, .gal {
  width: min(720px, 100%);
  padding: clamp(22px, 3.6vw, 42px);
  background: linear-gradient(180deg, rgba(10, 16, 26, 0.97), rgba(5, 8, 14, 0.99));
  border: 1px solid var(--line);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
  animation: popIn 0.36s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.boot__line {
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--cyan-dim);
}

/* 故障标题 */
.glitch {
  position: relative;
  margin: 0 0 10px;
  font-size: clamp(28px, 5.6vw, 52px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #eafcff;
  text-shadow: 0 0 24px rgba(53, 240, 224, 0.35);
}

.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}

.glitch::before {
  color: var(--mag);
  transform: translate(-2px, 0);
  clip-path: polygon(0 12%, 100% 12%, 100% 34%, 0 34%);
  animation: glitchA 4.2s infinite steps(1);
  opacity: 0.75;
}

.glitch::after {
  color: var(--cyan);
  transform: translate(2px, 0);
  clip-path: polygon(0 62%, 100% 62%, 100% 84%, 0 84%);
  animation: glitchB 3.6s infinite steps(1);
  opacity: 0.75;
}

@keyframes glitchA {
  0%, 92%, 100% { transform: translate(-2px, 0); opacity: 0.6; }
  93% { transform: translate(-6px, -2px); opacity: 0.9; }
  95% { transform: translate(4px, 1px); opacity: 0.9; }
  97% { transform: translate(-2px, 0); opacity: 0.6; }
}

@keyframes glitchB {
  0%, 90%, 100% { transform: translate(2px, 0); opacity: 0.6; }
  91% { transform: translate(6px, 2px); opacity: 0.9; }
  94% { transform: translate(-4px, -1px); opacity: 0.9; }
  96% { transform: translate(2px, 0); opacity: 0.6; }
}

.boot__sub {
  margin: 0 0 24px;
  font-family: var(--mono);
  font-size: clamp(13px, 1.6vw, 15px);
  letter-spacing: 0.22em;
  color: var(--cyan);
}

.caret { animation: caret 1.1s steps(1) infinite; }

.boot__desc {
  margin: 0 auto 24px;
  max-width: 30em;
  font-size: 14px;
  line-height: 2;
  color: #b6ccd2;
}

.boot__meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.boot__meta span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  padding: 4px 10px;
  border: 1px solid var(--line-soft);
}

.boot__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.boot__tip {
  margin: 22px 0 0;
  font-size: 11.5px;
  color: #55686f;
  letter-spacing: 0.05em;
}

/* ---------------------------------------------------------------- 结算 */

.over { text-align: left; }
.over > * { text-align: left; }
.over .over__tag, .over .over__actions { text-align: center; }

.over__tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  padding: 5px 12px;
  margin-bottom: 14px;
  color: var(--cyan);
  border: 1px solid var(--line);
}

.over__tag.is-bad { color: var(--red); border-color: rgba(255, 77, 94, 0.5); }
.over__tag.is-hidden { color: var(--amber); border-color: rgba(255, 194, 71, 0.5); }

.over__name {
  margin: 0 0 16px;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #f0fdff;
  text-shadow: 0 0 24px rgba(53, 240, 224, 0.3);
}

.over__text p {
  margin: 0 0 1em;
  font-size: 14.5px;
  line-height: 2;
  color: #c2d6db;
}

.over__note {
  margin: 20px 0;
  padding: 14px 16px 14px 18px;
  background: rgba(53, 240, 224, 0.06);
  border-left: 2px solid var(--cyan);
}

.review {
  margin: 22px 0;
  padding: 16px 18px;
  border: 1px dashed rgba(53, 240, 224, 0.22);
}

.review__title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
}

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

.review__list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: #9fb6bc;
}

.review__list li.on { color: var(--ink); }

.mark {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line-soft);
  color: #4a5b62;
}

.review__list li.on .mark { color: #04060b; background: var(--cyan); border-color: var(--cyan); }

.review__desc { color: #66808a; font-size: 12px; margin-left: auto; }

.over__stats {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  margin: 18px 0;
  text-align: center;
}

.over__stats b { color: var(--cyan); font-weight: 700; }

.over__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

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

.gal__kicker {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.4em;
  color: var(--cyan-dim);
}

.gal__title {
  margin: 0 0 22px;
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #f0fdff;
}

.gal__grid {
  display: grid;
  gap: 12px;
  text-align: left;
}

.card {
  position: relative;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}

.card.is-locked { opacity: 0.45; border-style: dashed; }

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card__name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #eafcff;
}

.card__label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--cyan);
}

.card__label.bad { color: var(--red); }
.card__label.hidden { color: var(--amber); }

.card__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.85;
  color: #96aeb5;
}

.card__count {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: #5d727a;
}

.gal__note {
  margin: 18px 0 22px;
  font-size: 12px;
  line-height: 1.8;
  color: #5d727a;
  text-align: center;
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 640px) {
  .hud { flex-wrap: wrap; row-gap: 8px; }
  .hud__chapter { display: none; }
  .hud__sep { display: none; }
  .stage { padding-bottom: 84px; }
  .panel { padding: 18px 16px; }
  .text { line-height: 1.95; min-height: 8em; }
  .choice { grid-template-columns: 26px 1fr; gap: 9px; padding: 12px 13px; }
  .choice__cost { grid-column: 2; }
  .corner-school { font-size: 11px; letter-spacing: 0.34em; }
  .boot, .over, .gal { padding: 22px 18px; }
  .review__desc { display: none; }
}

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