/* ============ VOXEL HORIZON UI ============ */
@font-face { font-family: 'GameFont'; src: local('Segoe UI'); }

:root {
  --cyan: #7fe9ff;
  --cyan-dim: rgba(127, 233, 255, .55);
  --amber: #ffcf7a;
  --red: #ff6a5e;
  --green: #8dffb0;
  --panel-bg: rgba(8, 20, 30, .72);
  --panel-border: rgba(127, 233, 255, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; color: #dff6ff; }

#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }
.screen { position: fixed; inset: 0; z-index: 50; }

/* ============ 主菜单 ============ */
#main-menu {
  background: radial-gradient(ellipse at 30% 110%, rgba(30,80,120,.55), transparent 60%),
              radial-gradient(ellipse at 80% -10%, rgba(120,40,140,.35), transparent 55%),
              linear-gradient(#020409, #050a14 55%, #0a1526);
  display: flex; align-items: center; justify-content: center;
}
.menu-stars { position: absolute; inset: 0; overflow: hidden; }
.menu-stars::before, .menu-stars::after {
  content: ''; position: absolute; inset: -100%;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 40% 70%, #9fdcff, transparent),
    radial-gradient(2px 2px at 60% 20%, #fff, transparent),
    radial-gradient(1px 1px at 80% 50%, #ffd9a0, transparent),
    radial-gradient(1.5px 1.5px at 10% 80%, #fff, transparent),
    radial-gradient(1px 1px at 90% 85%, #b0f0ff, transparent),
    radial-gradient(1.5px 1.5px at 50% 45%, #fff, transparent),
    radial-gradient(1px 1px at 70% 90%, #fff, transparent),
    radial-gradient(1px 1px at 33% 10%, #ffe9c0, transparent);
  background-size: 520px 520px;
  animation: starDrift 120s linear infinite;
}
.menu-stars::after { background-size: 780px 780px; opacity: .6; animation-duration: 200s; }
@keyframes starDrift { from { transform: translate(0,0);} to { transform: translate(260px, 130px);} }

.menu-content { position: relative; text-align: center; z-index: 2; animation: menuIn 1.2s ease-out; }
@keyframes menuIn { from { opacity: 0; transform: translateY(24px);} to { opacity: 1; transform: none;} }

.logo-sub { font-size: 20px; letter-spacing: 14px; color: var(--cyan-dim); font-weight: 300; }
.logo-main {
  font-size: 88px; font-weight: 800; letter-spacing: 26px; text-indent: 26px;
  background: linear-gradient(180deg, #fff 20%, var(--cyan) 60%, #3a8fb5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px rgba(127,233,255,.25);
  margin: 6px 0 10px;
}
.logo-line { width: 420px; height: 2px; margin: 0 auto 12px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); }
.logo-tag { font-size: 12px; letter-spacing: 4px; color: rgba(223,246,255,.5); }

.menu-buttons { margin-top: 64px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.menu-btn {
  position: relative; width: 380px; padding: 14px 20px 14px 34px;
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  color: #e8fbff; font-size: 17px; letter-spacing: 3px; cursor: pointer;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  transition: all .18s; text-align: left; font-family: inherit;
}
.menu-btn:hover { background: rgba(127,233,255,.14); border-color: var(--cyan); padding-left: 44px; }
.menu-btn .btn-deco { position: absolute; left: 14px; top: 50%; width: 8px; height: 8px;
  background: var(--cyan); transform: translateY(-50%) rotate(45deg); opacity: .8; }
.menu-btn:hover .btn-deco { left: 22px; }
.menu-btn .btn-hint { float: right; font-size: 11px; color: rgba(223,246,255,.4); letter-spacing: 1px; margin-top: 5px; }
.menu-btn.small { width: 220px; margin: 26px auto 0; }
.menu-btn.creative { border-color: rgba(255,207,122,.4); }
.menu-btn.creative:hover { background: rgba(255,207,122,.13); border-color: var(--amber); }
.menu-btn.creative .btn-deco { background: var(--amber); }
.menu-footer { margin-top: 54px; font-size: 11px; letter-spacing: 2px; color: rgba(223,246,255,.35); }

#help-panel {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(2,6,12,.92); z-index: 5;
}
#help-panel.hidden { display: none; }
.panel-title { font-size: 22px; letter-spacing: 6px; color: var(--cyan); margin-bottom: 30px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 60px; font-size: 15px; color: rgba(223,246,255,.85); }
.help-grid b { color: var(--amber); font-weight: 600; margin-right: 10px; display: inline-block; min-width: 90px; }

/* ============ 开场剧情 ============ */
#intro-screen { background: #000; display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 60; }
.intro-text {
  max-width: 720px; font-size: 22px; line-height: 2.2; letter-spacing: 3px;
  color: var(--cyan); text-align: center; text-shadow: 0 0 24px rgba(127,233,255,.4);
  white-space: pre-line;
}
.intro-skip { position: absolute; bottom: 40px; font-size: 12px; letter-spacing: 3px; color: rgba(223,246,255,.35);
  animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: .2;} 50% { opacity: .9;} }

/* ============ HUD 通用 ============ */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.hud-corner { position: absolute; }

/* 十字准星 */
#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 64px; height: 64px; }
.ch-dot { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px;
  background: rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 6px rgba(127,233,255,.8); }
#mine-reticle { position: absolute; inset: 0; transform: rotate(-90deg); opacity: 0; transition: opacity .15s; }
#mine-reticle.active { opacity: 1; }
#mine-progress { fill: none; stroke: var(--amber); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 264; stroke-dashoffset: 264; filter: drop-shadow(0 0 4px rgba(255,207,122,.8)); }

/* 生存面板 */
#survival-panel { left: 26px; bottom: 24px; width: 300px; }
.stat-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.hex-icon {
  width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--panel-bg); border: 1px solid var(--panel-border); font-size: 14px; color: var(--cyan);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.stat-body { flex: 1; }
.stat-label { font-size: 10px; letter-spacing: 3px; color: rgba(223,246,255,.6); margin-bottom: 3px; }
.stat-bar { position: relative; height: 12px; background: rgba(8,20,30,.75); border: 1px solid var(--panel-border);
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); overflow: hidden; }
.stat-bar.wide { height: 10px; }
.stat-fill { height: 100%; width: 100%; transition: width .25s ease-out; }
.stat-fill.hazard { background: linear-gradient(90deg, #3ad6ff, #9ff0ff); box-shadow: 0 0 10px rgba(58,214,255,.6); }
.stat-fill.life { background: linear-gradient(90deg, #ff7a5e, #ffd0a0); box-shadow: 0 0 10px rgba(255,122,94,.5); }
.stat-fill.health { background: linear-gradient(90deg, #ff4a4a, #ff9a8a); }
.stat-fill.beam { background: linear-gradient(90deg, #ffb54a, #ffe9a0); }
.stat-fill.jet { background: linear-gradient(90deg, #7fe9ff, #d0f8ff); }
.stat-fill.pulse { background: linear-gradient(90deg, #b08aff, #e0d0ff); }
.bar-segs { position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg, transparent 0 23px, rgba(0,0,0,.55) 23px 25px); }
.env-readout { margin-top: 10px; font-size: 10px; letter-spacing: 2px; color: rgba(223,246,255,.45); }
.stat-row.danger .stat-label { color: var(--red); animation: blink 1s infinite; }

/* 工具面板 */
#tool-panel { right: 26px; bottom: 24px; width: 240px; text-align: right; }
.tool-name { font-size: 10px; letter-spacing: 3px; color: rgba(223,246,255,.65); margin: 8px 0 4px; }
.tool-name.dim { color: rgba(223,246,255,.4); }

/* 星球信息 */
#planet-info { left: 26px; top: 22px; }
.planet-name { font-size: 24px; letter-spacing: 6px; font-weight: 600; color: #fff;
  text-shadow: 0 0 20px rgba(127,233,255,.5); }
.planet-name::before { content: '◆ '; color: var(--cyan); font-size: 14px; vertical-align: 3px; }
.planet-sub { font-size: 11px; letter-spacing: 3px; color: rgba(223,246,255,.55); margin-top: 4px; }

/* 任务面板 */
#mission-panel { right: 26px; top: 22px; width: 320px; text-align: right;
  background: linear-gradient(270deg, rgba(8,20,30,.55), transparent); padding: 10px 14px;
  border-right: 2px solid var(--cyan); }
.mission-tag { font-size: 10px; letter-spacing: 3px; color: var(--cyan-dim); }
.mission-title { font-size: 17px; letter-spacing: 2px; color: #fff; margin: 4px 0; font-weight: 600; }
.mission-desc { font-size: 12px; letter-spacing: 1px; color: rgba(223,246,255,.7); line-height: 1.7; }
.mission-desc .done { color: var(--green); }

/* 拾取信息流 */
#pickup-feed { position: absolute; right: 26px; top: 140px; width: 280px; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.pickup-item {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px;
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  font-size: 13px; letter-spacing: 1px; animation: pickupIn .25s ease-out;
}
.pickup-item.fading { opacity: 0; transition: opacity .6s; }
.pickup-item .p-icon { width: 20px; height: 20px; image-rendering: pixelated; }
.pickup-item .p-num { color: var(--green); font-weight: 700; }
@keyframes pickupIn { from { opacity: 0; transform: translateX(30px);} to { opacity: 1; transform: none;} }

/* 交互提示 */
#interact-tip {
  position: absolute; left: 50%; top: 58%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 10px 22px;
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  font-size: 15px; letter-spacing: 2px;
}
.key-cap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; background: rgba(127,233,255,.15); border: 1px solid var(--cyan);
  color: var(--cyan); font-weight: 700; font-size: 15px;
}

/* 通知横幅 */
#notify-banner {
  position: absolute; left: 50%; top: 17%; transform: translateX(-50%);
  min-width: 420px; text-align: center; pointer-events: none;
}
.notify-inner {
  padding: 14px 40px; background: linear-gradient(90deg, transparent, rgba(8,25,38,.9) 15% 85%, transparent);
  border-top: 1px solid var(--cyan); border-bottom: 1px solid var(--cyan);
  font-size: 20px; letter-spacing: 6px; color: #fff; text-shadow: 0 0 18px rgba(127,233,255,.7);
  animation: notifyIn .4s ease-out;
}
.notify-inner .n-sub { display: block; font-size: 12px; letter-spacing: 3px; color: var(--cyan-dim); margin-top: 6px; }
@keyframes notifyIn { from { opacity: 0; letter-spacing: 16px; } to { opacity: 1; letter-spacing: 6px; } }
#notify-banner.fading { opacity: 0; transition: opacity .8s; }

/* 屏幕特效 */
#damage-vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(255,40,30,.45)); }
#heat-overlay { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(255,120,30,.55)); }

/* ============ 飞船 HUD ============ */
#ship-hud { position: absolute; inset: 0; }
.ship-reticle { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; transform: translate(-50%,-50%); }
.sr-c { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px;
  border: 1px solid var(--cyan-dim); transform: rotate(45deg); }
.sr-c::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px;
  background: var(--cyan); }
.sr-l, .sr-r { position: absolute; top: 50%; width: 26px; height: 2px; background: var(--cyan-dim); margin-top: -1px; }
.sr-l { left: -10px; } .sr-r { right: -10px; }
#ship-left { left: 26px; bottom: 26px; width: 260px; }
.ship-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.ss-label { font-size: 10px; letter-spacing: 3px; color: rgba(223,246,255,.5); width: 44px; }
.ss-val { font-size: 26px; font-weight: 700; color: #fff; text-shadow: 0 0 14px rgba(127,233,255,.6);
  font-variant-numeric: tabular-nums; min-width: 90px; }
.ss-unit { font-size: 11px; color: var(--cyan-dim); }
.ship-tip { position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%);
  font-size: 14px; letter-spacing: 3px; color: var(--amber); text-shadow: 0 0 12px rgba(255,207,122,.6); }

/* 目标标记 */
#markers { position: absolute; inset: 0; overflow: hidden; }
.world-marker { position: absolute; transform: translate(-50%,-50%); text-align: center; transition: opacity .3s; }
.world-marker .m-icon { width: 26px; height: 26px; margin: 0 auto; border: 2px solid var(--cyan);
  transform: rotate(45deg); background: rgba(127,233,255,.12); box-shadow: 0 0 14px rgba(127,233,255,.5);
  display: flex; align-items: center; justify-content: center; }
.world-marker .m-icon span { transform: rotate(-45deg); font-size: 13px; color: var(--cyan); }
.world-marker .m-label { margin-top: 8px; font-size: 11px; letter-spacing: 2px; color: #fff;
  text-shadow: 0 1px 4px #000; white-space: nowrap; }
.world-marker .m-dist { font-size: 10px; color: var(--cyan-dim); }
.world-marker.amber .m-icon { border-color: var(--amber); box-shadow: 0 0 14px rgba(255,207,122,.5); }
.world-marker.amber .m-icon span { color: var(--amber); }

/* ============ 物品栏 ============ */
#inventory-screen {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(2,8,14,.72); backdrop-filter: blur(6px);
}
.inv-window {
  width: 900px; max-width: 94vw; background: var(--panel-bg); border: 1px solid var(--panel-border);
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
  padding: 22px 28px; animation: invIn .22s ease-out;
}
.small-window { width: 560px; }
@keyframes invIn { from { opacity: 0; transform: scale(.96);} to { opacity: 1; transform: none;} }
.inv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px;
  border-bottom: 1px solid var(--panel-border); padding-bottom: 12px; }
.inv-title { font-size: 18px; letter-spacing: 5px; color: var(--cyan); }
.inv-close-tip { font-size: 11px; letter-spacing: 2px; color: rgba(223,246,255,.4); }
.inv-columns { display: flex; gap: 26px; }
.inv-left { flex: 1.15; }
.inv-right { flex: 1; }

.inv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.inv-slot {
  position: relative; aspect-ratio: 1; background: rgba(15,35,50,.6); border: 1px solid rgba(127,233,255,.2);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .12s;
}
.inv-slot:hover { background: rgba(127,233,255,.16); border-color: var(--cyan); }
.inv-slot img { width: 60%; height: 60%; image-rendering: pixelated; }
.inv-slot .slot-num { position: absolute; right: 5px; bottom: 3px; font-size: 12px; font-weight: 700;
  color: #fff; text-shadow: 0 1px 3px #000; }
.inv-slot .slot-fill { position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: rgba(127,233,255,.25); }
.inv-slot .slot-fill i { display: block; height: 100%; background: var(--cyan); }

.craft-tag { font-size: 11px; letter-spacing: 3px; color: var(--cyan-dim); margin-bottom: 10px; }
.craft-item, .repair-item, .recharge-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px;
  background: rgba(15,35,50,.6); border: 1px solid rgba(127,233,255,.2);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  cursor: pointer; transition: all .12s; pointer-events: auto;
}
.craft-item:hover, .repair-item:hover, .recharge-item:hover { background: rgba(127,233,255,.14); border-color: var(--cyan); }
.craft-item.locked, .repair-item.locked, .recharge-item.locked { opacity: .45; cursor: not-allowed; }
.craft-item img, .repair-item img, .recharge-item img { width: 34px; height: 34px; image-rendering: pixelated; flex: none; }
.ci-body { flex: 1; }
.ci-name { font-size: 14px; letter-spacing: 1px; color: #fff; }
.ci-req { font-size: 11px; color: rgba(223,246,255,.55); margin-top: 3px; }
.ci-req .ok { color: var(--green); } .ci-req .no { color: var(--red); }
.ci-action { font-size: 11px; letter-spacing: 2px; color: var(--cyan); }
.repair-item .rp-bar { height: 5px; background: rgba(0,0,0,.5); margin-top: 5px; }
.repair-item .rp-bar i { display: block; height: 100%; background: var(--green); }
.inv-footer { margin-top: 16px; padding-top: 10px; border-top: 1px solid rgba(127,233,255,.15);
  font-size: 12px; letter-spacing: 1px; color: rgba(223,246,255,.5); min-height: 34px; }

#repair-screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(2,8,14,.72); backdrop-filter: blur(6px); }

/* ============ 过渡 ============ */
#fade-overlay { position: fixed; inset: 0; z-index: 80; background: #000; opacity: 0; pointer-events: none;
  transition: opacity .8s ease; }
#fade-overlay.white { background: #eaf8ff; }
#warp-lines { position: fixed; inset: 0; z-index: 70; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(90deg, transparent 0 40px, rgba(160,220,255,.06) 40px 41px);
  transition: opacity .4s; }
#warp-lines.active { opacity: 1; animation: warpPulse .1s linear infinite; }
@keyframes warpPulse { from { transform: scaleX(1);} to { transform: scaleX(1.04);} }

@media (max-width: 900px) {
  .logo-main { font-size: 52px; letter-spacing: 14px; }
  .inv-columns { flex-direction: column; }
}
