/* ============================================================
   HydraChat · base.css
   设计令牌 / 重置 / 排版
   ============================================================ */

:root {
  /* 主色（由 JS 注入覆盖） */
  --accent:      #4f6bff;
  --accent-2:    #00c2a8;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 34%, transparent);

  /* 圆角 / 尺寸 */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --modal-w: 520px;
  --bubble-max: 720px;
  --chat-pad: 20px;
  --font-size: 14px;

  /* 间距密度 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --sp-6: 30px;

  /* 表面 */
  --bg:        #fafbfd;
  --surface:   #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef1f6;
  --border:    #e6e9ef;
  --border-strong: #d3d8e2;

  /* 文本 */
  --text:      #14181f;
  --text-2:    #545c6b;
  --text-3:    #8b93a3;

  /* 语义色 */
  --ok:   #17915b;
  --warn: #c2760b;
  --err:  #d43d3d;
  --info: #2563eb;

  /* 阴影 —— 极简风：轻 */
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-2: 0 4px 14px rgba(16, 24, 40, .07);
  --shadow-3: 0 18px 48px rgba(16, 24, 40, .13);

  /* 动效 */
  --dur-collapse: 320ms;
  --dur-expand: 360ms;
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-smooth: cubic-bezier(.22, .61, .36, 1);
  --ease-bounce: cubic-bezier(.34, 1.8, .64, 1);
}

:root[data-theme="dark"] {
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 42%, transparent);

  --bg:        #0e1116;
  --surface:   #161a21;
  --surface-2: #1b1f27;
  --surface-3: #22262f;
  --border:    #262b34;
  --border-strong: #363c47;

  --text:      #e7eaf0;
  --text-2:    #a2a9b6;
  --text-3:    #6d7583;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-3: 0 18px 48px rgba(0, 0, 0, .6);
}

:root[data-density="compact"] {
  --sp-3: 9px;  --sp-4: 12px; --sp-5: 16px; --sp-6: 22px;
  --radius: 10px; --chat-pad: 14px;
}
:root[data-density="roomy"] {
  --sp-3: 15px; --sp-4: 20px; --sp-5: 28px; --sp-6: 38px;
  --radius: 18px; --chat-pad: 28px;
}

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

html, body { height: 100%; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system,
               BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--font-size);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color .35s ease, color .35s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
:root[data-reduce-motion="true"] *,
:root[data-reduce-motion="true"] *::before,
:root[data-reduce-motion="true"] *::after {
  animation-duration: .001ms !important;
  transition-duration: .001ms !important;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }

/* hidden 属性必须始终生效 —— 组件若设了 display 会覆盖 UA 的 [hidden]{display:none} */
[hidden] { display: none !important; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-3) 30%, transparent);
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-3) 55%, transparent);
  background-clip: content-box;
}

/* ---------- 工具类 ---------- */
.mono {
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: .82em;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ico {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}
.ico--sm { width: 15px; height: 15px; stroke-width: 2; }
.ico--xs { width: 13px; height: 13px; stroke-width: 2.2; }

/* 隐藏原生光标 */
:root[data-custom-cursor="true"] body,
:root[data-custom-cursor="true"] body * { cursor: none !important; }
:root[data-custom-cursor="true"] input,
:root[data-custom-cursor="true"] textarea { cursor: text !important; }

/* 光标层 */
#cursor-layer { position: fixed; inset: 0; z-index: 9990; pointer-events: none; }
#cursor-dot, #cursor-ring {
  position: fixed; top: 0; left: 0;
  z-index: 9991; pointer-events: none;
  will-change: transform;
}
#cursor-dot {
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--cursor-color, var(--accent));
  box-shadow: 0 0 10px color-mix(in srgb, var(--cursor-color, var(--accent)) 55%, transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
#cursor-ring {
  width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--cursor-color, var(--accent)) 65%, transparent);
  opacity: 0;
  transition: opacity .2s ease, width .2s var(--ease-spring), height .2s var(--ease-spring),
              margin .2s var(--ease-spring), border-radius .2s var(--ease-spring);
  display: grid; place-items: center;
}
:root[data-custom-cursor="true"] #cursor-dot,
:root[data-custom-cursor="true"] #cursor-ring { opacity: 1; }
#cursor-ring.is-hover {
  border-color: var(--cursor-color, var(--accent));
  background: color-mix(in srgb, var(--cursor-color, var(--accent)) 12%, transparent);
}
.cursor-ring__label {
  font-size: 10px; font-weight: 600;
  color: var(--cursor-color, var(--accent));
  opacity: 0;
  transition: opacity .18s ease;
  white-space: nowrap;
}
