/* mcres 2.1 设计基础：色彩 token + 像素原语。前台（app.css）与后台（admin.css）共用。
   视觉语言：极简单色 + 一个草绿强调色；全站直角；像素边框用 2px 阶梯（四角缺一格）。
   像素字体 MCPixel 只在 12px / 24px（12 的整数倍）下使用，避免发虚。 */

:root {
  --px: 2px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
             "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-px: "MCPixel", var(--font-ui);

  /* 浅色 */
  --bg: #f1f2ef;
  --surface: #fafaf8;
  --surface-2: #e8e9e5;
  --ink: #1d1f1c;
  --ink-2: #4f534d;
  --ink-3: #62675f;
  --line: #d3d5cf;
  --frame: #1d1f1c;          /* 像素框线（深） */
  --accent: #33711f;         /* 草绿 */
  --accent-ink: #f6f8f2;     /* 强调色上的文字 */
  --accent-weak: #dfe9d6;
  --bevel-hi: rgba(255, 255, 255, .28);
  --bevel-lo: rgba(0, 0, 0, .28);
  --scrim: rgba(18, 20, 17, .55);
  --focus: #33711f;

  /* 状态色（只用于小标签，低饱和） */
  --tone-green: #33711f;  --tone-green-bg: #dfe9d6;
  --tone-red: #a8362a;    --tone-red-bg: #f2dcd8;
  --tone-yellow: #7a5c08; --tone-yellow-bg: #f0e6c8;
  --tone-orange: #9a4f12; --tone-orange-bg: #f2e0cf;
  --tone-blue: #2c5f8a;   --tone-blue-bg: #d9e5ef;
  --tone-purple: #634b8f; --tone-purple-bg: #e4ddef;
  --tone-pink: #9a3b67;   --tone-pink-bg: #f1dbe5;
  --tone-cyan: #22706f;   --tone-cyan-bg: #d6eae8;
  --tone-gray: #5d625a;   --tone-gray-bg: #e3e4e0;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #161816;
  --surface: #1d201d;
  --surface-2: #262a26;
  --ink: #e6e8e2;
  --ink-2: #b0b5ac;
  --ink-3: #959b91;
  --line: #313630;
  --frame: #0b0c0b;
  --accent: #7cbf5b;
  --accent-ink: #102009;
  --accent-weak: #243420;
  --bevel-hi: rgba(255, 255, 255, .22);
  --bevel-lo: rgba(0, 0, 0, .35);
  --scrim: rgba(0, 0, 0, .66);
  --focus: #7cbf5b;

  --tone-green: #8ccb6c;  --tone-green-bg: #233420;
  --tone-red: #ec8a7c;    --tone-red-bg: #3a2220;
  --tone-yellow: #e0c068; --tone-yellow-bg: #362f1a;
  --tone-orange: #eba268; --tone-orange-bg: #3a2a1b;
  --tone-blue: #85b7e3;   --tone-blue-bg: #1d2c3a;
  --tone-purple: #b9a3e6; --tone-purple-bg: #2c2539;
  --tone-pink: #e69bbd;   --tone-pink-bg: #3a2330;
  --tone-cyan: #79cbc6;   --tone-cyan-bg: #1b3231;
  --tone-gray: #a6aba2;   --tone-gray-bg: #2a2e29;

  color-scheme: dark;
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: var(--px) solid var(--focus); outline-offset: var(--px); }

/* ---------------------------------------------------------------- 像素原语 */

/* 像素字：只用 12 / 24 两档 */
.px, .px-24 {
  font-family: var(--font-px);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: auto;
  font-smooth: never;
}
.px { font-size: 12px; line-height: 16px; }
.px-24 { font-size: 24px; line-height: 32px; }

/* 阶梯框：四边各 2px，四角各缺一格。元素需要留出 --px 的外边距 */
.frame {
  background: var(--surface);
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--frame-c, var(--line)),
    0 var(--px) 0 0 var(--frame-c, var(--line)),
    calc(-1 * var(--px)) 0 0 0 var(--frame-c, var(--line)),
    var(--px) 0 0 0 var(--frame-c, var(--line));
}
.frame-dark { --frame-c: var(--frame); }

