:root {
  --bg: #f4f6fb;
  --bg-card: #ffffff;
  --text: #162033;
  --muted: #6f7a90;
  --primary: #bc8f2f;
  --primary-2: #e4bc58;
  --border: #dce2ef;
  --shadow: 0 12px 30px rgba(21, 35, 70, 0.08);
  --up: #0f9f57;
  --down: #b42323;
  --neutral: #6f7a90;
}

html[data-theme="dark"] {
  --bg: #0c1222;
  --bg-card: #141d34;
  --text: #ecf1ff;
  --muted: #97a5c5;
  --primary: #ffcc66;
  --primary-2: #b98d34;
  --border: #273354;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --up: #55d69a;
  --down: #ff9a9a;
  --neutral: #97a5c5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Vazirmatn", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 90% 10%, #f3e5be 0, transparent 34%),
    radial-gradient(circle at 10% 80%, #d9e4ff 0, transparent 30%), var(--bg);
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at 90% 10%, #47381a 0, transparent 30%),
    radial-gradient(circle at 10% 80%, #1d2a49 0, transparent 30%), var(--bg);
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
}

.bg-shape-1 {
  width: 280px;
  height: 280px;
  background: #f7cc6f;
  top: -100px;
  right: -80px;
}

.bg-shape-2 {
  width: 260px;
  height: 260px;
  background: #85a7ff;
  bottom: -100px;
  left: -80px;
}

.site-header,
.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  padding: 1.2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 0 8px rgba(188, 143, 47, 0.15);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-family: "Vazirmatn", sans-serif;
  font-weight: 700;
}

.container {
  padding-bottom: 3rem;
}

.hero {
  padding: 1.2rem;
  background: linear-gradient(140deg, rgba(188, 143, 47, 0.16), rgba(122, 164, 255, 0.12));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-badge {
  margin: 0;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.88rem;
}

.hero h1 {
  margin: 0.6rem 0 0.4rem;
  font-size: clamp(1.45rem, 3.4vw, 2.4rem);
}

.hero-text {
  margin: 0;
  color: var(--muted);
}

.meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.meta-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.65rem 0.85rem;
}

.meta-label {
  font-size: 0.8rem;
  color: var(--muted);
  display: block;
}

.status {
  margin: 1rem 0 0.7rem;
  color: var(--down);
  font-size: 0.9rem;
  min-height: 1.4rem;
}

.prices-section {
  margin-top: 2rem;
}

.status:empty {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
}

.price-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.95rem;
  box-shadow: var(--shadow);
  animation: card-in 350ms ease both;
}

.price-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.price-value {
  margin: 0.35rem 0;
  font-weight: 800;
  font-size: 1.2rem;
}

.price-change {
  margin: 0;
  font-size: 0.85rem;
}

.price-change.up {
  color: var(--up);
}

.price-change.down {
  color: var(--down);
}

.price-change.neutral {
  color: var(--neutral);
}

.tools-section {
  margin-top: 1.4rem;
}

.compare-section {
  margin-top: 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.05rem;
  box-shadow: var(--shadow);
}

.compare-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.compare-head p {
  margin: 0.35rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.compare-table-wrap {
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
  border-radius: 12px;
  overflow: hidden;
}

.compare-table th,
.compare-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.5rem;
  text-align: center;
  white-space: nowrap;
  font-size: 0.9rem;
}

.compare-table th {
  color: var(--muted);
  font-weight: 700;
  background: color-mix(in srgb, var(--bg-card) 86%, var(--primary) 14%);
}

.compare-table tr:last-child td {
  border-bottom: none;
}

.compare-table tbody tr {
  transition: background 180ms ease;
}

.compare-table tbody tr:hover {
  background: color-mix(in srgb, var(--bg-card) 90%, var(--primary) 10%);
}

.compare-table .best-price {
  color: var(--up);
  font-weight: 800;
}

.sort-btn {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 999px;
}

.sort-btn::after {
  content: "⇅";
  font-size: 0.72rem;
  margin-inline-start: 0.35rem;
  opacity: 0.45;
}

.sort-btn.active {
  color: var(--text);
  background: color-mix(in srgb, var(--bg-card) 72%, var(--primary) 28%);
}

.sort-btn.active[data-dir="asc"]::after {
  content: "▲";
  opacity: 0.9;
}

.sort-btn.active[data-dir="desc"]::after {
  content: "▼";
  opacity: 0.9;
}

.tools-section h2 {
  font-size: 1.2rem;
  margin: 0 0 0.8rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.95rem;
  box-shadow: var(--shadow);
}

.asset-card {
  grid-column: span 2;
}

.tool-card h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.tool-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}

.tool-row label,
.tool-help {
  color: var(--muted);
  font-size: 0.9rem;
}

.storage-note {
  margin: 0 0 0.7rem;
  padding: 0.6rem 0.7rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
}

.tool-row input {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-family: "Vazirmatn", sans-serif;
}

.tool-row input::placeholder {
  color: var(--muted);
}

.coin-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.coin-builder-header h4 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.coin-rows {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.coin-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
}

.coin-type {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font-family: "Vazirmatn", sans-serif;
}

.coin-type option {
  background: var(--bg-card);
  color: var(--text);
}

.tool-row .coin-type {
  width: 100%;
}

.qty-box {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.coin-qty {
  width: 56px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: center;
  padding: 0.4rem 0.25rem;
  font-family: "Vazirmatn", sans-serif;
}

.qty-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  font-family: "Vazirmatn", sans-serif;
  font-weight: 700;
}

.qty-box .qty-btn {
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
}

.qty-box .qty-btn.plus {
  border-right: 1px solid var(--border);
  border-left: none;
}

.btn-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}

.btn {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #1f1a0c;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-family: "Vazirmatn", sans-serif;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary {
  margin-top: 0.5rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tool-result {
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
}

.install-cta-section {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.45rem;
}

.install-cta-btn {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(188, 143, 47, 0.2), rgba(122, 164, 255, 0.2));
  color: var(--text);
  border-radius: 18px;
  padding: 0.95rem 1rem;
  font-family: "Vazirmatn", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.install-cta-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.install-cta-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 1.2rem 1rem 1.7rem;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0.2rem 0;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .site-header,
  .container {
    width: calc(100% - 1rem);
  }

  .hero {
    padding: 1rem;
    border-radius: 18px;
  }

  .asset-card {
    grid-column: span 1;
  }

  .coin-row {
    grid-template-columns: 1fr;
  }
}
