/* ══════════════════════════════════════════════════════════════════════════
   雪原小游戏 · MC 界面皮肤（共用样式）
   ──────────────────────────────────────────────────────────────────────────
   目标：把农场、矿洞、入口页三个页面的界面统一成 Minecraft 原版 GUI 的样子。

   ## 这套东西的依据

   全部取自本机 MC 26.1.2 客户端的原版贴图，不是自己画的：

     widgets/button.png          按钮的九宫格底图（含高亮、禁用三态）
     widgets/slot_frame.png      物品格的边框
     widgets/tab.png             页签
     container/slot.png          槽位凹槽
     tooltip/background.png      提示框底
     hud/hotbar.png              快捷栏
     hud/experience_bar_*        经验条（用作进度条）
     font/ascii.png              原版位图字体（只覆盖 ASCII，中文用系统字体）

   ## MC 界面的四条规矩（照这个做才像）

   ① **没有圆角**。原版 GUI 全是硬边矩形，`border-radius` 一律为 0。
   ② **灰紫底色 + 深色描边**。原版面板是 `#c6c6c6` 一族的灰，边线是 `#373737`。
   ③ **按钮按下时整体下移 1px**，并换成更暗的底图 —— 这是原版按钮的触感。
   ④ **字体带阴影**。原版文字右下 1px 有深色影子，行高偏紧。

   ## 用法

     页面里先引 gui.css，再引自己的样式。
     需要 MC 样子的元素加对应的 class：

       <button class="mc-btn">普通按钮</button>
       <button class="mc-btn mc-btn--primary">主要按钮</button>
       <div class="mc-panel">面板</div>
       <div class="mc-slot">物品格</div>
       <div class="mc-frame">凹槽框</div>
       <div class="mc-tooltip">提示框</div>
       <div class="mc-title">标题条</div>
       <div class="mc-progress"><i style="width:40%"></i></div>
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 令牌 ──────────────────────────────────────────────────────────────── */
:root {
  /* 原版面板灰阶（取自 button.png 的实际像素） */
  --mc-bg:        #c6c6c6;
  --mc-bg-light:  #d8d8d8;
  --mc-bg-dark:   #8b8b8b;
  --mc-bg-deep:   #555555;
  --mc-border:    #373737;
  --mc-border-hi: #ffffff;
  --mc-border-lo: #545454;

  /* 文字 */
  --mc-ink:       #3f3f3f;
  --mc-ink-light: #ffffff;
  --mc-ink-shadow:#3f3f3f;

  /* 原版 GUI 里的几种功能色 */
  --mc-green:     #55ff55;
  --mc-yellow:    #ffff55;
  --mc-gold:      #ffaa00;
  --mc-red:       #ff5555;
  --mc-aqua:      #55ffff;
  --mc-purple:    #ff55ff;

  /* 深色容器底（箱子、熔炉那类） */
  --mc-dark:      #1d1d1d;
  --mc-dark-2:    #2b2b2b;

  /* 槽位 */
  --mc-slot-bg:   #8b8b8b;

  /* 字体：中文用系统黑体，英文数字尽量贴合原版观感 */
  --mc-font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

/* ── 基础重置：MC 界面没有圆角、没有柔和阴影 ───────────────────────────── */
.mc-ui,
.mc-ui * {
  box-sizing: border-box;
  border-radius: 0 !important;
}

.mc-ui {
  font-family: var(--mc-font);
  color: var(--mc-ink);
  font-size: 13px;
  line-height: 1.55;
  /* 原版文字有右下 1px 阴影 */
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .22);
  image-rendering: pixelated;
}

.mc-ui img {
  image-rendering: pixelated;
  display: block;
}

/* 深色底上的文字用白字 + 深影，与原版一致 */
.mc-dark-text,
.mc-dark-text * {
  color: #e0e0e0;
  text-shadow: 1px 1px 0 #1a1a1a;
}

/* ── 面板：原版容器样式 ────────────────────────────────────────────────── */
/* 浅色面板（像箱子、工作台那种灰面板） */
.mc-panel {
  background: var(--mc-bg);
  /* 原版的立体边框：左上白、右下深灰、最外圈黑 */
  border: 2px solid var(--mc-border);
  box-shadow:
    inset 2px 2px 0 var(--mc-border-hi),
    inset -2px -2px 0 var(--mc-border-lo),
    0 0 0 2px #000;
  padding: 14px;
  position: relative;
}

/* 深色面板（像熔炉、附魔台那种深底） */
.mc-panel--dark {
  background: var(--mc-dark-2);
  border: 2px solid #000;
  box-shadow:
    inset 2px 2px 0 #4a4a4a,
    inset -2px -2px 0 #101010;
  color: #e0e0e0;
}

