:root {
  --bg: #0e1722;
  --panel: #18283a;
  --panel-2: #22364b;
  --line: #37516b;
  --text: #f2f8ff;
  --muted: #aebfd1;
  --accent: #58a7e6;
  --accent-2: #93cef7;
  --danger: #d66d6d;
  --good: #74c69d;
  --shadow: rgba(3, 10, 19, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(88, 167, 230, 0.16), transparent 34%),
    linear-gradient(180deg, #0d1621 0%, #14263a 46%, #0e1722 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

a,
button {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar {
  height: 64px;
  margin-top: 18px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(20, 34, 49, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px var(--shadow), inset 0 1px 0 rgba(147, 206, 247, 0.06);
}

.brand {
  width: 118px;
  height: 40px;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
  font-size: 22px;
}

.brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a,
.nav-button {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover,
.nav-button:hover {
  color: var(--text);
  background: rgba(55, 81, 107, 0.72);
}

.nav-group {
  position: relative;
}

.nav-menu {
  position: absolute;
  top: 38px;
  left: 0;
  width: 190px;
  padding: 8px;
  background: #17283a;
  border: 1px solid var(--line);
  box-shadow: 0 16px 30px var(--shadow);
  display: none;
  z-index: 10;
}

.nav-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: block;
}

.nav-menu a {
  width: 100%;
  justify-content: flex-start;
}

.page {
  display: none;
  padding: 42px 0;
}

.page.active {
  display: block;
}

.hero {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 104px);
  display: none;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  overflow: hidden;
}

.hero::before {
  content: "RTV";
  position: absolute;
  z-index: -1;
  right: -32px;
  top: 42%;
  transform: translateY(-50%);
  color: rgba(147, 206, 247, 0.055);
  font-size: clamp(190px, 28vw, 380px);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: 0;
  pointer-events: none;
  text-shadow: 0 0 40px rgba(88, 167, 230, 0.08);
}

.hero.active {
  display: grid;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  margin-bottom: 0;
  font-size: 34px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 22px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.title-row h2 {
  overflow-wrap: anywhere;
  margin: 0;
}

.detail-acronym-inline {
  color: var(--muted);
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  margin: 0;
}

.roblox-link {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #0c1825;
}

.roblox-link:hover {
  border-color: #73bdf2;
}

.roblox-link img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.hidden {
  display: none;
}

.hero-copy {
  max-width: 620px;
  color: #bfd0df;
  font-size: 18px;
  line-height: 1.6;
}

.hero-notes {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(13, 20, 32, 0.45);
}

.hero-notes p {
  margin: 0 0 8px;
  color: #bfd0df;
  line-height: 1.45;
}

.hero-notes p:last-child {
  margin-bottom: 0;
}

.hero-notes strong {
  color: var(--text);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}

.primary-action,
.secondary-action,
.back-button,
.add-user-button {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.primary-action {
  border-color: #73bdf2;
  background: #2f75aa;
}

.market-card,
.item-card,
.chart-card,
.search-panel,
.empty-state {
  background: rgba(24, 40, 58, 0.9);
  border: 1px solid var(--line);
  box-shadow: 0 16px 34px var(--shadow), inset 0 1px 0 rgba(147, 206, 247, 0.055);
}

.market-card {
  backdrop-filter: blur(8px);
  padding: 22px;
}

.card-label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.metric-row span,
.muted {
  color: var(--muted);
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading.compact {
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.catalog-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-input {
  width: 220px;
  height: 38px;
  padding: 0 12px;
  background: #0c1825;
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
}

.filter-wrap {
  position: relative;
}

.filter-button {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.filter-menu {
  position: absolute;
  top: 44px;
  right: 0;
  width: 190px;
  padding: 8px;
  display: none;
  background: #17283a;
  border: 1px solid var(--line);
  box-shadow: 0 16px 30px var(--shadow);
  z-index: 15;
}

.filter-menu.active {
  display: block;
}

.filter-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.filter-menu button:hover,
.filter-menu button.active {
  color: var(--text);
  background: var(--panel-2);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.item-card {
  min-height: 244px;
  padding: 12px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.item-card:hover {
  border-color: #73bdf2;
}

.item-name {
  height: 22px;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  line-height: 1.25;
}

.item-image {
  position: relative;
  height: 92px;
  margin-bottom: 12px;
  display: grid;
  place-items: center;
  background: #0c1825;
  border: 1px solid var(--line);
}

.item-image .item-image-placeholder {
  width: 54px;
  height: 54px;
  display: block;
  background: linear-gradient(135deg, #7bbff0, #d9e9f5);
  transform: rotate(45deg);
}

.item-image.has-image {
  background: #102235;
}

.item-image img {
  max-width: 86px;
  max-height: 86px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.item-quantity-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: rgba(12, 24, 37, 0.9);
  border: 1px solid var(--line);
  z-index: 2;
}

.item-rarity-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: rgba(12, 24, 37, 0.9);
  border: 1px solid var(--line);
  z-index: 2;
}

.item-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.item-stat strong {
  color: var(--text);
}

.pager {
  flex-wrap: wrap;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.pager button,
.pager span,
.tab,
.icon-button {
  min-height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: transparent;
  background: transparent;
}

.pager button.active,
.tab.active {
  background: #2f75aa;
  border-color: #73bdf2;
  color: var(--text);
}

.leaderboard {
  border: 1px solid var(--line);
  background: rgba(24, 40, 58, 0.9);
}

.leader-row,
.change-row,
.search-result {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 150px 150px;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
}

.leader-row:first-child,
.change-row:first-child {
  border-top: 0;
}

.leader-row button,
.search-result button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-2);
  text-align: left;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  margin-top: 20px;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.scan-pill {
  padding: 7px 11px;
  background: rgba(116, 198, 157, 0.14);
  color: var(--good);
  border: 1px solid rgba(116, 198, 157, 0.32);
  font-size: 13px;
}

.profile-main {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
}

.avatar-card {
  display: grid;
  align-content: start;
  gap: 10px;
}

.avatar-frame {
  height: 330px;
  display: grid;
  place-items: center;
  background: #0c1825;
  border: 1px solid var(--line);
}

.avatar-frame img {
  max-width: 100%;
  max-height: 318px;
  object-fit: contain;
}

.avatar-stand {
  width: 112px;
  height: 230px;
  background: linear-gradient(180deg, #d7e0e7, #7292b1);
  clip-path: polygon(36% 0, 64% 0, 74% 28%, 100% 38%, 82% 55%, 72% 100%, 28% 100%, 18% 55%, 0 38%, 26% 28%);
}

.profile-stat-bar {
  display: grid;
  gap: 8px;
}

.profile-stat-bar div {
  min-height: 46px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: rgba(24, 40, 58, 0.9);
  border: 1px solid var(--line);
}

.profile-stat-bar span {
  color: var(--muted);
  font-size: 13px;
}

.profile-stat-bar strong {
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.chart-card {
  min-height: 330px;
  padding: 18px;
}

.private-inventory-message {
  margin: 0 0 12px;
  padding: 10px 12px;
  color: #ffe3c2;
  background: rgba(214, 109, 109, 0.16);
  border: 1px solid rgba(214, 109, 109, 0.34);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 28px;
}

.chart {
  height: 238px;
  display: flex;
  align-items: end;
  gap: 12px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 0 12px 12px;
}

.chart span {
  flex: 1;
  min-width: 18px;
  background: linear-gradient(180deg, var(--accent-2), #2f75aa);
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inventory-search {
  width: 180px;
}

.empty-inventory {
  grid-column: 1 / -1;
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(24, 40, 58, 0.9);
  border: 1px solid var(--line);
}

.item-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  margin-top: 18px;
}

.item-detail-header {
  margin-top: 34px;
  margin-bottom: 8px;
}

.item-detail-header .title-row {
  margin-top: 10px;
}

.item-detail-main,
.detail-panel {
  background: rgba(24, 40, 58, 0.9);
  border: 1px solid var(--line);
  box-shadow: 0 16px 34px var(--shadow), inset 0 1px 0 rgba(147, 206, 247, 0.055);
}

.item-detail-main {
  min-height: 300px;
  position: relative;
  display: block;
  padding: 26px 26px 30px;
}

.detail-note-wrap {
  margin-left: 282px;
  min-height: 210px;
  display: flex;
  align-items: flex-start;
  padding-top: 10px;
}

.detail-image {
  position: absolute;
  top: 26px;
  left: 26px;
  width: 250px;
  min-height: 248px;
  display: grid;
  place-items: center;
  background: #0c1825;
  border: 1px solid var(--line);
}

.detail-image img {
  max-width: 210px;
  max-height: 210px;
  object-fit: contain;
}

.detail-image span {
  width: 96px;
  height: 96px;
  display: block;
  background: linear-gradient(135deg, #7bbff0, #d9e9f5);
  transform: rotate(45deg);
}

.detail-note {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.6;
}

.detail-panel {
  padding: 18px;
}

.detail-stat {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.detail-stat:first-child {
  border-top: 0;
}

.detail-stat span {
  color: var(--muted);
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.change-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.change-empty {
  grid-column: 1 / -1;
}

.change-row {
  grid-template-columns: minmax(0, 1fr) 130px 130px 130px;
}

.change-card {
  min-height: 320px;
  padding: 12px;
  background: rgba(24, 40, 58, 0.9);
  border: 1px solid var(--line);
  box-shadow: 0 16px 34px var(--shadow), inset 0 1px 0 rgba(147, 206, 247, 0.055);
}

.change-card.is-clickable {
  cursor: pointer;
}

.change-card.is-clickable:hover,
.change-card.is-clickable:focus-visible {
  border-color: #73bdf2;
}

.change-card-name {
  min-height: 38px;
  margin-bottom: 10px;
  font-weight: 700;
  line-height: 1.25;
}

.change-card-type {
  margin-top: 6px;
  font-weight: 700;
}

.change-card-split {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.change-card-split > div {
  padding: 8px;
  border: 1px solid var(--line);
  background: #0c1825;
}

.change-card-split span {
  display: block;
  margin-bottom: 4px;
}

.change-card-split strong {
  overflow-wrap: anywhere;
}

.change-card-time {
  margin-top: 10px;
  font-size: 13px;
}

.change-card-exact {
  margin-top: 4px;
  font-size: 12px;
}

.admin-token-input {
  max-width: 260px;
}

.admin-change-list {
  display: grid;
  gap: 8px;
}

.admin-change-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1.2fr) 118px 132px 132px auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 8px 10px;
  background: rgba(24, 40, 58, 0.9);
  border: 1px solid var(--line);
  box-shadow: 0 10px 20px var(--shadow), inset 0 1px 0 rgba(147, 206, 247, 0.055);
}

.admin-change-thumb {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: #0c1825;
  border: 1px solid var(--line);
}

.admin-change-thumb span {
  width: 18px;
  height: 18px;
  display: block;
  background: linear-gradient(135deg, #7bbff0, #d9e9f5);
  transform: rotate(45deg);
}

.admin-change-thumb img {
  max-width: 34px;
  max-height: 34px;
  object-fit: contain;
}

.admin-change-row strong,
.admin-change-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-button {
  min-height: 30px;
  padding: 0 10px;
  color: #ffe8e8;
  background: #8f2633;
  border: 1px solid #d85d6c;
  cursor: pointer;
}

.danger-button:hover {
  background: #a63240;
}

.change-up {
  color: var(--good);
}

.change-down {
  color: var(--danger);
}

.empty-state {
  padding: 40px;
  text-align: center;
}

.notfound-wrap {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 14px;
  padding: 48px 16px;
}

.notfound-logo {
  width: min(320px, 72vw);
  height: auto;
  margin-bottom: 8px;
}

.notfound-wrap h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.notfound-wrap p {
  margin: 0;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 90px 18px 18px;
  background: rgba(4, 8, 14, 0.72);
  z-index: 30;
}

.modal-backdrop.active {
  display: flex;
}

.search-panel {
  width: min(720px, 100%);
  padding: 18px;
}

.search-head,
.search-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.search-tabs {
  justify-content: flex-start;
  margin: 18px 0 12px;
}

.tab {
  padding: 0 14px;
}

.search-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: #0c1825;
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
}

.add-user-button {
  width: 100%;
  margin-top: 18px;
  display: none;
  justify-content: center;
  align-items: center;
}

.add-user-button.visible {
  display: inline-flex;
}

.search-results {
  margin-top: 14px;
}

.search-result {
  grid-template-columns: minmax(0, 1fr) 130px;
  min-height: 52px;
  padding: 0;
}

@media (max-width: 960px) {
  .topbar {
    height: auto;
    padding: 12px;
    align-items: flex-start;
    gap: 12px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hero.active,
  .profile-layout,
  .profile-main,
  .item-detail-layout,
  .item-detail-main {
    grid-template-columns: 1fr;
  }

  .hero::before {
    right: -18px;
    top: 132px;
    transform: none;
    font-size: clamp(150px, 42vw, 250px);
    color: rgba(147, 206, 247, 0.045);
  }

  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .change-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-change-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 20px, 1180px);
  }

  .topbar,
  .page-heading,
  .catalog-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-input {
    width: 100%;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero {
    min-height: auto;
    gap: 26px;
  }

  .hero::before {
    right: -22px;
    top: 104px;
    font-size: 148px;
    color: rgba(147, 206, 247, 0.038);
  }

  .catalog-grid,
  .inventory-grid,
  .snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-search {
    width: 100%;
  }

  .change-list {
    grid-template-columns: 1fr;
  }

  .admin-change-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .leader-row,
  .change-row {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 12px;
  }

  .leader-row span:nth-child(3),
  .leader-row span:nth-child(4),
  .change-row span:nth-child(3),
  .change-row span:nth-child(4) {
    grid-column: 2;
  }
}
