/* ============================================================
   J2ME 游戏库管理系统 — "Arcade Night" 主题
   深空底色 + 霓虹蓝紫渐变 + 玻璃拟态卡片
   ============================================================ */

:root {
  --bg: #0b0d14;
  --bg-soft: #10131d;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-solid: #151926;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1f8;
  --muted: #8e97ad;
  --muted-2: #6b7488;
  --accent: #5b8cff;
  --accent-2: #9d6bff;
  --grad: linear-gradient(135deg, #5b8cff 0%, #9d6bff 100%);
  --ok: #3fd68c;
  --warn: #f0b34e;
  --err: #f45a5a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 8px 30px -6px rgba(91, 140, 255, 0.45);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(157, 107, 255, 0.14), transparent 60%),
    radial-gradient(1000px 600px at -10% 20%, rgba(91, 140, 255, 0.12), transparent 55%),
    radial-gradient(900px 600px at 50% 120%, rgba(63, 214, 140, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7ba7ff; }

::selection { background: rgba(91, 140, 255, 0.35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }

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

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 12px;
  animation: rise 0.4s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

h1 { font-size: 24px; margin: 6px 0 18px; letter-spacing: 0.2px; }
h2 { font-size: 16px; margin: 0 0 12px; }

footer {
  text-align: center; color: var(--muted-2);
  padding: 28px 16px 34px; font-size: 12.5px;
}

/* ============ 顶栏 ============ */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: rgba(11, 13, 20, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--grad);
  box-shadow: var(--shadow-glow);
}
.brand-name {
  background: linear-gradient(120deg, #eef1f8 30%, #9d6bff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 7px 14px; border-radius: 999px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.nav-links a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.25), rgba(157, 107, 255, 0.25));
  box-shadow: inset 0 0 0 1px rgba(140, 160, 255, 0.35);
}
.nav-links a.nav-logout { margin-left: 6px; }

/* ============ 登录页 ============ */

.login-body {
  display: flex; flex-direction: column;
  min-height: 100vh; align-items: center; justify-content: center;
  padding: 24px;
  overflow: hidden; position: relative;
}
.aurora {
  position: fixed; inset: -40%; z-index: -1; pointer-events: none;
  background:
    conic-gradient(from 90deg at 30% 40%, rgba(91, 140, 255, 0.16), transparent 30%),
    conic-gradient(from 240deg at 70% 60%, rgba(157, 107, 255, 0.16), transparent 32%),
    conic-gradient(from 10deg at 60% 20%, rgba(63, 214, 140, 0.07), transparent 26%);
  filter: blur(48px);
  animation: aurora-drift 26s linear infinite;
}
@keyframes aurora-drift {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.12); }
  100% { transform: rotate(360deg) scale(1); }
}
.login-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
}

.login-card {
  width: 400px; max-width: 100%;
  padding: 44px 40px 36px;
  text-align: center;
  border-radius: 22px;
  background: rgba(17, 20, 31, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: card-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 18px; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad);
  box-shadow: 0 12px 34px -6px rgba(125, 110, 255, 0.55);
}
.login-card h1 {
  margin: 0 0 6px; font-size: 22px;
  background: linear-gradient(120deg, #fff 40%, #b9a3ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 13.5px; }

.login-card form { text-align: left; }
.field { position: relative; margin-bottom: 14px; }
.field .field-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 15px; opacity: 0.55; pointer-events: none;
}
.field input {
  width: 100%; padding: 13px 14px 13px 42px;
  border-radius: 12px; font-size: 15px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus {
  outline: none;
  border-color: rgba(91, 140, 255, 0.65);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.15);
}

.login-card button {
  width: 100%; padding: 13px; margin-top: 6px;
  border: 0; border-radius: 12px;
  font-size: 15.5px; font-weight: 600; letter-spacing: 4px;
  color: #fff; cursor: pointer;
  background: var(--grad);
  background-size: 160% 100%;
  box-shadow: var(--shadow-glow);
  transition: background-position 0.25s, transform 0.12s, box-shadow 0.25s;
}
.login-card button:hover {
  background-position: 100% 0;
  transform: translateY(-1px);
  box-shadow: 0 12px 36px -6px rgba(125, 110, 255, 0.6);
}
.login-card button:active { transform: translateY(0); }

.login-foot { margin-top: 22px; color: var(--muted-2); font-size: 12px; }

.error {
  background: rgba(244, 90, 90, 0.12);
  border: 1px solid rgba(244, 90, 90, 0.35);
  color: #ff9d9d;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px;
}

/* ============ 工具栏（搜索 / 筛选） ============ */

.toolbar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 22px; flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
.toolbar input[type="search"] {
  flex: 1; min-width: 220px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.toolbar input[type="search"]:focus {
  outline: none;
  border-color: rgba(91, 140, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.12);
}
.toolbar select {
  max-width: 320px; padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel-solid); color: var(--text);
  cursor: pointer;
}
.toolbar .count {
  color: var(--muted); font-size: 13px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(91, 140, 255, 0.1);
  border: 1px solid rgba(91, 140, 255, 0.22);
  white-space: nowrap;
}

/* ============ 游戏卡片网格 ============ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(91, 140, 255, 0.55);
  box-shadow: 0 18px 40px -14px rgba(91, 140, 255, 0.4);
}
.card img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  display: block;
  background:
    linear-gradient(135deg, rgba(91, 140, 255, 0.08), rgba(157, 107, 255, 0.08)),
    repeating-linear-gradient(45deg, #131722 0 8px, #10141e 8px 16px);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.card img.loaded { opacity: 1; }
.card:hover img { filter: saturate(1.15) contrast(1.03); }
.card-body { padding: 10px 12px 12px; }
.card-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px; min-height: 18px;
}
.card-arrow {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 12, 18, 0.65); color: #cdd6ff;
  font-size: 13px; opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.18s, transform 0.18s;
  backdrop-filter: blur(4px);
}
.card:hover .card-arrow { opacity: 1; transform: none; }
.empty { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 40px 0; }

/* ============ 分页 ============ */

.pager {
  display: flex; gap: 14px; justify-content: center; align-items: center;
  margin: 28px 0 10px; color: var(--muted); font-size: 14px;
}
.pager a {
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text); font-size: 13.5px;
  background: var(--panel);
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.pager a:hover {
  border-color: rgba(91, 140, 255, 0.6);
  background: rgba(91, 140, 255, 0.12);
  transform: translateY(-1px);
}

/* ============ 详情页 ============ */

.detail-head {
  display: flex; gap: 22px; align-items: flex-start;
  margin-bottom: 22px;
}
.detail-icon {
  width: 104px; height: 104px; object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.6);
  background: var(--panel-solid);
}
.detail-meta {
  display: flex; gap: 8px 16px; flex-wrap: wrap;
  color: var(--muted); font-size: 13px; margin: 8px 0;
}
.detail-path {
  color: var(--muted-2); font-size: 12px;
  word-break: break-all;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

.pill {
  padding: 2px 11px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.pill-ok {
  background: rgba(63, 214, 140, 0.14);
  color: var(--ok);
  box-shadow: inset 0 0 0 1px rgba(63, 214, 140, 0.35);
}
.pill-wait {
  background: rgba(240, 179, 78, 0.13);
  color: var(--warn);
  box-shadow: inset 0 0 0 1px rgba(240, 179, 78, 0.35);
}

/* ============ 面板 / 按钮 ============ */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  backdrop-filter: blur(8px);
}
.panel h2 {
  display: flex; align-items: center; gap: 9px;
  font-size: 15.5px; margin: 0 0 14px;
}
.panel h2::before {
  content: ""; width: 4px; height: 16px; border-radius: 99px;
  background: var(--grad); flex: none;
}

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

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  cursor: pointer; border: 0; font-size: 14px; font-weight: 500;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 6px 18px -6px rgba(91, 140, 255, 0.5);
  transition: transform 0.12s, box-shadow 0.18s, filter 0.18s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 10px 24px -6px rgba(125, 110, 255, 0.55); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.45; cursor: wait; transform: none; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.btn-ghost:hover { border-color: rgba(91, 140, 255, 0.55); background: rgba(91, 140, 255, 0.1); transform: translateY(-1px); }

.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }

.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--warn); }
.hint.err { color: #ff9d9d; }

/* ============ 导出矩阵 ============ */

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}
.export-item {
  border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s, background 0.15s;
}
.export-item:hover { border-color: rgba(91, 140, 255, 0.4); background: rgba(91, 140, 255, 0.05); }
.export-item b {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; margin-bottom: 2px;
}
.export-item .platform-icon {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; flex: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}
.export-item .actions { margin-top: 12px; }
.export-item .btn { font-size: 13px; padding: 7px 14px; }

