/* =====================================================================
   像素宠舍 · 设计令牌与基础层
   底色是冷调的雾青纸，唯一的强调色留给宠物与喂食；
   2px 硬边、直角、硬阴影——因为这个世界是由格子拼成的。
   ===================================================================== */

:root {
  --paper: #eaeff0;
  --paper-2: #f7fafa;
  --paper-3: #dfe7e8;
  --grid: #d7e1e2;
  --line: #b9c7c9;
  --ink: #131a21;
  --ink-2: #4f5b67;
  --ink-3: #8b979e;
  --sky: #bfdce8;
  --sky-2: #a9cde0;
  --leaf: #3fa46a;
  --leaf-d: #2b7b4d;
  --berry: #ef4265;
  --berry-d: #c92a4c;
  --sun: #f5b32e;
  --night: #1d2836;

  --font-ui: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Consolas", "SF Mono", "Menlo", monospace;

  --t-11: 0.6875rem;
  --t-12: 0.75rem;
  --t-14: 0.875rem;
  --t-16: 1rem;
  --t-20: 1.25rem;
  --t-26: 1.625rem;
  --t-34: 2.125rem;
  --t-46: 2.875rem;
  --t-64: 4rem;

  --gut: 20px;
  --col: 1080px;
  --shadow-hard: 4px 4px 0 rgba(19, 26, 33, 0.16);
  --shadow-hard-sm: 2px 2px 0 rgba(19, 26, 33, 0.18);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-16);
  line-height: 1.65;
  letter-spacing: 0.005em;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
p,
figure,
blockquote {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

a {
  color: var(--leaf-d);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

a:hover {
  color: var(--berry-d);
}

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

img,
canvas,
svg {
  display: block;
  max-width: 100%;
}

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

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

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

/* ------------------------------- 布局 ------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 var(--gut);
}

.band {
  /* flow-root 阻止子元素的外边距穿透出去，否则色块之间会露出底纹 */
  display: flow-root;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--paper-2);
}

.band + .band {
  border-top: 0;
}

.stack > * + * {
  margin-top: 14px;
}

.stack-lg > * + * {
  margin-top: 28px;
}

.muted {
  color: var(--ink-2);
}

.faint {
  color: var(--ink-3);
}

.tiny {
  font-size: var(--t-12);
}

.tag {
  display: inline-block;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: var(--t-11);
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ------------------------------ 页头 ------------------------------ */

.topbar {
  background: var(--night);
  color: var(--paper-2);
  border-bottom: 2px solid var(--ink);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
  flex: none;
}

.brand__name {
  font-size: var(--t-20);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand__sub {
  font-family: var(--font-mono);
  font-size: var(--t-11);
  color: #9fb0be;
  letter-spacing: 0.04em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}

.topnav a {
  display: inline-block;
  padding: 5px 10px;
  color: #d6e2ea;
  text-decoration: none;
  font-size: var(--t-14);
  border: 2px solid transparent;
}

.topnav a:hover {
  color: #fff;
  border-color: #46586a;
}

.topnav a[aria-current="page"] {
  background: var(--paper-2);
  color: var(--night);
  border-color: var(--paper-2);
  font-weight: 600;
}

/* ------------------------------ 按钮 ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  padding: 8px 16px;
  font-size: var(--t-14);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 90ms steps(2, end), box-shadow 90ms steps(2, end), background-color 120ms linear;
}

.btn:hover {
  background: #fff;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.btn--primary {
  background: var(--berry);
  border-color: var(--ink);
  color: #fff;
}

.btn--primary:hover {
  background: var(--berry-d);
}

.btn--ghost {
  background: transparent;
  box-shadow: none;
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.5);
}

.btn--sun {
  background: var(--sun);
}

.btn--sun:hover {
  background: #ffc94f;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn--sm {
  padding: 4px 10px;
  font-size: var(--t-12);
}

.btn--block {
  width: 100%;
  justify-content: center;
}

/* ------------------------------ 表单 ------------------------------ */

.field {
  display: block;
}

.field__label {
  display: block;
  font-size: var(--t-12);
  font-family: var(--font-mono);
  color: var(--ink-2);
  margin-bottom: 5px;
}

.input {
  width: 100%;
  border: 2px solid var(--ink);
  background: #fff;
  padding: 9px 11px;
  font-size: var(--t-16);
}

.input--mono {
  font-family: var(--font-mono);
}

.input:focus {
  outline: 3px solid var(--berry);
  outline-offset: 1px;
}

.field__hint {
  font-size: var(--t-12);
  color: var(--ink-3);
  margin-top: 4px;
}

.notice {
  border: 2px solid var(--ink);
  border-left-width: 6px;
  padding: 9px 12px;
  font-size: var(--t-14);
  background: #fff;
}

.notice--error {
  border-left-color: var(--berry);
  background: #ffeef2;
}

.notice--info {
  border-left-color: var(--sky-2);
  background: #eef7fb;
}

.notice--ok {
  border-left-color: var(--leaf);
  background: #edf8f1;
}

.notice[hidden] {
  display: none;
}

/* ------------------------------ 页脚 ------------------------------ */

.footer {
  margin-top: auto;
  background: var(--night);
  color: #9fb0be;
  border-top: 2px solid var(--ink);
  padding: 22px 0;
  font-size: var(--t-12);
}

.footer__grid {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.footer a {
  color: #cfe0ea;
}

.footer strong {
  color: var(--paper-2);
  font-weight: 600;
}

/* --------------------------- 提示条 / 加载 --------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
  pointer-events: none;
  width: min(92vw, 420px);
}

.toast {
  border: 2px solid var(--ink);
  background: var(--paper-2);
  box-shadow: var(--shadow-hard);
  padding: 10px 14px;
  font-size: var(--t-14);
  animation: toast-in 140ms steps(3, end);
}

.toast--error {
  background: #ffeef2;
}

.toast--ok {
  background: #edf8f1;
}

@keyframes toast-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px 0;
  color: var(--ink-2);
  font-size: var(--t-14);
}

.loading__dot {
  width: 10px;
  height: 10px;
  background: var(--berry);
  animation: blink 900ms steps(2, end) infinite;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.15;
  }
}

.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;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  :root {
    --gut: 14px;
  }

  body {
    background-size: 24px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
