:root {
  --bg: #eef3f1;
  --paper: #ffffff;
  --ink: #071426;
  --muted: #66707f;
  --line: #d9e2e7;
  --soft-blue: #dff3f8;
  --soft-mint: #eef9f6;
  --dark: #07182b;
  --dark-2: #14263a;
  --teal: #139d9a;
  --green: #0b8f55;
  --red: #c84242;
  --radius: 12px;
  --container: 1120px;
  --shadow-soft: 0 12px 28px rgba(7, 20, 38, .08);
  --shadow-card: 0 18px 42px rgba(7, 20, 38, .11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

main {
  padding-bottom: 64px;
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(var(--container), calc(100% - 32px));
  min-height: 68px;
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid rgba(7, 20, 38, .1);
  border-radius: 14px;
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.brand,
.main-nav,
.header-actions,
.hero-actions,
.mini-links,
.coin-title-row,
.panel-head {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo--icon { display: none; }
@media (max-width: 399px) {
  .brand-logo--full { display: none; }
  .brand-logo--icon { display: block; }
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #bdf3ee;
  font-size: 13px;
  font-weight: 900;
}

.cbr-mark {
  width: 76px;
  height: 76px;
  min-width: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: #f6fffb;
  color: var(--ink);
  font-size: 17px;
  letter-spacing: -.5px;
  box-shadow: 0 10px 20px rgba(7, 20, 38, .12);
}

.main-nav {
  justify-content: center;
  gap: clamp(12px, 2vw, 24px);
  flex: 1;
  font-size: 15px;
  font-weight: 760;
}

.main-nav a {
  position: relative;
  color: var(--dark-2);
  text-decoration: none;
  white-space: nowrap;
}

.main-nav a::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 3px;
  border-radius: 99px;
  background: var(--teal);
  content: "";
  opacity: 0;
  transform: scaleX(.55);
  transition: .18s ease;
}

.main-nav a:hover::after,
.main-nav a.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.header-actions,
.hero-actions {
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 780;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-dark {
  background: var(--dark);
  color: #fff;
  box-shadow: 0 8px 18px rgba(7, 20, 38, .18);
}

.button-ghost {
  border-color: rgba(7, 20, 38, .32);
  background: #fff;
}

.button-light {
  border-color: rgba(7, 20, 38, .18);
  background: rgba(255, 255, 255, .76);
}

.hero,
.coin-hero,
.rates-section,
.market-section,
.info-section,
.text-section,
.related-section,
.converter-section,
.coin-layout,
.cbr-section,
.cta-section {
  width: min(var(--container), calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .82fr);
  gap: clamp(22px, 4vw, 48px);
  min-height: 520px;
  margin-top: 18px;
  padding: clamp(34px, 5vw, 54px);
  overflow: hidden;
  border: 1px solid rgba(7, 20, 38, .08);
  border-radius: 20px;
  background: var(--soft-blue);
  box-shadow: var(--shadow-card);
}

.hero-copy {
  max-width: 650px;
  align-self: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(40px, 5vw, 70px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 520px;
  font-size: clamp(30px, 3.3vw, 46px);
  line-height: 1.08;
}

h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.hero-lead {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--dark-2);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.45;
}

.hero-actions {
  flex-wrap: wrap;
  margin-top: 28px;
}

.hero-side {
  display: grid;
  align-self: center;
  justify-self: end;
  width: min(360px, 100%);
  gap: 12px;
}

.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.hero-visual img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.hero-ticker {
  width: 100%;
  min-width: 0;
}

.coin-cloud {
  position: absolute;
  right: clamp(28px, 5vw, 58px);
  bottom: 30px;
  display: grid;
  grid-template-columns: repeat(4, 62px);
  gap: 12px;
}

.coin-token,
.rate-icon,
.table-coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background-color: transparent;
  background-position: center;
  background-size: cover;
  color: transparent;
  font-size: 0;
  text-indent: -999px;
  box-shadow: 0 10px 20px rgba(7, 20, 38, .16);
}

.coin-token {
  width: 62px;
  height: 62px;
}

.rate-icon {
  width: 62px;
  height: 62px;
  margin-bottom: 16px;
}

.table-coin {
  width: 34px;
  height: 34px;
}

.coin-xrp {
  background-image: url("../img/icon-xrp.svg");
}

.coin-btc {
  background-image: url("../img/icon-btc.svg");
}

.coin-eth {
  background-image: url("../img/icon-eth.svg");
}

.coin-doge {
  background-image: url("../img/icon-doge.svg");
}

.rates-section {
  padding: 70px 0 40px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(280px, .5fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.section-heading.compact {
  display: block;
}

.section-heading p:not(.eyebrow) {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.coin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.rate-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}

.rate-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}

.rate-card h3 {
  min-height: 48px;
}

.rate-price {
  margin: 12px 0 4px;
  font-size: 28px;
  font-weight: 880;
  line-height: 1.05;
}

.rate-change {
  margin: 0;
  font-weight: 820;
}

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

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

.sparkline {
  display: block;
  width: 100%;
  height: 54px;
  margin: 16px 0 18px;
  overflow: visible;
}

.sparkline path,
.large-chart path.line {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline path.area,
.large-chart path.area {
  stroke: none;
  opacity: .13;
}

.market-section,
.info-section,
.text-section,
.related-section,
.converter-section {
  padding: 46px 0;
}

.market-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.market-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.market-table th,
.market-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.market-table th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.market-table tr:last-child td {
  border-bottom: 0;
}

.market-table td:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 820;
}

.market-table a {
  color: var(--teal);
  font-weight: 820;
  text-decoration: none;
}

.cbr-section {
  padding: 46px 0;
}

.cbr-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.cbr-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(19, 157, 154, .18);
  border-radius: 999px;
  background: #fff;
  color: var(--dark-2);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.cbr-source::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(19, 157, 154, .14);
  content: "";
}

.cbr-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0 18px;
}

.cbr-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.cbr-card small,
.cbr-date,
.cbr-name {
  color: var(--muted);
}

.cbr-card small {
  display: block;
  margin-top: 2px;
  font-weight: 760;
}

.cbr-card strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1;
}

.cbr-card span:last-child {
  display: inline-block;
  margin-top: 10px;
  font-weight: 820;
}

.cbr-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.cbr-table td:first-child {
  display: table-cell;
}

.cbr-code,
.cbr-name {
  display: block;
}

.cbr-code {
  color: var(--ink);
  font-weight: 880;
}

.cbr-change {
  font-weight: 820;
}

.cbr-change.up,
.cbr-card span.up {
  color: var(--green);
}

.cbr-change.down,
.cbr-card span.down {
  color: var(--red);
}

.cbr-note {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.info-list {
  display: grid;
  gap: 14px;
}

.info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.info-card header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #3d4248;
  color: #fff;
}

.info-card p {
  max-width: 82ch;
  margin: 0;
  padding: 18px 20px 24px;
  color: #242c37;
  font-size: 17px;
  line-height: 1.58;
}

.cta-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 26px;
  margin-bottom: 0;
  padding: 30px;
  border: 1px solid rgba(7, 20, 38, .08);
  border-radius: var(--radius);
  background: var(--soft-blue);
  box-shadow: var(--shadow-soft);
}

