*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--font-scale));
  -webkit-text-size-adjust: 100%;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--coal);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.6;
  overflow: hidden;
  overscroll-behavior: none;
}

body { -webkit-font-smoothing: antialiased; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 2.5rem;
  padding: 0.45rem 1.05rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #2b353a, #20282c);
  color: var(--ink);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
  user-select: none;
}
.btn:hover:not(:disabled) { border-color: var(--ink-3); background: linear-gradient(180deg, #33404a, #252e33); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn--primary { border-color: #7d9a76; background: linear-gradient(180deg, #4f6a4b, #3d533a); color: #f1eedf; }
.btn--primary:hover:not(:disabled) { border-color: #a6c39d; background: linear-gradient(180deg, #5c7a57, #465f42); }
.btn--danger { border-color: #c06a5c; background: linear-gradient(180deg, #8a3c33, #6c2d26); color: #fbe9e4; }
.btn--danger:hover:not(:disabled) { border-color: #e08a7b; background: linear-gradient(180deg, #9e463b, #7a332b); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
.btn--small { min-height: 2rem; padding: 0.25rem 0.7rem; font-size: 0.85rem; }

.kbd {
  display: inline-block;
  padding: 0 0.35em;
  border: 1px solid currentColor;
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75em;
  line-height: 1.5;
  opacity: 0.75;
}

.dev-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.05rem 0.5rem;
  border: 1px dashed currentColor;
  border-radius: 99px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

/* 启动遮罩 */
.boot {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot);
  display: grid;
  place-items: center;
  background: var(--coal);
  color: var(--ink-2);
  transition: opacity 0.4s;
}
.boot.is-hidden { opacity: 0; pointer-events: none; }
.boot__inner { text-align: center; }
.boot__title { font-family: var(--font-paper); font-size: 1.8rem; letter-spacing: 0.3em; color: var(--paper); }
.boot__msg { margin-top: 0.6rem; font-size: 0.9rem; }
.boot__error { margin-top: 1rem; color: var(--rust-2); max-width: 28rem; }
