.buy-section,
.buy-section h2 {
  text-align: center;
}

.buy-section {
  width: 100%;
  max-width: var(--visual-width);
  margin: 0 auto 44px;
}

.buy-page {
  min-height: 100vh;
  padding-top: 18px;
}

.buy-page-header {
  max-width: var(--visual-width);
}

.buy-page-header h1 {
  font-size: clamp(48px, 7vw, 64px);
  line-height: 1;
}

.buy-panel {
  max-width: 100%;
  border: 4px solid #5f5f5f;
  border-radius: 8px;
  background-color: var(--panel);
  color: var(--ink);
  font-family: 'Teko', Arial, sans-serif;
  padding: 18px;
}

.buy-converter,
.market-chart,
.chart-top,
#priceChart {
  min-width: 0;
  max-width: 100%;
}

.buy-panel p,
.buy-panel span,
.buy-panel label {
  color: var(--ink);
}

.conversion-row {
  display: grid;
  grid-template-columns: minmax(150px, 180px) 32px minmax(230px, 1fr) 96px;
  gap: 14px;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: var(--panel-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  padding: 16px;
}

.quote-field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 64px;
  border: 1px solid #a9a9a9;
  border-radius: 5px;
  background-color: var(--field);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 9px 12px;
}

.quote-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.usd-field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 0;
}

.usd-input-control {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  align-items: center;
  gap: 9px;
}

#usdInput,
#walletAddress {
  border: 1px solid #7a7a7a;
  border-radius: 4px;
  background-color: #ffffff;
  color: var(--ink);
  font-family: 'Teko', Arial, sans-serif;
  font-weight: 500;
  letter-spacing: inherit;
  line-height: 1;
}

#usdInput {
  width: 100%;
  min-height: 34px;
  font-size: 20px;
  padding: 2px 6px;
  text-align: right;
}

.currency-suffix {
  display: inline-block;
  color: #222222;
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.usd-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  accent-color: var(--blue);
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.usd-slider:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.usd-slider::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid #7a7a7a;
  border-radius: 999px;
  background: #d8d8d8;
}

.usd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background-color: var(--blue);
  appearance: none;
}

.usd-slider::-moz-range-track {
  height: 8px;
  border: 1px solid #7a7a7a;
  border-radius: 999px;
  background: #d8d8d8;
}

.usd-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background-color: var(--blue);
}

.conversion-equals {
  color: #4d4d4d;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.ind-result {
  min-width: 0;
  align-self: center;
  text-align: left;
}

.ind-result strong {
  display: block;
  color: #0b3510;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  overflow-wrap: anywhere;
  transition: color 180ms ease, transform 180ms ease;
}

.ind-result strong.price-better {
  color: #1d741f;
}

.ind-result strong.price-worse {
  color: var(--red);
}

.buy-button {
  min-width: 96px;
  min-height: 38px;
  border: 1px solid var(--blue);
  border-radius: 5px;
  background-color: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-family: 'Teko', Arial, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  margin: 0;
  padding: 2px 10px;
  text-align: center;
  text-transform: uppercase;
}

.buy-button:hover,
.buy-button:focus-visible {
  border-color: var(--blue-dark);
  background-color: var(--blue-dark);
}

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

.wallet-entry {
  grid-column: 1 / -1;
  margin: 0;
  border-top: 1px solid #b6b6b6;
  padding: 16px 0 0;
  text-align: left;
}

.wallet-entry label {
  display: block;
  margin-bottom: 11px;
  color: #333333;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

#walletAddress {
  width: min(100%, 430px);
  min-height: 42px;
  font-size: 22px;
  padding: 4px 8px;
}

#walletAddress::placeholder {
  color: #555555;
  font-size: inherit;
  opacity: 1;
}

#walletAddress:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.buy-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--ink);
  font-size: 20px;
  text-align: center;
}

.market-chart {
  margin-top: 24px;
}

.chart-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.chart-label,
.chart-status {
  margin: 0;
  color: var(--ink);
}