/* 面板标题条：原版 GUI 顶部那一行 */
.mc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--mc-ink);
  background: var(--mc-bg-light);
  border-bottom: 2px solid var(--mc-border);
  box-shadow: inset 0 2px 0 var(--mc-border-hi);
  padding: 6px 10px;
  margin: -14px -14px 12px;
}
.mc-title img { width: 18px; height: 18px; }
.mc-title .sub {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 400;
  color: #555;
}

/* ── 按钮：原版三态 ────────────────────────────────────────────────────── */
.mc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  font-family: var(--mc-font);
  font-size: 13px;
  font-weight: 700;
  color: var(--mc-ink-light);
  text-shadow: 2px 2px 0 #3f3f3f;

  /* 原版按钮底：灰面 + 上白下深的立体边 */
  background: var(--mc-bg-dark);
  border: 2px solid var(--mc-border);
  box-shadow:
    inset 2px 2px 0 #a8a8a8,
    inset -2px -2px 0 #4a4a4a,
    0 0 0 2px #000;

  padding: 7px 16px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  /* 原版按钮文字居中、字形偏粗 */
  letter-spacing: .3px;
  transition: none;
}

.mc-btn:hover:not(:disabled) {
  background: #a0a0a0;
  box-shadow:
    inset 2px 2px 0 #c8c8c8,
    inset -2px -2px 0 #565656,
    0 0 0 2px #000;
}

.mc-btn:active:not(:disabled) {
  /* 原版按下时整块下移 1px、换成更暗的底 */
  transform: translateY(1px);
  background: #6f6f6f;
  box-shadow:
    inset 2px 2px 0 #4a4a4a,
    inset -2px -2px 0 #8b8b8b,
    0 0 0 2px #000;
}

.mc-btn:disabled {
  cursor: not-allowed;
  color: #a0a0a0;
  text-shadow: 2px 2px 0 #262626;
  background: #6f6f6f;
  box-shadow:
    inset 2px 2px 0 #8b8b8b,
    inset -2px -2px 0 #3a3a3a,
    0 0 0 2px #000;
}

/* 主要按钮：原版用绿色强调（像「完成」「确认」） */
.mc-btn--primary {
  background: #4a7a34;
  box-shadow:
    inset 2px 2px 0 #6fa04f,
    inset -2px -2px 0 #2d4a1f,
    0 0 0 2px #000;
}
.mc-btn--primary:hover:not(:disabled) {
  background: #5a8f40;
  box-shadow:
    inset 2px 2px 0 #85b866,
    inset -2px -2px 0 #365a26,
    0 0 0 2px #000;
}

/* 危险按钮 */
.mc-btn--danger {
  background: #7a3434;
  box-shadow:
    inset 2px 2px 0 #a05050,
    inset -2px -2px 0 #4a1f1f,
    0 0 0 2px #000;
}

/* 小按钮 */
.mc-btn--sm {
  font-size: 11.5px;
  padding: 4px 10px;
  text-shadow: 1px 1px 0 #3f3f3f;
}

/* 图标按钮（方形） */
.mc-btn--icon {
  width: 34px;
  height: 34px;
  padding: 0;
}
.mc-btn--icon img {
  width: 20px;
  height: 20px;
}

/* ── 槽位与凹槽 ────────────────────────────────────────────────────────── */
/* 物品格：原版那种凹进去的深灰格 */
.mc-slot {
  position: relative;
  background: var(--mc-slot-bg);
  border: 2px solid var(--mc-border);
  box-shadow:
    inset 2px 2px 0 var(--mc-border-lo),
    inset -2px -2px 0 var(--mc-border-hi),
    0 0 0 2px #000;
  display: grid;
  place-items: center;
  padding: 4px;
}
.mc-slot img {
  width: 26px;
  height: 26px;
}
.mc-slot .n {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
  font-variant-numeric: tabular-nums;
}
.mc-slot--on {
  box-shadow:
    inset 2px 2px 0 var(--mc-border-lo),
    inset -2px -2px 0 var(--mc-border-hi),
    0 0 0 2px #fff,
    0 0 0 4px #000;
}

/* 凹槽框：比槽位更宽，用来包一组东西 */
.mc-frame {
  background: var(--mc-bg-dark);
  border: 2px solid var(--mc-border);
  box-shadow:
    inset 2px 2px 0 var(--mc-border-lo),
    inset -2px -2px 0 #b0b0b0,
    0 0 0 2px #000;
  padding: 8px;
}

/* ── 进度条：借用原版经验条 ────────────────────────────────────────────── */
.mc-progress {
  position: relative;
  height: 10px;
  background: #3f3f3f;
  border: 1px solid #1a1a1a;
  box-shadow: inset 1px 1px 0 #1a1a1a;
  overflow: hidden;
}
.mc-progress > i {
  display: block;
  height: 100%;
  background: #80ff20;
  box-shadow: inset 0 1px 0 #b0ff80, inset 0 -1px 0 #40a000;
  transition: width .3s linear;
}
/* 金色进度条（用于收获/进度提示） */
.mc-progress--gold > i {
  background: #ffc000;
  box-shadow: inset 0 1px 0 #ffe080, inset 0 -1px 0 #a07000;
}

