:root {
  --bg: #0b0614;
  --bg2: #140b24;
  --line: #2c1d47;
  --fg: #f3e9ff;
  --mute: #8f7fb0;
  --pink: #ff3ea5;
  --cyan: #3ef2ff;
  --lime: #b8ff3e;
  --amber: #ffb02e;
  --violet: #9b6bff;
  --px: "Press Start 2P", "ZCOOL QingKe HuangYou", monospace;
  --vt: "VT323", "ZCOOL QingKe HuangYou", "PingFang SC", monospace;
  --zh: "ZCOOL QingKe HuangYou", "PingFang SC", sans-serif;
  --pad: clamp(16px, 4vw, 56px);
  --step: steps(6, end);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  color: var(--fg); font-family: var(--vt); font-size: 22px; line-height: 1.35;
  overflow-x: hidden; -webkit-font-smoothing: none; image-rendering: pixelated;
}
::selection { background: var(--pink); color: var(--bg); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.px { font-family: var(--px); letter-spacing: 0.04em; }
.vt { font-family: var(--vt); }
.tiny { font-size: 10px; color: var(--mute); }
.small { font-size: 13px; }

/* ---------- 背景与 CRT ---------- */
#sky { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -2; display: block; image-rendering: pixelated; }
.crt { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.crt::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.crt::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.55) 100%);
  animation: flicker 4s infinite steps(1);
}
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.92; } 48% { opacity: 1; } 73% { opacity: 0.96; } }
.cursor {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; width: 14px; height: 14px; margin: -7px;
  background: var(--lime); mix-blend-mode: difference; transition: width 0.15s var(--step), height 0.15s var(--step), margin 0.15s;
  clip-path: polygon(0 0, 100% 50%, 45% 55%, 40% 100%);
}
.cursor.is-hover { width: 24px; height: 24px; margin: -12px; background: var(--pink); }
@media (hover: none) { .cursor { display: none; } }

.boot {
  position: fixed; inset: 0; z-index: 80; background: #000; color: var(--lime); padding: 6vh 6vw;
  font-family: var(--vt); font-size: 22px; transition: opacity 0.4s steps(4);
}
.boot pre { white-space: pre-wrap; font: inherit; text-shadow: 0 0 6px currentColor; }
.boot.is-done { opacity: 0; pointer-events: none; }

/* ---------- 顶栏 ---------- */
.bar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 20px; justify-content: space-between;
  padding: 8px var(--pad); background: rgba(11, 6, 20, 0.86); border-bottom: 2px solid var(--line); backdrop-filter: blur(6px);
}
.bar__title { font-size: 12px; color: var(--lime); text-shadow: 0 0 8px rgba(184, 255, 62, 0.6); white-space: nowrap; }
.bar__menu { display: flex; gap: clamp(10px, 2.4vw, 30px); font-size: 22px; }
.bar__menu a { position: relative; color: var(--mute); }
.bar__menu a:hover { color: var(--fg); }
.bar__menu a:hover::before { content: "▸"; position: absolute; left: -0.8em; color: var(--pink); }
.bar__right { display: flex; gap: 14px; align-items: center; color: var(--mute); font-size: 20px; }
.bar__sound { border: 2px solid var(--line); padding: 0 8px; }
.bar__sound.is-on { color: var(--lime); border-color: var(--lime); }
@media (max-width: 760px) { .bar__menu { display: none; } }

/* ---------- 像素边框 ---------- */
.pxbox, .cab, .term, .panel, .cart, .day {
  border: 0;
  box-shadow:
    0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
    8px 8px 0 0 rgba(0, 0, 0, 0.55);
}

/* ---------- HERO / ARCADE ---------- */
.arcade { padding: 22px var(--pad) 30px; min-height: calc(100svh - 50px); display: flex; flex-direction: column; gap: 18px; }
.arcade__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.name {
  font-family: var(--px); font-weight: 400; font-size: clamp(28px, 4.6vw, 64px); line-height: 1.05; margin: 10px 0 6px;
  color: var(--fg); text-shadow: 4px 4px 0 var(--pink), 8px 8px 0 var(--violet); user-select: none; position: relative;
}
.name .l { display: inline-block; cursor: grab; will-change: transform; }
.name .l:active { cursor: grabbing; }
.tagline { font-size: clamp(22px, 2.6vw, 32px); color: var(--cyan); min-height: 1.3em; }
.caret { animation: blink 1s steps(1) infinite; color: var(--lime); }
@keyframes blink { 50% { opacity: 0; } }
.blink-soft { animation: blink 1.6s steps(1) infinite; color: var(--lime); }