/* 按钮：方块 + 斜面高光，按下时下沉 2px */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  margin: var(--px);
  border: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-px);
  font-size: 12px;
  line-height: 16px;
  -webkit-font-smoothing: none;
  font-smooth: never;
  white-space: nowrap;
  box-shadow:
    inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 0 var(--bevel-lo),
    inset var(--px) var(--px) 0 0 var(--bevel-hi),
    0 calc(-1 * var(--px)) 0 0 var(--frame),
    0 var(--px) 0 0 var(--frame),
    calc(-1 * var(--px)) 0 0 0 var(--frame),
    var(--px) 0 0 0 var(--frame);
  transition: transform .06s steps(1), filter .1s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active {
  transform: translateY(var(--px));
  box-shadow:
    inset var(--px) var(--px) 0 0 var(--bevel-lo),
    0 calc(-1 * var(--px)) 0 0 var(--frame),
    0 var(--px) 0 0 var(--frame),
    calc(-1 * var(--px)) 0 0 0 var(--frame),
    var(--px) 0 0 0 var(--frame);
}
.btn:focus-visible { outline-offset: 4px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost {
  background: transparent;
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(-1 * var(--px)) 0 0 0 var(--line),
    var(--px) 0 0 0 var(--line);
}
.btn-ghost:active { box-shadow: inset var(--px) var(--px) 0 0 var(--line); }
.btn-danger { background: var(--tone-red); color: var(--surface); }
.btn .ic { width: 16px; height: 16px; }

/* 输入框：内嵌 2px 边，聚焦变强调色 */
.input, .select, .textarea {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 var(--px) var(--line);
  outline: none;
  appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 1; }
.input:focus, .select:focus, .textarea:focus { box-shadow: inset 0 0 0 var(--px) var(--accent); }
.select {
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(-45deg, transparent 50%, var(--ink-2) 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

/* 小标签：像素字 + 低饱和底色 */
.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  font-family: var(--font-px);
  font-size: 12px;
  line-height: 16px;
  -webkit-font-smoothing: none;
  font-smooth: never;
  color: var(--t, var(--tone-gray));
  background: var(--tb, var(--tone-gray-bg));
  white-space: nowrap;
}
.tone-green  { --t: var(--tone-green);  --tb: var(--tone-green-bg); }
.tone-red    { --t: var(--tone-red);    --tb: var(--tone-red-bg); }
.tone-yellow { --t: var(--tone-yellow); --tb: var(--tone-yellow-bg); }
.tone-orange { --t: var(--tone-orange); --tb: var(--tone-orange-bg); }
.tone-blue   { --t: var(--tone-blue);   --tb: var(--tone-blue-bg); }
.tone-purple { --t: var(--tone-purple); --tb: var(--tone-purple-bg); }
.tone-pink   { --t: var(--tone-pink);   --tb: var(--tone-pink-bg); }
.tone-cyan   { --t: var(--tone-cyan);   --tb: var(--tone-cyan-bg); }
.tone-gray   { --t: var(--tone-gray);   --tb: var(--tone-gray-bg); }

kbd, .kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 4px;
  font-family: var(--font-px);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--ink-2);
  background: var(--surface-2);
  box-shadow: inset 0 calc(-1 * var(--px)) 0 var(--line);
  -webkit-font-smoothing: none;
}

/* 图标（像素图标雪碧图 static/img/icons.svg，pixelarticons） */
.ic { width: 20px; height: 20px; flex: none; fill: currentColor; shape-rendering: crispEdges; }

/* 像素化缩放（小图标、logo） */
.pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }

/* 进度条：方块步进 */
.pbar {
  height: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 var(--px) var(--frame);
  padding: var(--px);
}
.pbar > i {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
