:root {
  color-scheme: dark;
  --bg: #07100f;
  --sidebar: #091312;
  --surface: #0d1918;
  --surface-raised: #122321;
  --surface-soft: #172b28;
  --text: #eaf7f2;
  --text-soft: #b9d0c8;
  --muted: #78918a;
  --line: #1d3834;
  --line-strong: #2c5550;
  --green: #42d392;
  --green-dark: #0d2c22;
  --cyan: #32c9d5;
  --cyan-dark: #0a2930;
  --amber: #f0b84b;
  --amber-dark: #34260d;
  --danger: #ee747d;
  --shadow: 0 22px 60px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; }
body {
  position: relative;
  background-color: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}
body:before, body:after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body:before {
  z-index: 0;
  background-image:
    linear-gradient(rgba(50, 201, 213, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(50, 201, 213, .035) 1px, transparent 1px),
    radial-gradient(circle at 12% 20%, rgba(66, 211, 146, .13), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(50, 201, 213, .1), transparent 25%),
    radial-gradient(circle at 72% 86%, rgba(240, 184, 75, .08), transparent 24%);
  background-size: 52px 52px, 52px 52px, 100% 100%, 100% 100%, 100% 100%;
  animation: background-drift 22s linear infinite alternate;
}
body:after {
  z-index: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(50, 201, 213, .045) 48%, rgba(66, 211, 146, .035) 52%, transparent 80%);
  transform: translateX(-70%);
  animation: background-scan 13s ease-in-out infinite;
}
button, input { font: inherit; }
button { letter-spacing: 0; }
.hidden { display: none !important; }

.console { min-height: 100vh; position: relative; z-index: 1; isolation: isolate; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(9, 19, 18, .92);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 30px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(50, 201, 213, .75);
  border-radius: 7px;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #041311;
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 7px 25px rgba(50, 201, 213, .18);
  animation: brand-arrive .55s cubic-bezier(.2,.8,.2,1) both;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 5px; }
.nav-label { padding: 0 10px 8px; color: #56716a; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.nav-item {
  height: 43px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  transition: color .16s, background .16s, border-color .16s;
}
.nav-item span { width: 18px; color: #66877f; font-size: 18px; text-align: center; transition: transform .18s, color .18s; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { border-color: var(--line); background: var(--surface-raised); color: var(--text); box-shadow: inset 2px 0 var(--green); }
.nav-item.active span { color: var(--green); }
.nav-item:hover span { transform: translateX(2px); }
.sidebar-status { margin-top: auto; padding: 15px 10px 3px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; }
.sidebar-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(66,211,146,.1); animation: status-pulse 2.4s ease-out infinite; }
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { color: var(--text-soft); font-size: 10px; }
.sidebar-status small { margin-top: 3px; color: #56716a; font-size: 9px; }

.workspace { min-width: 0; }
.topbar {
  min-height: 92px;
  padding: 18px clamp(24px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 15, .84);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}
.crumb { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.crumb b { color: var(--green); }
.topbar h1 { margin: 7px 0 0; font-size: 21px; font-weight: 720; }
.primary, .secondary, .icon-button { border: 0; border-radius: 6px; cursor: pointer; }
.primary {
  min-height: 40px;
  padding: 0 16px;
  background: var(--green);
  color: #04130e;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(66,211,146,.14);
  transition: background .16s, transform .16s, box-shadow .16s;
}
.primary:hover { background: #66e2aa; transform: translateY(-2px); box-shadow: 0 11px 28px rgba(66,211,146,.23); }
.primary:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.secondary { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); background: transparent; color: var(--text-soft); }
.secondary:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface-raised); color: var(--muted); font-size: 19px; }
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }
.topbar .primary { display: flex; align-items: center; gap: 8px; }