.cta-section p:not(.eyebrow) {
  max-width: 660px;
  margin: 12px 0 0;
  color: var(--dark-2);
  font-size: 17px;
  line-height: 1.52;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
  color: var(--muted);
  font-size: 14px;
}

.footer-copy {
  display: grid;
  gap: 4px;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.footer-link {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(7, 20, 38, .18);
  border-radius: 8px;
  background: #fff;
  color: var(--dark-2);
  font: inherit;
  font-weight: 760;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.footer-link:hover {
  border-color: rgba(7, 20, 38, .34);
  box-shadow: 0 8px 18px rgba(7, 20, 38, .08);
  transform: translateY(-1px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 20, 38, .55);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(660px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 56px rgba(7, 20, 38, .3);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #dee2e6;
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}

.modal-close:hover {
  background: #f0f4f5;
  color: var(--ink);
}

.modal-body {
  overflow-y: auto;
  padding: 20px 24px;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid #dee2e6;
  flex-shrink: 0;
}

.modal-text {
  color: #2a3340;
  font-size: 15px;
  line-height: 1.65;
  text-align: left;
}

.modal-text h4 {
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.modal-text h4:first-child {
  margin-top: 0;
}

.modal-text p {
  margin: 0 0 10px;
}

.modal-text b {
  font-weight: 600;
}

.coin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: clamp(18px, 4vw, 36px);
  align-items: end;
  margin-top: 18px;
  padding: clamp(30px, 5vw, 52px);
  border: 1px solid rgba(7, 20, 38, .08);
  border-radius: 20px;
  background: var(--soft-blue);
  box-shadow: var(--shadow-card);
}

.coin-hero h1 {
  font-size: clamp(22px, 3.2vw, 42px);
}

.coin-title-row {
  gap: 18px;
}

.coin-title-row .coin-token {
  width: 76px;
  height: 76px;
}

.price-panel,
.chart-panel,
.stats-panel,
.text-section,
.related-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.price-panel {
  padding: 24px;
}

.price-panel span,
.price-panel em {
  display: block;
}

.price-panel span {
  color: var(--muted);
  font-weight: 760;
}

.price-panel strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1;
}

.price-panel [data-cbr-date] {
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.12;
}

.price-panel em {
  margin-top: 8px;
  font-style: normal;
}

.coin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
  gap: 18px;
  padding: 46px 0 0;
}

.chart-panel {
  min-width: 0;
  padding: 22px;
}

.bison-widget-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.bison-widget-panel > div {
  width: 100%;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head span {
  color: var(--muted);
  font-weight: 760;
}

.large-chart {
  display: block;
  width: 100%;
  min-height: 280px;
  color: var(--teal);
  border-radius: 10px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    #f8fbfb;
  background-size: 100% 25%, 20% 100%;
}

.large-chart .axis {
  stroke: rgba(7, 20, 38, .16);
  stroke-width: 1;
}

.large-chart .dot {
  fill: currentColor;
}

.stats-panel {
  padding: 22px;
}

.stats-panel dl {
  margin: 18px 0 0;
}

.stats-panel dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.stats-panel dl > div:last-child {
  border-bottom: 0;
}

.stats-panel dt {
  color: var(--muted);
}

.stats-panel dd {
  margin: 0;
  font-weight: 820;
  text-align: right;
}

.text-section,
.related-section,
.converter-section {
  max-width: 860px;
}

.text-section {
  margin-top: 18px;
  padding: 28px;
}

.text-section p {
  max-width: 72ch;
  margin: 16px 0 0;
  color: #2a3340;
  font-size: 18px;
  line-height: 1.62;
}

.related-section {
  margin-top: 18px;
  padding: 28px;
}

.converter-section {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: center;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft-blue);
  box-shadow: var(--shadow-soft);
}

body[data-page="coin"] .text-section,
body[data-page="coin"] .related-section,
body[data-page="coin"] .converter-section,
body[data-page="cbr"] .text-section,
body[data-page="home"] .text-section {
  max-width: none;
}

body[data-page="coin"] .coin-layout {
  padding-top: 18px;
}

.converter-copy p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.converter-widget {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.converter-field {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(7, 20, 38, .12);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(7, 20, 38, .08);
}

.converter-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 58px;
  padding: 0 12px;
  background: #ea1590;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  text-transform: uppercase;
}

.converter-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 760;
  line-height: 1;
  padding: 14px 12px;
  outline: none;
}

