/* 基础重置与全局控件外观。浏览器默认样式一律覆盖。 */

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

/* 手机浏览器上光靠 overflow: hidden 挡不住整页跟着触摸手势弹一下
   （iOS / 部分安卓内核在内容触达边缘时仍会做橡皮筋回弹），必须把 html、body
   钉死成撑满视口的定位元素，让页面根本没有"可以被滚动"的余地 */
html,
body {
  position: fixed;
  inset: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

/* 页面就绪之前不显示，免得看见没填文案的半成品闪一下 */
.app-shell {
  opacity: 0;
  transition: opacity 140ms ease;
}

html.ready .app-shell {
  opacity: 1;
}

.boot-loading {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  transition: opacity 140ms ease;
}

.boot-loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-line);
  border-top-color: var(--color-text-muted);
  border-radius: 50%;
  animation: boot-spin 0.8s linear infinite;
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

html.ready .boot-loading {
  opacity: 0;
  pointer-events: none;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  transition: background-color var(--transition-theme), color var(--transition-theme);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  overflow-anchor: none;
}

h1,
h2,
p {
  margin: 0;
  line-height: var(--line-height-title);
}

p {
  line-height: var(--line-height-body);
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
  opacity: 0.35;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: var(--border-width) solid var(--color-line-strong);
  outline-offset: 3px;
  border-radius: var(--radius-pill);
}

::selection {
  background: var(--color-accent);
  color: var(--color-accent-ink);
}

/* 滚动条：不使用系统外观 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-line);
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-faint);
  background-clip: content-box;
}
