/* ===========================================================================
   方块世界 · UI 样式
   =========================================================================== */
:root {
  --mc-slot: #8b8b8b;
  --mc-slot-border: #373737;
  --mc-slot-inner: #6f6f6f;
  --hud-text: #ffffff;
  --panel-bg: rgba(18, 20, 26, 0.92);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1020;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #e9eef7;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* ---------------- 准星 ---------------- */
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  opacity: 0.85;
}
#crosshair i {
  position: absolute;
  background: #ffffff;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.9);
}
#crosshair i:nth-child(1) {
  left: 0; top: 10px; width: 22px; height: 2px;
}
#crosshair i:nth-child(2) {
  left: 10px; top: 0; width: 2px; height: 22px;
}

/* ---------------- 快捷栏 ---------------- */
#hotbar-wrap {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#hotbar {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(20, 20, 20, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  pointer-events: none;
}

.slot {
  position: relative;
  width: 50px;
  height: 50px;
  background: var(--mc-slot-inner);
  border: 2px solid var(--mc-slot-border);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12),
              inset 2px 2px 0 rgba(255, 255, 255, 0.10),
              inset -2px -2px 0 rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 60ms linear;
}
.slot canvas {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
}
.slot .num {
  position: absolute;
  left: 3px;
  top: 1px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}
.slot.active {
  border-color: #ffffff;
  transform: scale(1.10);
  z-index: 2;
}

#slot-name {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--hud-text);
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
  min-height: 18px;
  opacity: 0;
  transition: opacity 180ms ease;
}
#slot-name.show { opacity: 1; }

/* ---------------- 模式提示 ---------------- */
#mode-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  letter-spacing: 0.05em;
}
#mode-badge span {
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 3px 9px;
  border-radius: 3px;
  text-shadow: 1px 1px 2px #000;
}

/* ---------------- 调试信息 ---------------- */
#debug {
  position: absolute;
  top: 14px;
  left: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #eaffea;
  background: rgba(0, 0, 0, 0.42);
  padding: 8px 10px;
  border-radius: 3px;
  white-space: pre;
  display: none;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}
#debug.on { display: block; }
#mode-badge.hide { display: none; }

/* ---------------- Toast ---------------- */
#toast {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  opacity: 0;
  transition: opacity 220ms ease;
  text-shadow: 1px 1px 2px #000;
}
#toast.show { opacity: 1; }

/* ---------------- 遮罩 / 面板 ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, rgba(38, 52, 88, 0.72), rgba(6, 9, 18, 0.93));
  backdrop-filter: blur(3px);
}
.overlay.hidden { display: none; }

#loading .box {
  text-align: center;
}
#loading .logo {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.55), 0 0 28px rgba(120, 180, 255, 0.35);
  margin-bottom: 22px;
}
#loading .bar {
  width: 320px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  overflow: hidden;
}
#loading .bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6fd66f, #b6f36f);
  transition: width 120ms linear;
}
#loading .tip {
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.75;
}

.panel {
  width: min(920px, 94vw);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 26px 30px 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.panel.small { width: min(680px, 94vw); }

.panel-head h1 {
  margin: 0 0 4px;
  font-size: 28px;
  letter-spacing: 0.1em;
}
.panel-head p {
  margin: 0 0 18px;
  font-size: 13px;
  opacity: 0.7;
}

.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 760px) {
  .cols { grid-template-columns: 1fr; }
}

.col h3 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 6px;
}

ul.keys {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}
ul.keys li {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
}
ul.keys b {
  flex: 0 0 108px;
  color: #9fd2ff;
  font-weight: 600;
}
ul.keys span { opacity: 0.82; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.row > span:first-child {
  flex: 0 0 84px;
  opacity: 0.8;
}
.row input[type="range"] {
  flex: 1;
  accent-color: #6fd66f;
  min-width: 0;
}
.row em {
  flex: 0 0 54px;
  font-style: normal;
  text-align: right;
  color: #9fd2ff;
  font-size: 12px;
}
.row input[type="text"] {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e9eef7;
  padding: 6px 8px;
  border-radius: 3px;
  font-family: inherit;
  min-width: 0;
}
.row.checks {
  flex-wrap: wrap;
  gap: 16px;
  margin: 14px 0 16px;
}
.row.checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.row.checks input { accent-color: #6fd66f; }

.hint {
  font-size: 12px;
  opacity: 0.55;
  line-height: 1.6;
  margin: 12px 0 0;
}

button {
  display: block;
  margin: 22px auto 0;
  padding: 11px 40px;
  font-size: 15px;
  letter-spacing: 0.1em;
  font-family: inherit;
  color: #10240f;
  background: linear-gradient(180deg, #9ee87f, #5fbf52);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 0 #3d8a37, 0 8px 18px rgba(0, 0, 0, 0.35);
  transition: transform 80ms ease, box-shadow 80ms ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(2px); box-shadow: 0 2px 0 #3d8a37; }

#btn-regen {
  margin: 0;
  padding: 6px 14px;
  font-size: 13px;
  letter-spacing: 0;
  box-shadow: 0 3px 0 #3d8a37;
}

/* ---------------- 物品栏 ---------------- */
#inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 54vh;
  overflow: auto;
  padding: 4px;
}
.inv-cell {
  position: relative;
  background: var(--mc-slot-inner);
  border: 2px solid var(--mc-slot-border);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  padding: 4px;
  cursor: pointer;
  text-align: center;
  transition: background 120ms ease;
}
.inv-cell:hover {
  background: #8d8d8d;
  border-color: #ffffff;
}
.inv-cell canvas {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto;
}
.inv-cell span {
  display: block;
  font-size: 11px;
  margin-top: 2px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
