:root {
  --rpx: min(0.6px, calc(100vw / 750));
  --bg: #071525;
  --ink: #e7f7f3;
  --muted: #7f9c98;
  --teal: #13b3a4;
  --ink-on: #042b29;
  --panel: #0a1a2c;
  --sheet: #0d2034;
  --chip: #123044;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

button, input { font-family: inherit; }

.page {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) calc(16 * var(--rpx)) 8px calc(28 * var(--rpx));
}

.titles { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.title {
  color: var(--ink);
  font-size: calc(34 * var(--rpx));
  font-weight: 650;
  line-height: 1.2;
}

.sub {
  color: var(--muted);
  font-size: calc(22 * var(--rpx));
  margin-top: calc(4 * var(--rpx));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sub-mouse { display: none; }

@media (hover: hover) and (pointer: fine) {
  .sub-touch { display: none; }
  .sub-mouse { display: inline; }
}

.actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: calc(10 * var(--rpx));
  margin-left: calc(12 * var(--rpx));
}

.lang {
  display: flex;
  background: var(--chip);
  border-radius: calc(28 * var(--rpx));
  overflow: hidden;
}

.lang button {
  border: 0;
  background: transparent;
  color: #d5ebe6;
  font-size: calc(22 * var(--rpx));
  font-weight: 650;
  line-height: 1.2;
  padding: calc(8 * var(--rpx)) calc(14 * var(--rpx));
  cursor: pointer;
}

.lang button.on {
  background: var(--teal);
  color: var(--ink-on);
}

.reset {
  flex-shrink: 0;
  color: var(--ink-on);
  background: var(--teal);
  font-size: calc(24 * var(--rpx));
  font-weight: 600;
  padding: calc(8 * var(--rpx)) calc(22 * var(--rpx));
  border: 0;
  border-radius: calc(28 * var(--rpx));
  cursor: pointer;
}

.cv {
  display: block;
  background: #071e3a;
  flex-shrink: 0;
  width: 100%;
  touch-action: none;
  cursor: default;
}

.cv.orbiting { cursor: grabbing; }
.cv.panning { cursor: all-scroll; }
.cv.picking { cursor: pointer; }

.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border-radius: calc(28 * var(--rpx)) calc(28 * var(--rpx)) 0 0;
  box-shadow: 0 calc(-10 * var(--rpx)) calc(28 * var(--rpx)) rgba(0, 0, 0, 0.28);
}

.grab {
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
  touch-action: none;
  cursor: ns-resize;
  user-select: none;
}

