:root {
  --bg: #050814;
  --surface: #0d1426;
  --surface-2: #15203b;
  --border: rgba(139, 92, 246, 0.32);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-2: #ec4899;
  --accent: #10b981;
  --danger: #ef4444;
}

body:not(.dark) {
  --bg: #eef2ff;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: rgba(79, 70, 229, 0.2);
  --text: #0f172a;
  --muted: #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }
body {
  background: radial-gradient(circle at 15% 5%, rgba(99, 102, 241, 0.28), transparent 45%),
              radial-gradient(circle at 85% 15%, rgba(236, 72, 153, 0.22), transparent 45%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 92px;
  overflow-x: hidden;
}

.snow-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}
.snowflake {
  position: absolute;
  top: -12px;
  color: #e0f2fe;
  opacity: 0.72;
  text-shadow: 0 0 8px rgba(125, 211, 252, 0.85);
  animation: snowFall linear infinite;
}
@keyframes snowFall {
  0% { transform: translate3d(0, -10px, 0) rotate(0deg); }
  100% { transform: translate3d(26px, 105vh, 0) rotate(360deg); }
}

.top-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 20, 38, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
body:not(.dark) .top-head { background: rgba(255, 255, 255, 0.92); }

.top-inner { max-width: 980px; margin: 0 auto; }
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.back-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 18px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.brand-link {
  text-decoration: none; font-size: 19px; font-weight: 900; letter-spacing: 0.3px;
  background: linear-gradient(90deg, #38bdf8, #a855f7, #f472b6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.top-right { display: flex; align-items: center; gap: 6px; }
.bal-pill {
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #34d399;
  white-space: nowrap;
}
.db-mini {
  font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.16); color: #34d399;
}
.theme-switch {
  width: 44px; height: 24px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 11px; cursor: pointer;
}

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 7px 12px;
}
.search-box input {
  border: none; background: transparent; padding: 2px 4px;
  font-size: 14px; color: var(--text); width: 100%; outline: none;
}

.page-wrap { max-width: 980px; margin: 0 auto; padding: 14px 16px 24px; position: relative; z-index: 10; }

.gamer-hero {
  position: relative;
  border-radius: 22px;
  padding: 22px 18px;
  background: linear-gradient(125deg, #090d1e 0%, #3b0764 45%, #831843 80%, #1e1b4b 100%);
  background-size: 220% 220%;
  animation: gamerAura 7s ease infinite;
  border: 1.5px solid rgba(168, 85, 247, 0.55);
  box-shadow: 0 0 32px rgba(168, 85, 247, 0.35), inset 0 0 24px rgba(56, 189, 248, 0.14);
  color: #fff;
  margin-bottom: 16px;
  overflow: hidden;
}
@keyframes gamerAura {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gamer-scanline {
  position: absolute;
  left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.85), rgba(244, 114, 182, 0.85), transparent);
  animation: scanMove 3.6s linear infinite;
  pointer-events: none;
}
@keyframes scanMove {
  0% { top: -4px; opacity: 0; }
  20% { opacity: 0.9; }
  80% { opacity: 0.9; }
  100% { top: 100%; opacity: 0; }
}
.gamer-hero h1 {
  position: relative; z-index: 2;
  font-size: 22px; line-height: 1.25; margin-bottom: 6px;
  text-shadow: 0 0 18px rgba(168, 85, 247, 0.7);
}
.gamer-hero p {
  position: relative; z-index: 2;
  font-size: 13px; color: #e2e8f0; margin-bottom: 16px;
}

.split-action-row {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gamer-btn-sell {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; text-align: center;
  padding: 12px 14px; border-radius: 13px;
  font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease;
}
.gamer-btn-ask {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; text-align: center;
  padding: 12px 14px; border-radius: 13px;
  font-weight: 800; font-size: 13px; color: #052e16;
  background: linear-gradient(135deg, #34d399, #22d3ee);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease;
}
.gamer-btn-sell:hover, .gamer-btn-ask:hover { transform: translateY(-2px); }

.sec-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 0 10px;
}
.sec-header h2, .sec-header h3 { font-size: 16px; font-weight: 800; }

.home-quick-5 {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px;
}
.quick-tile {
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
  border-radius: 15px; padding: 9px 5px; text-align: center;
  color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.quick-tile:hover { transform: translateY(-2px); box-shadow: 0 0 22px rgba(168, 85, 247, 0.45); }
.quick-tile.active {
  border-color: #e879f9;
  box-shadow: 0 0 20px rgba(232, 121, 249, 0.45);
}
.quick-tile span {
  font-size: 10px; font-weight: 700; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.app-grid-4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px;
}
.app-tile {
  background: transparent; border: none; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 4px;
}
.app-icon-box {
  position: relative;
  width: 68px; height: 68px; border-radius: 18px; overflow: hidden;
  border: 1.5px solid rgba(168, 85, 247, 0.45);
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.32);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  transition: transform 0.16s ease;
}
.app-tile:hover .app-icon-box { transform: scale(1.05); }
.app-icon-box .custom-asset,
.app-icon-box .custom-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.app-icon-box .custom-asset { z-index: 2; }
.app-icon-box .custom-video { z-index: 3; pointer-events: none; }
.app-icon-box .svg-fallback {
  position: relative; z-index: 1; width: 100%; height: 100%; display: block;
}
.app-tile span {
  font-size: 12px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.platform-hero-logo {
  position: relative; width: 68px; height: 68px; border-radius: 16px; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.55); flex-shrink: 0;
}
.platform-hero-logo .custom-asset,
.platform-hero-logo .custom-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.platform-hero-logo .custom-asset { z-index: 2; }
.platform-hero-logo .custom-video { z-index: 3; pointer-events: none; }
.platform-hero-logo .svg-fallback { position: relative; z-index: 1; width: 100%; height: 100%; display: block; }

.subtabs-scroll {
  display: flex; gap: 16px; overflow-x: auto;
  border-bottom: 1px solid var(--border); padding: 6px 2px 0; margin-bottom: 14px;
}
.subtab-link {
  background: transparent; border: none; border-bottom: 3px solid transparent;
  color: var(--muted); font-size: 13px; font-weight: 700;
  padding: 10px 2px 11px; cursor: pointer; white-space: nowrap;
}
.subtab-link.active { color: #e879f9; border-bottom-color: #e879f9; }

.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 14px;
}
.item-card {
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.16);
  border-radius: 16px; padding: 13px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
}
.item-img {
  width: 100%; height: 150px; object-fit: cover; border-radius: 12px;
  background: var(--surface-2); margin-bottom: 8px; display: block;
}
.chip-cat {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 6px; background: rgba(99, 102, 241, 0.22); color: #c4b5fd;
}
.chip-escrow {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 6px; background: rgba(16, 185, 129, 0.18); color: #34d399; margin-left: 4px;
}
.item-title { font-size: 15px; font-weight: 700; margin: 6px 0 4px; }
.item-desc { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 6px; }
.item-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.item-price { font-size: 17px; font-weight: 800; color: #34d399; }
.item-old { font-size: 12px; color: var(--muted); text-decoration: line-through; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.15);
  border-radius: 16px; padding: 16px; margin-bottom: 14px;
}
.mt5-notice {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.mt5-notice strong { color: #34d399; }

.muted { font-size: 12px; color: var(--muted); }
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px; margin-top: 12px;
}
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; font-size: 14px;
}
input[type="file"] { padding: 7px; }
.escrow-box {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  background: rgba(99, 102, 241, 0.1); border: 1px dashed rgba(165, 180, 252, 0.5);
}

.btn {
  border: none; border-radius: 11px; padding: 10px 14px;
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.btn-main {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.4);
  color: #fff;
}
.btn-green { background: var(--accent); color: #052015; }
.btn-soft { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-del { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.35); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.list-row {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; margin-top: 10px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
}
.badge-status {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: rgba(245, 158, 11, 0.18); color: #fbbf24;
}
.badge-status.ok { background: rgba(16, 185, 129, 0.18); color: #34d399; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(13, 20, 38, 0.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px;
}
body:not(.dark) .bottom-nav { background: rgba(255, 255, 255, 0.96); }
.bnav-item {
  text-decoration: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10px; font-weight: 600; padding: 4px 2px; border-radius: 11px;
  transition: transform 0.14s ease, background 0.14s ease;
}
.bnav-logo-box {
  position: relative;
  width: 22px; height: 22px; border-radius: 7px; overflow: hidden;
  border: 1px solid rgba(168, 85, 247, 0.45);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.28);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
}
.bnav-logo-box .custom-asset,
.bnav-logo-box .custom-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.bnav-logo-box .custom-asset { z-index: 2; }
.bnav-logo-box .custom-video { z-index: 3; pointer-events: none; }
.bnav-logo-box .svg-fallback {
  position: relative; z-index: 1; width: 100%; height: 100%; display: block;
}
.bnav-item .ico { font-size: 14px; line-height: 1; }
.bnav-item.active { color: #e879f9; background: rgba(168, 85, 247, 0.18); font-weight: 700; }
.bnav-item.active .bnav-logo-box {
  border-color: #e879f9;
  box-shadow: 0 0 14px rgba(232, 121, 249, 0.6);
  transform: translateY(-1px);
}

.modal-bg {
  position: fixed; inset: 0; background: rgba(2, 6, 15, 0.78);
  backdrop-filter: blur(4px); z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-bg.open { display: flex; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; padding: 18px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px;
}
.cred-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; margin-top: 10px; font-size: 13px;
}
.cred-card div { margin-bottom: 6px; }
.cred-card div:last-child { margin-bottom: 0; }
.preview-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preview-pic { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.toast {
  position: fixed; bottom: 84px; right: 16px; background: #0f172a; color: #fff;
  border: 1px solid var(--accent); border-radius: 12px; padding: 11px 15px;
  font-size: 13px; z-index: 130; display: none;
}
