:root {
  --bg: #050505;
  --bg-soft: #0d0d0f;
  --card: rgba(18, 18, 22, 0.92);
  --card-2: rgba(28, 28, 34, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #a7a7b3;
  --accent: #ff5a00;
  --accent-2: #b43cff;
  --danger: #e04b4b;
  --success: #18b86a;
  --warning: #ffbe3b;
  --blue: #4a7dff;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.has-wallpaper::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* Screens */

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* Auth */

.auth-shell {
  width: min(92vw, 540px);
  margin: 40px auto;
  padding: 24px;
  border-radius: 28px;
}

.app-title {
  font-size: clamp(2rem, 6vw, 3.3rem);
  line-height: 0.95;
  margin-bottom: 18px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.auth-actions {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

/* App layout */

.app-shell {
  padding: 14px 14px 100px;
  width: min(100%, 840px);
  margin: 0 auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-greeting {
  margin-bottom: 18px;
  font-size: 1.05rem;
}

/* Shared blocks */

.glass,
.panel,
.auth-shell,
.modal-card,
.stat-box,
.watch-card,
.card,
.sale-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.panel {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.glass {
  border-radius: var(--radius);
}

.card {
  border-radius: 18px;
  padding: 14px;
  margin-top: 12px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* Forms */

.form-grid {
  display: grid;
  gap: 10px;
}

.input-dark,
select.input-dark,
textarea.input-dark {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 15px;
  outline: none;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.input-dark::placeholder {
  color: #8f8f9a;
}

.input-dark:focus,
select.input-dark:focus,
textarea.input-dark:focus {
  border-color: rgba(255, 90, 0, 0.7);
  background: rgba(255, 255, 255, 0.07);
}

textarea.input-dark {
  min-height: 110px;
  resize: vertical;
}

/* Buttons */

.btn-primary,
.btn-secondary,
.btn-danger,
.upload-btn,
.btn-small,
.glass-btn {
  appearance: none;
  border: none;
  border-radius: 18px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
  text-align: center;
  text-decoration: none;
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active,
.upload-btn:active,
.btn-small:active,
.glass-btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: linear-gradient(180deg, #ff6a1e, #ff4f00);
  color: #fff;
  font-weight: 700;
}

.btn-secondary {
  background: linear-gradient(90deg, #7c2cff, #c13cff);
  color: #fff;
  font-weight: 700;
}

.btn-danger {
  background: linear-gradient(180deg, #d74444, #b72727);
  color: #fff;
  font-weight: 700;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  width: 100%;
  min-height: 54px;
  margin-bottom: 12px;
}

.btn-small {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

.btn-blue {
  background: rgba(74, 125, 255, 0.18);
  color: #b9d0ff;
  border: 1px solid rgba(74, 125, 255, 0.45);
}

.btn-green {
  background: rgba(24, 184, 106, 0.18);
  color: #92ffbf;
  border: 1px solid rgba(24, 184, 106, 0.45);
}

.btn-red {
  background: rgba(224, 75, 75, 0.18);
  color: #ff9e9e;
  border: 1px solid rgba(224, 75, 75, 0.45);
}

.glass-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Messages */

.message-box {
  margin: 12px 0;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.message-box.error {
  background: rgba(120, 18, 18, 0.22);
  border-color: rgba(255, 92, 92, 0.55);
  color: #ffd2d2;
}

/* Dashboard */

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

.stat-box {
  border-radius: 22px;
  padding: 16px;
  min-height: 120px;
}

.stat-box h4 {
  font-size: 2rem;
  margin: 0 0 8px;
  font-weight: 900;
}

.stat-box p {
  margin: 0;
  color: var(--muted);
}

.dashboard-link {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.dashboard-link:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--card-2);
}

.dashboard-link:active {
  transform: scale(0.98);
}

/* Preview images */

.preview-image {
  width: 100%;
  border-radius: 18px;
  margin: 8px 0 14px;
  border: 1px solid var(--border);
  background: #000;
  object-fit: cover;
}

/* Scan pages */

.scan-grid {
  display: grid;
  gap: 12px;
}

.quick-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

/* Watch hub */

.watch-grid {
  display: grid;
  gap: 12px;
}

.watch-card {
  border-radius: 22px;
  padding: 18px;
  text-align: left;
  display: grid;
  gap: 8px;
}

.watch-card strong {
  font-size: 1rem;
}

.watch-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Compact lists */

.compact-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 12px;
  margin-top: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.compact-item:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.compact-item:active {
  transform: scale(0.99);
}

.compact-item.rare {
  border-color: rgba(255, 190, 59, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 190, 59, 0.08) inset;
}

.compact-item.wanted {
  border-color: rgba(255, 90, 0, 0.3);
}

.compact-thumb {
  width: 72px;
  height: 96px;
  border-radius: 14px;
  object-fit: cover;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.compact-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
}

.compact-title {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

.compact-sub {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 4px;
}

.compact-value {
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  margin: 4px 6px 4px 0;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-gold {
  background: rgba(255, 190, 59, 0.15);
  color: #ffd66c;
  border: 1px solid rgba(255, 190, 59, 0.35);
}

.badge-blue {
  background: rgba(74, 125, 255, 0.15);
  color: #b9d0ff;
  border: 1px solid rgba(74, 125, 255, 0.35);
}

.badge-purple {
  background: rgba(180, 60, 255, 0.15);
  color: #e2b8ff;
  border: 1px solid rgba(180, 60, 255, 0.35);
}

.badge-red {
  background: rgba(255, 90, 0, 0.16);
  color: #ffb18b;
  border: 1px solid rgba(255, 90, 0, 0.36);
}

.badge-green {
  background: rgba(24, 184, 106, 0.16);
  color: #9bffca;
  border: 1px solid rgba(24, 184, 106, 0.36);
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
}

.modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(94vw, 720px);
  max-height: 88vh;
  overflow: auto;
  border-radius: 26px;
  padding: 18px;
}

.modal-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  z-index: 1;
}

.detail-title {
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.detail-cover {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  margin: 10px 0;
  background: #000;
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* Sales */

.sale-card {
  border-radius: 18px;
  padding: 14px;
  margin-top: 14px;
}

.sale-card-top {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: start;
}

.sale-thumb {
  width: 74px;
  height: 100px;
  border-radius: 12px;
  object-fit: cover;
  background: #000;
  border: 1px solid #333;
}

.sale-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-size: 0.75rem;
  text-align: center;
  padding: 6px;
}

.sale-main {
  min-width: 0;
}

.sale-title {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

.sale-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.sale-grid {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.sale-profit {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
}

.profit-positive {
  background: rgba(0, 184, 92, 0.12);
  border: 1px solid rgba(0, 184, 92, 0.45);
  color: #7dffb0;
}

.profit-negative {
  background: rgba(217, 54, 54, 0.12);
  border: 1px solid rgba(217, 54, 54, 0.45);
  color: #ff8a8a;
}

.sale-notes {
  margin-top: 12px;
  color: var(--text);
}

/* Config */

.config-block + .config-block {
  margin-top: 18px;
}

/* Bottom nav */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 10, 12, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  display: grid;
  gap: 4px;
  justify-items: center;
  align-items: center;
  padding: 8px 4px;
  border-radius: 14px;
  cursor: pointer;
}

.nav-btn span {
  font-size: 1.2rem;
  line-height: 1;
}

.nav-btn small {
  font-size: 0.7rem;
  line-height: 1;
}

.nav-btn.active {
  color: var(--accent);
  background: rgba(255, 90, 0, 0.08);
}

/* Utilities */

#alerts-list img,
#scan-result img,
#box-results img {
  border-radius: 12px;
  margin-top: 8px;
  border: 1px solid var(--border);
}

/* Responsive */

@media (min-width: 700px) {
  .auth-actions {
    grid-template-columns: 1fr 1fr;
  }

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

  .scan-grid {
    grid-template-columns: 1fr 1fr;
  }

  .watch-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sale-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 12px 12px 96px;
  }

  .panel,
  .auth-shell,
  .stat-box,
  .watch-card,
  .sale-card,
  .card {
    padding: 14px;
  }

  .bottom-nav {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: auto;
    row-gap: 6px;
  }

  .nav-btn small {
    font-size: 0.66rem;
  }

  .stat-box {
    min-height: 108px;
  }

  .stat-box h4 {
    font-size: 1.7rem;
  }
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0f0f14;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#splash-screen img {
  width: min(82vw, 420px);
  max-width: 420px;
  height: auto;
  display: block;
}
  .profile-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.profile-stat {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
  padding: 14px;
}

.profile-stat strong {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.hunt-card {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
  padding: 14px;
  margin-top: 12px;
}

.rare-alert-popup {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  width: min(92vw, 520px);
  z-index: 10000;
  background: rgba(28, 10, 10, 0.96);
  border: 1px solid rgba(255, 190, 59, 0.5);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}

.rare-alert-popup h4 {
  margin: 0 0 8px;
  color: #ffd66c;
}

.rare-alert-popup.hidden {
  display: none !important;
}
}
