:root {
  color-scheme: dark;
  --bg: #081217;
  --bg-soft: #12222c;
  --panel: rgba(9, 17, 23, 0.7);
  --panel-strong: rgba(11, 22, 29, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6f3ea;
  --muted: #afbbb8;
  --gold: #e8c56d;
  --gold-deep: #9c7425;
  --silver: #d3dde0;
  --silver-deep: #7f8e95;
  --platinum: #bfd1d6;
  --platinum-deep: #6b848d;
  --danger: #ff9f92;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --content-width: min(1120px, calc(100vw - 2rem));
  --title-font: Georgia, "Times New Roman", serif;
  --body-font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--body-font);
  background:
    radial-gradient(
      circle at top left,
      rgba(232, 197, 109, 0.22),
      transparent 28%
    ),
    radial-gradient(
      circle at top right,
      rgba(191, 209, 214, 0.12),
      transparent 24%
    ),
    linear-gradient(135deg, #081217 0%, #0f1f27 50%, #081217 100%);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding-top: calc(28px + env(safe-area-inset-top, 0px));
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px);
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 90%);
}

.dashboard {
  position: relative;
  z-index: 1;
  width: var(--content-width);
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.hero-panel,
.rates-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel::before,
.rates-panel::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--radius-xl) - 1px);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.07),
    rgba(255, 255, 255, 0.01)
  );
  pointer-events: none;
}

.hero-surface,
.rates-panel {
  position: relative;
  z-index: 1;
}

.hero-surface {
  display: grid;
  gap: 20px;
  padding: clamp(28px, 6vw, 56px);
  min-height: 430px;
  background:
    radial-gradient(
      circle at right center,
      rgba(232, 197, 109, 0.24),
      transparent 30%
    ),
    linear-gradient(125deg, rgba(232, 197, 109, 0.14), transparent 40%),
    var(--panel);
}

.hero-copy {
  display: grid;
  gap: 18px;
  align-content: start;
}

.status-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(232, 197, 109, 0.65);
  animation: pulse 1.8s infinite;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero-title,
.panel-title {
  margin: 0;
  font-family: var(--title-font);
  font-weight: 700;
  line-height: 0.95;
}

.hero-title {
  max-width: 10ch;
  font-size: clamp(3rem, 9vw, 6.4rem);
}

.hero-subtitle,
.panel-note,
.footer-copy,
.card-time,
.price-caption {
  margin: 0;
  color: var(--muted);
}

.hero-subtitle {
  max-width: 58ch;
  font-size: 1.02rem;
  line-height: 1.7;
}

.hero-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 26px;
  border: 1px solid rgba(232, 197, 109, 0.16);
  border-radius: 26px;
  background: linear-gradient(
    135deg,
    rgba(232, 197, 109, 0.11),
    rgba(255, 255, 255, 0.02)
  );
}

.hero-price {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.gold-purity-label {
  margin: 0 0 8px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
}

.price-caption {
  margin-top: 10px;
}

.calculator-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(232, 197, 109, 0.14);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(
      circle at top left,
      rgba(232, 197, 109, 0.18),
      transparent 26%
    ),
    linear-gradient(145deg, rgba(18, 34, 44, 0.94), rgba(8, 18, 23, 0.96));
  box-shadow: var(--shadow);
}

.calculator-panel::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--radius-xl) - 1px);
  pointer-events: none;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.07),
    rgba(255, 255, 255, 0.01)
  );
}

.buy-calculator-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  padding: clamp(24px, 4vw, 34px);
}

.buy-calculator-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.buy-calculator-title {
  margin: 6px 0 0;
  font-family: var(--title-font);
  font-size: clamp(1.3rem, 3vw, 2rem);
}

.buy-calculator-note {
  max-width: 30ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.gram-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.gram-tab {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.gram-tab:hover,
.gram-tab:focus-visible,
.gram-tab.is-active {
  transform: translateY(-1px);
  background: linear-gradient(
    135deg,
    rgba(232, 197, 109, 0.18),
    rgba(255, 255, 255, 0.06)
  );
  border-color: rgba(232, 197, 109, 0.28);
  box-shadow: 0 10px 24px rgba(232, 197, 109, 0.12);
}

.gram-tab:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.custom-grams-field,
.making-range-field,
.making-input-field {
  display: grid;
  gap: 8px;
}

.custom-grams-field span,
.making-range-field span,
.making-input-field span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.custom-grams-field input,
.making-input-field input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.making-range-field input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.making-range-field small {
  color: var(--muted);
  font-size: 0.78rem;
}

.calculator-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.8fr);
  gap: 16px;
}

