:root {
  --bg: #070807;
  --bg-2: #0d120e;
  --panel: rgba(16, 22, 16, 0.82);
  --panel-solid: #121812;
  --line: rgba(155, 240, 11, 0.14);
  --line-strong: rgba(155, 240, 11, 0.32);
  --green: #107c10;
  --lime: #9bf00b;
  --lime-dim: #6aa308;
  --text: #e8f0e4;
  --muted: #8a9786;
  --danger: #ff5a5a;
  --gold: #e8c547;
  --disc: #7ec8ff;
  --digital: #c9a6ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "Segoe UI", "Bahnschrift", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(16, 124, 16, 0.28), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(155, 240, 11, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  letter-spacing: 0.01em;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app-shell { max-width: 1280px; margin: 0 auto; padding: 28px 22px 80px; }
.auth-shell { max-width: 980px; }
.auth-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; }
@media (max-width: 860px) { .auth-grid { grid-template-columns: 1fr; } }
.auth-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.auth-tabs button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
}
.auth-tabs button.active { background: var(--lime); color: #062006; border-color: transparent; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--lime), var(--green));
  display: grid; place-items: center;
  color: #062006;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 0 28px rgba(155, 240, 11, 0.25);
}
.brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brand p { color: var(--muted); font-size: 12px; margin-top: 2px; }

.nav {
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,0.35);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.nav button.active {
  background: var(--lime);
  color: #062006;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 20px;
  margin-bottom: 22px;
}
@media (max-width: 900px) {
  .hero, .stats, .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--lime);
  margin-bottom: 12px;
}

.lookup {
  display: flex;
  gap: 10px;
}
.lookup input, .field input, .field select, .field textarea, .search {
  width: 100%;
  background: #0a0e0a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
.lookup input:focus, .field input:focus, .field select:focus, .search:focus {
  border-color: var(--lime);
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  background: var(--lime);
  color: #062006;
  white-space: nowrap;
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn.danger { background: #3a1212; color: #ffb4b4; border: 1px solid #5a2020; }
.btn.small { padding: 7px 11px; font-size: 12px; border-radius: 9px; }

.profile {
  display: flex;
  gap: 16px;
  align-items: center;
}
.gamerpic {
  width: 72px; height: 72px;
  border-radius: 16px;
  background: #1a241a;
  border: 2px solid var(--lime-dim);
  object-fit: cover;
}
.profile h3 { font-size: 22px; }
.meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.gs {
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.stat span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat strong { display: block; font-size: 26px; margin-top: 6px; }
.stat.physical strong { color: var(--disc); }
.stat.digital strong { color: var(--digital); }
.stat.score strong { color: var(--gold); }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.search { max-width: 320px; }

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.game {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cover {
  height: 168px;
  background:
    linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.72)),
    var(--cover, linear-gradient(135deg, #1c3a1c, #0a120a));
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.suggest-wrap { position: relative; }
.suggest {
  position: absolute;
  z-index: 20;
  left: 0; right: 0; top: calc(100% + 4px);
  background: #101610;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  max-height: 260px;
  overflow: auto;
  box-shadow: var(--shadow);
}
.suggest button {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  color: var(--text);
}
.suggest button:hover { background: rgba(155, 240, 11, 0.08); }
.suggest button.active { background: rgba(155, 240, 11, 0.18); outline: 1px solid var(--lime-dim); }
.game { cursor: pointer; }
.suggest img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.suggest .meta { font-size: 11px; color: var(--muted); }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(155, 240, 11, 0.1);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px 5px 5px;
  font-size: 12px;
}
.chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 14px;
}
.chip select {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  max-width: 140px;
}
.badge {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
}
.badge.phys { background: rgba(126, 200, 255, 0.2); color: var(--disc); }
.badge.digi { background: rgba(201, 166, 255, 0.2); color: var(--digital); }
.badge.pass { background: rgba(155, 240, 11, 0.18); color: var(--lime); }
.game-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-body h3 { font-size: 15px; line-height: 1.3; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}
.progress {
  height: 6px;
  background: #1a221a;
  border-radius: 99px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--lime));
}
.row-actions { display: flex; gap: 6px; margin-top: auto; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}

.modal-back {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.62);
  display: none;
  place-items: center;
  z-index: 20;
  padding: 20px;
}
.modal-back.open { display: grid; }
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #101610;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 22px;
}
.modal h3 { margin-bottom: 14px; }
.fields { display: grid; gap: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ach-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ach-row.gold {
  box-shadow: 0 0 0 1px rgba(240, 200, 70, 0.6), 0 0 22px rgba(240, 190, 40, 0.38);
}
.ach-row.dropped {
  box-shadow: 0 0 0 1px rgba(255, 80, 70, 0.6), 0 0 22px rgba(255, 60, 50, 0.34);
}
.ach-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
}
.ach-row img, .thumb {
  width: 56px; height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: #182018;
}
.ach-row h4 { font-size: 14px; }
.pct { font-size: 13px; color: var(--lime); font-variant-numeric: tabular-nums; }

.notice {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.notice a { color: var(--lime); }

.hidden { display: none !important; }
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #142014;
  border: 1px solid var(--lime-dim);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  display: none;
  z-index: 30;
}
.toast.show { display: block; }

.detail-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.detail-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  background: #0c100c;
}
.detail-item.locked { opacity: 0.45; }
.lockdot {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: #1b241b;
  font-size: 12px;
}

.dock { display: none; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

@media (max-width: 820px) {
  .app-shell {
    padding: 16px 14px calc(92px + env(safe-area-inset-bottom));
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .topbar .nav {
    display: none;
  }
  .brand p { display: none; }
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }
  .stat { padding: 12px; }
  .stat strong { font-size: 20px; }
  .hero { grid-template-columns: 1fr; gap: 12px; }
  .lookup { flex-direction: column; }
  .lookup .btn, .toolbar .btn { width: 100%; justify-content: center; }
  .search { max-width: none; }
  .games { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cover { height: 120px; }
  .game-body { padding: 10px; }
  .game-body h3 { font-size: 13px; }
  .ach-row {
    grid-template-columns: 44px 1fr auto;
    padding: 8px;
  }
  .ach-row img, .thumb { width: 44px; height: 44px; }
  .grid-2 { grid-template-columns: 1fr; }
  .modal-back { padding: 10px; align-items: end; }
  .modal {
    width: 100%;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    padding: 16px;
  }
  .btn, .lookup input, .field input, .field select {
    min-height: 44px;
  }
  .dock {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 15;
    background: rgba(10, 14, 10, 0.94);
    border-top: 1px solid var(--line);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    backdrop-filter: blur(14px);
  }
  .dock button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    padding: 8px 4px;
  }
  .dock button.active { color: var(--lime); }
}
