/*
 * 驭鬼者论坛 · 全站基础样式（R108 重建）
 * 原文件随服务器数据一同丢失。本文件只负责全站外壳与元素基线：
 * 深色背景、排版、表单元素、滚动条、主容器留白与无障碍焦点。
 * 各页面自身的布局仍由页面内联样式 / 专属样式表负责，这里不覆盖页面组件。
 */
:root {
  color-scheme: dark;
  --ygz-bg: #07070b;
  --ygz-bg-2: #0b0c12;
  --ygz-surface: rgba(17, 18, 25, .78);
  --ygz-surface-strong: rgba(22, 23, 32, .94);
  --ygz-surface-soft: rgba(255, 255, 255, .045);
  --ygz-line: rgba(255, 255, 255, .12);
  --ygz-line-strong: rgba(255, 255, 255, .22);
  --ygz-text: rgba(255, 255, 255, .95);
  --ygz-text-soft: rgba(255, 255, 255, .68);
  --ygz-text-muted: rgba(255, 255, 255, .46);
  --ygz-blood: #8f1420;
  --ygz-blood-soft: rgba(143, 20, 32, .18);
  --ygz-gold: #d9b46a;
  --ygz-gold-soft: rgba(217, 180, 106, .16);
  --ygz-radius-xl: 30px;
  --ygz-radius-lg: 22px;
  --ygz-radius-md: 16px;
  --ygz-radius-sm: 12px;
  --ygz-shadow: 0 18px 44px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .08);
  --ygz-shadow-soft: 0 10px 28px rgba(0, 0, 0, .3);
  --ygz-nav-ease: cubic-bezier(.16, 1, .3, 1);
  --ygz-ease-silk: cubic-bezier(.22, 1, .36, 1);
  --ygz-ease-out: cubic-bezier(.2, .8, .2, 1);
  --ygz-float-z: 5400;
  --ygz-header-top: max(10px, env(safe-area-inset-top, 0px));
  --ygz-header-height: 54px;
  --ygz-header-total: 54px;
  --ygz-content-gap: 14px;
  --ygz-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --ygz-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ygz-bg);
  scroll-behavior: auto;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ygz-text);
  font-family: var(--ygz-font);
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--ygz-bg);
  /* 远处的血色雾气 + 底部暗角，固定在视口，滚动时不重绘内容层 */
  background-image:
    radial-gradient(120% 70% at 50% -20%, rgba(120, 18, 34, .16), transparent 58%),
    radial-gradient(90% 60% at 100% 110%, rgba(58, 30, 90, .10), transparent 60%),
    radial-gradient(80% 50% at 0% 100%, rgba(10, 40, 48, .10), transparent 62%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  overflow-x: clip;
}

/* 主内容容器：为悬浮导航留出空间 */
.main-wrapper,
#mainWrapper {
  position: relative;
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
  padding-top: calc(var(--ygz-header-top) + var(--ygz-header-total) + var(--ygz-content-gap));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
}
body.ygz-public-auth .main-wrapper,
body.ygz-public-auth #mainWrapper { padding-top: max(18px, env(safe-area-inset-top, 0px)); }

/* 排版基线 */
h1, h2, h3, h4, h5, h6 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: .01em; color: inherit; }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.3vw, 2rem); }
h2 { font-size: clamp(1.15rem, 1rem + .7vw, 1.45rem); }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
small { font-size: .85em; }
strong, b { font-weight: 700; }
hr { border: 0; height: 1px; background: var(--ygz-line); margin: 18px 0; }
code, kbd, pre, samp { font-family: var(--ygz-font-mono); font-size: .92em; }
pre { overflow: auto; white-space: pre-wrap; word-break: break-word; }
blockquote { margin: 0 0 1em; padding: .4em 1em; border-left: 3px solid var(--ygz-line-strong); color: var(--ygz-text-soft); }

a { color: inherit; text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: none; }
a, button, [role="button"], label, summary { touch-action: manipulation; }

img, video { max-width: 100%; }
img { border-style: none; }
svg:not([fill]) { fill: currentColor; }
iframe { border: 0; max-width: 100%; }

table { border-collapse: collapse; border-spacing: 0; max-width: 100%; }

/* 表单元素基线（页面样式优先级更高时会覆盖） */
button, input, select, textarea, optgroup { font: inherit; color: inherit; margin: 0; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
/* 没有任何类名的按钮：给一个与站点一致的暗色玻璃外观（带类名的按钮由页面自行定义） */
button:not([class]), input[type="submit"]:not([class]), input[type="button"]:not([class]), input[type="reset"]:not([class]) {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--ygz-line);
  background: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02) 60%), rgba(20, 21, 29, .9);
  color: var(--ygz-text);
  font-weight: 600;
  transition: border-color .18s ease, background-color .18s ease, transform .18s var(--ygz-nav-ease);
}
button:not([class]):hover, input[type="submit"]:not([class]):hover { border-color: var(--ygz-line-strong); }
button:not([class]):active, input[type="submit"]:not([class]):active { transform: scale(.98); }
button:not([class]):disabled { opacity: .5; }
input, select, textarea {
  max-width: 100%;
  border-radius: var(--ygz-radius-sm);
  border: 1px solid var(--ygz-line);
  background-color: rgba(255, 255, 255, .055);
  color: var(--ygz-text);
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
select, textarea { padding: 10px 12px; }
textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--ygz-text-muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ygz-line-strong); background-color: rgba(255, 255, 255, .08); }
input[type="checkbox"], input[type="radio"] { accent-color: #c9a35a; width: 1.05em; height: 1.05em; vertical-align: -.15em; }
input[type="range"] { accent-color: #c9a35a; }
select { background-image: none; }
select option { background: #15161d; color: #f1f1f4; }
fieldset { border: 1px solid var(--ygz-line); border-radius: var(--ygz-radius-md); padding: 12px 14px; margin: 0 0 14px; }
legend { padding: 0 6px; color: var(--ygz-text-soft); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* 键盘焦点：仅键盘导航时显示 */
:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(217, 180, 106, .75); outline-offset: 2px; border-radius: 6px; }

::selection { background: rgba(143, 20, 32, .55); color: #fff; }

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .28); background-clip: padding-box; }

dialog { color: var(--ygz-text); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }

[hidden] { display: none !important; }
.hidden { display: none !important; }
.sr-only, .ly-visually-hidden, .visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

/* 通用小部件（页面未定义时的兜底外观） */
.container { width: min(1080px, calc(100% - 32px)); margin-inline: auto; }
.text-muted { color: var(--ygz-text-muted); }
.text-soft { color: var(--ygz-text-soft); }
.red { color: #e0707a; }
.green { color: #7cc79a; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* 页脚 */
.footer {
  position: relative;
  margin: 28px auto 0;
  padding: 22px 18px calc(28px + env(safe-area-inset-bottom, 0px));
  width: min(980px, 100%);
  text-align: center;
  color: var(--ygz-text-muted);
  font-size: 12px;
  line-height: 1.75;
}
.footer::before {
  content: "";
  display: block;
  width: min(260px, 60%);
  height: 1px;
  margin: 0 auto 16px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
}
.footer p { margin: 0 0 4px; }

/* 图片加载占位：避免布局跳动 */
img.user-avatar, img.post-avatar, img.avatar { background-color: #1d1e26; }

/* 打印 */
@media print {
  .ygz-floating-header, .music-trigger, .music-card, .ygz-duanwu-notice, .ygz-action-island { display: none !important; }
  body { background: #fff; color: #000; }
}

@media (max-width: 380px) {
  body { font-size: 14.5px; }
}

/* 尊重系统“减少动态效果” */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
