/* =============================================================
   基础重置与通用元素
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

/* hidden 属性必须能压过组件自身的 display */
[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  outline: none;
}

input[type="search"]::-webkit-search-cancel-button { display: none; }

:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.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;
}

/* ------------------------------------------------------------ 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 20px;
  border-radius: var(--r-sm);
  font-size: var(--fs-md); font-weight: 500;
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease),
              border-color .16s var(--ease), transform .1s var(--ease);
}
.btn:active { transform: scale(.985); }
.btn:disabled { cursor: not-allowed; opacity: .5; transform: none; }

.btn-primary { background: var(--c1-btn); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c1-d); }

.btn-line {
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-line:hover:not(:disabled) { border-color: var(--control-line); color: var(--ink); }

.btn-block { width: 100%; }

/* ------------------------------------------------------------ 提示条 */
.toast {
  position: fixed; left: 50%; bottom: 40px; z-index: 90;
  transform: translate(-50%, 12px);
  max-width: min(88vw, 460px);
  padding: 11px 20px;
  background: rgba(29, 33, 41, .92);
  color: #fff; font-size: var(--fs-sm); line-height: 1.5;
  border-radius: var(--r-pill);
  box-shadow: var(--sh-3);
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast[data-on="1"] { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