main { width: min(1320px, 100%); margin: auto; padding: 36px clamp(24px, 4vw, 54px) 72px; }
.view-enter { animation: view-in .22s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); overflow: hidden; }
.summary > div { min-width: 0; padding: 19px 21px; border-right: 1px solid var(--line); position: relative; }
.summary > div:last-child { border-right: 0; }
.summary > div:before { content: ""; position: absolute; left: 20px; top: 0; width: 28px; height: 2px; background: var(--cyan); opacity: .65; }
.summary > div:first-child:before { background: var(--green); }
.summary > div:last-child:before { background: var(--amber); }
.summary span, .summary strong, .summary small { display: block; }
.summary span { color: var(--muted); font-size: 10px; }
.summary strong { margin: 9px 0 5px; font-size: 23px; font-variant-numeric: tabular-nums; }
.summary small { color: #658078; font-size: 9px; }
.summary .online { margin-top: 13px; color: var(--green); font-size: 12px; text-transform: uppercase; }
.section-head { margin: 38px 0 17px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-head h2 { margin: 0 0 5px; font-size: 18px; }
.section-head p { margin: 0; color: var(--muted); font-size: 11px; }
.search { width: 236px; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.search:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(50,201,213,.08); }
.search input { width: 100%; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }

.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); display: flex; flex-direction: column; gap: 15px; transition: border-color .22s, background .22s, transform .22s, box-shadow .22s; animation: card-in .38s ease-out both; }
.card:nth-child(2) { animation-delay: .05s; }.card:nth-child(3) { animation-delay: .1s; }.card:nth-child(4) { animation-delay: .15s; }.card:nth-child(5) { animation-delay: .2s; }.card:nth-child(6) { animation-delay: .25s; }
.card:hover { border-color: var(--line-strong); background: #10211f; transform: translateY(-3px); box-shadow: 0 16px 34px rgba(0,0,0,.25); }
.card.unavailable { opacity: .55; }
.card-head { display: flex; align-items: center; gap: 12px; }
.cover { width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 6px; object-fit: cover; background: var(--surface-soft); }
.identity { min-width: 0; flex: 1; }
.identity h2 { margin: 0 0 6px; overflow: hidden; color: var(--text); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.identity code { color: var(--cyan); font: 9px ui-monospace, SFMono-Regular, monospace; }
.badge { padding: 4px 7px; border: 1px solid rgba(240,184,75,.35); border-radius: 4px; color: var(--amber); background: var(--amber-dark); font-size: 9px; }
.description { min-height: 40px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.meta div { padding: 9px; border-right: 1px solid var(--line); background: rgba(255,255,255,.012); }
.meta div:last-child { border-right: 0; }
.meta span, .meta b { display: block; }
.meta span { margin-bottom: 5px; color: #69847c; font-size: 8px; }
.meta b { color: var(--text-soft); font-size: 10px; }
.actions { padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.actions a { color: var(--green); font-size: 10px; text-decoration: none; }
.actions a:hover { text-decoration: underline; }
.checksum { overflow: hidden; color: #5f7972; font: 8px ui-monospace, SFMono-Regular, monospace; text-overflow: ellipsis; white-space: nowrap; }
.empty { grid-column: 1 / -1; padding: 72px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); text-align: center; }

.docs-layout { display: grid; grid-template-columns: minmax(0, 850px) 260px; gap: 24px; align-items: start; }
.docs-main, .docs-aside { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.docs-main { padding: clamp(28px, 4vw, 52px); }
.docs-loading { color: var(--muted); }
.markdown-body { color: var(--text-soft); font-size: 13px; line-height: 1.8; }
.markdown-body > h1 { margin: 0 0 14px; color: var(--text); font-size: 30px; }
.markdown-body h2 { margin: 46px 0 15px; padding: 0 0 10px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 20px; }
.markdown-body h3 { margin: 30px 0 10px; color: var(--text); font-size: 15px; }
.markdown-body h4 { margin: 24px 0 8px; color: var(--text-soft); font-size: 13px; }
.markdown-body p { margin: 10px 0; }
.markdown-body a { color: var(--cyan); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.heading-anchor { margin-left: 8px; color: transparent !important; font-weight: 400; }
.markdown-body h1:hover .heading-anchor, .markdown-body h2:hover .heading-anchor, .markdown-body h3:hover .heading-anchor { color: var(--muted) !important; }
.markdown-body blockquote { margin: 20px 0; padding: 11px 16px; border-left: 3px solid var(--green); background: var(--green-dark); }
.markdown-body blockquote p { margin: 0; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; }
.markdown-body li { margin: 5px 0; }
.markdown-body code { padding: 2px 5px; border-radius: 4px; background: var(--surface-soft); color: #77dfe6; font: 11px ui-monospace, SFMono-Regular, monospace; }
.markdown-body pre { overflow: auto; margin: 16px 0; padding: 19px; border: 1px solid var(--line); border-radius: 6px; background: #06110f; color: #a9e7d2; font: 11px/1.75 ui-monospace, SFMono-Regular, monospace; }
.markdown-body pre code { padding: 0; background: transparent; color: inherit; }
.markdown-body hr { height: 1px; margin: 32px 0; border: 0; background: var(--line); }
.table-wrap { overflow: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 6px; }
.markdown-body table { width: 100%; border-collapse: collapse; font-size: 11px; }
.markdown-body th, .markdown-body td { padding: 11px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-body th { background: var(--surface-soft); color: var(--text); }
.markdown-body tr:last-child td { border-bottom: 0; }
.markdown-body th:last-child, .markdown-body td:last-child { border-right: 0; }
.docs-aside { position: sticky; top: 124px; max-height: calc(100vh - 152px); padding: 20px; overflow: auto; }
.docs-aside h3 { margin: 0 0 12px; color: var(--text); font-size: 12px; }
.docs-aside nav { display: grid; }
.docs-aside nav a { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.45; text-decoration: none; }
.docs-aside nav a:hover { color: var(--green); }
.docs-error { padding: 20px; border: 1px solid var(--danger); border-radius: 6px; }

.modal { position: fixed; inset: 0; z-index: 20; padding: 20px; background: rgba(3, 3, 2, .86); backdrop-filter: blur(10px); display: grid; place-items: center; animation: veil-in .18s ease-out; }
.modal-card { width: min(580px, 100%); max-height: calc(100vh - 40px); padding: 26px; border: 1px solid var(--line-strong); border-radius: 8px; background: #0b1715; box-shadow: var(--shadow); overflow: auto; animation: modal-in .28s cubic-bezier(.2,.8,.2,1); }
.modal-head { margin-bottom: 20px; display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.modal-head > div > span { color: var(--amber); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.modal-head h2 { margin: 7px 0 5px; font-size: 21px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 10px; }
.dropzone { min-height: 170px; border: 1px dashed #38665f; border-radius: 7px; background: #081311; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: border-color .2s, background .2s, transform .2s; }
.dropzone:hover, .dropzone.drag { border-color: var(--cyan); background: var(--cyan-dark); transform: translateY(-1px); }
.upload-icon { width: 44px; height: 44px; margin-bottom: 14px; border: 1px solid rgba(50,201,213,.4); border-radius: 50%; background: var(--cyan-dark); color: var(--cyan); font-size: 21px; display: grid; place-items: center; transition: transform .22s; }
.dropzone:hover .upload-icon, .dropzone.drag .upload-icon { transform: translateY(-3px); }
.dropzone strong { font-size: 13px; }
.dropzone small { margin-top: 7px; color: var(--muted); font-size: 10px; }
.checks { padding: 12px 2px; color: var(--muted); font-size: 9px; display: flex; justify-content: center; gap: 18px; }
.checks span:before { content: "✓"; margin-right: 5px; color: var(--green); }
.package-result { margin: 12px 0 0; padding: 12px; border: 1px solid rgba(66,211,146,.35); border-radius: 6px; background: var(--green-dark); font-size: 10px; line-height: 1.7; animation: result-in .22s ease-out; }
.package-result strong { color: var(--green); }
.token-field { display: block; margin-top: 4px; }
.token-field > span { display: block; margin-bottom: 7px; color: var(--text-soft); font-size: 10px; }
.token-field input { width: 100%; height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #07110f; color: var(--text); }
.token-field input:focus { border-color: var(--cyan); }
.token-field small { display: block; margin-top: 6px; color: #668079; font-size: 9px; }
.confirm-field { margin: 15px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; display: flex; align-items: flex-start; gap: 8px; }
.confirm-field input { margin: 2px 0 0; accent-color: var(--green); }
.confirm-field code { color: var(--cyan); }
.form-error { min-height: 17px; margin: 9px 0 0; color: #ffabb0; font-size: 10px; }
.modal-actions { margin-top: 4px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 440px; padding: 14px 17px; border: 1px solid rgba(66,211,146,.42); border-radius: 6px; background: #0d2c22; color: #b7f4d8; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; font-size: 11px; }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: var(--danger); background: #2b171a; color: #ffd9dc; }

@keyframes brand-arrive { from { opacity: 0; transform: rotate(-8deg) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes status-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(66,211,146,.1); } 50% { box-shadow: 0 0 0 9px rgba(66,211,146,0); } }
@keyframes background-drift { from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; } to { background-position: 52px 26px, 52px 26px, 3% 2%, -3% 4%, 2% -3%; } }
@keyframes background-scan { 0%, 15% { transform: translateX(-70%); opacity: 0; } 45%, 60% { opacity: 1; } 85%, 100% { transform: translateX(70%); opacity: 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes result-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1080px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-aside { position: static; max-height: none; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary > div:nth-child(2) { border-right: 0; }
  .summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .console { display: block; }
  .sidebar { position: sticky; z-index: 8; width: 100%; height: auto; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; }
  .sidebar .brand { padding: 0; }
  .brand-mark { width: 36px; height: 36px; }
  .brand small, .nav-label, .sidebar-status { display: none; }
  .sidebar nav { margin-left: auto; display: flex; }
  .nav-item { width: 42px; padding: 0; justify-content: center; font-size: 0; }
  .nav-item span { font-size: 18px; }
  .topbar { top: 61px; min-height: 76px; padding: 14px 16px; }
  .topbar h1 { font-size: 17px; }
  .topbar .primary { min-height: 36px; padding: 0 11px; font-size: 11px; }
  main { padding: 23px 15px 48px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary > div { padding: 16px; }
  .summary strong { font-size: 19px; }
  .section-head { align-items: flex-start; }
  .search { width: 145px; }
  .game-grid { grid-template-columns: 1fr; }
  .docs-main { padding: 23px; }
  .markdown-body > h1 { font-size: 24px; }
  .markdown-body h2 { font-size: 18px; }
  .modal { padding: 10px; }
  .modal-card { max-height: calc(100vh - 20px); padding: 20px; }
  .checks { flex-wrap: wrap; gap: 8px 14px; }
  .dropzone { min-height: 150px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
