:root,
[data-theme="HEXTECH"] {
  --bg: #010a13;
  --navy: #091428;
  --card: #111b2e;
  --gold: #c8aa6e;
  --bright: #f0e6d2;
  --muted: #a09b8c;
  --border: #785a28;
  --cyan: #0ac8b9;
  --mythic: #c86dfb;
  --crimson: #ff4e5b;
  --emerald: #26d07c;
  --on-gold: #010a13;
}

[data-theme="SAKURA_VELVET"],
[data-theme="STAR_GUARDIAN"],
[data-theme="SPIRIT_BLOSSOM"] {
  --bg: #160c18;
  --navy: #221226;
  --card: #2d1833;
  --gold: #ff9ec4;
  --bright: #fff0f6;
  --muted: #c9a8bc;
  --border: #9c5578;
  --cyan: #7de8ff;
  --mythic: #e29eff;
  --crimson: #ff6b8b;
  --emerald: #4fe3a4;
  --on-gold: #1e0d1b;
}

[data-theme="SAKURA_MILK"] {
  --bg: #fff5f8;
  --navy: #ffe6ef;
  --card: #ffffff;
  --gold: #d95384;
  --bright: #3d1626;
  --muted: #7d5466;
  --border: #e5a8bf;
  --cyan: #008a9b;
  --mythic: #8f44ad;
  --crimson: #d6335c;
  --emerald: #1b995c;
  --on-gold: #ffffff;
}

[data-theme="PORCELAIN"] {
  --bg: #f4f7fc;
  --navy: #e4ecf7;
  --card: #ffffff;
  --gold: #2a62b8;
  --bright: #132440;
  --muted: #5b6e8c;
  --border: #b8c9e0;
  --cyan: #0e8696;
  --mythic: #7e4bc4;
  --crimson: #d1364a;
  --emerald: #1d9460;
  --on-gold: #ffffff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--bright);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100%;
  overflow: hidden;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
}

.top-bar {
  background: var(--navy);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  padding: calc(env(safe-area-inset-top, 10px) + 8px) 14px 10px;
  flex-shrink: 0;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  object-fit: cover;
}

.brand-meta {
  min-width: 0;
}

.riot-id {
  font-size: 14px;
  font-weight: 800;
  color: var(--bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.riot-sub {
  font-size: 11px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: var(--card);
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.gold-btn-sm {
  background: var(--gold);
  color: var(--on-gold);
  border: none;
  border-radius: 6px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.danger-btn-sm {
  background: var(--crimson);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.wallet-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.w-pill {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  border-radius: 6px;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
}

.w-tag.me { color: var(--mythic); }
.w-tag.rp { color: var(--gold); }
.w-tag.be { color: var(--cyan); }
.w-tag.oe { color: #f59e0b; }

.loading-bar {
  height: 2px;
  margin-top: 8px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--cyan), transparent);
  animation: pulse 1.2s infinite linear;
}

@keyframes pulse {
  0% { opacity: 0.35; }
  50% { opacity: 1; }
  100% { opacity: 0.35; }
}

.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 10px) + 64px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--bright);
  border: 1px solid var(--gold);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px 18px;
}

.tab-view { display: none; }
.tab-view.active { display: block; }

.reset-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--mythic) 55%, transparent);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  margin-bottom: 10px;
}

.reset-banner strong {
  color: var(--mythic);
}

.chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 6px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }
.chip-row.compact { margin-bottom: 10px; }

.chip, .chip-outline {
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  background: var(--card);
  color: var(--muted);
}

.chip.active, .chip-outline.active {
  background: var(--gold);
  color: var(--on-gold);
  border-color: var(--gold);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.item-card {
  position: relative;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.item-card.owned {
  border-color: var(--emerald);
}

.item-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--navy);
  overflow: hidden;
}

.item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wish-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(200, 170, 110, 0.7);
  background: rgba(1, 10, 19, 0.78);
  color: #f0e6d2;
  font-size: 14px;
  cursor: pointer;
}
.wish-btn.active {
  color: #facc15;
  border-color: #facc15;
}

.item-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.item-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--bright);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 30px;
}

.item-price {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}
.item-price.mythic { color: var(--mythic); }
.item-price.sale { color: var(--cyan); }
.item-price.owned-lbl { color: var(--emerald); }

.ys-card {
  min-height: 175px;
  background: linear-gradient(160deg, var(--navy), var(--card));
  border: 1.5px solid var(--gold);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  gap: 6px;
}

.ys-discount {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
}

.savings-pill {
  background: var(--card);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  text-align: center;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.section-head h2 {
  margin: 0;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.8px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
  line-height: 1.45;
}

.empty-state {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 10px;
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.search-box input {
  width: 100%;
  background: var(--card);
  color: var(--bright);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 8px;
  outline: none;
}

.settings-card {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.settings-card.highlight-card {
  border-color: var(--cyan);
}
.settings-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--gold);
}

.row-gap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.hex-select {
  flex: 1;
  background: var(--navy);
  color: var(--bright);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 12px;
}

.discord-btn {
  display: block;
  margin-top: 10px;
  background: #5865f2;
  color: #fff;
  text-decoration: none;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.brand-footer {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--navy);
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  padding: 6px 4px calc(env(safe-area-inset-bottom, 6px) + 6px);
  flex-shrink: 0;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 0;
}
.nav-btn.active {
  color: var(--gold);
}
.nav-ico { font-size: 18px; }
.nav-lbl { font-size: 9px; font-weight: 800; letter-spacing: 0.5px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 80;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--navy);
  border: 1.5px solid var(--gold);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 {
  margin: 0;
  color: var(--gold);
  font-size: 15px;
}

.login-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.gold-btn-full, .cyan-btn-full {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.gold-btn-full {
  background: var(--gold);
  color: var(--on-gold);
}
.cyan-btn-full {
  background: var(--cyan);
  color: #010a13;
}

.hex-textarea {
  width: 100%;
  background: var(--card);
  color: var(--bright);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  font-size: 12px;
  resize: none;
}

.err-text {
  color: var(--crimson);
  font-size: 12px;
  font-weight: 700;
}

.hidden { display: none !important; }
