/* LumiFlux · Fluent Light Theme
   浅色 Fluent 设计系统：柔和阴影、圆角、半透明质感、mica 背景 */

:root {
  /* Fluent 浅色调色板 */
  --bg-base: #f3f4f8;
  --bg-mica: radial-gradient(1200px 800px at 12% -10%, #e7efff 0%, rgba(231,239,255,0) 55%),
             radial-gradient(1000px 700px at 100% 0%, #fdeaf6 0%, rgba(253,234,246,0) 50%),
             linear-gradient(180deg, #f7f9fc 0%, #eef1f6 100%);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-hover: #f0f4ff;
  --surface-strong: #eaf1ff;
  --accent: #0f6cbd;          /* Fluent primary blue */
  --accent-hover: #115ea3;
  --accent-soft: #e8f1fc;
  --accent-2: #b14bd8;        /* Fluent magenta accent */
  --text: #1b1b1f;
  --text-dim: #5b5d66;
  --text-faint: #8a8d96;
  --border: #e3e6ec;
  --border-strong: #d2d6de;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 6px 16px rgba(16, 24, 40, 0.08), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 16px 38px rgba(16, 24, 40, 0.12), 0 4px 12px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --radius-lg: 18px;
  --maxw: 1120px;
  --ok: #0e700e;
  --err: #c4314b;
  --warn: #9d5d00;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg-mica);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.3rem; letter-spacing: 0.3px; }
.brand .brand-logo { width: 34px; height: 34px; flex: none; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand .brand-text b { font-weight: 700; }
.brand .brand-text b span { color: var(--accent); }
.brand .tag { font-size: 0.7rem; font-weight: 400; color: var(--text-faint); margin-top: 2px; letter-spacing: 0; }

.lang-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.lang-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.lang-btn:active { transform: scale(0.97); }
.lang-btn svg { width: 16px; height: 16px; }

.nav { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.nav a {
  color: var(--text-dim);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}
.nav a:hover { color: var(--text); background: var(--surface-hover); }
.nav a.active { color: #fff; background: var(--accent); box-shadow: var(--shadow-sm); }
.nav a.active:hover { background: var(--accent-hover); }

/* ---------- Layout ---------- */
.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem 1.5rem;
}

.app-footer {
  padding: 1.4rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.5);
}

.section-title { font-size: 1.7rem; font-weight: 700; letter-spacing: 0.2px; }
.section-sub { color: var(--text-dim); margin-bottom: 1.8rem; margin-top: 0.35rem; }

/* ---------- Cards / Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.card .ico {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), #f3e9fb);
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.card .ico svg { width: 28px; height: 28px; }
.card .name { font-weight: 700; font-size: 1.02rem; }
.card .desc { font-size: 0.85rem; color: var(--text-dim); }
.card .open-tag {
  margin-top: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 0.25rem;
}
.card .open-tag svg { width: 14px; height: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--accent); color: #fff;
  border: 1px solid transparent;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-weight: 600; font-size: 0.92rem; font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.btn svg { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--surface-hover); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); margin-bottom: 0.4rem; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 108, 189, 0.15);
}
.field textarea { min-height: 130px; resize: vertical; }
.field .hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 0.3rem; }
.field-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 160px; }

/* ---------- Panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-md);
}
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.tool-head h2 { font-size: 1.35rem; display: flex; align-items: center; gap: 0.6rem; }
.tool-head h2 .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tool-head h2 .ico svg { width: 20px; height: 20px; }

/* ---------- Output ---------- */
.out { margin-top: 1.4rem; }
.out h3 { font-size: 1rem; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.4rem; }
.out h3 svg { width: 16px; height: 16px; color: var(--accent); }
.out pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.85rem;
  color: var(--text);
  font-family: "Cascadia Code", "SF Mono", Consolas, monospace;
}
.out .result-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.out .kv { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px dashed var(--border); }
.out .kv:last-child { border-bottom: none; }
.out .kv .k { color: var(--text-dim); font-size: 0.88rem; }
.out .kv .v { font-weight: 600; word-break: break-all; text-align: right; }
.badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; }
.badge.ok { background: #e6f4ea; color: var(--ok); }
.badge.err { background: #fde7eb; color: var(--err); }
.badge.warn { background: #fdf3e3; color: var(--warn); }

/* ---------- Tool list (catalog) ---------- */
.tool-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.9rem; margin-bottom: 2rem; }
.tool-list .card { cursor: pointer; padding: 1.1rem; }
.cat-block { margin-bottom: 1.8rem; }
.cat-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.7rem; color: var(--text); display: flex; align-items: center; gap: 0.5rem; }
.cat-title .ci { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cat-title .ci svg { width: 16px; height: 16px; }

/* ---------- AI page ---------- */
.ai-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .ai-wrap { grid-template-columns: 1fr; } }
.chat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); height: 62vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-md); }
.chat-log { flex: 1; overflow-y: auto; padding: 1.1rem; }
.msg { margin-bottom: 1rem; display: flex; gap: 0.5rem; align-items: flex-end; }
.msg.user { flex-direction: row-reverse; }
.msg .avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.msg .avatar svg { width: 18px; height: 18px; }
.msg.user .avatar { background: var(--accent); color: #fff; }
.msg .bubble { padding: 0.65rem 0.95rem; border-radius: 14px; max-width: 80%; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.92rem; }
.msg.user .bubble { background: var(--accent); color: #fff; border-color: var(--accent); }
.composer { display: flex; gap: 0.5rem; padding: 0.8rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.composer input { flex: 1; padding: 0.65rem 0.9rem; border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); font: inherit; }
.composer input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 108, 189, 0.15); }
.composer button { padding: 0.65rem 1.2rem; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; }
.composer button:hover { background: var(--accent-hover); }
.composer button svg { width: 16px; height: 16px; }
.side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.2rem; box-shadow: var(--shadow-md); }
.side h3 { font-size: 1rem; margin-bottom: 0.7rem; display: flex; align-items: center; gap: 0.45rem; }
.side h3 svg { width: 18px; height: 18px; color: var(--accent); }
.step { font-size: 0.85rem; color: var(--text-dim); padding: 0.5rem 0 0.5rem 1.3rem; border-left: 2px solid var(--border-strong); position: relative; margin-left: 0.3rem; }
.step::before { content: ""; position: absolute; left: -5px; top: 0.85rem; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.step.done { color: var(--text); }
.step.done::before { background: var(--ok); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 0.7rem 1.2rem; border-radius: 999px;
  font-size: 0.88rem; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* markdown preview */
.md-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem; margin-top: 1rem; overflow-x: auto; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: 0.8em 0 0.4em; }
.md-preview p { margin: 0.5em 0; }
.md-preview code { background: #e9edf3; padding: 0.1em 0.35em; border-radius: 5px; font-family: "Cascadia Code", Consolas, monospace; font-size: 0.88em; }
.md-preview pre { background: #1b1b1f; color: #e8e8e8; padding: 0.9rem; border-radius: 10px; overflow-x: auto; }
.md-preview pre code { background: transparent; color: inherit; }
.md-preview blockquote { border-left: 3px solid var(--accent); margin: 0.6em 0; padding: 0.2em 0.9em; color: var(--text-dim); }
.md-preview table { border-collapse: collapse; margin: 0.6em 0; }
.md-preview th, .md-preview td { border: 1px solid var(--border-strong); padding: 0.4em 0.7em; }
.md-preview a { color: var(--accent); }
.md-preview img { max-width: 100%; }

/* generic image preview */
.img-preview { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); margin-top: 0.8rem; box-shadow: var(--shadow-sm); }
.qr-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; display: inline-block; margin-top: 0.8rem; }
.qr-box img { display: block; }

/* notes list */
.note-list { list-style: none; margin-top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.note-item { display: flex; align-items: flex-start; gap: 0.7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 0.9rem; }
.note-item .chk { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong); flex: none; margin-top: 2px; cursor: pointer; display: grid; place-items: center; color: #fff; transition: all 0.15s ease; }
.note-item .chk svg { width: 13px; height: 13px; opacity: 0; }
.note-item.done .chk { background: var(--ok); border-color: var(--ok); }
.note-item.done .chk svg { opacity: 1; }
.note-item.done .txt { text-decoration: line-through; color: var(--text-faint); }
.note-item .txt { flex: 1; white-space: pre-wrap; word-break: break-word; }
.note-item .del { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 2px; border-radius: 6px; }
.note-item .del:hover { color: var(--err); background: #fde7eb; }
.note-item .del svg { width: 16px; height: 16px; }
