/* ============================================================
   方块星野 BlockWilds — 像素风 UI 样式
   石质/木板质感面板 · 双层凹凸像素边框 · 无抗锯齿位图字体
   ============================================================ */
@font-face {
  font-family: 'PixelLatin';
  src: url('../assets/pixel-latin.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'PixelZH';
  src: url('../assets/pixel-zh.woff2') format('woff2');
  font-display: swap;
}

:root {
  --px: 2px;                 /* 像素单位 */
  --c-panel: #c6c6c6;
  --c-panel-dark: #8b8b8b;
  --c-panel-light: #ffffff;
  --c-slot: #8b8b8b;
  --c-text: #404040;
  --c-white: #ffffff;
  --c-yellow: #ffff55;
  --c-cyan: #55ffff;
  --c-purple: #b478ff;
  --c-tooltip-border: #2d0a63;
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none;
    -webkit-user-select: none; font-family: 'PixelLatin','PixelZH',monospace; }

html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }

body { image-rendering: pixelated; }

#game-root { position: fixed; inset: 0; }

#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.ui-layer { position: absolute; inset: 0; pointer-events: none; }
.hidden { display: none !important; }

canvas, img { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ============ 通用像素文本 ============ */
.px-text {
  color: var(--c-white);
  text-shadow: 2px 2px 0 #3f3f3f;
  letter-spacing: 1px;
  -webkit-font-smoothing: none;
}

/* ============ MC 风按钮：双层凹凸边框 + 悬停亮化 ============ */
.mc-btn {
  display: inline-block;
  position: relative;
  padding: 10px 22px;
  font-size: 16px;
  color: #e0e0e0;
  text-shadow: 2px 2px 0 #383838;
  background:
    linear-gradient(rgba(255,255,255,.06), rgba(0,0,0,.14)),
    var(--btn-tex, #6f6f6f);
  background-size: cover;
  border: 0;
  outline: 2px solid #000;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,.42),
    inset -2px -2px 0 rgba(0,0,0,.45);
  cursor: pointer;
  letter-spacing: 1px;
}
.mc-btn:hover {
  color: var(--c-yellow);
  filter: brightness(1.18);
  outline: 2px solid #fff;
}
.mc-btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 0 rgba(0,0,0,.45),
    inset -2px -2px 0 rgba(255,255,255,.25);
}
.mc-btn.big { font-size: 20px; padding: 14px 44px; }
.mc-btn:disabled { filter: grayscale(.8) brightness(.7); cursor: default; }

/* ============ 石质 / 木板 / 羊皮纸面板 ============ */
.mc-panel {
  position: relative;
  background: var(--panel-tex, var(--c-panel));
  background-size: 128px 128px;
  outline: 2px solid #000;
  box-shadow:
    inset 3px 3px 0 rgba(255,255,255,.38),
    inset -3px -3px 0 rgba(0,0,0,.42),
    0 10px 40px rgba(0,0,0,.65);
  padding: 16px;
  color: var(--c-text);
  pointer-events: auto;
}
.mc-panel .panel-title {
  font-size: 15px;
  color: #3a3a3a;
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.panel-corner {
  position: absolute; width: 14px; height: 14px;
  background-size: 14px 14px;
  pointer-events: none;
}
.pc-tl { left: 2px; top: 2px; }
.pc-tr { right: 2px; top: 2px; transform: scaleX(-1); }
.pc-bl { left: 2px; bottom: 2px; transform: scaleY(-1); }
.pc-br { right: 2px; bottom: 2px; transform: scale(-1,-1); }

/* ============ 物品槽 ============ */
.slot {
  width: 44px; height: 44px;
  background: var(--c-slot);
  box-shadow:
    inset 2px 2px 0 #373737,
    inset -2px -2px 0 #ffffff;
  position: relative;
  cursor: pointer;
}
.slot:hover::after {
  content: '';
  position: absolute; inset: 2px;
  background: rgba(255,255,255,.42);
  pointer-events: none;
}
.slot img { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px;
  transform: translate(-50%,-50%); pointer-events: none; }
.slot .cnt {
  position: absolute; right: 2px; bottom: 0;
  font-size: 14px; color: #fff; text-shadow: 2px 2px 0 #3f3f3f;
  pointer-events: none; z-index: 2;
}
.slot .dur {
  position: absolute; left: 4px; right: 4px; bottom: 4px; height: 3px;
  background: #202020; pointer-events: none;
}
.slot .dur > div { height: 100%; background: #4dff4d; }

/* ============ HUD ============ */
#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%,-50%);
  background:
    linear-gradient(#ddd,#ddd) 50% 0/2px 100% no-repeat,
    linear-gradient(#ddd,#ddd) 0 50%/100% 2px no-repeat;
  mix-blend-mode: difference;
}
#hotbar {
  position: absolute; left: 50%; bottom: 6px;
  transform: translateX(-50%);
  display: flex;
  padding: 2px;
  background: rgba(0,0,0,.22);
  outline: 2px solid rgba(0,0,0,.55);
}
#hotbar .slot {
  width: 48px; height: 48px;
  background: rgba(70,70,70,.72);
  box-shadow: inset 2px 2px 0 rgba(30,30,30,.9), inset -2px -2px 0 rgba(160,160,160,.85);
  margin: 1px;
}
#hotbar .slot.sel {
  outline: 3px solid #fff;
  z-index: 2;
}
#hud-status {
  position: absolute; left: 50%; bottom: 62px;
  transform: translateX(-50%);
  width: 440px;
  pointer-events: none;
}
.seg-bar { display: flex; gap: 1px; margin-top: 3px; height: 18px; }
.seg-bar img { width: 18px; height: 18px; }
#bar-oxygen, #bar-fuel { justify-content: flex-end; }
#bar-jet {
  position: absolute; right: -30px; bottom: 0; width: 12px; height: 64px;
  background: rgba(0,0,0,.5);
  outline: 2px solid #000;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.25);
}
#jet-fill {
  position: absolute; left: 2px; right: 2px; bottom: 2px;
  background: linear-gradient(#ffd24d,#ff7a1a);
  height: 40%;
}
#hud-hint {
  position: absolute; left: 50%; bottom: 132px; transform: translateX(-50%);
  font-size: 15px; color: #fff; text-shadow: 2px 2px 0 #303030;
  white-space: nowrap;
}
#hud-toast {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  font-size: 17px; color: var(--c-yellow); text-shadow: 2px 2px 0 #3c3c00;
  opacity: 0; transition: opacity .4s;
  text-align: center; line-height: 1.7;
}
#hud-loopclock {
  position: absolute; right: 14px; top: 12px;
  font-size: 14px; color: #ffd9a0; text-shadow: 2px 2px 0 #402800;
  text-align: right; line-height: 1.6;
}
#ship-hud {
  position: absolute; left: 14px; top: 12px;
  font-size: 14px; color: #9fe8ff; text-shadow: 2px 2px 0 #00303c;
  line-height: 1.7; white-space: pre;
}
#damage-flash {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,0,.55) 100%);
  opacity: 0; transition: opacity .12s;
}
#supernova-flash {
  position: absolute; inset: 0; pointer-events: none;
  background: #fff; opacity: 0;
}

