@font-face {
  font-family: Vazirmatn;
  src: url("Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #0b1516;
  --panel: #142629;
  --tint: #24403d;
  --edge: #385155;
  --muted: #b7c8c8;
  --gold: #f4cc82;
  --white: #fff9ee;
  --warning: #ffc08c;
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  line-height: 1.35;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--white);
  background: var(--background);
}
[hidden] { display: none !important; }
.price-board {
  width: min(100%, 2400px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(18px, 2.25vw, 54px) clamp(16px, 3.2vw, 75px) 16px;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.4vw, 28px);
  background: radial-gradient(ellipse at 82% 0%, var(--tint) 0%, var(--background) 60%);
}
.price-board[data-theme="midnight"] {
  --background: #101623; --tint: #263443; --panel: #1a2636; --edge: #3a4a5e; --muted: #bfccd8;
}
.price-board[data-theme="warm"] {
  --background: #1b1612; --tint: #382b23; --panel: #291f18; --edge: #584637; --muted: #d2c3b8;
}
.price-board[data-gold-position="hide"] .gold-grid { display: none; }
.price-board[data-gold-position="bottom"] .gold-grid { order: 2; }
.price-board[data-quote-times="false"] .quote-meta time,
.price-board[data-quote-times="false"] .retail-time > span { display: none; }
.board-header, .identity, .gold-title, .panel-title, .board-tabs,
.tab-buttons, .display-buttons, .board-footer {
  display: flex;
  align-items: center;
}
.board-header, .gold-title, .panel-title, .board-tabs, .board-footer {
  justify-content: space-between;
}
.board-header { padding-block-end: clamp(7px, 1.2vh, 18px); border-bottom: 1px solid var(--edge); }
.identity { gap: clamp(12px, 1.4vw, 30px); }
.identity img {
  width: clamp(54px, 5.2vw, 110px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}
.identity p, .identity h1, h2, dl, dd, .board-empty { margin: 0; }
.identity p { color: var(--gold); font-size: clamp(11px, 1vw, 22px); font-weight: 500; }
.identity h1 { font-size: clamp(23px, 2.6vw, 58px); font-weight: 800; margin-block-start: .08em; }
.board-clock { display: grid; text-align: left; gap: .2em; font-size: clamp(11px, 1.05vw, 22px); }
.board-clock bdi { font-size: clamp(22px, 2.5vw, 56px); font-weight: 650; color: var(--gold); line-height: 1; }
.board-clock bdi, .gold-values strong, .amount { font-variant-numeric: tabular-nums; }
.board-clock span { color: var(--muted); }
.gold-grid, .two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 28px); }
.gold-card, .market-list {
  border: 1px solid var(--edge);
  border-radius: clamp(14px, 1.25vw, 26px);
  min-width: 0;
}
.gold-card {
  padding: clamp(14px, 1.25vw, 28px) clamp(14px, 1.6vw, 38px);
  background: radial-gradient(ellipse at 94% 0%, #59472a 0%, #272b23 45%, #1d2826 100%);
  border-color: #87693e;
  box-shadow: 0 12px 32px #050a0b40, inset 0 1px #e3c28740;
}
.gold-title, .panel-title { gap: .75em; }
.gold-title h2, .panel-title h2 { font-size: clamp(17px, 1.7vw, 37px); }
.gold-title h2 { color: var(--gold); }
.gold-title > span, .panel-title > span { color: var(--muted); font-size: clamp(11px, 1vw, 21px); text-align: left; }
.gold-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: .85em .6em; }
.gold-values div { display: flex; flex-direction: column; gap: .15em; }
.gold-values div + div { border-inline-start: 1px solid #675736; padding-inline-start: clamp(8px, 1.4vw, 28px); }
.gold-values span { color: var(--muted); font-size: clamp(12px, 1.15vw, 25px); }
.gold-values strong { font-size: clamp(21px, 3.1vw, 66px); line-height: 1.12; font-weight: 750; white-space: nowrap; }
.gold-values div + div strong { color: var(--gold); }
.quote-meta {
  display: flex;
  gap: .35em .6em;
  flex-wrap: wrap;
  font-size: clamp(10px, .83vw, 18px);
  color: var(--muted);
}
.quote-meta > * { white-space: nowrap; }
.warning { color: var(--warning); font-weight: bold; }
.is-stale .gold-values strong, .amount.is-stale { color: #d3c7af; }
.board-tabs { gap: .5em; }
.tab-buttons, .display-buttons { gap: .45em; flex-wrap: wrap; }
.board-tabs button, .slide-controls button {
  background: #142528;
  border: 1px solid var(--edge);
  color: var(--muted);
  border-radius: 8px;
  padding: .55em .9em;
  font: inherit;
  font-size: clamp(11px, .92vw, 19px);
  white-space: nowrap;
  cursor: pointer;
}
.board-tabs button[aria-pressed="true"] { color: #15140f; border-color: #f4d48c; background: var(--gold); font-weight: 700; }
.board-tabs button:hover, .slide-controls button:hover { color: var(--white); }
.board-tabs button[aria-pressed="true"]:hover { color: #15140f; background: #f8dba5; }
.board-tabs button:focus-visible, .slide-controls button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button:disabled { opacity: .55; cursor: default; }
.market-list { padding: 0 clamp(12px, 1.45vw, 34px); background: var(--panel); box-shadow: 0 11px 24px #050a0b25; }
.panel-title { padding: clamp(10px, 1vw, 24px) 0; border-bottom: 1px solid var(--edge); }
.panel-title h2 { color: var(--gold); font-weight: 700; }
.quote-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: .7em;
  min-height: clamp(53px, 4.2vw, 91px);
  padding: .42em 0;
}
.quote-row + .quote-row { border-top: 1px solid var(--edge); }
.quote-row dt { font-size: clamp(13px, 1.37vw, 29px); font-weight: 650; }
.quote-row dd { text-align: left; }
.quote-row dd .quote-meta { justify-content: flex-end; }
.quote-row .melted-prices { display: flex; align-items: flex-start; justify-content: flex-end; gap: .35rem .7rem; flex-wrap: wrap; }
.melted-prices > div > span:first-child { font-size: .8rem; }
.price-board #world .melted-prices .amount { font-size: clamp(14px, 1.38vw, 29px); }
.amount { display: block; font-size: clamp(19px, 2.05vw, 46px); line-height: 1.12; font-weight: 750; white-space: nowrap; }
.missing { color: var(--muted); font-size: 1.2rem; }
.board-scroll { overflow-x: auto; }
.coin-detail table { width: 100%; min-width: 690px; border-collapse: collapse; text-align: right; }
.coin-detail th, .coin-detail td { padding: .45em .6em; border-bottom: 1px solid var(--edge); }
.coin-detail thead th { color: var(--muted); font-size: clamp(11px, 1vw, 20px); }
.coin-detail tbody th { font-size: clamp(13px, 1.2vw, 26px); }
.coin-detail tbody tr:last-child > * { border-bottom: 0; }
.coin-detail .amount { font-size: clamp(15px, 1.48vw, 31px); }
.board-empty { color: var(--muted); padding: 2em; text-align: center; }
.vintage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 24px);
  padding-block: clamp(10px, 2vh, 24px);
}
.vintage-card {
  padding: clamp(12px, 1.35vw, 30px);
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--background);
}
.vintage-card h3 { color: var(--gold); font-size: clamp(16px, 1.5vw, 32px); margin: 0 0 .55em; }
.vintage-price > span:first-child { display: block; color: var(--muted); font-size: clamp(11px, 1vw, 22px); }
.vintage-price + .vintage-price { margin-block-start: .35em; }
.retail-time { margin-block: .45em; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(12px, 1.55vw, 36px); }
.product-row {
  min-width: 0;
  min-height: clamp(56px, 7.4vh, 128px);
  border-top: 1px solid var(--edge);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .45em;
  padding: .45em 0;
}
.product-name { min-width: 0; display: grid; gap: .17em; }
.product-name strong {
  color: var(--white);
  font-size: clamp(13px, 1.35vw, 29px);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.product-weight { color: var(--gold); font-size: clamp(11px, .99vw, 22px); }
.product-price { text-align: left; }
.product-price .amount { font-size: clamp(14px, 1.6vw, 35px); }
.product-stock { font-size: clamp(10px, .92vw, 19px); color: var(--muted); }
.product-stock.stock-out { color: var(--warning); }
.product-stock.stock-in { color: #a9d8b6; }
.price-board[data-density="large"] .amount { font-size: clamp(18px, 2.5vw, 50px); }
.price-board[data-density="large"] .quote-row dt,
.price-board[data-density="large"] .product-name strong { font-size: clamp(15px, 1.65vw, 36px); }
.price-board[data-density="large"] .coin-detail .amount { font-size: clamp(17px, 1.9vw, 39px); }
.board-footer {
  margin-block-start: auto;
  order: 3;
  gap: .5em 1.4em;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: clamp(11px, .95vw, 20px);
}
.board-footer [data-connection] { color: var(--warning); }
.slide-controls { display: flex; align-items: center; gap: .6em; }

@media (min-width: 850px) {
  #overview .market-list { min-height: min(35vh, 460px); }
  #world .market-list { align-self: start; }
}

@media (min-width: 850px) and (min-aspect-ratio: 4/3) {
  .price-board {
    min-height: 100vh;
    padding-block: clamp(12px, 3vh, 55px) clamp(10px, 2vh, 40px);
    gap: clamp(8px, 2.15vh, 35px);
  }
  .identity img { width: clamp(48px, 9vh, 160px); }
  .gold-values { margin-block: .5em .4em; }
  #overview .quote-row { min-height: clamp(47px, 8.3vh, 150px); }
  #world .quote-row { min-height: clamp(39px, 5vh, 96px); }
  .coin-detail .amount, #world .amount { font-size: clamp(15px, 2.5vh, 44px); }
  .coin-detail th, .coin-detail td { padding-block: clamp(4px, .48vh, 9px); }
  #world .quote-meta, .coin-detail .quote-meta { font-size: clamp(9px, 1.35vh, 22px); }
}

@media (max-width: 720px) {
  .gold-grid, .two-columns, .product-grid, .vintage-grid { grid-template-columns: minmax(0, 1fr); }
  .board-tabs { flex-wrap: wrap; }
  .board-footer { justify-content: start; }
}
@media (max-width: 400px) {
  .board-tabs button, .slide-controls button { padding-inline: .65em; }
}
.price-board[data-touch="true"] button { min-height: 3rem; min-width: 3rem; }
.insight-view {
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: clamp(12px, 1.6vw, 30px);
  background: var(--background);
}
.insight-view h2 {
  color: var(--gold);
  font-size: clamp(19px, 2vw, 38px);
  margin: 0 0 .6em;
}
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 20px);
}
.insight-card {
  min-width: 0;
  padding: .72em;
  border: 1px solid var(--edge);
  border-radius: 11px;
}
.insight-card h3, .insight-news h3 {
  margin: 0;
  font-size: clamp(15px, 1.45vw, 30px);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.insight-value, .insight-change {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .24em .55em;
}
.insight-value { margin-block: .35em; }
.insight-value strong { font-size: clamp(20px, 2.24vw, 43px); }
.insight-value span, .insight-muted, .insight-news small { color: var(--muted); font-size: clamp(11px, 1.15vw, 21px); }
.insight-up { color: #a9e6bd; }
.insight-down { color: #ffc3b0; }
.insight-flat { color: var(--muted); }
.insight-card p, .insight-note { margin: .5em 0 0; font-size: clamp(12px, 1.2vw, 23px); }
.insight-note { padding-block-start: .5em; color: var(--muted); }
.insight-news { margin: .45em 0 0; padding: 0; list-style: none; }
.insight-news li { padding-block: .53em; border-block-start: 1px solid var(--edge); }
.insight-news h3 { margin-block-start: .15em; }
@media (max-width: 720px) {
  .insight-grid { grid-template-columns: minmax(0, 1fr); }
}

.public-prices {
  width: min(100%, 1140px);
  padding: clamp(16px, 3.6vw, 38px);
  gap: 20px;
}
.public-prices .board-header { gap: 12px; padding-bottom: 14px; }
.public-prices h1 { margin: 0; font-size: clamp(24px, 3.3vw, 38px); }
.public-home, .price-tv-link { display: inline-flex; align-items: center; gap: .65em; color: var(--white); text-decoration: none; }
.public-home { font-weight: 700; }
.public-home img { width: 42px; height: 42px; object-fit: contain; }
.price-tv-link { border: 1px solid var(--edge); border-radius: 8px; padding: .6em .8em; white-space: nowrap; color: var(--gold); }
.price-tv-link:hover { background: var(--panel); }
.public-home:focus-visible, .price-tv-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.public-prices .gold-card { border-radius: 14px; }
.public-prices .gold-values strong { font-size: clamp(20px, 4.3vw, 34px); }
.public-quote-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.public-quote-grid .market-list { border-radius: 12px; }
.public-quote-grid .panel-title h2 { font-size: 20px; }
.public-quote-grid .quote-row dt { font-size: 14px; }
.public-quote-grid .amount { font-size: clamp(16px, 2vw, 23px); }
.public-quote-grid .melted-prices .amount { font-size: 16px; }
.public-quote-grid .quote-meta { font-size: 11px; }
@media (max-width: 850px) {
  .public-quote-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .public-quote-grid { grid-template-columns: minmax(0, 1fr); }
  .public-prices .board-header { font-size: 13px; }
}