.chart-label {
  font-size: 26px;
  line-height: 1;
}

.chart-status {
  font-size: 18px;
  line-height: 1.15;
}

.range-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.range-tabs button {
  min-width: 44px;
  min-height: 34px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background-color: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-family: 'Teko', Arial, sans-serif;
  font-size: 20px;
  line-height: 1;
}

.range-tabs button.active {
  background-color: var(--ink);
  color: #ffffff;
}

#priceChart {
  display: block;
  width: 100%;
  height: var(--chart-height);
  margin-top: 16px;
  border-radius: 6px;
  background-color: var(--ink);
}

@media (min-width: 1600px) {
  .buy-panel {
    padding: 22px;
  }

  .conversion-row {
    grid-template-columns: minmax(170px, 210px) 38px minmax(280px, 1fr) 120px;
    gap: 18px;
    padding: 20px;
  }

  .quote-field {
    min-height: 76px;
    padding: 12px 16px;
  }

  .quote-label {
    font-size: 19px;
  }

  .currency-suffix {
    font-size: 27px;
  }

  #usdInput {
    width: 102px;
    min-height: 42px;
    font-size: 24px;
  }

  .usd-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -11px;
  }

  .usd-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  .conversion-equals,
  .ind-result strong {
    font-size: 36px;
  }

  .buy-button {
    min-height: 46px;
    font-size: 22px;
    padding: 2px 12px;
  }

  .wallet-entry label {
    font-size: 25px;
  }

  #walletAddress {
    width: min(100%, 500px);
    min-height: 48px;
    font-size: 26px;
    padding: 5px 10px;
  }

  .chart-label {
    font-size: 30px;
  }

  .chart-status {
    font-size: 21px;
  }
}

@media (min-width: 2400px) {
  .buy-panel {
    padding: 36px;
  }

  .conversion-row {
    grid-template-columns: minmax(320px, 380px) 64px minmax(520px, 1fr) 190px;
    gap: 32px;
    padding: 34px;
  }

  .quote-field {
    min-height: 116px;
    padding: 20px 28px;
  }

  .quote-label {
    font-size: 26px;
  }

  .currency-suffix {
    font-size: 42px;
  }

  #usdInput {
    width: 164px;
    min-height: 68px;
    font-size: 38px;
  }

  .usd-slider {
    height: 34px;
  }

  .usd-slider::-webkit-slider-runnable-track {
    height: 12px;
  }

  .usd-slider::-moz-range-track {
    height: 12px;
  }

  .usd-slider::-webkit-slider-thumb {
    width: 40px;
    height: 40px;
    margin-top: -15px;
  }

  .usd-slider::-moz-range-thumb {
    width: 40px;
    height: 40px;
  }

  .conversion-equals {
    font-size: 58px;
  }

  .ind-result strong {
    font-size: 56px;
  }

  .buy-button {
    min-height: 64px;
    font-size: 30px;
    padding: 4px 20px;
  }

  .wallet-entry {
    padding-top: 26px;
  }

  .wallet-entry label {
    margin-bottom: 14px;
    font-size: 38px;
  }

  #walletAddress {
    width: min(100%, 740px);
    min-height: 72px;
    font-size: 40px;
    padding: 7px 14px;
  }

  .chart-label {
    font-size: 46px;
  }

  .chart-status {
    font-size: 30px;
  }

  .range-tabs button {
    min-width: 68px;
    min-height: 52px;
    font-size: 30px;
  }
}

