@charset "UTF-8";
/* ============================================================
 * style.css — Manosaba Nameplate Maker（纯静态版）
 *
 * 配色沿用主项目 webui/css/theme.css 的深色主题，
 * 但不依赖任何后端 / 框架 / 外部 CDN。
 * ============================================================ */

:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-panel: #151c26;
  --bg-elev: #1a2330;
  --bg-hover: #1f2a38;
  --bg-active: #22303f;
  --border: #24303e;
  --border-strong: #33465c;
  --text: #e6edf3;
  --text-dim: #9aa7b4;
  --text-faint: #6b7785;
  --accent: #35d07f;
  --accent-2: #58a6ff;
  --accent-soft: rgba(53, 208, 127, 0.12);
  --accent-ink: #07130c;
  --accent-text: #35d07f;
  --warning: #fbbf24;
  --danger: #f85149;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-sm: 9px;
  --thumb-checker-dark: #3a414b;
  --thumb-checker-light: #4f5761;
  --stage-text: #c2cad3;
  --stage-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", "Courier New", monospace;
}

/* 浅色模式（沿用主项目 webui/css/theme.css 的浅色变量） */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-panel: #ffffff;
  --bg-elev: #f0f2f8;
  --bg-hover: #e8ebf4;
  --bg-active: #dfe4f0;
  --border: #e2e6f0;
  --border-strong: #c9d2e4;
  --text: #1c2430;
  --text-dim: #5b6575;
  --text-faint: #93a0b3;
  --accent-text: #2aa865;
  --warning: #b45309;
  --danger: #c62828;
  --shadow: 0 10px 30px rgba(30, 41, 80, 0.12);
  --shadow-sm: 0 2px 8px rgba(30, 41, 80, 0.08);
  --thumb-checker-dark: #c0c0c0;
  --thumb-checker-light: #ffffff;
  --stage-text: #5b6575;
  --stage-shadow: none;
}

/* 默认主题色：原项目的 Ema（粉） */
html[data-accent="ema"] {
  --accent: #FF8FB4;
  --accent-2: #FF8FB4;
  --accent-soft: rgba(255, 143, 180, 0.14);
  --accent-ink: #2a1018;
  --accent-text: #FF8FB4;
}

