/* ========================================
   Roblox Limiteds Tracker - Minimal Theme
   ======================================== */

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

:root {
  --bg: #09090b;
  --bg2: #111113;
  --bg3: #18181b;
  --bg4: #1f1f23;
  --accent: #7c6ef0;
  --accent2: #a5a0f5;
  --accent-soft: rgba(124, 110, 240, 0.08);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.1);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.1);
  --yellow: #eab308;
  --yellow-soft: rgba(234, 179, 8, 0.1);
  --text: #fafafa;
  --text2: #a1a1aa;
  --text3: #71717a;
  --border: rgba(255, 255, 255, 0.06);
  --border2: rgba(255, 255, 255, 0.1);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Currency Dropdown ===== */
.currency-dropdown { position: relative; }
.currency-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.currency-btn:hover { border-color: var(--accent); background: var(--bg4); }
.currency-btn img { border-radius: 2px; object-fit: cover; }
.currency-arrow { font-size: 0.65rem; opacity: 0.4; }

.currency-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 4px;
  z-index: 200;
  min-width: 140px;
  max-height: 340px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.currency-menu.open { display: block; }

.currency-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text2);
  transition: all 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 6px;
}
.currency-option:hover { background: var(--bg4); color: var(--text); opacity: 1; }
.currency-option.active { background: var(--accent-soft); color: var(--accent2); }
.currency-option img { border-radius: 2px; object-fit: cover; flex-shrink: 0; }

/* ===== Search ===== */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
#searchInput {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 8px 32px 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  width: 200px;
  outline: none;
  transition: all 0.15s;
}
#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#searchInput::placeholder { color: var(--text3); }

.search-clear {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  display: none;
}
.search-clear:hover { color: var(--text); opacity: 1; }
.search-wrapper.has-text .search-clear { display: block; }

/* ===== Buttons ===== */
button, select {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border2);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
  font-family: inherit;
}
button:hover, select:hover { background: var(--bg4); color: var(--text); opacity: 1; }

.last-update {
  font-size: 0.7rem;
  color: var(--text3);
}

/* ===== Main ===== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px;
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border2); }

.stat-label {
  font-size: 0.65rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--text3);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Alerts ===== */
.alerts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border-radius: 8px;
  padding: 10px 14px;
  border-left: 3px solid var(--red);
}
.alert-item.up { border-left-color: var(--green); }
.alert-item img { width: 32px; height: 32px; border-radius: 6px; }
.alert-change { font-weight: 600; font-size: 0.85rem; }
.alert-change.positive { color: var(--green); }
.alert-change.negative { color: var(--red); }
.alert-name { font-size: 0.75rem; color: var(--text3); }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--bg2);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border);
}

.tab {
  background: transparent;
  color: var(--text3);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.82rem;
  transition: all 0.15s;
}
.tab:hover { color: var(--text2); background: var(--bg3); opacity: 1; }
.tab.active {
  background: var(--bg4);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ===== Panel ===== */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 {
  font-size: 0.85rem;
  margin-bottom: 14px;
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-controls { margin-bottom: 14px; }

/* ===== Items Grid ===== */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.item-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  gap: 12px;
  align-items: center;
}
.item-card:hover {
  border-color: var(--border2);
  background: var(--bg4);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.item-card img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--bg);
  object-fit: contain;
}

.item-info { flex: 1; min-width: 0; }

.item-name {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.item-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.item-rap {
  font-size: 0.7rem;
  color: var(--text3);
  margin-top: 1px;
}

.item-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 2px;
}
.item-change.positive { color: var(--green); }
.item-change.negative { color: var(--red); }
.item-change.neutral { color: var(--text3); }

/* ===== Chart ===== */
.chart-controls { margin-bottom: 14px; }
.chart-container { position: relative; height: 350px; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: var(--bg3);
  color: var(--text3);
  font-size: 1.1rem;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 10;
  line-height: 1;
  border: 1px solid var(--border2);
}
.modal-close:hover { color: var(--text); opacity: 1; }

.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.modal-header img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: var(--bg);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.modal-detail {
  font-size: 0.85rem;
  color: var(--text3);
  margin-top: 3px;
}
.modal-detail span {
  color: var(--text);
  font-weight: 600;
}

/* ===== Auth ===== */
.auth-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}
.auth-btn:hover { opacity: 0.9; }
.logout-btn { background: var(--bg3); border: 1px solid var(--border2); color: var(--text2); }
.user-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
}
#userArea { display: flex; align-items: center; gap: 8px; }

.auth-modal { max-width: 380px; padding-top: 48px; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 20px; }
.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text3);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}
.auth-tab:first-child { border-radius: 8px 0 0 8px; }
.auth-tab:last-child { border-radius: 0 8px 8px 0; }
.auth-tab.active { background: var(--accent); color: white; border-color: var(--accent); }

#authForm { display: flex; flex-direction: column; gap: 12px; }
#authForm input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.15s;
}
#authForm input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-error { color: var(--red); font-size: 0.78rem; min-height: 18px; }
.auth-submit-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 11px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.auth-submit-btn:hover { opacity: 0.9; }

