:root {
  color-scheme: light;
  --ink: #182420;
  --muted: #6f7b77;
  --line: #dce5e7;
  --paper: #f3f6f7;
  --white: #ffffff;
  --teal: #009897;
  --teal-dark: #006c69;
  --up: #ee4f54;
  --down: #169779;
  --warn: #c58a25;
  --sans: "Avenir Next", "DIN Alternate", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-family: var(--sans);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 4%, rgba(0, 152, 151, 0.055), transparent 24rem),
    linear-gradient(180deg, #f7f9f9 0, var(--paper) 100%);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(0, 152, 151, 0.26);
  outline-offset: 3px;
}

.page-glow {
  position: fixed;
  z-index: 0;
  top: -18vw;
  right: -12vw;
  width: 48vw;
  height: 48vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(60, 210, 201, 0.09), transparent 67%);
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1360px, calc(100% - 64px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

.topbar,
.brand,
.market-status,
.status-copy,
.updated-copy,
.hero-topline,
.hero-label,
.hero-price-line,
.hero-change,
.section-heading,
.section-heading > div,
footer > div {
  display: flex;
  align-items: center;
}

.topbar {
  min-height: 58px;
  justify-content: space-between;
}

.brand {
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  margin-right: 13px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 7px 18px rgba(22, 60, 56, 0.14);
}

.brand > span,
.updated-copy {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.market-status {
  gap: 18px;
}

.status-copy {
  gap: 10px;
  font-size: 13px;
}

.status-beacon {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8e9a96;
}

.status-beacon::after {
  position: absolute;
  inset: -5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0.18;
}

.status-beacon.is-live {
  color: #2aa77e;
  background: #2aa77e;
}

.status-beacon.is-loading,
.status-beacon.is-warning {
  color: var(--warn);
  background: var(--warn);
}

.status-beacon.is-stale {
  color: #c65f55;
  background: #c65f55;
}

.status-divider {
  width: 1px;
  height: 28px;
  background: #d8dfdd;
}

.updated-copy {
  align-items: flex-end;
  line-height: 1.2;
}

.updated-copy small {
  color: var(--muted);
  font-size: 10px;
}

.updated-copy b {
  margin-top: 3px;
  font-size: 13px;
}

.refresh-button {
  display: flex;
  min-width: 94px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: #176f5a;
  border: 1px solid #cbd8d4;
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  gap: 7px;
  transition: background 160ms ease, transform 160ms ease;
}

.refresh-button:hover {
  background: #fff;
  transform: translateY(-1px);
}

.refresh-button span {
  font-size: 19px;
  line-height: 1;
}

.refresh-button b {
  font-size: 12px;
}

.refresh-button.is-loading span {
  animation: spin 720ms linear infinite;
}

.notice-banner {
  margin-top: 18px;
  padding: 11px 16px;
  color: #765717;
  border: 1px solid #ead6a4;
  border-radius: 12px;
  background: #fff9e8;
  font-size: 11px;
}

.notice-banner strong {
  margin-right: 9px;
}

.loading-board {
  display: flex;
  min-height: 520px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-direction: column;
}

.radar-loader {
  position: relative;
  width: 82px;
  height: 82px;
  overflow: hidden;
  border: 1px solid rgba(0, 152, 151, 0.22);
  border-radius: 50%;
  background: rgba(0, 152, 151, 0.04);
}

.radar-loader span {
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(0, 152, 151, 0.25);
  border-radius: 50%;
}

.radar-loader i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 1px;
  background: var(--teal);
  transform-origin: left;
  animation: spin 1.2s linear infinite;
}

.loading-board strong {
  margin-top: 20px;
  color: var(--ink);
  font-size: 16px;
}

.loading-board p {
  margin: 7px 0 0;
  font-size: 11px;
}

.dashboard {
  display: grid;
  margin-top: 28px;
  grid-template-columns: minmax(460px, 0.98fr) minmax(560px, 1.12fr);
  grid-template-areas:
    "hero metals"
    "macro metals"
    "indices crypto";
  gap: 20px;
}

.hero-panel {
  position: relative;
  grid-area: hero;
  min-height: 378px;
  align-self: start;
  overflow: hidden;
  color: #fff;
  border-radius: 22px;
  background: linear-gradient(140deg, #006f6a 0%, #008d8d 58%, #00a6a8 100%);
  box-shadow: 0 18px 38px rgba(0, 99, 96, 0.18);
  animation: rise-in 420ms ease-out both;
}

.hero-topline,
.hero-main {
  position: relative;
  z-index: 2;
}

.hero-topline {
  justify-content: space-between;
  padding: 28px 30px 0;
}

.hero-label h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.03em;
}

.hero-label i {
  width: 19px;
  height: 3px;
  margin-left: 12px;
  border-radius: 3px;
  background: #f0bd3a;
}

.hero-source {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
}

.hero-source strong {
  color: #ffca3e;
  font-size: 14px;
}

.hero-source span {
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 10px;
}

.hero-main {
  padding: 54px 30px 34px;
}

.hero-price-line {
  align-items: baseline;
}

.hero-price-line strong {
  font-size: clamp(58px, 6.2vw, 88px);
  font-weight: 750;
  line-height: 0.94;
  letter-spacing: -0.045em;
}

.hero-price-line span {
  margin-left: 12px;
  font-size: 13px;
  font-weight: 700;
}

.hero-change {
  width: fit-content;
  min-height: 42px;
  margin-top: 26px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  gap: 8px;
  font-size: 13px;
}

.hero-change.is-up,
.hero-change.is-down,
.hero-change.is-flat {
  color: #fff;
}

.hero-change i {
  color: rgba(255, 255, 255, 0.55);
  font-style: normal;
}

.hero-metrics {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  min-height: 82px;
  color: var(--ink);
  background: #fff;
  grid-template-columns: repeat(4, 1fr);
}

.hero-metrics div {
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #e6eceb;
  flex-direction: column;
}

.hero-metrics div:first-child {
  border-left: 0;
}

.hero-metrics span {
  color: var(--muted);
  font-size: 10px;
}

.hero-metrics strong {
  margin-top: 7px;
  font-size: 14px;
}

.value-up {
  color: var(--up);
}

.value-down {
  color: var(--down);
}

.hero-radar {
  position: absolute;
  right: -42px;
  bottom: 26px;
  width: 270px;
  height: 270px;
  opacity: 0.5;
}

.radar-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ring-one {
  width: 80px;
  height: 80px;
}

.ring-two {
  width: 150px;
  height: 150px;
}

.ring-three {
  width: 230px;
  height: 230px;
}

.radar-sweep {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, #fff, transparent);
  box-shadow: 0 0 9px rgba(255, 255, 255, 0.7);
  transform: rotate(-42deg);
  transform-origin: left;
}

.radar-dot {
  position: absolute;
  top: 32%;
  left: 31%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7fffe3;
  box-shadow: 0 0 12px 4px rgba(127, 255, 227, 0.72);
}

.market-sections {
  display: contents;
}

.market-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 9px 23px rgba(31, 58, 53, 0.055);
  animation: rise-in 420ms ease-out both;
}