.converter-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--dark);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(7, 20, 38, .18);
}

.mini-links {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.mini-links a {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 760;
  text-decoration: none;
}

@media (max-width: 980px) {
  .site-header {
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
  }

  .main-nav {
    flex: 0 1 auto;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
    overflow: visible;
    padding-bottom: 0;
  }

  .header-actions {
    flex: 0 0 auto;
  }

  .hero,
  .coin-hero,
  .coin-layout,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 240px);
    grid-template-areas:
      "copy visual"
      "ticker ticker";
    align-items: center;
    min-height: auto;
    padding: clamp(28px, 4vw, 38px);
  }

  .hero-copy {
    grid-area: copy;
    align-self: center;
    max-width: none;
  }

  .hero-side {
    display: contents;
  }

  .hero-visual {
    grid-area: visual;
    justify-self: end;
    width: clamp(170px, 30vw, 240px);
    border-radius: 16px;
  }

  .hero-ticker {
    grid-area: ticker;
    justify-self: start;
    width: min(430px, 100%);
  }

  .coin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cbr-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .site-header {
    width: min(100% - 20px, var(--container));
    padding: 10px 12px;
  }

  .main-nav {
    gap: 8px;
    margin-left: 0;
  }

  .main-nav a[href="/xrp"],
  .main-nav a[href="/bitcoin"],
  .main-nav a[href="/ethereum"],
  .main-nav a[href="/dogecoin"] {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid rgba(7, 20, 38, .14);
    border-radius: 50%;
    background-color: #fff;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 30px 30px;
    box-shadow: 0 8px 16px rgba(7, 20, 38, .08);
    color: transparent;
    font-size: 0;
    overflow: hidden;
  }

  .main-nav a[href="/xrp"] {
    background-image: url("../img/icon-xrp.svg");
  }

  .main-nav a[href="/bitcoin"] {
    background-image: url("../img/icon-btc.svg");
  }

  .main-nav a[href="/ethereum"] {
    background-image: url("../img/icon-eth.svg");
  }

  .main-nav a[href="/dogecoin"] {
    background-image: url("../img/icon-doge.svg");
  }

  .main-nav a[href="/xrp"]::after,
  .main-nav a[href="/bitcoin"]::after,
  .main-nav a[href="/ethereum"]::after,
  .main-nav a[href="/dogecoin"]::after {
    display: none;
  }

  .main-nav a[href="/xrp"].is-active,
  .main-nav a[href="/bitcoin"].is-active,
  .main-nav a[href="/ethereum"].is-active,
  .main-nav a[href="/dogecoin"].is-active {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(19, 157, 154, .14), 0 8px 16px rgba(7, 20, 38, .08);
  }

  .main-nav a[href="/#rates"],
  .main-nav a[href="/cbr"] {
    padding: 8px 10px;
    border: 1px solid rgba(7, 20, 38, .12);
    border-radius: 999px;
    background: #fff;
  }

  .main-nav a[href="/#rates"]::after,
  .main-nav a[href="/cbr"]::after {
    display: none;
  }
}

