/* =========================================================
   像素英雄 · 样式
   ---------------------------------------------------------
   设计语言：深色底 + 玻璃面板 + 细描边 + 金色/青色点缀。
   所有面板统一用 .panel，边框统一 1px rgba(255,255,255,.09)。
   ========================================================= */

:root {
  --bg:       #070910;
  --bg-2:     #0d1119;
  --panel:    rgba(14, 18, 28, .74);
  --panel-2:  rgba(20, 26, 38, .92);
  --line:     rgba(255, 255, 255, .09);
  --line-2:   rgba(255, 255, 255, .16);
  --ink:      #e9eef7;
  --ink-dim:  #93a0b8;
  --ink-dim2: #5b6579;
  --gold:     #f0cf7a;
  --gold-2:   #b98c3c;
  --red:      #ff5b5b;
  --red-2:    #a32b2b;
  --green:    #55c98a;
  --green-2:  #2c8f5f;
  --blue:     #5aa9e6;
  --blue-2:   #2f6ea8;
  --purple:   #b79cf0;

  --r-sm: 4px;
  --r:    8px;
  --r-lg: 12px;

  --font: ui-monospace, "Cascadia Mono", Consolas, "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   首页
   ========================================================= */

body.home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
  overflow-x: hidden;

  background-color: #06050c;
  background-image:
    radial-gradient(ellipse 70% 55% at 14% -8%,  rgba(126, 62, 210, .40), transparent 62%),
    radial-gradient(ellipse 62% 50% at 90% 4%,   rgba(48, 128, 214, .30), transparent 58%),
    radial-gradient(ellipse 90% 55% at 50% 112%, rgba(206, 76, 128, .28), transparent 62%),
    radial-gradient(ellipse at 50% 45%, #12101d 0%, #06050c 100%);
  background-attachment: fixed;
}

/* 很淡的网格底纹 */
body.home::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, #000 18%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 18%, transparent 76%);
}

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

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: .48;
  animation: orbFloat 24s ease-in-out infinite;
}

