/* OpenSky VFX Lab — 深空夜航底 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: #0b0f1c;
  color: #dfe6f5;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  overflow: hidden;
}

#app { display: flex; height: 100vh; }

/* ---------- 侧栏目录 ---------- */
#sidebar {
  width: 220px; flex: none;
  background: #0e1424;
  border-right: 1px solid #1d2842;
  display: flex; flex-direction: column;
}
#sidebar header { padding: 14px 14px 10px; border-bottom: 1px solid #1d2842; }
#sidebar h1 { font-size: 16px; }
#sidebar .sub { font-size: 11px; color: #7686ab; margin-top: 4px; }
#atom-list { flex: 1; overflow-y: auto; padding: 8px; }
.cat-title {
  font-size: 11px; color: #5f7ac8; font-weight: 700;
  margin: 12px 6px 4px; letter-spacing: 2px;
}
.atom-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: #c3cde6;
  font-size: 13px; padding: 7px 10px; border-radius: 6px; cursor: pointer;
  font-family: inherit;
}
.atom-item:hover { background: #16203a; }
.atom-item.active { background: #23335c; color: #fff; font-weight: 700; }

/* ---------- 舞台 ---------- */
#stage-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 10px; overflow: auto; min-width: 0;
}
#stage-frame {
  position: relative; width: 960px; height: 620px; flex: none;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, #1a2340 0%, transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 110%, #182038 0%, transparent 60%),
    #0d1220;
  border: 1px solid #253154; border-radius: 12px;
  overflow: hidden;
}
#board { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 14px 90px 12px; }
#fx      { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#arrows  { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
#fly-layer { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#banner-layer {
  position: absolute; left: 0; right: 0; top: 46%; z-index: 12;
  display: flex; justify-content: center; pointer-events: none;
}
#screen-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; z-index: 20; }
#screen-vignette { position: absolute; inset: 0; opacity: 0; pointer-events: none; z-index: 19; }
#hud {
  position: absolute; top: 8px; right: 12px; z-index: 25;
  font-size: 11px; color: #7686ab; font-family: ui-monospace, monospace;
  display: flex; gap: 12px;
}

