:root {
  color-scheme: light;
  --wechat-green: #07c160;
  --wechat-green-pressed: #06ad56;
  --page: #ededed;
  --surface: #ffffff;
  --text: #191919;
  --secondary: #888888;
  --tertiary: #b2b2b2;
  --line: #e5e5e5;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.page-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--page);
}

.brand-bar {
  display: flex;
  min-height: calc(56px + env(safe-area-inset-top));
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 0;
  border-bottom: .5px solid var(--line);
  background: rgba(255, 255, 255, .96);
  color: var(--text);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-icon-frame {
  display: grid;
  width: 42px;
  height: 42px;
  overflow: hidden;
  place-items: center;
  object-fit: cover;
  border: .5px solid rgba(0, 0, 0, .06);
  border-radius: 10px;
  background: #fff;
}

.brand-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.24);
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 16px;
  font-weight: 600;
}

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

.live-mark {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--secondary);
  font-size: 12px;
}

.live-mark i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wechat-green);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.language-toggle {
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  border: .5px solid #d8d8d8;
  border-radius: 6px;
  background: #f7f7f7;
  color: #576b95;
  font-size: 11px;
  font-weight: 500;
}

.language-toggle:active {
  background: #ececec;
}

main {
  padding-bottom: 34px;
}

.hero {
  padding: 25px 16px 13px;
}

.hero h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.35;
}

.hero-note {
  margin: 5px 0 0;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.6;
}

.converter-card {
  margin: 0 12px;
  padding: 18px 16px 15px;
  border-radius: 10px;
  background: var(--surface);
}

.card-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--secondary);
  font-size: 12px;
}

.card-label-row label {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.amount-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  border-bottom: .5px solid var(--line);
}

.amount-symbol {
  margin-right: 7px;
  color: var(--text);
  font-size: 28px;
  font-weight: 500;
}

#amount {
  width: 100%;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 38px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  line-height: 1;
}

.currency-select-wrap {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 8px 8px 8px 10px;
  border: .5px solid rgba(7, 193, 96, .22);
  border-radius: 7px;
  background: rgba(7, 193, 96, .08);
  color: var(--wechat-green);
}

.currency-select-wrap select {
  appearance: none;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 600;
}

.currency-select-wrap svg {
  width: 16px;
  height: 16px;
  margin-left: 3px;
}

.data-note {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 18px;
  margin-top: 12px;
  color: var(--secondary);
  font-size: 11px;
}

.note-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #f0ad4e;
}

.data-note.is-ready .note-dot {
  background: var(--wechat-green);
}

.data-note.is-stale .note-dot,
.data-note.is-error .note-dot {
  background: #fa5151;
}

.rate-section {
  padding-top: 29px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
}

.section-heading h2 {
  margin: 0;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 400;
}

.result-count {
  color: var(--tertiary);
  font-size: 12px;
}

.search-field {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  height: 38px;
  margin: 0 12px 10px;
  padding: 0 11px;
  border-radius: 7px;
  background: var(--surface);
}

.search-field:focus-within {
  box-shadow: inset 0 0 0 .5px rgba(7, 193, 96, .55);
}

.search-field svg {
  width: 17px;
  color: var(--secondary);
}

.search-field input {
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.search-field input::placeholder {
  color: var(--tertiary);
}

#clear-search {
  display: none;
  width: 19px;
  height: 19px;
  padding: 0 0 1px;
  border: 0;
  border-radius: 50%;
  background: #c6c6c6;
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

#clear-search.is-visible {
  display: block;
}

.rate-list {
  overflow: hidden;
  background: var(--surface);
}

.rate-row {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 13px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 68px;
  padding: 10px 12px 10px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.rate-row::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 68px;
  height: .5px;
  background: var(--line);
  content: "";
}

.rate-row:last-child::after {
  display: none;
}

.rate-row:active {
  background: #ececec;
}

.currency-stamp {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #f2f2f2;
  color: #666;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
}

.currency-copy,
.rate-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.currency-copy strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.currency-copy small,
.rate-copy small {
  overflow: hidden;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.currency-copy b {
  margin-right: 6px;
  color: var(--wechat-green);
  font-weight: 500;
}

.rate-copy {
  max-width: 142px;
  text-align: right;
}

.rate-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-arrow {
  width: 13px;
  color: var(--tertiary);
}

.rate-row.is-base {
  background: rgba(7, 193, 96, .045);
}

.rate-row.is-base .currency-stamp {
  background: var(--wechat-green);
  color: #fff;
}

.rate-row.is-base .row-arrow {
  visibility: hidden;
}

.empty-state,
.error-state {
  margin: 0 12px;
  padding: 44px 20px;
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}

.empty-state > span,
.error-state > span {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 13px;
  place-items: center;
  border-radius: 50%;
  background: #f2f2f2;
  color: var(--secondary);
  font-size: 21px;
}

.empty-state strong,
.error-state strong {
  font-size: 15px;
  font-weight: 500;
}

.empty-state p,
.error-state p {
  margin: 6px 0 0;
  color: var(--secondary);
  font-size: 12px;
}

#retry-button {
  min-width: 110px;
  margin-top: 18px;
  padding: 10px 18px;
  border: 0;
  border-radius: 5px;
  background: var(--wechat-green);
  color: #fff;
  font-size: 14px;
}

#retry-button:active {
  background: var(--wechat-green-pressed);
}

.skeleton-row {
  display: grid;
  grid-template-columns: 42px 1fr 88px;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 10px 12px 10px 16px;
  border-bottom: .5px solid var(--line);
}

.skeleton-row:last-child {
  border-bottom: 0;
}

.skeleton-row span {
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(90deg, #f0f0f0 25%, #f7f7f7 45%, #f0f0f0 65%);
  background-size: 240% 100%;
  animation: shimmer 1.2s infinite linear;
}

.skeleton-row span:first-child {
  height: 42px;
  border-radius: 8px;
}

.skeleton-row span:last-child {
  justify-self: end;
  width: 76px;
}

.seo-section {
  padding: 28px 12px 0;
}

.seo-section > h2 {
  margin: 0 4px 8px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 400;
}

.seo-card {
  padding: 15px 16px;
  border-radius: 10px;
  background: var(--surface);
}

.seo-card p {
  margin: 0;
  color: #666;
  font-size: 12px;
  line-height: 1.75;
}

.seo-card p + p {
  margin-top: 7px;
}

footer {
  display: grid;
  justify-items: center;
  padding: 36px 20px calc(28px + env(safe-area-inset-bottom));
  color: var(--tertiary);
  text-align: center;
}

footer img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  opacity: .76;
}

footer p {
  margin: 7px 0 4px;
  color: var(--secondary);
  font-size: 11px;
}

footer span {
  font-size: 9px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@keyframes shimmer {
  to { background-position-x: -240%; }
}

@media (min-width: 521px) {
  body {
    padding: 20px 0;
  }

  .page-shell {
    min-height: calc(100vh - 40px);
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 36px rgba(0, 0, 0, .08);
  }

  .brand-bar {
    padding-top: 0;
  }
}

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