.orb.o1 { width: 340px; height: 340px; left: -80px;  top: -60px;  background: #8b46e0; animation-duration: 19s; }
.orb.o2 { width: 280px; height: 280px; right: -60px; top: 10%;     background: #2f8fd8; animation-duration: 26s; animation-delay: -7s; }
.orb.o3 { width: 400px; height: 400px; left: 40%;    bottom: -170px; background: #d84f86; animation-duration: 31s; animation-delay: -14s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(36px, -28px) scale(1.10); }
  66%      { transform: translate(-28px, 22px) scale(0.94); }
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 34%, rgba(0,0,0,.68) 100%);
}

.home-wrap {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
  max-width: 440px;
  animation: rise .5s ease both;
}

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

.logo h1 {
  margin: 0;
  font-size: 42px;
  letter-spacing: 16px;
  text-indent: 16px;
  background: linear-gradient(180deg, #fff8dc 0%, #ffdc7a 34%, #e8a63f 64%, #c9601f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 16px rgba(240, 168, 68, .45));
}

.logo .sub {
  margin: 14px 0 0;
  font-size: 10px;
  letter-spacing: 8px;
  text-indent: 8px;
  color: #8b7fb0;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 40px 0 0;
}

.menu-btn {
  --accent: var(--blue);

  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;

  background: linear-gradient(180deg, rgba(30,36,52,.82), rgba(16,20,30,.86));
  backdrop-filter: blur(8px);
  transition: border-color .15s, box-shadow .15s, background .15s, transform .08s;
}

/* 左侧彩色竖条 */
.menu-btn::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

/* 右侧一抹光晕 */
.menu-btn::after {
  content: '';
  position: absolute;
  right: -50px; top: -50px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .12;
  filter: blur(30px);
  transition: opacity .18s;
}

.menu-btn .ico {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
}

.menu-btn .txt { display: flex; flex-direction: column; gap: 4px; }

.menu-btn.guest   { --accent: #55c98a; }
.menu-btn.account { --accent: #5aa9e6; }
.menu-btn.intro   { --accent: #f0cf7a; }

.menu-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 32px rgba(0,0,0,.6);
  background: linear-gradient(180deg, rgba(38,46,66,.92), rgba(20,26,38,.94));
}

.menu-btn:hover::after { opacity: .26; }
.menu-btn:active { transform: translateY(1px); }

.menu-btn .k {
  display: block;
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--accent);
}

.menu-btn .d {
  display: block;
  font-size: 11px;
  letter-spacing: .5px;
  color: var(--ink-dim);
}

.who-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 22px 0 0;
  min-height: 26px;
  flex-wrap: wrap;
}

.who { margin: 0; font-size: 12px; color: var(--gold); letter-spacing: 1px; }

.logout {
  padding: 6px 14px;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.logout:hover { border-color: var(--red); color: var(--red); }
.logout:disabled { opacity: .5; cursor: default; }
.logout[hidden] { display: none; }

.tip { margin: 26px 0 0; font-size: 10px; letter-spacing: 4px; color: var(--ink-dim2); }

/* =========================================================
   弹窗
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4,6,10,.84);
  backdrop-filter: blur(4px);
  z-index: 50;
  animation: fade .18s ease both;
}

.modal[hidden] { display: none; }

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

.modal-box {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 30px 28px 26px;
  background: linear-gradient(180deg, #141926, #0d1119);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 28px 70px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.06);
}

.modal-box.wide { max-width: 760px; }

.modal-box h2 {
  margin: 0 0 22px;
  font-size: 17px;
  letter-spacing: 6px;
  text-indent: 6px;
  color: var(--ink);
}

.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  width: 30px; height: 30px;
  background: none;
  border: 0;
  color: var(--ink-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s;
}

.modal-close:hover { color: var(--ink); }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-dim);
}

.field input {
  width: 100%;
  padding: 11px 13px;
  background: #0a0d14;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(90,169,230,.14);
}

.captcha-row { display: flex; gap: 10px; align-items: stretch; }

.captcha-row input {
  flex: 1;
  min-width: 0;
  letter-spacing: 4px;
}

.cap-q {
  flex: 0 0 auto;
  padding: 11px 14px;
  background: #0a0d14;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--gold);
  font-size: 15px;
  letter-spacing: 2px;
  white-space: nowrap;
  user-select: none;
  min-width: 116px;
  text-align: center;
}

.captcha-hint {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin: 7px 0 0;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-dim2);
  min-height: 16px;
}

.captcha-hint a { color: var(--blue); text-decoration: none; }
.captcha-hint a:hover { text-decoration: underline; }
.captcha-hint a.disabled { color: var(--ink-dim2); pointer-events: none; }

.primary {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  background: linear-gradient(180deg, #6cb6ef, #3f83c4);
  border: 0;
  border-radius: var(--r-sm);
  color: #06121d;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 5px;
  text-indent: 5px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(90,169,230,.22);
  transition: filter .15s;
}

.primary:hover { filter: brightness(1.1); }
.primary:disabled { opacity: .5; cursor: default; }

.msg { margin: 0 0 10px; min-height: 16px; font-size: 12px; color: var(--red); letter-spacing: 1px; }
.msg.good { color: var(--green); }

.switch { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--ink-dim); }
.switch a { color: var(--blue); text-decoration: none; }
.switch a:hover { text-decoration: underline; }

/* ---- 介绍弹窗 ---- */

.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 30px;
  text-align: left;
}

.intro-grid section {
  padding: 14px 16px;
  background: rgba(0,0,0,.22);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.intro-grid h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--gold);
}

.intro-grid p, .intro-grid li {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.85;
  color: var(--ink-dim);
}

.intro-grid ul { margin: 0; padding-left: 16px; }

ul.bosses { list-style: none; padding-left: 0; }

ul.bosses li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 11.5px;
  white-space: nowrap;
}

