:root {
  color-scheme: dark;
  font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
}

/* Project-wide typography rule: text stays flat and shadow-free. */
*,
*::before,
*::after {
  text-shadow: none !important;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #8eba67;
}

body { overscroll-behavior: none; }

body::after {
  content: "";
  position: fixed;
  z-index: 9999;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, .001);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition: -webkit-backdrop-filter 1s ease-in-out, backdrop-filter 1s ease-in-out;
}

body.is-arriving::after,
body.is-leaving::after {
  pointer-events: auto;
  -webkit-backdrop-filter: blur(13px);
  backdrop-filter: blur(13px);
}

.fair-search-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: #8eba67;
}

.fair-search-stage.is-dragging { cursor: grabbing; }

.fair-search-stage:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .8);
  outline-offset: -3px;
}

.fair-search-image {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: block;
  max-width: none;
  max-height: none;
  opacity: 0;
  transform-origin: center;
  will-change: transform;
  transition: opacity .3s ease-out;
}

.fair-search-image.is-ready { opacity: 1; }

.fair-search-hit-layer {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
  transform-origin: center;
  will-change: transform;
}

.fair-search-pair-target {
  position: absolute;
  top: 38.94793%;
  left: 76.31579%;
  width: max(1.6%, 42px);
  height: max(4.5%, 50px);
  padding: 0;
  border: 0;
  outline: 0;
  opacity: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  -webkit-tap-highlight-color: transparent;
}

.fair-search-loading,
.fair-search-fallback {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: rgba(255, 255, 255, .95);
  background: #8eba67;
  text-align: center;
  letter-spacing: .08em;
}

.fair-search-loading { transition: opacity .22s ease-out; }
.fair-search-loading.is-hidden { opacity: 0; pointer-events: none; }
.fair-search-fallback[hidden] { display: none; }

.fair-search-caption {
  position: fixed;
  z-index: 48;
  isolation: isolate;
  top: 47%;
  right: clamp(34px, 7vw, 118px);
  max-width: min(72vw, 920px);
  padding: .36em .18em .44em .36em;
  border: 0;
  color: #1671b8;
  background: transparent;
  font-family: "Noto Sans TC", "Noto Sans HK", "Microsoft JhengHei", sans-serif;
  font-size: clamp(23px, 2.45vw, 40px);
  font-weight: 900;
  font-variation-settings: "wght" 900;
  line-height: 1.5;
  letter-spacing: .055em;
  text-align: right;
  -webkit-text-stroke: .008em currentColor;
  text-shadow:
    0 0 2px rgba(255, 255, 255, 1),
    0 0 .2em rgba(255, 255, 255, 1),
    0 0 .46em rgba(255, 255, 255, .92),
    0 0 .78em rgba(255, 255, 255, .66);
  white-space: nowrap;
  opacity: 0;
  cursor: default;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.fair-search-caption::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: -.28em -.38em;
  border-radius: 1em;
  background: linear-gradient(135deg, rgba(218, 224, 227, .44), rgba(152, 162, 168, .46));
  -webkit-backdrop-filter: blur(18px) saturate(.75) contrast(.78) brightness(1.12);
  backdrop-filter: blur(18px) saturate(.75) contrast(.78) brightness(1.12);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='b' x='-20%25' y='-30%25' width='140%25' height='160%25'%3E%3CfeGaussianBlur stdDeviation='3.5'/%3E%3C/filter%3E%3C/defs%3E%3Crect x='5' y='8' width='90' height='84' rx='12' fill='white' filter='url(%23b)'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='b' x='-20%25' y='-30%25' width='140%25' height='160%25'%3E%3CfeGaussianBlur stdDeviation='3.5'/%3E%3C/filter%3E%3C/defs%3E%3Crect x='5' y='8' width='90' height='84' rx='12' fill='white' filter='url(%23b)'/%3E%3C/svg%3E");
  mask-size: 100% 100%;
  mask-repeat: no-repeat;
  pointer-events: none;
}

.fair-search-caption.is-visible { opacity: 1; }

.fair-search-caption span {
  position: relative;
  z-index: 2;
  display: inline-block;
  opacity: 0;
  filter: blur(4px);
  transform: translateY(.22em);
  animation: fair-search-caption-character .72s cubic-bezier(.2, .72, .25, 1) forwards;
  animation-delay: calc(.35s + var(--character-index) * .12s);
}

.fair-search-caption .is-target-word { color: #df352f; }
.fair-search-caption .is-question-word { color: #1671b8; }

.fair-search-caption.is-ready {
  cursor: pointer;
  pointer-events: auto;
}

.fair-search-caption.is-dismissing {
  pointer-events: none;
  animation: fair-search-caption-dismiss .85s ease-in-out forwards;
}

.fair-search-caption:focus-visible {
  outline: 1px solid rgba(255, 255, 255, .68);
  outline-offset: .18em;
}

@keyframes fair-search-caption-character {
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes fair-search-caption-dismiss {
  to {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(-.2em);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  body::after { display: none; }
  .fair-search-image,
  .fair-search-loading { transition: none; }
  .fair-search-caption span {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
  }
  .fair-search-caption.is-dismissing { animation: none; }
}

@media (max-width: 640px) {
  .fair-search-caption {
    top: 37%;
    right: 18px;
    max-width: calc(100vw - 36px);
    font-size: clamp(19px, 5.8vw, 26px);
    letter-spacing: .045em;
    white-space: normal;
  }
}