.score { text-align: right; padding: 10px 16px; background: rgba(11, 6, 20, 0.78); box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line); }
.who { padding: 6px 0; }
.tagline { background: rgba(11, 6, 20, 0.6); display: inline-block; padding: 0 8px; }
.odo { font-family: var(--px); font-size: clamp(18px, 2.4vw, 34px); color: var(--amber); text-shadow: 0 0 12px rgba(255, 176, 46, 0.7); letter-spacing: 0.06em; margin: 8px 0 4px; display: flex; justify-content: flex-end; }
.odo .d { display: inline-block; height: 1.15em; overflow: hidden; position: relative; }
.odo .d > span { display: block; transition: transform 1.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.odo .d > span > i { display: block; font-style: normal; height: 1.15em; line-height: 1.15em; }
.odo .sep { opacity: 0.5; }
.score__sub { color: var(--mute); }

.cab { background: rgba(10, 5, 18, 0.82); flex: 1; display: flex; }
.cab__screen { flex: 1; display: flex; flex-direction: column; padding: 10px 12px 8px; min-width: 0; }
.cab__toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 20px; padding-bottom: 8px; border-bottom: 2px dashed var(--line); }
.cab__hint { color: var(--mute); margin-left: auto; font-size: 18px; }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg button { padding: 0 10px; color: var(--mute); border: 2px solid var(--line); line-height: 1.3; }
.seg button:hover { color: var(--fg); border-color: var(--mute); }
.seg button.is-on { color: var(--bg); background: var(--lime); border-color: var(--lime); }
.seg button .sw { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: 1px; }

.cab__body { flex: 1; display: grid; grid-template-columns: 1fr minmax(280px, 340px); gap: 14px; padding-top: 10px; min-height: 360px; }
.city { position: relative; min-height: 320px; }
.city canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; cursor: crosshair; }
.city__tip {
  position: absolute; pointer-events: none; padding: 4px 10px; background: var(--fg); color: var(--bg); font-size: 18px;
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; display: none; z-index: 3;
  box-shadow: 4px 4px 0 var(--pink);
}

.day { background: rgba(20, 11, 36, 0.92); display: flex; flex-direction: column; min-height: 0; max-height: 560px; }
.day__head { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; text-align: center; padding: 10px 6px; border-bottom: 2px solid var(--line); }
.day__head h3 { font-size: 34px; font-weight: 400; color: var(--amber); line-height: 1; margin-top: 4px; }
.day__nav { font-size: 18px; color: var(--cyan); height: 34px; }
.day__nav:hover { color: var(--bg); background: var(--cyan); }
.day__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 14px; border-bottom: 2px solid var(--line); font-size: 19px; }
.day__stats span { color: var(--mute); }
.day__stats b { font-weight: 400; color: var(--fg); text-align: right; }
.day__list { list-style: none; overflow-y: auto; padding: 6px 10px 10px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.day__list li { padding: 6px 4px 7px; border-bottom: 1px dashed var(--line); animation: slideIn 0.35s steps(5) both; animation-delay: calc(var(--i) * 40ms); }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }
.day__row { display: flex; justify-content: space-between; gap: 8px; font-size: 19px; }
.day__row .m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day__row .m i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.day__row b { font-weight: 400; color: var(--amber); }
.day__meta { display: flex; justify-content: space-between; color: var(--mute); font-size: 16px; }
.day__bar { height: 6px; background: rgba(255, 255, 255, 0.06); margin: 3px 0 2px; display: flex; }
.day__bar span { height: 100%; animation: barIn 0.6s steps(8) both; transform-origin: left; }
@keyframes barIn { from { transform: scaleX(0); } }
.day__empty { color: var(--mute); padding: 24px 8px; text-align: center; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-top: 8px; font-size: 18px; color: var(--mute); }
.legend span { cursor: pointer; }
.legend span:hover, .legend span.is-on { color: var(--fg); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: 0; }
@media (max-width: 900px) {
  .cab__body { grid-template-columns: 1fr; }
  .city { min-height: 260px; }
  .score { text-align: left; } .odo { justify-content: flex-start; }
  .cab__hint { display: none; }
}