.grab.open { border-bottom: 1px solid #163246; }

.pill {
  width: calc(72 * var(--rpx));
  height: calc(8 * var(--rpx));
  border-radius: calc(8 * var(--rpx));
  background: #3d6270;
}

.grab-t {
  max-width: 86%;
  margin-top: calc(8 * var(--rpx));
  color: #c5e4de;
  font-size: calc(28 * var(--rpx));
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar { background: var(--panel); flex-shrink: 0; }

.filters {
  display: flex;
  padding: calc(10 * var(--rpx)) calc(16 * var(--rpx)) 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.seg {
  display: flex;
  background: var(--chip);
  border-radius: calc(12 * var(--rpx));
  overflow: hidden;
}

.seg.layer { margin-right: calc(12 * var(--rpx)); }
.seg.bone { margin-left: calc(12 * var(--rpx)); }
.filters.region { padding-top: calc(10 * var(--rpx)); }
.seg.region { flex: 1; }
.seg.region .seg-i { flex: 1; padding: calc(16 * var(--rpx)) 0; font-size: calc(32 * var(--rpx)); }
.seg.bone .seg-i { padding: calc(16 * var(--rpx)); }
.seg.freq { flex: 1; }
.seg.freq .seg-i { flex: 1; padding-left: 0; padding-right: 0; }

.seg-i {
  color: #d5ebe6;
  background: transparent;
  border: 0;
  font-size: calc(30 * var(--rpx));
  line-height: 1.3;
  padding: calc(16 * var(--rpx)) calc(8 * var(--rpx));
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.seg.layer .seg-i { padding: calc(16 * var(--rpx)) calc(18 * var(--rpx)); }

.seg-i.on {
  background: var(--teal);
  color: var(--ink-on);
  font-weight: 600;
}

.search {
  display: block;
  width: calc(100% - 40 * var(--rpx));
  height: calc(76 * var(--rpx));
  margin: calc(12 * var(--rpx)) calc(20 * var(--rpx)) 0;
  padding: 0 calc(24 * var(--rpx));
  border: 0;
  border-radius: calc(38 * var(--rpx));
  background: var(--chip);
  color: var(--ink);
  font-size: max(16px, calc(30 * var(--rpx)));
  outline: none;
}

.search::placeholder { color: #9fc4be; }

@media (min-width: 800px) {
  .filters { justify-content: flex-start; }
  .seg.freq,
  .seg.region { flex: 0 0 auto; }
  .seg.freq .seg-i,
  .seg.region .seg-i {
    flex: 0 0 auto;
    padding: calc(16 * var(--rpx)) calc(22 * var(--rpx));
  }
  .search,
  .sheet-body { max-width: 760px; }
  .pic { max-width: 480px; }
}

html[lang="en"] .seg.freq,
html[lang="en"] .seg.region { flex: 0 0 auto; }

html[lang="en"] .seg.freq .seg-i,
html[lang="en"] .seg.region .seg-i,
html[lang="en"] .seg.layer .seg-i {
  flex: 0 0 auto;
  padding-left: calc(14 * var(--rpx));
  padding-right: calc(14 * var(--rpx));
}

.chips {
  height: calc(104 * var(--rpx));
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--panel);
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

@media (hover: hover) and (pointer: fine) {
  .grab { cursor: pointer; }
  .chips,
  .filters {
    scrollbar-width: thin;
    scrollbar-color: #3d6270 transparent;
  }
  .chips::-webkit-scrollbar,
  .filters::-webkit-scrollbar {
    display: block;
    height: 8px;
  }
  .chips::-webkit-scrollbar-thumb,
  .filters::-webkit-scrollbar-thumb {
    background: #3d6270;
    border-radius: 8px;
  }
}

.chip-row {
  display: flex;
  align-items: center;
  height: calc(104 * var(--rpx));
  padding: 0 calc(16 * var(--rpx));
  width: max-content;
}

.chip {
  display: inline-block;
  margin-right: calc(12 * var(--rpx));
  padding: calc(12 * var(--rpx)) calc(24 * var(--rpx));
  border: 0;
  border-radius: calc(28 * var(--rpx));
  background: var(--chip);
  color: #e7f6f2;
  font-size: calc(34 * var(--rpx));
  cursor: pointer;
  white-space: nowrap;
}

.chip.textonly {
  background: transparent;
  border: 1px solid #3d6a64;
}

.chip.on {
  background: var(--teal);
  color: var(--ink-on);
  font-weight: 600;
  border-color: transparent;
}

.sheet {
  box-sizing: border-box;
  background: var(--sheet);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sheet-body {
  padding: calc(8 * var(--rpx)) calc(28 * var(--rpx)) calc(24 * var(--rpx));
}

.name { display: block; color: #fff; font-size: calc(40 * var(--rpx)); font-weight: 700; margin: 0; }
.latin { display: block; color: #8a8ab0; font-size: calc(24 * var(--rpx)); font-style: italic; margin: calc(4 * var(--rpx)) 0 calc(12 * var(--rpx)); }

.tags { display: flex; flex-wrap: wrap; margin-bottom: calc(12 * var(--rpx)); }
.tag { font-size: calc(22 * var(--rpx)); padding: calc(6 * var(--rpx)) calc(16 * var(--rpx)); border-radius: calc(16 * var(--rpx)); margin-right: calc(12 * var(--rpx)); }
.tag.z { background: #0d3b38; color: #6fe0d2; }
.tag.f { background: #7c2d12; color: #fdba74; }

.pic {
  width: 100%;
  height: calc(280 * var(--rpx));
  object-fit: contain;
  background: #f3eee5;
  border-radius: calc(12 * var(--rpx));
}

.credit { display: block; color: #6b6b8a; font-size: calc(20 * var(--rpx)); margin: calc(8 * var(--rpx)) 0; }

.h { display: block; margin: calc(16 * var(--rpx)) 0 0; color: #6fe0d2; font-size: calc(26 * var(--rpx)); font-weight: 600; }
.b { display: block; margin: calc(6 * var(--rpx)) 0 0; color: #d5e4e1; font-size: calc(26 * var(--rpx)); line-height: 1.6; }

.rel { margin-top: calc(18 * var(--rpx)); display: flex; flex-wrap: wrap; gap: calc(12 * var(--rpx)); }
.rel .chip { margin-right: 0; }

.hint { display: block; color: #d7ece8; font-size: calc(28 * var(--rpx)); line-height: 1.5; margin: 0; }
.miss { display: block; margin: calc(12 * var(--rpx)) 0 0; color: #8eaaaa; font-size: calc(24 * var(--rpx)); line-height: 1.5; }
.err { display: block; color: #fda4af; font-size: calc(26 * var(--rpx)); line-height: 1.5; margin: 0; }
.note {
  display: block;
  margin-top: calc(22 * var(--rpx));
  padding-top: calc(14 * var(--rpx));
  border-top: 1px solid #1c3346;
  color: #6b8a86;
  font-size: calc(22 * var(--rpx));
  line-height: 1.6;
}
.attr { display: block; margin-top: calc(16 * var(--rpx)); color: #5e7572; font-size: calc(20 * var(--rpx)); line-height: 1.5; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: 80vw;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.toast[hidden] { display: none; }

#safe-probe {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 0;
  height: env(safe-area-inset-bottom);
  pointer-events: none;
}