/* 浅色 + Ema：标题文字用更深的粉，保证可读性 */
html[data-theme="light"][data-accent="ema"] {
  --accent-text: #C94D78;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

[hidden] { display: none !important; }

button, input, select { font: inherit; }

.page {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 44px 22px 0;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* ── 顶部工具条：主题切换 + 语言（靠右） ─────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.theme-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.theme-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.theme-btn svg { width: 16px; height: 16px; }

/* 深色模式显示太阳（点击切浅色）；浅色模式显示月亮（点击切深色） */
.theme-btn .icon-sun { display: flex; }
.theme-btn .icon-moon { display: none; }
html[data-theme="light"] .theme-btn .icon-sun { display: none; }
html[data-theme="light"] .theme-btn .icon-moon { display: flex; }

/* ── 页头 ─────────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 26px;
}

.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-logo {
  display: block;
  width: clamp(190px, 22vw, 280px);
  max-width: 86vw;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.hero-game {
  margin: 0;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.6;
}

.hero h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hero-desc {
  margin: 0 auto;
  max-width: 680px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.8;
}

.lang-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 12px;
}

/* ── 主卡片 ───────────────────────────────────────────── */
.card {
  padding: 26px;
  margin-bottom: 26px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.np-body {
  display: flex;
  align-items: flex-start;
  gap: 30px;
}

.np-form {
  flex: 1 1 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.np-preview {
  flex: 1 1 380px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.np-row { display: flex; flex-direction: column; gap: 7px; }
.np-row-inline { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.np-row-inline .np-label { flex-shrink: 0; }

.np-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.np-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }

.np-example {
  margin: -8px 0 0;
  color: var(--text-dim);
  font-size: 11.5px;
}

/* 字体行的补充提示（例如：中文名字请使用 SourceHanSerifSC） */
.np-tip {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: -9px 0 0;
  color: var(--text-faint);
  font-size: 11.5px;
  line-height: 1.6;
}

.np-tip::before {
  content: "!";
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(1px);
}

.np-label {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.np-input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.np-input::placeholder { color: var(--text-faint); }

.np-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.np-empty { font-size: 12px; color: var(--warning); }

/* ── 自定义下拉（非原生 select）──────────────────────── */
.dd-slot { display: inline-flex; min-width: 0; }
.dd { position: relative; display: inline-block; }

.dd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  min-width: 0;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dd-trigger:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.dd-trigger:disabled { opacity: 0.42; cursor: not-allowed; }

.dd-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.dd-trigger.is-placeholder .dd-value { color: var(--text-faint); }

.dd-caret {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-faint);
  transition: transform 0.15s ease;
}

.dd.open .dd-caret { transform: rotate(180deg); }

.dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 45;
  min-width: 100%;
  max-height: 240px;
  overflow: auto;
  padding: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.dd-menu-right { left: auto; right: 0; }

.dd-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.dd-option:hover, .dd-option.active { background: var(--bg-hover); }
.dd-option.selected { background: var(--accent-soft); }

.dd-check {
  display: none;
  margin-left: auto;
  color: var(--accent-text);
  font-weight: 700;
}

.dd-option.selected .dd-check { display: inline-block; }

.dd-option-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.dd-lang .dd-trigger {
  height: 32px;
  min-width: 92px;
  font-size: 12px;
  background: var(--bg-panel);
}

.dd-font { width: 210px; max-width: 100%; }
.dd-font .dd-trigger { width: 100%; }

/* 首字颜色按钮 */
.np-color-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 168px;
  height: 36px;
  padding: 0 11px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.np-color-btn:hover { border-color: var(--border-strong); background: var(--bg-hover); }

.np-color-btn .cp-caret { color: var(--text-faint); display: inline-flex; flex-shrink: 0; }

.np-color-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 12px;
}

.np-swatch {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.np-status {
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
}

.np-status[data-tone="error"] { color: var(--danger); }

/* ── 预览区 ───────────────────────────────────────────── */
.np-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  padding: 14px;
  background-color: var(--thumb-checker-dark);
  background-image:
    linear-gradient(45deg, var(--thumb-checker-light) 25%, transparent 25%),
    linear-gradient(-45deg, var(--thumb-checker-light) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--thumb-checker-light) 75%),
    linear-gradient(-45deg, transparent 75%, var(--thumb-checker-light) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: auto;
}

.np-stage-empty {
  padding: 18px;
  color: var(--stage-text);
  font-size: 12px;
  text-align: center;
  text-shadow: var(--stage-shadow);
}

.np-stage img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  height: auto;
}

.np-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.np-size { color: var(--text-faint); font-size: 12px; }

.np-hint {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.6;
}

/* ── 按钮 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }

.btn.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }

.btn:disabled { opacity: 0.42; cursor: not-allowed; }

.btn:focus-visible,
.np-input:focus-visible,
.np-color-btn:focus-visible,
.np-color-item:focus-visible,
.theme-btn:focus-visible,
.dd-trigger:focus-visible,
.dd-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 页脚（免责声明 / 版权 / 许可）───────────────────── */
.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px 28px;
  margin-top: auto;
  padding: 18px 0 24px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 11.5px;
  line-height: 1.75;
}

.foot-title {
  margin: 0 0 4px;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.foot-text { margin: 0; }

.foot-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  white-space: nowrap;
}

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

.foot-link {
  color: var(--accent-text);
  text-decoration: none;
  transition: text-decoration-color 0.15s ease;
}

/* 下划线只跟随文字宽度（不用 border-bottom，避免被 flex 拉伸成整行） */
.foot-link:hover,
.foot-link:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.foot-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── 颜色模态 ─────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 6, 10, 0.66);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open { opacity: 1; }

.modal {
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-backdrop.open .modal {
  opacity: 1;
  transform: none;
}

.modal-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.np-color-modal { display: flex; flex-direction: column; gap: 13px; }

.np-color-top { display: flex; align-items: center; gap: 10px; }

.np-color-preview {
  width: 48px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.np-color-hex {
  flex: 1;
  width: auto;
  max-width: 190px;
  height: 34px;
  font-family: var(--mono);
  text-transform: uppercase;
}

.np-color-hint { margin: -2px 0 0; color: var(--text-faint); font-size: 11.5px; line-height: 1.6; }

.np-color-rgb { display: flex; align-items: center; gap: 12px; }

.np-rgb-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}

.np-rgb-input {
  width: 58px;
  height: 30px;
  padding: 0 6px;
  text-align: center;
  font-family: var(--mono);
}

.np-color-grid { display: grid; grid-template-columns: repeat(auto-fill, 28px); gap: 5px; }

.np-color-item {
  width: 28px;
  height: 28px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
}

.np-color-item:hover { background: var(--bg-active); }
.np-color-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.np-color-item .np-swatch { width: 20px; height: 20px; }

.np-color-plane {
  position: relative;
  height: 132px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  cursor: crosshair;
  touch-action: none;
  overflow: hidden;
}

.np-color-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  max-width: min(520px, calc(100vw - 40px));
  padding: 10px 16px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { border-color: var(--accent); }
.toast.error { border-color: rgba(248, 81, 73, 0.65); }
.toast.warning { border-color: rgba(251, 191, 36, 0.6); }

/* ── 响应式 ───────────────────────────────────────────── */
@media (max-width: 820px) {
  .page { padding: 28px 16px 0; }
  .card { padding: 20px; margin-bottom: 22px; }
  .np-body { flex-direction: column; gap: 22px; }
  .np-form, .np-preview { flex: 1 1 auto; width: 100%; }
  .np-stage { min-height: 160px; }
  .site-footer {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 16px 0 20px;
  }
  .foot-meta { align-items: flex-start; text-align: left; white-space: normal; }
}

@media (max-width: 480px) {
  .np-fields { grid-template-columns: 1fr; }
  .hero { gap: 7px; }
  .hero h1 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