/* ---------- Ticker ---------- */
.ticker { overflow: hidden; background: var(--pink); color: var(--bg); border-block: 4px solid var(--bg); font-size: 24px; }
.ticker__track { display: flex; gap: 40px; width: max-content; padding: 4px 0; animation: tick 60s linear infinite; }
.ticker__track span { white-space: nowrap; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---------- Section ---------- */
.section { padding: 12vh var(--pad) 6vh; }
.head { margin-bottom: 6vh; }
.zh-title { font-family: var(--zh); font-weight: 400; font-size: clamp(48px, 9vw, 120px); line-height: 1; margin-top: 10px; color: var(--fg); text-shadow: 5px 5px 0 var(--violet); }
.head .sub { color: var(--mute); margin-top: 12px; max-width: 46ch; }
.head .sub b { color: var(--lime); font-weight: 400; }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s steps(6), transform 0.6s steps(6); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- 卡带 ---------- */
.carts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 34px 28px; }
.cart { position: relative; background: var(--bg2); display: flex; flex-direction: column; transition: transform 0.2s steps(3); --h: 300; }
.cart:hover { transform: translate(-4px, -6px); box-shadow: 0 -4px 0 0 hsl(var(--h) 90% 60%), 0 4px 0 0 hsl(var(--h) 90% 60%), -4px 0 0 0 hsl(var(--h) 90% 60%), 4px 0 0 0 hsl(var(--h) 90% 60%), 12px 14px 0 0 rgba(0, 0, 0, 0.6); }
.cart__notch { height: 16px; background: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 16px); margin: 8px 18px 0; }
.cart__label { margin: 10px 14px 0; background: hsl(var(--h) 85% 58%); color: var(--bg); padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; }
.cart__label .px { font-size: 9px; }
.cart__shot { position: relative; margin: 10px 14px 0; aspect-ratio: 16 / 10; overflow: hidden; background: #000; }
.cart__shot img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; filter: contrast(1.1) saturate(1.1); transition: transform 0.4s steps(4); }
.cart__shot::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.25) 0 2px, transparent 2px 4px); pointer-events: none; }
.cart:hover .cart__shot img { transform: scale(1.06); }
.cart__shot .ph { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--zh); font-size: 54px; color: hsl(var(--h) 90% 65%); }
.cart__shot .play {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--px); font-size: 14px; color: var(--fg);
  background: rgba(11, 6, 20, 0.6); opacity: 0; transition: opacity 0.2s steps(2); z-index: 2;
}
.cart:hover .cart__shot .play { opacity: 1; }
.cart__shot .play span { animation: blink 0.8s steps(1) infinite; }
.cart__body { padding: 12px 16px 16px; display: grid; gap: 6px; flex: 1; align-content: start; }
.cart__title { font-family: var(--zh); font-weight: 400; font-size: 30px; line-height: 1.05; }
.cart__desc { color: var(--mute); font-size: 19px; line-height: 1.25; }
.cart__tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 17px; color: hsl(var(--h) 90% 70%); }
.cart__tags span::before { content: "#"; }
.cart__btns { display: flex; gap: 10px; margin-top: 6px; }
.btn { padding: 2px 12px; border: 2px solid currentColor; font-size: 20px; color: var(--fg); }
.btn:hover { background: var(--fg); color: var(--bg); }
.btn--go { color: var(--bg); background: hsl(var(--h) 90% 62%); border-color: hsl(var(--h) 90% 62%); }
.btn--go:hover { background: var(--fg); border-color: var(--fg); }