/* ============ 信号镜 ============ */
#scope-overlay { position: absolute; inset: 0; }
#scope-ring {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 62vmin; height: 62vmin;
  border: 4px solid rgba(160,220,255,.5);
  outline: 2px solid #000;
  border-radius: 50%;
  box-shadow: 0 0 0 2000px rgba(4,8,16,.72), inset 0 0 60px rgba(120,200,255,.18);
}
#scope-freq {
  position: absolute; left: 50%; bottom: 16%; transform: translateX(-50%);
  font-size: 17px; color: #aef; text-shadow: 2px 2px 0 #012;
}
#scope-signal {
  position: absolute; left: 50%; top: 15%; transform: translateX(-50%);
  font-size: 15px; color: #ffe9a8; text-shadow: 2px 2px 0 #210;
  text-align: center; line-height: 1.7;
}

/* ============ 翻译机 ============ */
#translate-overlay { position: absolute; inset: 0; }
#translate-panel {
  position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%);
  min-width: 480px; max-width: 60vw;
  background: rgba(8,20,24,.88);
  outline: 2px solid #000;
  box-shadow: inset 0 0 0 2px #2f8f7f, inset 0 0 24px rgba(60,220,190,.15);
  padding: 14px 18px;
}
#translate-title { font-size: 13px; color: #55e6c8; text-shadow: 2px 2px 0 #032; margin-bottom: 8px; }
#translate-text { font-size: 16px; color: #d8fff4; text-shadow: 2px 2px 0 #032; line-height: 1.8; min-height: 52px; }

