/* =========================================================
   XLOG base.css — full build
   - Title centered, mobile-first
   - Light/Dark palettes
   - Dark: links = warm orange, bold names
   - Light: .btn-accent text = black
   - Mobile FAB no overlap with content
   - Theme selector as mini icon button (left of language)
   - Compact language select & hide "Language" label text
   ========================================================= */

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; overflow-x: hidden; }
img, video, canvas, iframe { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Theme variables: Light ---------- */
:root {
  --bg: #ffffff;
  --text: #0f1222;
  --muted: #5f6475;

  --accent: #635bff;       /* 品牌靛紫 */
  --accent-ink: #3926ff;

  --card: #f7f8fb;
  --border: #e5e8f0;
  --shadow: 0 8px 24px rgba(14,18,35,.06);

  --link: #0b66d0;         /* 亮色下的文本/链接色 */
  --link-visited: #5a4fdc;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --gap-lg: 18px;
  --gap-md: 14px;
  --gap-sm: 10px;

  --fab-bar: 72px;         /* 移动端底部悬浮条高度，按需微调 */
}

/* ---------- Theme variables: Dark ---------- */
.theme-dark {
  --bg: #0f1115;
  --text: #e8eaf3;
  --muted: #9aa1b2;

  --accent: #7c73ff;       /* 暗色下更亮的主色 */
  --accent-ink: #a29cff;

  --card: #151823;
  --border: #262b39;
  --shadow: 0 10px 28px rgba(0,0,0,.35);

  --link: #ffb357;         /* 暗色下链接：活力橙 */
  --link-visited: #ff9a2b;
}

/* ---------- Typography & layout ---------- */
html { font-size: 16px; }
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC","Hiragino Sans GB","Noto Sans CJK SC",
               "Helvetica Neue", Arial, "Noto Sans", "Noto Sans TC", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 让移动端不被底部悬浮按钮遮挡正文 */
@media (max-width: 768px) {
  body { padding-bottom: calc(var(--fab-bar) + env(safe-area-inset-bottom, 0px)); }
}

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 18px 16px 24px;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: center; /* 标题居中 */
  gap: 10px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  backdrop-filter: blur(6px) saturate(130%);
  background: color-mix(in srgb, var(--bg), transparent 0%);
  z-index: 10;
}
.header .title {
  text-align: center;
  font-weight: 800;
  font-size: clamp(20px, 4.8vw, 28px);
  letter-spacing: .3px;
}

/* ---------- Header controls (theme mini button + language select) ---------- */
.controls {
  position: absolute; right: 16px; top: 10px;
  display: flex; align-items: center; gap: 8px;
}

/* 通用控制项样式 */
.controls label { position: relative; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.controls select {
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

/* —— 仅用 CSS 将「主题选择」变为语言选择左侧的小圆按钮 —— */
.controls label:has(#theme) { order: -1; }              /* 1) 放到最左侧 */
.controls label:has(#theme) span { display: none; }     /* 2) 隐藏“主题”字样 */
.controls label:has(#theme) select {
  width: 44px; height: 36px; padding: 0;
  border-radius: 999px; text-indent: -9999px;
  appearance: none; -webkit-appearance: none; background: var(--bg);
}
/* 3) 用伪元素显示图标（☀️/🌙），不影响原生下拉逻辑 */
.controls label:has(#theme)::after {
  content: "☀️";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; font-size: 16px;
  border: 1px solid var(--border); border-radius: 999px;
  box-shadow: 0 0 0 3px transparent;
}
.theme-dark .controls label:has(#theme)::after { content: "🌙"; }
/* 聚焦态高亮 */
.controls label:has(#theme):focus-within::after {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 80%);
  border-color: var(--accent);
}

/* —— 语言选择紧凑化 + 隐藏“语言”文字 —— */
.controls label:has(#lang) span { display: none; }
.controls label:has(#lang) select { width: 120px; min-width: 120px; }
@media (max-width: 360px) {
  .controls label:has(#lang) select { width: 112px; min-width: 112px; }
}

/* ---------- Sections & cards ---------- */
.section {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 16px;
  box-shadow: var(--shadow);
}
.section h2 { margin: 0 0 10px; font-size: 16px; }

.help { color: var(--muted); font-size: 13px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- Links list (generated pages) ---------- */
.links { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 680px) { .links { grid-template-columns: 1fr 1fr; } }

.link-btn {
  display: grid; grid-template-columns: 1fr; align-items: start; gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card), var(--bg) 6%);
  text-decoration: none;
  transition: box-shadow .18s ease, transform .06s ease, border-color .18s ease, background .18s ease;
  will-change: transform;
}
.link-btn strong {
  font-size: 14px; line-height: 1.3;
  font-weight: 700;              /* 名称加粗 */
  color: var(--link);            /* 名称使用主题链接色（暗色=橙色） */
}
.link-btn span {
  font-size: 12px; color: var(--muted);
  word-break: break-word; overflow-wrap: anywhere;
}
.link-btn:hover {
  border-color: color-mix(in srgb, var(--link), var(--border) 60%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link), transparent 80%);
}
.link-btn:active { transform: translateY(1px); }

/* 普通文本链接颜色（非卡片按钮） */
a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }

/* ---------- Forms (creat.php) ---------- */
input[type="text"], input[type="url"], textarea, select {
  width: 100%;
  padding: 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted), transparent 20%); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 80%);
  outline: none;
}
.row { display: grid; gap: 10px; }
.row-2 { grid-template-columns: 1fr; }
@media (min-width: 720px) { .row-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 16px;
  font-size: 14px; font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow .18s ease, transform .06s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.btn:active { transform: translateY(1px); }

.btn-accent {
  border-color: color-mix(in srgb, var(--accent), var(--border) 40%);
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--accent), transparent 80%),
              color-mix(in srgb, var(--card), transparent 0%));
  color: #0f1115;  /* 亮色：按钮文字为黑色，保证可读性 */
}
.theme-dark .btn-accent {
  color: #0f1115; /* 暗色：在亮色渐变按钮上同样可读 */
  background: linear-gradient(180deg, var(--accent),
              color-mix(in srgb, var(--accent), transparent 15%));
}
.btn-accent:hover {
  box-shadow: 0 0 24px -6px color-mix(in srgb, var(--accent), transparent 20%);
}

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--accent), var(--border) 65%); }

/* ---------- Footer slot ---------- */
.footer-slot { margin-top: 16px; }

/* ---------- Success page block (generate.php) ---------- */
.success-wrap, .wrap {
  max-width: 720px; margin: 14px auto; padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}
.domain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px; word-break: break-word; overflow-wrap: anywhere;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: color-mix(in srgb, var(--card), var(--bg) 12%);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 8px;
  font-size: 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card), var(--bg) 8%);
  color: var(--muted);
}

/* ---------- Mobile Floating Action Bar (FAB) ---------- */
.fab {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg), transparent 0%);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px) saturate(140%);
  z-index: 40;
  display: none;             /* 仅在移动端显示 */
}
.fab .btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
}
@media (max-width: 768px) {
  .fab { display: block; }
}

/* ---------- Optional desktop scrollbar polish ---------- */
@media (min-width: 768px) {
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent), transparent 80%); border-radius: 10px; }
  *::-webkit-scrollbar-track { background: transparent; }
}