* { box-sizing: border-box; }

:root {
  --card-gap: 24px;
  --row-gap: 44px;
  --card-radius: 18px;
  --max-width: 1160px;
  --focus-scale: 1.075;
  --glass-blur: 24px;
  --dock-pad-y: 15px;
  --dock-pad-x: 16px;
  --dock-radius: 30px;
  --dock-bottom-space: 6vh;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: #fff;
  background: #101719;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "SF Pro Text", "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }

.scene {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  background: #15231f;
}

.backdrop {
  position: absolute;
  z-index: -3;
  inset: -2%;
  background-color: var(--page-bg, #15231f);
  background-image:
    radial-gradient(ellipse at 25% 25%, rgba(45, 113, 86, .42), transparent 38%),
    radial-gradient(ellipse at 76% 30%, rgba(28, 88, 73, .30), transparent 42%),
    linear-gradient(135deg, #172522, #101a1a 58%, #263b35);
  background-position: center;
  background-size: cover;
  transform: scale(1.025);
  filter: saturate(.94);
  transition: background-image .35s ease;
}

.backdrop-tint {
  position: absolute;
  z-index: -2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(5, 13, 12, var(--overlay-top, .12)) 0%,
    rgba(5, 13, 12, var(--overlay-mid, .19)) 48%,
    rgba(5, 13, 12, var(--overlay-bottom, .28)) 100%
  );
}

.site-scroller {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.site-scroller::-webkit-scrollbar { display: none; }

.site-content {
  width: min(var(--max-width), calc(100% - clamp(28px, 5vw, 88px)));
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--row-gap);
  padding-top: max(66vh, 330px);
  padding-bottom: 12vh;
}

.site-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: var(--card-gap);
  flex: 0 0 auto;
}

.site-row.featured-row {
  padding: var(--dock-pad-y) var(--dock-pad-x);
  border-radius: var(--dock-radius);
  background: rgba(239, 245, 241, .70);
  border: 1px solid rgba(255, 255, 255, .55);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, .18),
    inset 0 1px 0 rgba(255, 255, 255, .58);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.35);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.35);
}

/* 卡片比例：前一个数值是横向长度，后一个数值是纵向高度；1.62 表示横向明显更长。 */
.site-card {
  position: relative;
  display: flex;
  min-width: 0;
  width: 100%;
  aspect-ratio: 1.62 / 1;
  align-items: center;
  justify-content: center;
  overflow: visible;
  isolation: isolate;
  border-radius: var(--card-radius);
  background: var(--tile, #fff);
  color: #fff;
  text-decoration: none;
  outline: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
  transform: translateZ(0);
  transition:
    transform .22s cubic-bezier(.2, .8, .2, 1),
    box-shadow .22s ease,
    filter .22s ease;
}

.site-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255,255,255,.20), transparent 58%);
}

.site-card:hover,
.site-card:focus-visible {
  z-index: 5;
  transform: scale(var(--focus-scale));
  box-shadow: 0 15px 34px rgba(0,0,0,.32), 0 0 0 2px rgba(255,255,255,.92);
  filter: brightness(1.045);
}

.site-card:active { transform: scale(1.025); }

.site-card img {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: auto;
  max-width: 76%;
  max-height: 72%;
  object-fit: contain;
  pointer-events: none;
}

.site-card .fallback {
  position: relative;
  z-index: 1;
  max-width: 90%;
  color: var(--ink, #fff);
  font-size: clamp(26px, 3.1vw, 48px);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.site-card.kind-brand .fallback {
  font-size: clamp(15px, 1.7vw, 24px);
  letter-spacing: -.035em;
}

.site-card.kind-word .fallback {
  font-size: clamp(14px, 1.5vw, 21px);
  font-weight: 600;
}

.site-card.kind-symbol .fallback {
  font-size: clamp(34px, 4.3vw, 58px);
  font-weight: 400;
}

.site-card .label {
  position: absolute;
  z-index: 4;
  top: calc(100% + 9px);
  left: 50%;
  transform: translate(-50%, -3px);
  opacity: 0;
  color: rgba(255,255,255,.96);
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 2px 9px rgba(0,0,0,.85);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.site-card:hover .label,
.site-card:focus-visible .label {
  opacity: 1;
  transform: translate(-50%, 0);
}

.labels-always .site-card .label { opacity: 1; transform: translate(-50%, 0); }
.labels-never .site-card .label { display: none; }

.site-row.standard-row .site-card {
  aspect-ratio: 1.62 / 1;
  box-shadow: 0 8px 20px rgba(0,0,0,.22);
}

.search-hotspot {
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  width: clamp(92px, 12vw, 160px);
  height: clamp(76px, 12vh, 112px);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 18px 22px 0 0;
}

.search-trigger {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(15,22,22,.48);
  color: white;
  font-size: 29px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-5px);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}

.search-hotspot:hover .search-trigger,
.search-hotspot:focus-within .search-trigger {
  opacity: 1;
  transform: translateY(0);
}

.search-trigger:hover { background: rgba(15,22,22,.75); }

.search-panel {
  position: absolute;
  z-index: 30;
  top: clamp(62px, 9vh, 94px);
  right: clamp(18px, 4vw, 52px);
  width: min(440px, calc(100% - 36px));
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 17px;
  background: rgba(22,29,29,.82);
  box-shadow: 0 16px 42px rgba(0,0,0,.28);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.search-panel[hidden] { display: none; }
.search-symbol { color: #e8eeee; font-size: 27px; }
.search-panel input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  font-size: 17px;
}
.search-panel input::placeholder { color: rgba(255,255,255,.54); }
.search-panel button {
  border: 0;
  padding: 0 2px;
  background: none;
  color: #fff;
  font-size: 27px;
  cursor: pointer;
}

.toast {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 10px);
  padding: 10px 15px;
  border-radius: 11px;
  color: #fff;
  background: rgba(18,24,24,.82);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  :root { --card-gap: clamp(12px, 2.3vw, 22px); --row-gap: clamp(30px, 5vh, 42px); }
  .site-content { width: calc(100% - 34px); }
  .site-row.featured-row { padding: 12px; border-radius: 24px; }
  .site-card { border-radius: 15px; }
}

@media (max-width: 620px) {
  .site-content { width: calc(100% - 22px); padding-top: 62vh; }
  .site-row { gap: 9px; }
  .site-row.featured-row { padding: 8px; border-radius: 18px; }
  .site-card { aspect-ratio: 1.48 / 1; border-radius: 10px; }
  .site-row.standard-row .site-card { aspect-ratio: 1.48 / 1; }
  .site-card .fallback { font-size: clamp(18px, 4vw, 30px); }
  .site-card.kind-brand .fallback { font-size: clamp(10px, 2.2vw, 15px); }
  .site-card.kind-symbol .fallback { font-size: clamp(25px, 5vw, 38px); }
}

@media (max-height: 520px) and (orientation: landscape) {
  .site-content { padding-top: 60vh; padding-bottom: 9vh; }
  .site-row { gap: clamp(12px, 2vw, 24px); }
  .site-row.featured-row { padding: 9px 12px; }
  .site-card { aspect-ratio: 1.62 / 1; }
  .site-row.standard-row .site-card { aspect-ratio: 1.62 / 1; }
  .search-hotspot { height: 68px; padding-top: 10px; }
  .search-trigger { width: 36px; height: 36px; }
}

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