/* ---------- 牌桌布局 ---------- */
.frow { display: flex; justify-content: center; align-items: center; gap: 20px; flex: none; }
.enemy-row { margin-top: 4px; }
.mid-gap { flex: 1; min-height: 30px; }
.slot {
  width: 84px; height: 84px; border-radius: 50%;
  border: 1px dashed #223055;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.hero-slot { width: 104px; height: 104px; }

/* token 棋子 */
.token { position: relative; width: 74px; height: 74px; }
.token .tart {
  position: absolute; inset: 4px; border-radius: 50%;
  border: 2px solid #46587f;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #e8eeff;
  text-shadow: 0 2px 4px #000;
}
.token.guard .tart {
  border-radius: 26% 26% 42% 42%;
  border: 3px solid #93a7c4;
  box-shadow: inset 0 -6px 12px #0008;
}
.token.hero { width: 94px; height: 94px; }
.token.hero .tart { border: 3px solid #c8a24a; box-shadow: 0 0 14px #c8a24a44; }
.token .atk, .token .hp {
  position: absolute; bottom: -4px; z-index: 2;
  min-width: 24px; height: 24px; border-radius: 50%;
  background: #131b30; border: 1px solid #46587f;
  font-size: 13px; font-weight: 800; color: #fff;
  display: flex; align-items: center; justify-content: center;
  text-shadow: 0 1px 2px #000;
}
.token .atk { left: -2px; }
.token .hp { right: -2px; }
.token.hero .hp { min-width: 28px; height: 28px; font-size: 15px; border-color: #c8a24a; }
.token .badges {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 3px; z-index: 2; white-space: nowrap;
}
.badge {
  font-size: 9px; padding: 1px 5px; border-radius: 999px;
  background: #26345c; border: 1px solid #47598c; color: #cfe0ff;
}
.token .flash {
  position: absolute; inset: 2px; border-radius: 50%;
  opacity: 0; pointer-events: none; z-index: 3;
}
.token.guard .flash { border-radius: 26% 26% 42% 42%; }

/* ---------- 手牌迷你卡（2:3，布局按推断文档） ---------- */
.sw-card {
  position: relative; width: 92px; height: 138px; flex: none;
  background: linear-gradient(180deg, #1b2440, #131a30);
  border: 1px solid #3a4a77; border-radius: 8px;
}
.sw-card.gold { border-color: #ffa000; box-shadow: 0 0 10px #ffa00033; }
.sw-card.silver { border-color: #ccc; }
.sw-card .gem {
  position: absolute; top: -7px; left: -7px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b8dcff, #2b6cb0);
  border: 1px solid #cfe8ff;
  color: #04101f; font-size: 14px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.sw-card .cart {
  height: 44px; margin: 7px 7px 0; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #ffffffcc;
  text-shadow: 0 2px 4px #000;
}
.sw-card .cname {
  font-size: 10px; font-weight: 700; text-align: center;
  margin-top: 4px; color: #fff; text-shadow: 0 1px 2px #000;
}
.sw-card .cbanner {
  font-size: 8px; text-align: center; color: #0b1020;
  background: #aab8d8; margin: 3px 12px 0; border-radius: 2px;
  letter-spacing: 0.5px;
}
.sw-card .cdesc {
  font-size: 8px; color: #c6d2ec; text-align: center;
  padding: 3px 6px 0; line-height: 1.3; height: 32px; overflow: hidden;
}
.sw-card .cstats {
  position: absolute; bottom: 4px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 16px;
  font-size: 14px; font-weight: 800; color: #fff; text-shadow: 0 2px 2px #000;
}
.sw-card .foil { position: absolute; inset: 0; border-radius: 8px; overflow: hidden; opacity: 0; pointer-events: none; z-index: 2; }
.sw-card .flash { position: absolute; inset: 0; border-radius: 8px; opacity: 0; pointer-events: none; z-index: 3; }
.sw-card.flying { position: absolute; left: 0; top: 0; z-index: 11; }
.sw-card.big-card { position: absolute; left: 0; top: 0; z-index: 12; box-shadow: 0 18px 50px #000c; }

/* ---------- 底部行 ---------- */
.bottom-row {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 16px; flex: none; padding-bottom: 2px; margin-top: 10px;
}
.cast-slot {
  width: 66px; height: 96px; border: 1.5px dashed #2c3d68; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #566a9c; font-size: 10px; flex: none; align-self: center;
}
.hand-row { display: flex; gap: 10px; align-items: flex-end; }
.mana-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.bottle {
  position: relative; width: 42px; height: 58px; overflow: hidden;
  border: 2px solid #4a5f8f; border-radius: 8px 8px 14px 14px;
  background: #0d1424;
}
.bottle .liquid {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 43%;
  background: linear-gradient(180deg, #6ad8ff, #2b6cb0);
}
.mnum { font-size: 11px; font-weight: 700; color: #9fc4ff; font-family: ui-monospace, monospace; }
.pile {
  width: 58px; height: 84px; border-radius: 6px; flex: none; align-self: center;
  background: repeating-linear-gradient(45deg, #1a2340, #1a2340 5px, #151c33 5px, #151c33 10px);
  border: 1px solid #33436e;
  display: flex; align-items: center; justify-content: center;
}
.pile .pcount-label { font-size: 10px; color: #8ba0cf; text-align: center; line-height: 1.5; }
.pile.grave { position: absolute; left: 14px; top: 50%; transform: translateY(-30%); }

/* 飘数字 */
.fnum {
  position: absolute; z-index: 15; font-weight: 900;
  text-shadow: 0 2px 0 #000, 0 0 12px #0008;
  transform: translate(-50%, -50%); pointer-events: none;
  font-family: ui-monospace, monospace;
}

/* 横幅 */
.banner {
  font-size: 34px; font-weight: 900; letter-spacing: 10px;
  color: #fff; text-shadow: 0 3px 8px #000;
  padding: 10px 70px; opacity: 0;
}

/* ---------- 控制条 ---------- */
#global-controls {
  display: flex; align-items: center; gap: 16px; flex: none;
  background: #0e1424; border: 1px solid #1d2842; border-radius: 10px;
  padding: 10px 16px; flex-wrap: wrap; justify-content: center;
}
.ctl { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #9cabd0; }
.ctl input { width: 150px; }
.ctl-inline { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #9cabd0; }
.ctl-inline input[type=range] { width: 90px; }
.big-btn {
  background: #2f6bff; color: #fff; border: none; border-radius: 999px;
  font-size: 14px; font-weight: 700; padding: 10px 26px; cursor: pointer;
  font-family: inherit;
}
.big-btn:hover { background: #4a80ff; }
.info-btn { display: none; }

/* ---------- 详情面板 ---------- */
#detail {
  width: 260px; flex: none; background: #0e1424;
  border-left: 1px solid #1d2842; padding: 16px; overflow-y: auto;
  position: relative;
}
#detail-close { display: none; }
#detail-empty { color: #7686ab; font-size: 13px; line-height: 2; margin-top: 30px; }
#detail-empty .hint { font-size: 11px; }
#atom-name { font-size: 17px; margin-bottom: 6px; }
.tag {
  display: inline-block; font-size: 11px; color: #9db8ff;
  background: #1b2748; border-radius: 999px; padding: 2px 10px; margin-bottom: 10px;
}
#atom-desc { font-size: 12px; color: #b9c5e2; line-height: 1.7; }
.game-use { background: #131b30; border-radius: 8px; padding: 10px; margin: 12px 0; }
.game-use h3 { font-size: 12px; color: #8fa4d4; margin-bottom: 6px; }
.game-use p { font-size: 11px; color: #a9b6d8; line-height: 1.6; }
#detail h3 { font-size: 12px; color: #8fa4d4; margin: 10px 0 6px; }
.param-row { margin-bottom: 10px; }
.param-row label { display: flex; justify-content: space-between; font-size: 12px; color: #9cabd0; margin-bottom: 3px; }
.param-row input[type=range], .param-row select { width: 100%; }
.param-row select {
  background: #131b30; color: #dfe6f5; border: 1px solid #33436e;
  border-radius: 6px; padding: 4px 6px; font-family: inherit;
}

/* ---------- 窄屏兜底 ---------- */
@media (max-width: 1500px) {
  #detail { width: 230px; }
  #sidebar { width: 190px; }
}
@media (max-width: 1350px) {
  #stage-wrap { justify-content: flex-start; overflow: auto; }
}