/* ===== Notification Banner ===== */
.notif-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--green-soft);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--green);
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.notif-icon {
  background: var(--green);
  color: var(--bg);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.notif-text { flex: 1; font-size: 0.82rem; color: var(--text); }
.notif-text strong { display: block; font-size: 0.9rem; margin-bottom: 2px; color: var(--green); }
.notif-close { background: none; color: var(--text3); font-size: 1.2rem; padding: 4px; border: none; }

/* ===== Item Actions ===== */
.item-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fav-star {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 2px;
  transition: all 0.15s;
  line-height: 1;
}
.fav-star:hover { color: var(--yellow); transform: scale(1.15); }
.fav-star.active { color: var(--yellow); }

/* ===== Modal Actions ===== */
.modal-actions-row { margin-bottom: 16px; }
.modal-fav-btn {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--yellow);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
  font-weight: 500;
}
.modal-fav-btn:hover { border-color: rgba(234, 179, 8, 0.3); background: var(--yellow-soft); opacity: 1; }
.modal-fav-btn.active { background: var(--yellow-soft); border-color: rgba(234, 179, 8, 0.3); }

/* ===== Favorite Modal ===== */
.fav-modal { max-width: 420px; }
.fav-modal-title { color: var(--text); margin-bottom: 16px; font-size: 1rem; font-weight: 600; }
.fav-modal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg3);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.fav-modal-item img { width: 44px; height: 44px; border-radius: 8px; }
.fav-modal-name { font-weight: 600; font-size: 0.9rem; }
.fav-modal-price { color: var(--text2); font-size: 0.82rem; margin-top: 2px; }

#favForm { display: flex; flex-direction: column; gap: 12px; }
.fav-label { color: var(--text3); font-size: 0.82rem; }
.fav-price-input {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
}
.fav-dollar, .fav-currency {
  padding: 12px;
  color: var(--text3);
  font-weight: 500;
  font-size: 0.85rem;
}
.fav-price-input input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 12px 0;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  min-width: 0;
}
.fav-submit { background: var(--accent); color: white; border: none; }
.fav-submit:hover { opacity: 0.9; }

/* ===== Favorites Grid ===== */
.fav-grid { display: flex; flex-direction: column; gap: 8px; }
.fav-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  border-left: 3px solid var(--text3);
}
.fav-card.fav-hit { border-left-color: var(--green); background: var(--green-soft); }
.fav-card.fav-waiting { border-left-color: var(--yellow); }
.fav-card img { width: 44px; height: 44px; border-radius: 8px; }
.fav-info { flex: 1; min-width: 0; }
.fav-name { font-weight: 600; font-size: 0.85rem; margin-bottom: 3px; }
.fav-prices { display: flex; gap: 16px; font-size: 0.78rem; color: var(--text3); }
.fav-prices strong { color: var(--text); }
.fav-status { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; margin-top: 3px; letter-spacing: 0.5px; }
.fav-status.fav-hit { color: var(--green); }
.fav-status.fav-waiting { color: var(--yellow); }
.fav-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.fav-remove {
  background: var(--bg);
  border: 1px solid var(--border2);
  color: var(--red);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
}
.fav-remove:hover { background: var(--red); color: white; }

/* ===== Buy Button ===== */
.buy-btn {
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.buy-btn:hover { opacity: 0.85; }

/* ===== Modal Listings ===== */
.listings-title {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.listings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.listing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  transition: border-color 0.15s;
}
.listing-row:hover { border-color: var(--border2); }

.listing-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  min-width: 90px;
}

.listing-badge {
  background: var(--green);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.listing-buy-btn {
  margin-left: auto;
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.listing-buy-btn:hover { opacity: 0.85; }

/* ===== Adurite Comparison ===== */
.adu-compare {
  font-size: 0.7rem;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  font-weight: 500;
}
.adu-compare.adu-wins { background: var(--red-soft); color: var(--red); }
.adu-compare.ro-wins { background: var(--green-soft); color: var(--green); }
.adu-compare.same-price { background: rgba(161,161,170,0.1); color: var(--text3); }

.compare-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}
.compare-badge.adu-wins { background: var(--red); color: white; }
.compare-badge.ro-wins { background: var(--green); color: white; }
.compare-badge.same-price { background: var(--text3); color: var(--bg); }

.compare-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.7rem;
}
.compare-ro { color: var(--text3); }

/* ===== Adurite Tab ===== */
.adurite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.adurite-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adurite-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--red);
}
.adurite-rate, .adurite-stock, .adurite-updated {
  font-size: 0.75rem;
  color: var(--text3);
  background: var(--bg3);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.adurite-controls { display: flex; gap: 10px; align-items: center; }
.adu-sync-btn { background: var(--red); color: white; padding: 8px 16px; border-radius: 8px; font-weight: 600; white-space: nowrap; border: none; }
.adu-sync-btn:hover { opacity: 0.85; }

#aduriteSearch {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  width: 200px;
  outline: none;
  transition: all 0.15s;
}
#aduriteSearch:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.adurite-card { cursor: pointer; }
.adu-price { color: var(--red) !important; }
.item-seller { font-size: 0.7rem; color: var(--text3); }
.item-pay { font-size: 0.65rem; color: var(--text3); opacity: 0.7; }

