@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #171915;
  --muted: #797c73;
  --surface: #ffffff;
  --canvas: #f4f4f0;
  --line: #e8e8e2;
  --green: #20765a;
  --green-soft: #e8f4ee;
  --red: #b5544c;
  --red-soft: #f9ece9;
  --gold: #a87824;
  --gold-soft: #f8eed8;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(32, 118, 90, 0.07), transparent 28rem),
    var(--canvas);
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(32, 118, 90, 0.24);
  outline-offset: 3px;
}

.app-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
}

.brand-mark svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.icon-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-button.is-loading svg {
  animation: spin 650ms linear infinite;
}

.intro {
  padding: 48px 2px 30px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(32, 118, 90, 0.1);
  animation: live-pulse 1.8s ease-out infinite;
}

.eyebrow[data-connection="loading"] {
  color: var(--gold);
}

.eyebrow[data-connection="loading"] .live-dot {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(168, 120, 36, 0.1);
}

.eyebrow[data-connection="offline"] {
  color: var(--red);
}

.eyebrow[data-connection="offline"] .live-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(181, 84, 76, 0.1);
  animation: none;
}

.intro h1 {
  margin: 0;
  font-size: clamp(34px, 10vw, 48px);
  font-weight: 800;
  letter-spacing: -1.8px;
  line-height: 1.28;
}

.intro-copy {
  max-width: 320px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
}

.tab {
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.tab.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 10px rgba(28, 31, 25, 0.06);
}

.market-list {
  display: grid;
  gap: 12px;
}

.market-card {
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(25, 28, 21, 0.035);
  animation: enter 420ms both;
}

.market-card:nth-child(2) {
  animation-delay: 60ms;
}

.market-card:nth-child(3) {
  animation-delay: 120ms;
}

.market-card[hidden] {
  display: none;
}

.card-heading {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 11px;
  align-items: center;
}

.card-heading > div:nth-child(2) {
  min-width: 0;
}

.asset-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 700;
}

.asset-icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.asset-icon--dollar {
  color: var(--green);
  background: var(--green-soft);
  font-family: Arial, sans-serif;
}

.asset-icon--gold,
.asset-icon--coin {
  color: var(--gold);
  background: var(--gold-soft);
}

.card-heading h2 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
}

.card-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.change {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 7px;
  border-radius: 8px;
  direction: ltr;
  font-size: 11px;
  font-weight: 700;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-variant-numeric: tabular-nums;
}

.change svg {
  width: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.change--up {
  color: var(--green);
  background: var(--green-soft);
}

.change--down {
  color: var(--red);
  background: var(--red-soft);
}

.source-count {
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--green);
  background: var(--green-soft);
  direction: rtl;
  font-size: 10px;
  font-weight: 700;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-variant-numeric: tabular-nums;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 24px 0 17px;
  direction: rtl;
}

.price-row strong {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
}

.price-row strong.price-loading {
  color: #b4b6af;
}

.price-row strong.is-updated {
  animation: price-update 700ms ease-out;
}

.price-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.analysis-link {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 4px;
  margin-right: auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #5f625a;
  background: #fafaf8;
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.analysis-link:hover {
  border-color: rgba(32, 118, 90, 0.25);
  color: var(--green);
  background: var(--green-soft);
}

.analysis-link svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.source-list {
  padding: 3px 12px;
  border-radius: 12px;
  background: #f7f7f4;
}

.source-row {
  display: flex;
  min-height: 39px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.source-row + .source-row {
  border-top: 1px solid #e9e9e4;
}

.source-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.source-logo {
  display: block;
  width: 24px;
  height: 16px;
  flex: 0 0 24px;
  object-fit: contain;
  object-position: center;
  transition: filter 180ms ease, opacity 180ms ease;
}

.source-logo--raster {
  mix-blend-mode: multiply;
}

.source-monogram {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: #315f87;
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.source-row b {
  color: #4d5049;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.live-badge {
  padding: 2px 5px;
  border-radius: 5px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 8px;
  font-weight: 700;
}

.source-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
}

.source-dot--green {
  background: #5a9d73;
}

.source-dot--blue {
  background: #648baa;
}

.source-dot--purple {
  background: #8c74aa;
}

.source-dot--muted {
  background: #c6c8c1;
}

.source-row[data-status="loading"] .source-dot,
.source-row[data-status="loading"] .source-logo,
.source-row[data-status="loading"] .source-monogram {
  animation: pulse 1.1s ease-in-out infinite;
}

.source-row[data-status="online"] .source-dot {
  box-shadow: 0 0 0 0 rgba(32, 118, 90, 0.28);
  animation: source-live 2s ease-out infinite;
}

.source-row[data-status="online"] .source-logo {
  animation: logo-live 2.4s ease-in-out infinite;
}

.source-row[data-status="online"] .source-monogram {
  animation: logo-live 2.4s ease-in-out infinite;
}

.source-row[data-status="offline"] .source-dot {
  background: var(--red);
}

.source-row[data-status="offline"] .source-logo {
  filter: grayscale(1);
  opacity: 0.42;
}

.source-row[data-status="offline"] .source-monogram {
  filter: grayscale(1);
  opacity: 0.42;
}

.source-row[data-status="offline"] .live-badge {
  color: var(--red);
  background: var(--red-soft);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 3px 0;
  color: var(--muted);
  font-size: 10px;
}

.status-bar time {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-variant-numeric: tabular-nums;
}

.status-bar span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.8s ease-in-out infinite;
}

.auto-update-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 10px 0 0;
  color: #a0a29b;
  font-size: 9px;
}

.signal-bars {
  display: inline-flex;
  height: 10px;
  align-items: flex-end;
  gap: 2px;
}

.signal-bars i {
  width: 2px;
  border-radius: 2px;
  background: var(--green);
  animation: signal 1.2s ease-in-out infinite;
}

.signal-bars i:nth-child(1) {
  height: 4px;
}

.signal-bars i:nth-child(2) {
  height: 7px;
  animation-delay: 120ms;
}

.signal-bars i:nth-child(3) {
  height: 10px;
  animation-delay: 240ms;
}

.toast {
  position: fixed;
  right: 50%;
  bottom: 24px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 12px;
  color: #fff;
  background: #22241f;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(50%, 0);
}

.toast.is-error {
  background: #8e403a;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes spin {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 currentColor;
  }
  70%,
  100% {
    box-shadow: 0 0 0 7px transparent;
  }
}

@keyframes source-live {
  70%,
  100% {
    box-shadow: 0 0 0 6px transparent;
  }
}

@keyframes price-update {
  0% {
    color: var(--green);
    transform: translateY(2px);
  }
  100% {
    color: var(--ink);
    transform: translateY(0);
  }
}

@keyframes signal {
  50% {
    opacity: 0.3;
    transform: scaleY(0.65);
  }
}

@keyframes logo-live {
  50% {
    opacity: 0.72;
    transform: translateY(-0.5px);
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding-inline: 24px;
  }

  .intro {
    padding-top: 68px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