@media (max-width: 640px) {
  main {
    padding-bottom: 42px;
  }

  .site-header {
    top: 8px;
    width: min(100% - 20px, var(--container));
    min-height: auto;
    margin-top: 8px;
    padding: 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .brand {
    font-size: 18px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .header-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
  }

  .header-actions .button {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .main-nav {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-top: 4px;
    padding-bottom: 2px;
    font-size: 14px;
  }

  .hero,
  .coin-hero,
  .rates-section,
  .market-section,
  .info-section,
  .text-section,
  .related-section,
  .converter-section,
  .coin-layout,
  .cbr-section,
  .cta-section,
  .site-footer {
    width: min(100% - 20px, var(--container));
  }

  .hero,
  .coin-hero {
    margin-top: 12px;
    padding: 24px;
    border-radius: 16px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 150px);
    grid-template-areas:
      "copy visual"
      "ticker ticker";
    gap: 16px;
  }

  h1 {
    font-size: 38px;
  }

  .hero h1 {
    font-size: clamp(28px, 6vw, 32px);
  }

  .hero-lead {
    font-size: 17px;
    margin-top: 16px;
  }

  .hero-actions {
    margin-top: 22px;
  }

  .hero-visual {
    align-self: start;
    width: min(150px, 32vw);
  }

  .hero-ticker {
    width: 100%;
  }

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

  .cbr-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .cbr-grid {
    grid-template-columns: 1fr;
  }

  .coin-cloud {
    grid-template-columns: repeat(4, 52px);
    gap: 8px;
    right: auto;
    left: 24px;
    bottom: 24px;
  }

  .coin-token {
    width: 52px;
    height: 52px;
  }

  .coin-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .coin-title-row .coin-token {
    width: 68px;
    height: 68px;
  }

  .rates-section,
  .market-section,
  .info-section,
  .text-section,
  .related-section,
  .cbr-section {
    padding-top: 34px;
    padding-bottom: 26px;
  }

  .chart-panel,
  .stats-panel,
  .text-section,
  .related-section,
  .converter-section,
  .cta-section {
    padding: 22px;
  }

  .converter-section {
    grid-template-columns: 1fr;
  }

  .converter-widget {
    grid-template-columns: 1fr;
  }

  .converter-swap {
    justify-self: center;
    transform: rotate(90deg);
  }

  .large-chart {
    min-height: 220px;
  }

  .cta-section,
  .site-footer,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .footer-link {
    flex: 1 1 190px;
  }

  .modal-dialog {
    padding: 32px 20px 22px;
  }

  .cta-section .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "visual"
      "ticker";
  }

  .hero-visual {
    justify-self: center;
    width: min(220px, 78%);
  }
}

/* ── text-section: отступы заголовков и стили списков ─────────────────── */
.text-section > h2 {
  margin-top: 44px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
  font-size: clamp(20px, 2.6vw, 28px);
}
.text-section > h2:first-child {
  margin-top: 0;
}
.text-section > h3 {
  margin-top: 28px;
  padding-left: 14px;
  border-left: 3px solid var(--teal);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.3;
  color: var(--ink);
}
.text-section > ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.text-section > ul li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--soft-mint);
  color: #2a3340;
  font-size: 17px;
  line-height: 1.45;
}
.text-section > ul li::before {
  content: "";
  display: inline-block;
  width: 7px;
  min-width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}