@media (max-width: 760px) {
  .buy-section {
    width: calc(100% + 18px);
    max-width: none;
    margin-right: -9px;
    margin-bottom: 58px;
    margin-left: -9px;
  }

  .buy-panel {
    overflow: hidden;
    padding: 18px 16px 20px;
  }

  .conversion-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "pay"
      "equals"
      "receive"
      "wallet"
      "buy";
    gap: 15px;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    padding: 18px 14px;
  }

  .quote-pay {
    grid-area: pay;
    text-align: center;
  }

  .quote-field {
    min-height: 88px;
    padding: 14px 16px;
  }

  .quote-label {
    margin-bottom: 12px;
    font-size: 20px;
  }

  .usd-field {
    justify-content: center;
    gap: 12px;
  }

  .currency-suffix {
    font-size: 29px;
  }

  .usd-input-control {
    grid-template-columns: 116px auto;
    justify-content: center;
    gap: 10px;
  }

  #usdInput {
    width: 116px;
    min-width: 0;
    max-width: none;
    min-height: 52px;
    font-size: 29px;
  }

  .usd-slider {
    height: 34px;
  }

  .usd-slider::-webkit-slider-runnable-track {
    height: 12px;
  }

  .usd-slider::-moz-range-track {
    height: 12px;
  }

  .usd-slider::-webkit-slider-thumb {
    width: 38px;
    height: 38px;
    margin-top: -14px;
  }

  .usd-slider::-moz-range-thumb {
    width: 38px;
    height: 38px;
  }

  .conversion-equals {
    grid-area: equals;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border: 1px solid #b8b8b8;
    border-radius: 50%;
    background-color: #d7d7d7;
    font-size: 32px;
  }

  .ind-result {
    grid-area: receive;
    text-align: center;
  }

  .ind-result strong {
    font-size: 35px;
    text-align: center;
  }

  .wallet-entry {
    grid-area: wallet;
    padding-top: 16px;
  }

  .wallet-entry label {
    margin-bottom: 9px;
    font-size: 23px;
  }

  #walletAddress {
    width: 100%;
    min-height: 50px;
    font-size: 22px;
    padding: 4px 8px;
  }

  #walletAddress::placeholder {
    font-size: 23px;
  }

  .buy-button {
    grid-area: buy;
    justify-self: center;
    width: min(190px, 100%);
    min-width: 0;
    min-height: 42px;
    font-size: 21px;
    padding: 2px 10px;
  }

  .chart-top {
    display: block;
  }

  .chart-label,
  .chart-status {
    text-align: center;
  }

  .chart-label {
    font-size: 32px;
  }

  .chart-status {
    font-size: 22px;
  }

  .range-tabs {
    justify-content: center;
    margin-top: 16px;
  }

  .range-tabs button {
    min-width: 48px;
    min-height: 42px;
    font-size: 24px;
  }
}

@media (max-width: 430px) {
  .buy-section {
    width: calc(100% + 14px);
    margin-right: -7px;
    margin-left: -7px;
  }

  .buy-panel {
    padding: 14px 8px;
  }

  .conversion-row {
    gap: 11px;
    padding: 14px 12px;
  }

  .quote-field {
    min-height: 82px;
    padding: 13px 14px;
  }

  .quote-label {
    font-size: 19px;
  }

  .currency-suffix {
    font-size: 27px;
  }

  .usd-input-control {
    grid-template-columns: 110px auto;
  }

  #usdInput {
    width: 110px;
    min-height: 50px;
    font-size: 27px;
  }

  .usd-slider::-webkit-slider-thumb {
    width: 36px;
    height: 36px;
    margin-top: -13px;
  }

  .usd-slider::-moz-range-thumb {
    width: 36px;
    height: 36px;
  }

  .conversion-equals {
    width: 42px;
    height: 42px;
    font-size: 30px;
  }

  .ind-result strong {
    font-size: 31px;
  }

  .wallet-entry label {
    font-size: 21px;
  }

  #walletAddress {
    min-height: 48px;
    font-size: 21px;
  }

  #walletAddress::placeholder {
    font-size: 22px;
  }

  .buy-button {
    width: min(170px, 100%);
    min-height: 40px;
    font-size: 20px;
    padding: 2px 8px;
  }

  .chart-label {
    font-size: 30px;
  }

  .chart-status {
    font-size: 20px;
  }

  .range-tabs button {
    min-width: 46px;
    min-height: 40px;
    font-size: 22px;
  }
}