.calculator-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.calculator-breakdown div {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.calculator-breakdown span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.calculator-breakdown strong {
  font-size: 1rem;
  font-weight: 700;
}

.calculator-total-row {
  grid-column: 1 / -1;
  background: linear-gradient(
    135deg,
    rgba(232, 197, 109, 0.16),
    rgba(255, 255, 255, 0.05)
  ) !important;
  border-color: rgba(232, 197, 109, 0.18) !important;
  box-shadow: inset 0 1px 0 rgba(247, 226, 166, 0.16);
}

.hero-ornament {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.hero-ornament span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(232, 197, 109, 0.18),
    rgba(232, 197, 109, 0.85)
  );
}

.hero-ornament span:nth-child(1) {
  width: 92px;
}

.hero-ornament span:nth-child(2) {
  width: 64px;
}

.hero-ornament span:nth-child(3) {
  width: 124px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.meta-grid div {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.meta-grid dt {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.meta-grid dd {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 600;
}

.estimate-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(232, 197, 109, 0.16);
  background: linear-gradient(
    135deg,
    rgba(232, 197, 109, 0.09),
    rgba(255, 255, 255, 0.03)
  );
}

.estimate-card dt {
  margin: 0;
  color: var(--gold);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
}

.estimate-card .estimate-card-price {
  font-size: 1rem;
  font-weight: 700;
}

.estimate-card-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.estimate-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.estimate-breakdown div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.estimate-breakdown span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.estimate-breakdown strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.rates-panel {
  padding: clamp(24px, 5vw, 36px);
  background:
    radial-gradient(
      circle at bottom right,
      rgba(191, 209, 214, 0.1),
      transparent 28%
    ),
    var(--panel-strong);
}

.panel-head,
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.supporting-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.rate-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.03)
  );
}

.rate-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.08),
    transparent 45%
  );
}

.silver-card {
  box-shadow: inset 0 1px 0 rgba(211, 221, 224, 0.22);
}

.platinum-card {
  box-shadow: inset 0 1px 0 rgba(191, 209, 214, 0.22);
}

.card-label,
.card-rate {
  margin: 0;
}

.card-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
}

.card-rate {
  margin-top: 18px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
}

.card-time {
  margin-top: 14px;
}

.footer-bar {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.refresh-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 14px 22px;
  color: #101517;
  background: linear-gradient(135deg, var(--gold), #f7e2a6);
  font-weight: 700;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
  box-shadow: 0 16px 32px rgba(232, 197, 109, 0.22);
}

.install-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  border-radius: 999px;
  padding: 14px 22px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease;
}

.install-button:hover,
.install-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.install-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.refresh-button:hover,
.refresh-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(232, 197, 109, 0.3);
}

.refresh-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.refresh-button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.error-panel .hero-surface {
  min-height: 320px;
  background:
    radial-gradient(
      circle at right center,
      rgba(255, 159, 146, 0.18),
      transparent 30%
    ),
    var(--panel);
}

.error-pill .pulse-dot {
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 159, 146, 0.6);
}

.compact {
  padding-top: 0;
  border-top: 0;
}

.skeleton-panel {
  padding: clamp(24px, 5vw, 38px);
}

.skeleton-block,
.skeleton-line {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.skeleton-block::after,
.skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.16),
    transparent
  );
  animation: shimmer 1.8s infinite;
}

.skeleton-block {
  width: 150px;
  height: 40px;
}

.skeleton-line {
  height: 16px;
}

.skeleton-line.short {
  width: 32%;
}

.skeleton-line.medium {
  width: 62%;
}

.skeleton-line.long {
  width: 82%;
}

.skeleton-line.price {
  width: 46%;
  height: 62px;
  border-radius: 18px;
}

.skeleton-line.meta {
  width: 42%;
  height: 18px;
}

.meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 12px rgba(232, 197, 109, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(232, 197, 109, 0);
  }
}

@media (max-width: 900px) {
  .buy-calculator-head,
  .hero-price-row,
  .panel-head,
  .footer-bar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-title {
    max-width: 12ch;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px 0;
  }

  .dashboard {
    gap: 16px;
  }

  .footer-actions {
    width: 100%;
  }

  .install-button,
  .refresh-button {
    width: 100%;
    justify-content: center;
  }

  .supporting-grid,
  .calculator-controls,
  .calculator-breakdown,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .gram-tabs {
    border-radius: 24px;
  }

  .gram-tab {
    flex: 1 1 calc(50% - 10px);
    text-align: center;
  }

  .estimate-breakdown {
    grid-template-columns: 1fr;
  }

  .hero-price-row {
    padding: 22px;
  }

  .hero-ornament {
    justify-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
