:root {
  --ink: #111;
  --muted: #777;
  --line: #e3e0d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: #fff;
}

a {
  color: inherit;
}

.guide {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.lang-switch {
  display: flex;
  width: fit-content;
  margin-left: auto;
  padding: 3px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.85rem;
}

.lang-switch a {
  min-width: 4.2em;
  padding: 3px 12px;
  border-radius: 999px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
}

.lang-switch a:visited {
  color: var(--ink);
}

.lang-switch a:hover {
  background: #eee;
}

.lang-switch a[aria-current="page"] {
  background: var(--ink);
  color: #fff;
}

.lang-switch.is-animated {
  position: relative;
}

.lang-switch.is-animated a {
  position: relative;
  z-index: 1;
  background: transparent;
}

.lang-switch.is-animated a[aria-current="page"] {
  color: #fff;
}

.guide-body {
  transition: opacity 0.2s ease;
}

.guide-body.is-fading {
  opacity: 0;
}

.lang-switch-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: 999px;
  background: var(--ink);
  transition: transform 0.28s cubic-bezier(0.3, 1.3, 0.5, 1), width 0.28s;
}

@media (prefers-reduced-motion: reduce) {
  .lang-switch-indicator,
  .guide-body {
    transition: none;
  }
}

.guide-head {
  text-align: center;
  margin: 16px 0 24px;
}

.guide-head h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
}

.guide-head p {
  margin: 0;
  color: var(--muted);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-bar button {
  font: inherit;
  font-size: 0.9rem;
  padding: 4px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.filter-bar button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

.region {
  margin-bottom: 32px;
}

.region h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.region[hidden] {
  display: none;
}

.region-pins {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
}

.avatar-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  text-align: center;
}

.avatar-pin[hidden] {
  display: none;
}

.avatar-pin .avatar-frame {
  transition: transform 0.2s;
}

.avatar-pin:hover .avatar-frame {
  transform: translateY(-4px) rotate(-3deg);
}

.avatar-pin-name {
  margin-top: 6px;
  font-weight: 700;
}

.avatar-pin-latin {
  font-size: 0.75rem;
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin: 8px 0 16px;
  text-decoration: none;
  color: var(--muted);
}

.profile-head {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 32px;
  align-items: center;
}

.profile-art {
  object-fit: contain;
}

.profile-name {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
  color: #8a8a8a;
}

.profile-latin {
  margin: 4px 0 0;
  font-style: italic;
  color: var(--muted);
}

h1.profile-latin {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
}

.profile-category {
  margin: 16px 0 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.profile-summary {
  white-space: pre-line;
  margin: 16px 0 0;
  font-size: 1.05rem;
  line-height: 1.8;
}

.stories {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  margin: 32px 0;
}

.story {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 76px;
  text-decoration: none;
}

.story-ring {
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.story-cover {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.4rem;
  text-transform: uppercase;
}

.story-label {
  font-size: 0.75rem;
  text-align: center;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-cell {
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  aspect-ratio: 1;
}

.photo-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox {
  max-width: 95vw;
  max-height: 95vh;
  padding: 0;
  border: 0;
  background: transparent;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.lightbox img {
  display: block;
  max-width: 95vw;
  max-height: 85vh;
}

.lightbox-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.lightbox-bar a,
.lightbox-bar button {
  font: inherit;
  padding: 4px 14px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.license-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 48px;
  font-size: 0.8rem;
  color: var(--muted);
}

.license-note p {
  margin: 0;
  line-height: 1.7;
}

.license-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

@media (max-width: 600px) {
  .profile-head {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .art-frame {
    max-width: 366px;
    margin: 0 auto;
  }
}

.img-frame {
  position: relative;
  display: block;
  overflow: hidden;
  background: linear-gradient(100deg, #eee 30%, #f6f6f6 50%, #eee 70%);
  background-size: 300% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.js .img-frame img {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.img-frame.is-loaded {
  background: none;
  animation: none;
}

.js .img-frame.is-loaded img {
  opacity: 1;
}

.avatar-frame {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.avatar-frame img {
  display: block;
  width: 100%;
  height: 100%;
}

.art-frame {
  width: 100%;
  aspect-ratio: 5 / 3;
  border-radius: 16px;
}

.art-stage {
  position: relative;
}

.art-frame[hidden] {
  display: none;
}

.model-frame {
  display: block;
  height: auto;
  background: #f7f2e6;
  --poster-color: transparent;
}

.view-3d-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.view-3d-toggle:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.art-frame .profile-art {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
}

.page-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  height: 3px;
  width: 0;
  background: var(--ink);
  opacity: 0;
  transition: width 1.5s cubic-bezier(0.1, 0.7, 0.3, 1), opacity 0.3s;
}

.page-loading-bar.is-active {
  width: 85%;
  opacity: 1;
}

.page-loading-bar.is-done {
  width: 100%;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.3s 0.2s;
}

@keyframes skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .img-frame {
    animation: none;
  }

  .img-frame img,
  .page-loading-bar {
    transition: none;
  }
}

.spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}

.js .img-frame:not(.is-loaded) .spinner {
  display: block;
}

.lightbox-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: min(320px, 90vw);
  min-height: 200px;
}

.lightbox-stage .spinner {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
}

.lightbox-stage.is-loading .spinner {
  display: block;
}

.lightbox-stage.is-loading img {
  opacity: 0;
}

.lightbox-stage img {
  transition: opacity 0.25s ease;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

.lightbox-stage {
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
  user-select: none;
}

.lightbox-stage img {
  transform-origin: 0 0;
  will-change: transform;
  -webkit-user-drag: none;
}

.lightbox-stage.is-zoomed {
  cursor: grab;
}

.lightbox-stage.is-dragging {
  cursor: grabbing;
}

.lightbox-stage.is-upgrading .spinner {
  display: block;
  top: 12px;
  right: 12px;
  left: auto;
  width: 20px;
  height: 20px;
  margin: 0;
  border-width: 2px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  font-size: 1.3rem;
  line-height: 44px;
  cursor: pointer;
  transition: background 0.2s;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background: rgba(0, 0, 0, 0.75);
}

.lightbox-prev {
  left: 8px;
}

.lightbox-next {
  right: 8px;
}

.lightbox-count {
  align-self: center;
  color: #fff;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.playground-banner {
  position: relative;
  display: block;
  margin: 0 0 28px;
  border-radius: 16px;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
  background: #3b4a2a;
}

.playground-banner img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1600 / 536;
  object-fit: cover;
  transition: transform 0.4s;
}

.playground-banner:hover img,
.playground-banner:focus-visible img {
  transform: scale(1.03);
}

.playground-banner-text {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 48px 20px 18px;
  background: linear-gradient(to top, rgba(20, 16, 10, 0.7), rgba(20, 16, 10, 0));
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.playground-banner-text strong {
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  line-height: 1.2;
}

.playground-banner-cta {
  margin-top: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  text-shadow: none;
}

@media (max-width: 600px) {
  .playground-banner img {
    aspect-ratio: 4 / 3;
  }

  .playground-banner-text {
    padding: 40px 14px 14px;
    font-size: 0.85rem;
  }
}