.section-metals {
  grid-area: metals;
}

.section-macro {
  grid-area: macro;
  animation-delay: 60ms;
}

.section-indices {
  grid-area: indices;
  animation-delay: 120ms;
}

.section-crypto {
  grid-area: crypto;
  animation-delay: 90ms;
}

.section-heading {
  min-height: 54px;
  padding: 0 20px;
  justify-content: space-between;
  border-bottom: 1px solid #e9eeee;
}

.section-heading i {
  width: 5px;
  height: 22px;
  margin-right: 12px;
  border-radius: 4px;
  background: var(--teal);
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
}

.section-heading > span {
  color: var(--muted);
  font-size: 11px;
}

.column-heading,
.quote-main {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(170px, 1.45fr) minmax(100px, 0.75fr) 68px 86px;
}

.column-heading {
  min-height: 38px;
  padding: 0 20px;
  color: var(--muted);
  border-bottom: 1px solid #edf1f0;
  font-size: 9px;
}

.column-heading span:nth-child(2),
.column-heading span:nth-child(4) {
  text-align: right;
}

.column-heading span:nth-child(3) {
  padding-left: 14px;
}

.quote-item {
  border-top: 1px solid #edf1f0;
}

.quote-item:first-child {
  border-top: 0;
}

.quote-main {
  width: 100%;
  min-height: 62px;
  padding: 7px 20px;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease;
}

.quote-main:hover {
  background: rgba(0, 152, 151, 0.026);
}

.quote-identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.quote-name-line {
  display: flex;
  min-width: 0;
  align-items: center;
}

.quote-name-line strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-name-line i {
  margin-left: 7px;
  padding: 2px 5px;
  color: #a86c12;
  border: 1px solid #e8bf77;
  border-radius: 4px;
  background: #fffaf0;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.quote-identity small {
  margin-top: 4px;
  color: #78827f;
  font-family: "DIN Condensed", var(--sans);
  font-size: 9px;
}

.quote-price {
  font-size: 14px;
  text-align: right;
}

.quote-unit {
  padding-left: 14px;
  color: var(--muted);
  font-size: 9px;
}

.change-pill {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  justify-self: end;
  padding: 0 9px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  font-weight: 700;
  gap: 4px;
}