ul.bosses li:last-child { border-bottom: 0; }
ul.bosses b { letter-spacing: 1px; }

table.keys { width: 100%; border-collapse: collapse; }
table.keys td { padding: 5px 0; font-size: 12px; color: var(--ink-dim); vertical-align: middle; }
table.keys td:first-child { width: 56%; }

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  margin-right: 2px;
  background: linear-gradient(180deg, #1b2233, #10151f);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 11px;
  color: var(--ink);
  text-align: center;
}

/* =========================================================
   游戏页
   ========================================================= */

body.playing {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #04060a;
  overflow: hidden;
}

.stage {
  position: relative;
  line-height: 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px #1a2030, 0 40px 120px rgba(0,0,0,.9);
  --ui: 1;
}

.stage canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------------- HUD ---------------- */

.hud {
  position: absolute;
  top: 14px;
  line-height: 1.4;
  pointer-events: none;
  transform: scale(var(--ui, 1));
}

.hud-left  { left: 16px;  width: 336px; transform-origin: top left; }
.hud-right { right: 16px; width: 316px; transform-origin: top right; }

.panel {
  position: relative;
  padding: 9px 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 26px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05);
}

.panel-tag {
  margin-top: 7px;
  font-size: 10px;
  letter-spacing: 5px;
  color: var(--ink-dim2);
}

/* 血条 */

.hpbar {
  position: relative;
  height: 22px;
  background: #070a10;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.7);
}

.hpbar.boss { height: 16px; border-color: rgba(255,90,90,.28); }

.hpfill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 100%;
  z-index: 2;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(180deg, #6ee0a4 0%, #35a870 52%, #1f7a4e 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  transition: width .12s linear;
}

/* 掉血延迟层：垫在实际血量底下，露出右边一截浅色，再慢慢收回去 */
.hpfill.lag {
  z-index: 1;
  background: linear-gradient(180deg, rgba(255,120,120,.85), rgba(150,40,40,.85));
  transition: width .18s linear;
}

.hpbar.boss .hpfill {
  background: linear-gradient(180deg, #ff8080 0%, #d8433f 55%, #912420 100%);
}

.hpbar.boss .hpfill.lag {
  background: linear-gradient(180deg, rgba(255,215,150,.75), rgba(180,120,40,.75));
}

.hpbar span {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.9);
}

/* 技能卡 */

.skills {
  display: flex;
  gap: 7px;
  margin-top: 9px;
}

.skill {
  position: relative;
  flex: 1;
  padding: 8px 4px 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(6px);
  text-align: center;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color .15s;
}

.skill .sk-key {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #10141d;
  background: linear-gradient(180deg, #ffe9a8, #e0b855);
  border-radius: 3px;
  box-shadow: 0 2px 0 rgba(0,0,0,.45);
}

.skill .sk-icon {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1;
  color: var(--blue);
}

.skill .sk-name {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--ink-dim);
}

/* 冷却遮罩：宽度由 JS 按剩余比例设置 */
.skill i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(4,6,10,.72);
  border-right: 1px solid rgba(255,255,255,.10);
  transition: width .08s linear;
  pointer-events: none;
}

.sk-charge {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: .5px;
  color: var(--ink-dim2);
}

/* 大招就绪：整张卡点亮 */
.skill.ready {
  border-color: rgba(240,207,122,.75);
  box-shadow: 0 6px 18px rgba(0,0,0,.4), 0 0 22px rgba(240,207,122,.35), inset 0 1px 0 rgba(255,255,255,.08);
}

