:root {
  --ratio-bg: #f3f6f9;
  --ratio-text: #0f172a;
  --ratio-muted: #64748b;
  --ratio-line: #e2e8f0;
  --ratio-main: #0f766e;
  --ratio-deep: #172033;
  --ratio-red: #dc2626;
  --ratio-card: #ffffff;
  --ratio-shadow: 0 8px 18px rgba(15, 23, 42, .07);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--ratio-text);
  background: #dfe6ee;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.ratio-app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--ratio-bg);
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 0 36px rgba(15, 23, 42, .18);
}

.ratio-header {
  min-height: 92px;
  padding: 14px 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #0f766e 0%, #155e75 54%, #172033 100%);
  color: #fff;
}

.ratio-back {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .2);
}

.ratio-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ratio-title {
  min-width: 0;
}

.ratio-title h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 900;
}

.ratio-title p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, .84);
  font-size: 13px;
  line-height: 1.35;
}

.ratio-content {
  padding: 5px 5px 0;
}

.ratio-filter-grid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 6px;
}

.ratio-filter-card {
  min-width: 0;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid rgba(15, 118, 110, .18);
  text-align: left;
  position: relative;
}

.ratio-filter-card::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border: solid var(--ratio-main);
  border-width: 0 2px 2px 0;
  transform: translateY(-50%) rotate(-45deg);
  opacity: .65;
}

.ratio-filter-card span {
  display: block;
  color: #0f766e;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
}

.ratio-filter-card strong {
  display: -webkit-box;
  margin-top: 7px;
  padding-right: 12px;
  color: #334155;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 760;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ratio-quick-summary {
  margin-top: 8px;
  min-height: 36px;
  padding: 7px 8px 7px 11px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(15, 118, 110, .07);
  border: 1px solid rgba(15, 118, 110, .12);
  color: #475569;
  font-size: 12px;
  font-weight: 760;
}

.ratio-quick-summary span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ratio-refresh {
  flex: 0 0 auto;
  min-width: 50px;
  height: 26px;
  border-radius: 999px;
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid rgba(15, 118, 110, .18);
  font-size: 12px;
  font-weight: 850;
}

.ratio-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.ratio-card {
  padding: 11px;
  border-radius: 11px;
  background: var(--ratio-card);
  border: 1px solid rgba(15, 23, 42, .06);
  box-shadow: var(--ratio-shadow);
}

.ratio-card-head {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.ratio-league-mark {
  width: 10px;
  height: 34px;
  border-radius: 999px;
}

.ratio-card-title {
  min-width: 0;
}

.ratio-card-title h2 {
  margin: 0;
  color: #0f172a;
  font-size: 17px;
  line-height: 1.12;
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ratio-card-title p {
  margin: 4px 0 0;
  color: var(--ratio-muted);
  font-size: 12px;
}

.ratio-main-tag {
  max-width: 112px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  background: #fff1f2;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.ratio-insight {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 9px;
  color: #475569;
  background: #f8fafc;
  font-size: 13px;
  line-height: 1.55;
}

.ratio-bars {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.ratio-bar-row {
  display: grid;
  gap: 7px;
}

.ratio-bar-title {
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.ratio-stack {
  height: 10px;
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.ratio-stack i {
  min-width: 0;
}

.ratio-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 9px;
}

.ratio-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 780;
}

.ratio-legend em {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.ratio-legend strong {
  color: #334155;
}

.ratio-detail {
  margin-top: 10px;
  border-top: 1px solid #edf2f7;
}

.ratio-detail summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  color: #0f766e;
  font-size: 13px;
  font-weight: 850;
}

.ratio-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.ratio-detail-grid span {
  min-height: 48px;
  padding: 8px 7px;
  border-radius: 9px;
  display: grid;
  gap: 4px;
  background: #f8fafc;
}

.ratio-detail-grid b {
  color: #64748b;
  font-size: 11px;
}

.ratio-detail-grid strong {
  color: #0f172a;
  font-size: 14px;
}

.ratio-empty {
  min-height: 190px;
  margin-top: 8px;
  border-radius: 12px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  background: #fff;
  border: 1px dashed #cbd5e1;
  color: #64748b;
}

.ratio-empty strong {
  color: #0f172a;
  font-size: 18px;
}

.ratio-loading {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 120;
  transform: translate(-50%, -50%);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, .82);
  font-size: 13px;
  font-weight: 800;
}

.ratio-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, .48);
}

.ratio-sheet-mask[hidden],
.ratio-loading[hidden],
.ratio-empty[hidden] {
  display: none !important;
}

.ratio-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 91;
  width: min(430px, 100%);
  max-height: 78vh;
  transform: translate(-50%, 100%);
  display: flex;
  flex-direction: column;
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: 0 -18px 38px rgba(15, 23, 42, .18);
  transition: transform .22s ease;
}

.ratio-sheet.show {
  transform: translate(-50%, 0);
}

.ratio-sheet-head {
  padding: 15px 16px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--ratio-line);
}

.ratio-sheet-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
}

.ratio-sheet-head p {
  margin: 4px 0 0;
  color: var(--ratio-muted);
  font-size: 12px;
}

.ratio-sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #64748b;
  background: #f1f5f9;
  font-size: 22px;
}

.ratio-sheet-body {
  padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow: auto;
}

.ratio-search {
  margin-bottom: 10px;
}

.ratio-search input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #dbe3ee;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
}

.ratio-chip-group,
.ratio-letter-index {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ratio-letter-index {
  margin: 12px 0 8px;
}

.ratio-letter-index button,
.ratio-chip {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 780;
}

.ratio-chip.active {
  color: #fff;
  background: var(--ratio-main);
  border-color: var(--ratio-main);
}

.ratio-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.ratio-letter-title {
  margin: 14px 0 8px;
  color: var(--ratio-muted);
  font-size: 12px;
  font-weight: 900;
}

.ratio-sheet-empty {
  padding: 30px 12px;
  color: #64748b;
  text-align: center;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .ratio-sheet {
    transition: none;
  }
}