/* ============ 源码浏览器 ============ */

.source-wrap {
  display: grid; grid-template-columns: 300px 1fr; gap: 16px;
  align-items: start;
}
.source-side {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 78vh; overflow: auto;
  position: sticky; top: 76px;
}
.source-side h2 { font-size: 15px; display: block; }
.source-side h2 small { color: var(--muted); font-weight: 400; font-size: 12px; }

.file-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.file-list a {
  display: block; padding: 5px 10px; border-radius: 8px;
  color: var(--muted); word-break: break-all;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.file-list a:hover { background: rgba(91, 140, 255, 0.1); color: var(--text); }
.file-list a.active {
  background: linear-gradient(90deg, rgba(91, 140, 255, 0.18), rgba(157, 107, 255, 0.12));
  color: #fff;
  border-left-color: var(--accent);
}

.source-main { min-width: 0; }
.code-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 16px;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px; color: var(--muted); word-break: break-all;
}
.code-dots { display: inline-flex; gap: 6px; margin-right: 10px; flex: none; }
.code-dots i {
  width: 11px; height: 11px; border-radius: 50%; display: inline-block;
}
.code-dots i:nth-child(1) { background: #ff5f57; }
.code-dots i:nth-child(2) { background: #febc2e; }
.code-dots i:nth-child(3) { background: #28c840; }
.code {
  margin: 0;
  background: #0d1017;
  border: 1px solid var(--border-strong);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 18px 20px;
  overflow: auto; max-height: 72vh;
  font: 13px/1.6 "SF Mono", Menlo, Consolas, "Cascadia Code", monospace;
  white-space: pre; tab-size: 4;
  color: #c9d4f0;
}

/* ============ 仪表盘 ============ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat {
  position: relative; overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
}
.stat::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120px 60px at 85% 0%, rgba(91, 140, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.stat b {
  display: block; font-size: 28px; line-height: 1.25;
  background: linear-gradient(120deg, #fff 30%, #9d6bff 110%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat span { color: var(--muted); font-size: 13px; }
.stat .stat-icon {
  position: absolute; top: 14px; right: 14px;
  font-size: 18px; opacity: 0.35;
}

.progress-outer {
  height: 14px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}
.progress-inner {
  height: 100%; border-radius: 999px;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(91, 140, 255, 0.6);
  transition: width 0.6s ease;
}
.doc { color: var(--muted); font-size: 14px; padding-left: 18px; margin: 0; }
.doc li { margin: 7px 0; }
.doc li::marker { color: var(--accent); }

/* ============ 响应式 ============ */

@media (max-width: 800px) {
  main { padding: 18px 14px 8px; }
  .topbar { padding: 10px 14px; }
  .brand-name { display: none; }
  .source-wrap { grid-template-columns: 1fr; }
  .source-side { position: static; max-height: 40vh; }
  .detail-head { flex-direction: column; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .toolbar select { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card img { opacity: 1; }
}