.skill.ready .sk-icon { color: var(--gold); }
.skill.ready .sk-charge { color: var(--gold); }
.skill.ready .sk-key { background: linear-gradient(180deg, #fff3c4, #f0cf7a); }

.skill.cd { border-color: rgba(255,255,255,.05); }
.skill.cd .sk-key { background: #3a4152; color: #767f92; box-shadow: none; }
.skill.cd .sk-icon, .skill.cd .sk-name { opacity: .4; }

/* BOSS 名牌 */

.boss-panel { padding: 10px 12px; }

.boss-name {
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 6px;
  text-indent: 6px;
  color: #ff8a8a;
  text-shadow: 0 0 14px rgba(255,60,60,.4);
}

.boss-sub {
  margin-top: 7px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold);
}

.boss-sub[hidden] { display: none; }

/* ---------------- 关卡横幅 ---------------- */

.banner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(6,9,16,.78), rgba(4,6,10,.92));
  line-height: 1.4;
  pointer-events: none;
}

.banner[hidden] { display: none; }

.banner-main {
  font-size: 38px;
  letter-spacing: 14px;
  text-indent: 14px;
  background: linear-gradient(180deg, #ffffff, #cfe0f5 60%, #8fb0d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 20px rgba(120,180,255,.45));
}

.banner-sub {
  margin-top: 16px;
  font-size: 13px;
  letter-spacing: 6px;
  text-indent: 6px;
  color: var(--ink-dim);
}

.banner-rule {
  width: 180px;
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(90deg, transparent, rgba(240,207,122,.7), transparent);
}

.back {
  position: absolute;
  left: 16px;
  bottom: 14px;
  padding: 5px 10px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-dim2);
  text-decoration: none;
  line-height: 1.4;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  pointer-events: auto;
  transform: scale(var(--ui, 1));
  transform-origin: bottom left;
}

.back:hover { color: var(--ink); border-color: var(--line-2); }

/* ---------------- 死亡提示 / 通关结束页 ----------------
   静态页面：没有任何动画，只在 JS 切 hidden 时出现
*/

.endscreen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 3, 8, .84);
  line-height: 1.5;
  z-index: 20;
}

.endscreen[hidden] { display: none; }

.es-box {
  position: relative;
  min-width: 360px;
  max-width: 620px;
  padding: 38px 52px;
  text-align: center;
  background: linear-gradient(180deg, #161b28, #0c1017);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 34px 90px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.06);
}

#death-screen .es-box { border-color: rgba(255,91,91,.45); box-shadow: 0 34px 90px rgba(0,0,0,.85), 0 0 60px rgba(255,60,60,.18); }
#end-screen .es-box   { border-color: rgba(240,207,122,.5); box-shadow: 0 34px 90px rgba(0,0,0,.85), 0 0 70px rgba(240,207,122,.20); }

.es-kicker {
  margin-bottom: 16px;
  font-size: 11px;
  letter-spacing: 10px;
  text-indent: 10px;
  color: var(--gold-2);
}

.es-title {
  font-size: 27px;
  letter-spacing: 3px;
  color: var(--ink);
}

#death-screen .es-title { color: #ff8080; }
#end-screen .es-title   { color: var(--gold); }

.es-sub {
  margin-top: 18px;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--ink-dim);
}

.es-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
}

.es-btn {
  padding: 11px 24px;
  background: linear-gradient(180deg, #ffe9a8, #e0b855);
  border: 1px solid #f0cf7a;
  border-radius: var(--r-sm);
  color: #2a1c05;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  text-indent: 4px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(240,207,122,.20);
}

.es-btn:hover { filter: brightness(1.08); }

.es-btn.ghost {
  background: none;
  border-color: var(--line-2);
  color: var(--ink-dim);
  box-shadow: none;
}

.es-btn.ghost:hover { border-color: var(--ink-dim); color: var(--ink); }

/* ---------------- 窄屏 ---------------- */

@media (max-width: 860px) {
  .intro-grid { grid-template-columns: 1fr; }
  .hud { top: 8px; }
  .hud-left  { left: 8px;  width: 250px; }
  .hud-right { right: 8px; width: 220px; }
  .skill .sk-name { font-size: 9px; }
  .es-box { min-width: 0; padding: 26px 22px; }
  .es-title { font-size: 19px; letter-spacing: 2px; }
  .banner-main { font-size: 26px; letter-spacing: 8px; }
}