/* ── 提示框 ────────────────────────────────────────────────────────────── */
.mc-tooltip {
  position: absolute;
  z-index: 60;
  background: #100010;
  border: 2px solid #2d0a63;
  box-shadow:
    inset 0 0 0 1px #100010,
    0 0 0 2px #100010;
  color: #fff;
  text-shadow: 1px 1px 0 #3f3f3f;
  font-size: 12.5px;
  padding: 5px 9px;
  pointer-events: none;
  max-width: 260px;
  line-height: 1.5;
}

/* ── 消息条（原版聊天栏那种） ──────────────────────────────────────────── */
.mc-msg {
  background: rgba(0, 0, 0, .6);
  color: #fff;
  text-shadow: 1px 1px 0 #3f3f3f;
  padding: 5px 10px;
  font-size: 12.5px;
}

/* ── 提示条（拾取物品那种飘字） ────────────────────────────────────────── */
.mc-toast {
  background: #212121;
  border: 2px solid #000;
  box-shadow:
    inset 2px 2px 0 #4a4a4a,
    inset -2px -2px 0 #101010;
  color: #fff;
  text-shadow: 1px 1px 0 #3f3f3f;
  font-size: 12.5px;
  padding: 7px 13px;
  animation: mc-toast-in .2s steps(2);
}
.mc-toast--good { color: var(--mc-green); }
.mc-toast--gold { color: var(--mc-gold); }
.mc-toast--bad  { color: var(--mc-red); }
@keyframes mc-toast-in {
  from { transform: translateX(12px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── 弹层 ──────────────────────────────────────────────────────────────── */
.mc-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 20px;
}
.mc-modal[hidden] { display: none; }

/* 锁定遮罩：比普通弹层**更轻**的压暗。
   ⚠️ 第一版用了 .8 的黑色，整页几乎全黑，玩家以为页面坏了（实测截图可见）。
      原版客户端里没登录提示是一张小卡片浮在场景上，背景只略微压暗。
      这里降到 .45，让底下的界面仍然看得见轮廓。 */
.mc-lock {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: grid;
  place-items: center;
  z-index: 250;
  padding: 20px;
}
.mc-lock[hidden] { display: none; }
.mc-modal-card {
  background: var(--mc-bg);
  border: 2px solid var(--mc-border);
  box-shadow:
    inset 2px 2px 0 var(--mc-border-hi),
    inset -2px -2px 0 var(--mc-border-lo),
    0 0 0 2px #000;
  padding: 16px 18px;
  max-width: 520px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  color: var(--mc-ink);
}
.mc-modal-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-modal-card h3 img { width: 22px; height: 22px; }
.mc-modal-card .sub {
  font-size: 11.5px;
  color: #555;
  margin-bottom: 12px;
}
.mc-modal-card p {
  font-size: 12.5px;
  line-height: 1.75;
  margin-bottom: 8px;
}
.mc-modal-card .note {
  color: #555;
  font-size: 11.5px;
}

/* ── 分隔线 ────────────────────────────────────────────────────────────── */
.mc-hr {
  height: 2px;
  background: var(--mc-border-lo);
  box-shadow: inset 0 -1px 0 var(--mc-border-hi);
  margin: 10px 0;
  border: 0;
}

/* ── 文字色工具类 ──────────────────────────────────────────────────────── */
.mc-c-green  { color: #2a7a2a; }
.mc-c-gold   { color: #a07000; }
.mc-c-red    { color: #a02020; }
.mc-c-gray   { color: #606060; }
.mc-c-lgreen { color: var(--mc-green); }
.mc-c-lyellow{ color: var(--mc-yellow); }
.mc-c-lgold  { color: var(--mc-gold); }
.mc-c-lred   { color: var(--mc-red); }

/* 数字等宽，避免跳动（原版数字本身就是等宽位图） */
.mc-num {
  font-variant-numeric: tabular-nums;
}

/* ── 滚动条：做成原版那种细窄样式 ──────────────────────────────────────── */
.mc-ui ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.mc-ui ::-webkit-scrollbar-track {
  background: #2b2b2b;
}
.mc-ui ::-webkit-scrollbar-thumb {
  background: var(--mc-bg-dark);
  box-shadow: inset 2px 2px 0 #b0b0b0, inset -2px -2px 0 #4a4a4a;
}
.mc-ui ::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* ── 响应式：小屏时字号略降，但硬边风格不变 ────────────────────────────── */
@media (max-width: 560px) {
  .mc-ui { font-size: 12.5px; }
  .mc-btn { font-size: 12.5px; padding: 6px 12px; }
  .mc-btn--sm { font-size: 11px; padding: 4px 8px; }
  .mc-panel { padding: 11px; }
  .mc-title { margin: -11px -11px 10px; }
  .mc-slot img { width: 22px; height: 22px; }
}