.shelf { margin-top: 12vh; }
.shelf__head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; color: var(--cyan); }
.shelf__list { list-style: none; border-top: 2px solid var(--line); }
.shelf__list li { border-bottom: 2px solid var(--line); }
.shelf__list li.is-hidden { display: none; }
.shelf__list a { display: grid; grid-template-columns: 60px minmax(0, 1fr) minmax(0, 2fr) 120px 60px; gap: 16px; padding: 8px 6px; align-items: center; }
.shelf__list a:hover { background: var(--cyan); color: var(--bg); }
.shelf__list a:hover .s-desc, .shelf__list a:hover .s-meta, .shelf__list a:hover .s-year { color: var(--bg); }
.s-year { color: var(--mute); }
.s-name { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf__list a:hover .s-name { color: var(--bg); }
.s-desc, .s-meta { color: var(--mute); font-size: 19px; }
.s-star { text-align: right; color: var(--amber); }
@media (max-width: 760px) { .shelf__list a { grid-template-columns: 48px 1fr auto; } .s-desc { grid-column: 2 / 4; } .s-meta { display: none; } }

/* ---------- 终端 ---------- */
.term { background: rgba(3, 8, 3, 0.92); color: var(--lime); max-width: 1100px; }
.term__bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--line); color: var(--mute); font-size: 18px; }
.term__bar i { width: 12px; height: 12px; background: var(--pink); }
.term__bar i:nth-child(2) { background: var(--amber); } .term__bar i:nth-child(3) { background: var(--lime); }
.term__bar span { margin-left: 10px; }
.term__out { height: min(56vh, 480px); overflow-y: auto; padding: 14px 18px; white-space: pre-wrap; word-break: break-word; text-shadow: 0 0 6px rgba(184, 255, 62, 0.45); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.term__out .c { color: var(--cyan); } .term__out .p { color: var(--pink); } .term__out .a { color: var(--amber); } .term__out .m { color: var(--mute); }
.term__out a { color: var(--cyan); text-decoration: underline; }
.term__in { display: flex; gap: 10px; padding: 8px 18px 12px; border-top: 2px dashed var(--line); }
.term__in label { color: var(--pink); }
.term__in input { flex: 1; background: transparent; border: 0; outline: none; color: var(--lime); font: inherit; caret-color: var(--lime); }
.term__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 14px; }
.term__chips button { border: 2px solid var(--line); padding: 0 10px; color: var(--mute); font-size: 19px; }
.term__chips button:hover { color: var(--bg); background: var(--lime); border-color: var(--lime); }

/* ---------- 账本表 ---------- */
.panel { background: rgba(20, 11, 36, 0.9); }
.panel__tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 2px solid var(--line); font-size: 20px; }
.panel__tabs button { padding: 0 12px; border: 2px solid var(--line); color: var(--mute); }
.panel__tabs button.is-on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.panel__tabs input { margin-left: auto; background: transparent; border: 2px solid var(--line); color: var(--fg); font: inherit; padding: 0 10px; outline: none; min-width: 180px; }
.panel__tabs input:focus { border-color: var(--lime); }
.panel__wrap { max-height: 620px; overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 20px; }
.tbl th { position: sticky; top: 0; background: #1b1030; text-align: left; font-weight: 400; color: var(--mute); padding: 6px 12px; cursor: pointer; white-space: nowrap; border-bottom: 2px solid var(--line); }
.tbl th.is-sorted { color: var(--lime); }
.tbl td { padding: 4px 12px; border-bottom: 1px dashed rgba(255, 255, 255, 0.06); white-space: nowrap; }
.tbl tbody tr:hover { background: rgba(62, 242, 255, 0.08); }
.tbl tbody tr { animation: slideIn 0.3s steps(4) both; animation-delay: calc(var(--i) * 15ms); }
.num { text-align: right !important; }
.chip i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.chip { color: var(--mute); }
.pbar { display: flex; height: 10px; min-width: 140px; background: rgba(255, 255, 255, 0.05); }
.pbar span { height: 100%; }
.panel__foot { padding: 8px 12px; color: var(--mute); border-top: 2px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: 18px; }
.panel__foot i { display: inline-block; width: 10px; height: 10px; margin: 0 6px 0 12px; }

/* ---------- 联系 ---------- */
.coins { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.coins a { display: flex; flex-direction: column; gap: 10px; padding: 22px 20px; background: var(--bg2); box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line), 8px 8px 0 0 rgba(0, 0, 0, 0.55); transition: transform 0.15s steps(2); }
.coins a span { font-size: 12px; color: var(--pink); }
.coins a b { font-weight: 400; font-size: 26px; word-break: break-all; }
.coins a:hover { background: var(--lime); color: var(--bg); transform: translate(-3px, -4px); }
.coins a:hover span { color: var(--bg); }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 10vh; color: var(--mute); font-size: 18px; }

/* 秘籍 */
body.konami .name { animation: rainbow 1s steps(8) infinite; }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }
.shake { animation: shake 0.4s steps(4); }
@keyframes shake { 25% { transform: translate(4px, -2px); } 50% { transform: translate(-4px, 2px); } 75% { transform: translate(2px, 3px); } }

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