/* ============ 屏幕层（背包/日志/暂停） ============ */
#screens {
  background: rgba(6,6,10,.62);
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
.screen-pop { animation: popin .14s ease-out; }
@keyframes popin {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* 背包网格 */
.inv-grid { display: grid; grid-template-columns: repeat(9, 46px); gap: 2px; }
.inv-row-gap { height: 10px; }
.craft-zone { display: flex; align-items: center; gap: 14px; margin: 6px 0 12px; }
.craft-grid { display: grid; grid-template-columns: repeat(2, 46px); gap: 2px; }
.craft-grid.g3 { grid-template-columns: repeat(3, 46px); }
.craft-arrow { font-size: 26px; color: #6a6a6a; text-shadow: 1px 1px 0 #fff; }

/* ============ Tooltip ============ */
#tooltip {
  position: fixed; z-index: 99; pointer-events: none;
  background: rgba(16,0,16,.94);
  outline: 2px solid var(--c-tooltip-border);
  box-shadow: inset 0 0 0 2px rgba(80,0,160,.55);
  padding: 8px 10px;
  font-size: 15px; line-height: 1.65;
  color: #fff; text-shadow: 2px 2px 0 #2a002a;
  max-width: 340px;
}
#tooltip .tt-name { margin-bottom: 2px; }
#tooltip .tt-desc { color: #a8a8a8; font-size: 13px; }
.rar0 { color: #ffffff; } .rar1 { color: #ffff55; }
.rar2 { color: #55ffff; } .rar3 { color: #b478ff; }

#drag-ghost {
  position: fixed; z-index: 100; pointer-events: none;
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
}
#drag-ghost img { width: 40px; height: 40px; }
#drag-ghost .cnt { position: absolute; right: -2px; bottom: -4px; font-size: 14px;
  color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }

/* ============ 飞船日志 ============ */
.log-wrap { display: flex; gap: 14px; }
.log-list { width: 250px; max-height: 56vh; overflow-y: auto; }
.log-entry-btn {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; margin-bottom: 4px; font-size: 14px;
  color: #ffe9c8; background: rgba(40,26,12,.85);
  border: 0; outline: 2px solid #000;
  box-shadow: inset 1px 1px 0 rgba(255,220,160,.25), inset -1px -1px 0 rgba(0,0,0,.5);
  cursor: pointer; text-shadow: 1px 1px 0 #201000;
}
.log-entry-btn:hover { filter: brightness(1.25); }
.log-entry-btn.sel { outline-color: #ffd270; color: #fff; }
.log-entry-btn.new::after { content: ' ●'; color: #7cff7c; }
.log-detail {
  flex: 1; min-width: 380px; max-width: 460px; max-height: 56vh; overflow-y: auto;
  padding: 12px 16px; font-size: 15px; line-height: 1.9; color: #45301a;
  text-shadow: 1px 1px 0 rgba(255,255,240,.4);
}
.log-detail h3 { font-size: 17px; margin-bottom: 8px; color: #2e1c08; }
.log-detail .log-clue { margin: 6px 0; padding-left: 14px; position: relative; }
.log-detail .log-clue::before { content: '◆'; position: absolute; left: 0; color: #a06820; font-size: 11px; }

/* ============ 滚动条像素化 ============ */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #2a2a2a; outline: 2px solid #000; }
::-webkit-scrollbar-thumb {
  background: #7a7a7a;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.4), inset -2px -2px 0 rgba(0,0,0,.45);
}
::-webkit-scrollbar-thumb:hover { background: #9a9a9a; }

/* ============ 滑块像素化 ============ */
.mc-slider { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.mc-slider label { width: 130px; font-size: 14px; color: #3a3a3a; }
.mc-slider input[type=range] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 18px; background: #2c2c2c;
  outline: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.6), inset -1px -1px 0 rgba(255,255,255,.15);
  cursor: pointer;
}
.mc-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 26px;
  background: linear-gradient(#9a9a9a,#6e6e6e);
  outline: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.4), inset -2px -2px 0 rgba(0,0,0,.45);
}
.mc-slider .val { width: 44px; text-align: right; font-size: 14px; color: #3a3a3a; }

/* ============ 开始界面 ============ */
#title-screen {
  position: absolute; inset: 0; z-index: 50;
  background: radial-gradient(ellipse at 50% 120%, #1a2440 0%, #05070f 60%, #000 100%);
  display: flex; align-items: center; justify-content: center;
}
#title-stars { position: absolute; inset: 0; }
#title-inner { position: relative; text-align: center; }
#title-logo {
  font-size: 64px; color: #fff; letter-spacing: 10px;
  text-shadow: 4px 4px 0 #2c3550, 8px 8px 0 rgba(0,0,0,.6);
  animation: logo-bob 3.2s ease-in-out infinite;
}
@keyframes logo-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
#title-sub { margin-top: 10px; font-size: 16px; color: #86a8ff; text-shadow: 2px 2px 0 #101830; letter-spacing: 4px; }
#title-tip { margin: 22px 0 26px; font-size: 15px; color: #c8b06a; text-shadow: 2px 2px 0 #201800; }
#title-loading { margin-top: 18px; font-size: 14px; color: #9aa; display: none; }
#title-controls {
  margin-top: 36px; font-size: 13px; color: #8892a8; line-height: 2.1;
  text-shadow: 1px 1px 0 #000;
}

/* ============ 暂停/设置 ============ */
.pause-col { display: flex; flex-direction: column; gap: 8px; min-width: 340px; }
.pause-col .mc-btn { width: 100%; }

/* ============ 提示按键角标 ============ */
.keycap {
  display: inline-block; padding: 1px 7px; margin: 0 3px;
  background: #ddd; color: #222; font-size: 12px;
  outline: 2px solid #000;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -2px 0 #999;
  text-shadow: none;
}

/* ============ 烤棉花糖进度 ============ */
#roast-bar {
  position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%);
  width: 220px; height: 16px; background: rgba(0,0,0,.55);
  outline: 2px solid #000; display: none;
}
#roast-bar > div { height: 100%; width: 0%; background: linear-gradient(90deg,#fff,#ffb040,#803010); }

@media (max-width: 900px) {
  #hud-status { width: 340px; }
  #title-logo { font-size: 44px; }
}

/* ============ 创造模式物品目录 ============ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(9, 46px);
  gap: 2px;
  max-height: 208px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 8px;
  background: rgba(0,0,0,.18);
  outline: 2px solid rgba(0,0,0,.45);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.35);
}
#creative-badge {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  font-size: 13px; color: #7cff7c; text-shadow: 2px 2px 0 #043004;
  pointer-events: none;
}