.adu-buy { background: var(--red) !important; border: none; }
.adu-buy:hover { opacity: 0.85 !important; }

.adu-title { color: var(--red) !important; margin-top: 16px; }
.adu-listing { border-color: var(--red-soft); }
.adu-seller { font-size: 0.78rem; color: var(--text3); }

.listing-source {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.source-roplace { background: var(--accent-soft); color: var(--accent2); }
.source-adurite { background: var(--red-soft); color: var(--red); }

.adu-modal-note {
  font-size: 0.78rem;
  color: var(--text3);
  margin-top: 12px;
  font-style: italic;
}
.listing-buy-btn.adu-buy { background: var(--red); }
.listing-buy-btn.adu-buy:hover { opacity: 0.85; }

/* ===== Loading ===== */
.loading {
  text-align: center;
  color: var(--text3);
  padding: 48px;
  font-size: 0.85rem;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.85rem;
  z-index: 300;
  transition: bottom 0.3s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border2);
}
.toast.show { bottom: 30px; }

/* ===== Responsive - Tablets ===== */
@media (max-width: 900px) {
  main { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .items-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .modal { width: 95%; padding: 20px; }
}

/* ===== Responsive - Mobile ===== */
@media (max-width: 600px) {
  header { padding: 10px 14px; }
  .header-content { flex-direction: column; align-items: stretch; gap: 8px; max-width: 100%; }
  h1 { font-size: 1rem; text-align: center; }
  .header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
  .search-wrapper { flex: 1; order: 1; min-width: 0; }
  #searchInput { width: 100%; font-size: 16px; padding: 10px 32px 10px 12px; }
  .currency-dropdown { order: 0; }
  #refreshBtn { padding: 10px 14px; order: 2; }
  .auth-btn, .logout-btn { padding: 10px 14px; order: 3; }
  #userArea { order: 3; }
  .last-update { width: 100%; text-align: center; order: 4; }

  main { padding: 12px; max-width: 100%; overflow-x: hidden; }

  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: 0.6rem; }

  .tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 3px;
    border-radius: 10px;
  }
  .tab {
    text-align: center;
    padding: 10px 4px;
    font-size: 0.65rem;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .panel { padding: 12px; border-radius: 10px; width: 100%; overflow: hidden; }
  .items-grid { grid-template-columns: 1fr; gap: 6px; }
  .item-card { padding: 12px; gap: 10px; border-radius: 10px; }
  .item-card img { width: 44px; height: 44px; }
  .item-name { font-size: 0.82rem; }
  .item-price { font-size: 0.95rem; }
  .buy-btn { padding: 8px 14px; font-size: 0.75rem; }

  .alerts-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .alert-item { padding: 8px 10px; gap: 8px; }
  .alert-item img { width: 28px; height: 28px; }
  .alert-change { font-size: 0.78rem; }
  .alert-name { font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .table-controls select, .chart-controls select { width: 100%; padding: 10px; font-size: 0.82rem; }
  .chart-container { height: 250px; }

  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%; max-height: 90vh;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .modal-close { top: 8px; right: 12px; font-size: 1.5rem; padding: 6px 10px; }
  .modal-header { gap: 12px; margin-bottom: 16px; }
  .modal-header img { width: 56px; height: 56px; }
  .modal-title { font-size: 1rem; }
  .modal-detail { font-size: 0.78rem; }

  .listings-list { gap: 6px; }
  .listing-row { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .listing-price { font-size: 0.95rem; min-width: 80px; }
  .listing-buy-btn { padding: 9px 14px; font-size: 0.78rem; width: 100%; text-align: center; margin-left: 0; }
  .listing-badge { font-size: 0.6rem; }

  .adurite-header { flex-direction: column; align-items: stretch; }
  .adurite-controls { flex-direction: column; }
  #aduriteSearch { width: 100%; font-size: 16px; }
  .adurite-info { justify-content: center; }

  .auth-modal { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; }
  .fav-modal { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; }
  #authForm input { font-size: 16px; }
  .fav-price-input input { font-size: 16px; }
  #userArea { flex-shrink: 0; }

  .notif-banner { padding: 12px; font-size: 0.78rem; }
  .notif-icon { width: 24px; height: 24px; font-size: 0.8rem; }
  .fav-card { padding: 12px; gap: 10px; flex-wrap: wrap; }
  .fav-card img { width: 38px; height: 38px; }
  .fav-prices { flex-direction: column; gap: 2px; }
  .fav-actions { flex-direction: row; width: 100%; }
  .fav-actions .listing-buy-btn { flex: 1; text-align: center; }
  .fav-star { font-size: 1.1rem; }
  .toast { font-size: 0.78rem; padding: 10px 18px; max-width: 90vw; white-space: normal; text-align: center; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-value { font-size: 1rem; }
  h1 { font-size: 0.9rem; }
  .item-card img { width: 38px; height: 38px; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  header {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  main {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}
