:root {
  --bg: #1c1c1e;
  --bg2: #2c2c2e;
  --bg3: #3a3a3c;
  --accent: #0a84ff;
  --accent2: #30d158;
  --red: #ff453a;
  --text: #ffffff;
  --text2: #ebebf599;
  --text3: #ebebf54d;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 15px;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ── Header ─────────────────────────────────────────── */
.header {
  background: var(--bg2);
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--bg3);
}

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

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#user-name {
  font-size: 16px;
  font-weight: 600;
}

.balance {
  font-size: 13px;
  color: var(--accent2);
  font-weight: 500;
}

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

.label {
  font-size: 13px;
  color: var(--text2);
}

/* Toggle Switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg3);
  border-radius: 26px;
  transition: .2s;
}
.slider:before {
  position: absolute; content: "";
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: .2s;
}
input:checked + .slider { background: var(--accent2); }
input:checked + .slider:before { transform: translateX(18px); }

.mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mode-label { font-size: 13px; color: var(--text2); }
.mode-switch { display: flex; background: var(--bg3); border-radius: 8px; padding: 2px; gap: 2px; }
.mode-btn {
  background: transparent; border: none; color: var(--text2);
  font-size: 13px; padding: 4px 14px; border-radius: 6px; cursor: pointer;
  transition: .15s;
}
.mode-btn.active { background: var(--accent); color: white; }

/* ── Tabs ───────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
}
.tab {
  flex: 1; background: none; border: none;
  color: var(--text2); font-size: 14px;
  padding: 12px; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: .15s;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; padding: 16px; }
.tab-content.active { display: block; }

/* ── Section Header ─────────────────────────────────── */
.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header span { font-size: 15px; font-weight: 600; }

.btn-add {
  background: var(--accent); color: white;
  border: none; border-radius: var(--radius-sm);
  padding: 6px 14px; font-size: 13px; cursor: pointer;
}

/* ── Filter Card ────────────────────────────────────── */
.filter-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.filter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.filter-gift-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  margin-right: 2px;
}

.filter-name {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-price {
  font-size: 13px;
  color: var(--accent2);
  font-weight: 500;
}

.filter-attrs {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
}

.filter-platforms {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.plat-tag {
  background: var(--bg3);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text2);
}

.btn-del {
  background: none;
  border: none;
  color: var(--red);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}

/* ── History Card ───────────────────────────────────── */
.history-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

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

.history-name { font-size: 14px; font-weight: 600; }
.history-price { font-size: 14px; color: var(--accent2); font-weight: 500; }

.history-meta {
  font-size: 12px;
  color: var(--text2);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}
.status-success { background: #30d15820; color: var(--accent2); }
.status-pending { background: #ff9f0a20; color: #ff9f0a; }
.status-failed  { background: #ff453a20; color: var(--red); }

/* ── Wallet Tab ─────────────────────────────────────── */
.wallet-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}
.wallet-label { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.wallet-balance { font-size: 32px; font-weight: 700; color: var(--accent2); }

.deposit-section {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
}
.deposit-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.deposit-desc { font-size: 13px; color: var(--text2); margin-bottom: 12px; line-height: 1.4; }

.deposit-addr-wrap, .deposit-comment-wrap {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.deposit-addr {
  font-family: monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  margin-bottom: 8px;
}
.deposit-comment-label { font-size: 12px; color: var(--text2); }
.deposit-comment {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin: 4px 0 8px;
}
.copy-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: #00000088;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--bg2);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; text-align: center; }

.field-label { font-size: 13px; color: var(--text2); display: block; margin-bottom: 4px; margin-top: 12px; }
.hint { color: var(--text3); }
.field-input {
  width: 100%;
  background: var(--bg3);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
}
.field-input::placeholder { color: var(--text3); }

/* ── Gift Grid ──────────────────────────────────────── */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 8px;
}

.gift-grid-item {
  background: var(--bg3);
  border-radius: 10px;
  padding: 8px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background .1s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.gift-grid-item:active { background: var(--accent); }

.gift-grid-img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
}

.gift-grid-name {
  font-size: 10px;
  color: var(--text2);
  line-height: 1.2;
  word-break: break-word;
}

.gift-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  padding: 20px;
}

/* Selected gift */
.gift-selected {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.gift-selected-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gift-selected-img {
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: cover;
}
.gift-clear-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

/* ── Attribute Lists ────────────────────────────────── */
.attrs-title { font-size: 13px; color: var(--text2); margin-bottom: 10px; margin-top: 14px; }

.attr-block {
  margin-bottom: 12px;
}

.attr-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.attr-key {
  font-size: 13px;
  color: var(--text2);
  width: 60px;
  flex-shrink: 0;
}

.attr-mini-search {
  flex: 1;
  background: var(--bg3);
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
}
.attr-mini-search::placeholder { color: var(--text3); }

.attr-list {
  max-height: 150px;
  overflow-y: auto;
  border-radius: 8px;
  background: var(--bg3);
}

.attr-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #ffffff08;
  transition: background .1s;
  -webkit-tap-highlight-color: transparent;
}
.attr-list-item:last-child { border-bottom: none; }
.attr-list-item:active { background: #ffffff10; }
.attr-list-item.selected {
  background: #0a84ff22;
  color: var(--accent);
}

.attr-list-loading,
.attr-list-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text3);
  text-align: center;
}

.attr-list-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.attr-rarity {
  margin-left: auto;
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
}
.attr-option-name { flex: 1; }
.attr-color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid #ffffff22;
}

/* ── Platforms ──────────────────────────────────────── */
.platforms-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.btn-cancel {
  flex: 1;
  background: var(--bg3);
  color: var(--text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  cursor: pointer;
}
.btn-save {
  flex: 2;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Empty State ────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text2);
  font-size: 14px;
  padding: 40px 16px;
  line-height: 1.6;
}