.is-up {
  color: var(--up);
}

.is-down {
  color: var(--down);
}

.is-flat {
  color: #74807b;
}

.quote-details {
  display: grid;
  padding: 14px 20px 16px;
  border-top: 1px dashed #dfe7e5;
  background: #f7faf9;
  grid-template-columns: repeat(4, 1fr);
  animation: reveal 180ms ease-out both;
}

.quote-details div {
  display: flex;
  flex-direction: column;
}

.quote-details span {
  color: var(--muted);
  font-size: 9px;
}

.quote-details strong {
  margin-top: 5px;
  font-size: 11px;
}

.quote-details p {
  margin: 12px 0 0;
  color: #7d8884;
  font-size: 9px;
  grid-column: 1 / -1;
}

footer {
  display: grid;
  margin-top: 26px;
  padding: 17px 6px 0;
  color: #78837f;
  border-top: 1px solid #d9e1df;
  grid-template-columns: 1.4fr 0.8fr 1.2fr;
  font-size: 10px;
}

footer > div:nth-child(3) {
  justify-content: flex-end;
  text-align: right;
}

footer button {
  justify-self: center;
  padding: 0;
  color: #6d7874;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.footer-icon {
  margin-right: 8px;
  color: #6e817b;
  font-size: 15px;
}

.notes-dialog {
  width: min(600px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 32px 90px rgba(20, 50, 46, 0.27);
}

.notes-dialog::backdrop {
  background: rgba(20, 36, 33, 0.42);
  backdrop-filter: blur(7px);
}

.notes-dialog form {
  padding: 30px;
}

.dialog-heading span {
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.dialog-heading h2 {
  margin: 6px 0 20px;
  font-size: 24px;
}

.notes-dialog p {
  margin: 11px 0;
  color: #5f6a66;
  font-size: 12px;
  line-height: 1.8;
}

.notes-dialog button {
  width: 100%;
  height: 44px;
  margin-top: 15px;
  color: #fff;
  border: 0;
  border-radius: 12px;
  background: var(--teal-dark);
  cursor: pointer;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  padding: 10px 18px;
  color: #fff;
  border-radius: 20px;
  background: rgba(24, 36, 32, 0.92);
  box-shadow: 0 12px 28px rgba(24, 36, 32, 0.2);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 170ms ease, transform 170ms ease;
}

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

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

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@media (min-width: 1181px) {
  .dashboard {
    grid-template-columns: minmax(460px, 0.93fr) minmax(650px, 1.27fr);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    width: min(820px, calc(100% - 40px));
  }

  .dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "metals"
      "macro"
      "indices"
      "crypto";
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: calc(100% - 24px);
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .brand img {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .brand strong {
    font-size: 19px;
  }

  .brand small {
    font-size: 9px;
  }

  .status-divider,
  .updated-copy,
  .refresh-button b {
    display: none;
  }

  .market-status {
    gap: 12px;
  }

  .status-copy b {
    max-width: 84px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .refresh-button {
    min-width: 38px;
    width: 38px;
    height: 38px;
    padding: 0;
  }

  .dashboard {
    margin-top: 18px;
  }

  .hero-panel {
    min-height: 340px;
    border-radius: 18px;
  }

  .hero-topline {
    padding: 22px 20px 0;
  }

  .hero-label h1 {
    font-size: 18px;
  }

  .hero-main {
    padding: 54px 20px 32px;
  }

  .hero-price-line strong {
    font-size: 58px;
  }

  .hero-radar {
    right: -105px;
  }

  .hero-metrics {
    min-height: 76px;
  }

  .hero-metrics strong {
    font-size: 12px;
  }

  .market-section {
    border-radius: 16px;
  }

  .column-heading,
  .quote-main {
    grid-template-columns: minmax(126px, 1.35fr) minmax(82px, 0.85fr) 72px;
  }

  .column-heading {
    padding: 0 13px;
  }

  .column-heading span:nth-child(3) {
    display: none;
  }

  .column-heading span:nth-child(4) {
    grid-column: 3;
  }

  .quote-main {
    min-height: 68px;
    padding: 8px 13px;
  }

  .quote-unit {
    display: none;
  }

  .quote-name-line strong {
    font-size: 12px;
  }

  .quote-price {
    font-size: 13px;
  }

  .change-pill {
    font-size: 9px;
  }

  footer {
    grid-template-columns: 1fr;
    gap: 12px;
    line-height: 1.6;
  }

  footer button {
    justify-self: start;
  }

  footer > div:nth-child(3) {
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 380px) {
  .brand small,
  .status-copy {
    display: none;
  }

  .hero-price-line strong {
    font-size: 50px;
  }

  .hero-source span {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

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