/* ==========================================================================
   驭铁 · FERRO — Unified 5-Edition UI System for Utility Sites
   (l.ttf2.cn 短链站 · share.ttf2.cn 快传剪贴板与私有图床)
   Supports: 01 aero | 02 obsidian | 03 orbital | 04 titan | 05 aurora
   ========================================================================== */

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

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --bg: #040711;
  --bg-elevated: #0a1122;
  --surface: rgba(9, 17, 34, 0.84);
  --surface-hover: rgba(14, 27, 52, 0.96);
  --code-bg: #050a16;
  --border: rgba(0, 229, 255, 0.16);
  --border-strong: rgba(0, 229, 255, 0.36);
  --ink: #e8f4ff;
  --ink-secondary: #8ba5c4;
  --ink-muted: #506886;
  --accent: #00e5ff;
  --accent-soft: rgba(0, 229, 255, 0.12);
  --accent-ink: #021019;
  --brand-dot: #00e5ff;
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --card-clip: none;
  --shadow-lg: 0 22px 54px rgba(0, 0, 0, 0.5);
}

/* 01 · 极昼精工 (Aero Ceramic) */
html[data-edition="aero"] {
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #edf2f8;
  --code-bg: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #7c899b;
  --accent: #1d4ed8;
  --accent-soft: rgba(29, 78, 216, 0.08);
  --accent-ink: #ffffff;
  --brand-dot: #ea580c;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.1);
}

/* 02 · 深空座舱 (Obsidian Cockpit) */
html[data-edition="obsidian"] {
  --bg: #080b10;
  --bg-elevated: #111621;
  --surface: rgba(19, 25, 36, 0.82);
  --surface-hover: rgba(28, 37, 52, 0.94);
  --code-bg: #0b0f18;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(56, 189, 248, 0.35);
  --ink: #f1f5f9;
  --ink-secondary: #94a3b8;
  --ink-muted: #5d6b82;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.13);
  --accent-ink: #04111d;
  --brand-dot: #38bdf8;
  --radius-md: 14px;
  --radius-lg: 20px;
}

/* 03 · 星轨遥测 (Orbital Telemetry) */
html[data-edition="orbital"] {
  --bg: #040711;
  --bg-elevated: #0a1122;
  --surface: rgba(9, 17, 34, 0.84);
  --surface-hover: rgba(14, 27, 52, 0.95);
  --code-bg: #040914;
  --border: rgba(0, 229, 255, 0.17);
  --border-strong: rgba(0, 229, 255, 0.42);
  --ink: #e8f4ff;
  --ink-secondary: #8ba5c4;
  --ink-muted: #506886;
  --accent: #00e5ff;
  --accent-soft: rgba(0, 229, 255, 0.12);
  --accent-ink: #021019;
  --brand-dot: #00e5ff;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 4px;
}

