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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 40px 20px 20px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #58a6ff;
}

header p {
  font-size: 0.9rem;
  color: #8b949e;
  margin-top: 6px;
}

.search-bar {
  display: flex;
  justify-content: center;
  margin: 20px auto;
  max-width: 400px;
  padding: 0 20px;
}

.search-bar input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background-color: #161b22;
  color: #e6edf3;
  font-size: 0.95rem;
  outline: none;
}

.search-bar input:focus {
  border-color: #58a6ff;
}

.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 20px;
}

.card {
  background-color: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: #58a6ff;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-header img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.card-header span {
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
}

.price {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.change {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.change.positive {
  color: #3fb950;
}

.change.negative {
  color: #f85149;
}

.meta {
  font-size: 0.78rem;
  color: #8b949e;
  line-height: 1.6;
}

.loading {
  text-align: center;
  color: #8b949e;
  padding: 40px;
  grid-column: 1 / -1;
}

footer {
  text-align: center;
  padding: 30px;
  font-size: 0.8rem;
  color: #8b949e;
  margin-top: 40px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

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

.modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 30px;
  width: 90%;
  max-width: 500px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #8b949e;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #e6edf3;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.modal-header img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-header span {
  font-size: 0.8rem;
  color: #8b949e;
  text-transform: uppercase;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.modal-stat {
  background: #0d1117;
  border-radius: 10px;
  padding: 14px;
}

.modal-stat span {
  font-size: 0.75rem;
  color: #8b949e;
  display: block;
  margin-bottom: 6px;
}

.modal-stat strong {
  font-size: 1rem;
  font-weight: 600;
}

#modalChart {
  width: 100%;
  margin-top: 10px;
}

/* Fear & Greed Index */
.fng-container {
  display: flex;
  justify-content: center;
  margin: 10px auto 20px;
}

.fng-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 16px 32px;
  text-align: center;
}

.fng-label {
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 8px;
}

.fng-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.fng-text {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Currency Toggle */
.currency-toggle {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 20px;
}

.currency-btn {
  padding: 8px 24px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #161b22;
  color: #8b949e;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.currency-btn.active {
  background: #58a6ff;
  border-color: #58a6ff;
  color: #0d1117;
}

.currency-btn:hover {
  border-color: #58a6ff;
  color: #58a6ff;
}

/* Tabs */
.tab-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 20px;
}

.tab-btn {
  padding: 8px 24px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #161b22;
  color: #8b949e;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #58a6ff;
  border-color: #58a6ff;
  color: #0d1117;
}

.tab-btn:hover {
  border-color: #58a6ff;
  color: #58a6ff;
}

.watchlist-title {
  text-align: center;
  font-size: 1rem;
  color: #e6edf3;
  margin-bottom: 16px;
}

.watchlist-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Watchlist star button */
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  float: right;
  color: #8b949e;
  transition: color 0.2s;
}

.star-btn.active {
  color: #e3b341;
}