/* ── coin-facts strip ───────────────────────────────────────────────────── */
.coin-facts {
  width: min(var(--container), calc(100% - 32px));
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.coin-fact {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}
.coin-fact-label {
  display: block;
  margin-bottom: 10px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.coin-fact-value {
  display: block;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 880;
  line-height: 1.05;
  color: var(--ink);
}
.coin-fact-sub {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}
@media (max-width: 640px) {
  .coin-facts {
    width: min(100% - 20px, var(--container));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 420px) {
  .coin-facts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .brand span:last-child {
    display: none;
  }

  .header-actions .button {
    padding-right: 9px;
    padding-left: 9px;
  }

  .main-nav a[href="/#rates"] {
    min-height: 36px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .main-nav a[href="/cbr"] {
    min-height: 36px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

@media (max-width: 360px) {
  .site-header,
  .hero,
  .coin-hero,
  .rates-section,
  .market-section,
  .info-section,
  .text-section,
  .related-section,
  .converter-section,
  .coin-layout,
  .cbr-section,
  .cta-section,
  .site-footer {
    width: calc(100% - 16px);
  }

  .hero,
  .coin-hero {
    padding: 18px;
  }

  .hero h1 {
    font-size: 28px;
    line-height: 1.08;
  }

  .hero-lead {
    font-size: 15.5px;
  }

  .hero-actions .button {
    width: 100%;
  }

  .hero-visual {
    width: min(190px, 84%);
  }

  .chart-panel,
  .stats-panel,
  .text-section,
  .related-section,
  .converter-section,
  .cta-section {
    padding: 18px;
  }

  .converter-label {
    min-width: 50px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .converter-field input {
    padding: 12px 10px;
    font-size: 15px;
  }
}

@media (max-width: 320px) {
  .site-header {
    padding: 8px;
    gap: 5px;
    top: 6px;
    margin-top: 6px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .brand {
    font-size: 16px;
    gap: 7px;
  }

  .main-nav {
    gap: 5px;
  }

  .main-nav a[href="/xrp"],
  .main-nav a[href="/bitcoin"],
  .main-nav a[href="/ethereum"],
  .main-nav a[href="/dogecoin"] {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    background-size: 22px 22px;
  }

  .main-nav a[href="/cbr"] {
    padding: 5px 7px;
    font-size: 12px;
    min-height: 28px;
  }

  .header-actions .button {
    padding: 5px 8px;
    font-size: 12px;
    min-height: 28px;
  }

  .hero,
  .coin-hero {
    padding: 14px;
    border-radius: 12px;
    gap: 12px;
  }

  .hero h1 {
    font-size: 22px;
    line-height: 1.1;
  }

  .coin-hero h1 {
    font-size: 19px;
    line-height: 1.1;
  }

  .hero-lead {
    font-size: 14px;
    margin-top: 10px;
  }

  .hero-actions {
    margin-top: 14px;
    gap: 8px;
  }

  .hero-visual {
    width: min(170px, 80%);
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 17px;
  }

  .rate-price {
    font-size: 22px;
  }

  .price-panel {
    padding: 16px;
  }

  .price-panel strong {
    font-size: 26px;
  }

  .coin-title-row {
    gap: 10px;
  }

  .coin-title-row .coin-token {
    width: 48px;
    height: 48px;
  }

  .chart-panel,
  .stats-panel,
  .text-section,
  .related-section,
  .converter-section,
  .cta-section {
    padding: 14px;
  }

  .rates-section,
  .market-section,
  .info-section,
  .cbr-section {
    padding-top: 24px;
    padding-bottom: 18px;
  }

  .section-heading {
    margin-bottom: 18px;
  }

  .section-heading p:not(.eyebrow) {
    font-size: 15px;
  }

  .converter-label {
    min-width: 42px;
    padding: 0 7px;
    font-size: 11px;
  }

  .converter-field input {
    padding: 10px 8px;
    font-size: 14px;
  }

  .converter-swap {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .text-section p,
  .text-section > ul li {
    font-size: 15px;
  }

  .text-section > h2 {
    font-size: 18px;
    margin-top: 32px;
  }

  .text-section > h3 {
    font-size: 15px;
  }

  .cbr-card {
    padding: 14px;
  }

  .cbr-card strong {
    font-size: 24px;
    margin-top: 10px;
  }

  .cbr-topline {
    gap: 10px;
  }

  .stats-panel dl > div {
    padding: 10px 0;
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-panel dd {
    text-align: left;
  }

  .info-card p {
    padding: 14px 14px 18px;
    font-size: 15px;
  }

  .coin-fact {
    padding: 16px;
  }

  .coin-fact-value {
    font-size: 20px;
  }

  .site-footer {
    padding: 18px 0 24px;
  }

  .footer-link {
    flex: 1 1 130px;
    font-size: 13px;
    padding: 6px 10px;
    min-height: 34px;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-dialog {
    padding: 0;
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-footer {
    padding: 10px 14px;
  }

  .cbr-source {
    font-size: 12px;
    padding: 6px 10px;
  }
}