/* 04 · 钛金协议 (Ferro Protocol) */
html[data-edition="titan"] {
  --bg: #0c0e12;
  --bg-elevated: #151920;
  --surface: #161a22;
  --surface-hover: #1e2430;
  --code-bg: #090b0f;
  --border: #282f3d;
  --border-strong: #ff6b1a;
  --ink: #f3f5f8;
  --ink-secondary: #9aa4b5;
  --ink-muted: #657084;
  --accent: #ff6b1a;
  --accent-soft: rgba(255, 107, 26, 0.14);
  --accent-ink: #0f0904;
  --brand-dot: #ff6b1a;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --card-clip: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}

/* 05 · 全息极光 (Aurora Holo) */
html[data-edition="aurora"] {
  --bg: #060714;
  --bg-elevated: #10132b;
  --surface: rgba(20, 25, 54, 0.58);
  --surface-hover: rgba(30, 38, 78, 0.78);
  --code-bg: #080b1d;
  --border: rgba(148, 163, 255, 0.16);
  --border-strong: rgba(45, 212, 191, 0.44);
  --ink: #f5f7ff;
  --ink-secondary: #a5b4d4;
  --ink-muted: #68779c;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-ink: #031715;
  --brand-dot: #a855f7;
  --radius-md: 16px;
  --radius-lg: 22px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Ambient Canvas Per Edition */
.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

html[data-edition="aero"] .ambient-canvas {
  background-image:
    radial-gradient(circle at 82% 0%, rgba(29, 78, 216, 0.055), transparent 44%),
    linear-gradient(to right, rgba(15, 23, 42, 0.022) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.022) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
}

html[data-edition="obsidian"] .ambient-canvas {
  background:
    radial-gradient(ellipse 75% 42% at 50% -6%, rgba(56, 189, 248, 0.15), transparent 68%),
    linear-gradient(180deg, #080b10 0%, #0b0f17 100%);
}

html[data-edition="orbital"] .ambient-canvas {
  background:
    radial-gradient(1.5px 1.5px at 18% 22%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 46% 68%, rgba(0, 229, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 78% 18%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(ellipse 80% 44% at 50% -10%, rgba(0, 229, 255, 0.16), transparent 65%),
    linear-gradient(to right, rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, #03060f 0%, #060c1a 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 64px 64px, 64px 64px, 100% 100%;
}

html[data-edition="titan"] .ambient-canvas {
  background-image:
    radial-gradient(circle at 12% 0%, rgba(255, 107, 26, 0.09), transparent 42%),
    radial-gradient(rgba(255, 255, 255, 0.038) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
}

html[data-edition="aurora"] .ambient-canvas {
  background:
    radial-gradient(ellipse 60% 42% at 22% 8%, rgba(45, 212, 191, 0.19), transparent 65%),
    radial-gradient(ellipse 58% 45% at 78% 12%, rgba(168, 85, 247, 0.18), transparent 66%),
    linear-gradient(180deg, #050612 0%, #090c20 100%);
}

/* Container & Header */
.ferro-shell {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px 0;
}

.ferro-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  flex-wrap: wrap;
}

html[data-edition="orbital"] .ferro-topbar,
html[data-edition="titan"] .ferro-topbar {
  border-left: 3px solid var(--accent);
}

.ferro-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 750;
  font-size: 15.5px;
  letter-spacing: 0.03em;
}

.ferro-emblem {
  width: 28px;
  height: 28px;
  display: inline-flex;
  color: var(--accent);
  flex-shrink: 0;
}

.ferro-emblem svg { width: 100%; height: 100%; }

.ferro-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}

.ferro-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

/* Cards & Panels */
.ferro-card {
  position: relative;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  clip-path: var(--card-clip);
}

html[data-edition="orbital"] .ferro-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 11px;
  height: 11px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  pointer-events: none;
}

html[data-edition="titan"] .ferro-card {
  border-left: 3px solid var(--accent);
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.btn-primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--code-bg);
  color: var(--ink);
  font-size: 14px;
}

html[data-edition="aero"] .field-input,
html[data-edition="aero"] .field-select,
html[data-edition="aero"] .field-textarea {
  background: #ffffff;
}

.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}
.status-up { background: var(--ok-soft); color: var(--ok); }
.status-warn { background: var(--warn-soft); color: var(--warn); }
.status-down { background: var(--danger-soft); color: var(--danger); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th, .data-table td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(4, 7, 15, 0.68);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

/* Footer & 5-Edition Switcher */
.site-footer {
  margin-top: 56px;
  padding: 24px 0 34px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.edition-switcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  display: inline-flex;
  gap: 3px;
  padding: 5px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.edition-pill {
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 550;
}

.edition-pill.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.toast-stack {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 680px) {
  .ferro-shell { padding: 10px 14px 0; }
  .ferro-card { padding: 18px 16px; }
  .edition-switcher { right: 10px; left: 10px; justify-content: center; overflow-x: auto; }
}
