:root {
  --pws-yellow: #ffcc00;
  --pws-cyan: #00c1ff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --card-radius: 22px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Inter", "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 3D Canvas: strictly edge-to-edge ---------- */
#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none; /* prevent browser gestures stealing pointer events */
}

/* ---------- Loading overlay ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--pws-yellow);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__spinner {
  width: 46px;
  height: 46px;
  border: 5px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader__text {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

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

/* ---------- Mascot speech bubble ---------- */
.bubble {
  position: fixed;
  z-index: 30;
  transform: translate(-50%, -100%);
  width: max-content;
  max-width: min(260px, 70vw);
  padding: 10px 16px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.85), 0 12px 26px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 0;
  scale: 0.8;
  transition: opacity 0.25s ease, scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
}

.bubble.is-visible {
  opacity: 1;
  scale: 1;
}

.bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top-color: var(--ink);
  border-bottom: 0;
}

.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

/* ---------- Modal / Clean Card ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}

.modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.modal.is-open .modal__backdrop {
  opacity: 1;
}

.modal__card {
  position: relative;
  width: min(560px, 92vw);
  max-height: 80vh;
  margin-bottom: max(24px, env(safe-area-inset-bottom));
  padding: 40px 36px 36px;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: var(--card-radius);
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.9), 0 28px 70px rgba(0, 0, 0, 0.35);
  transform: translateY(120%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

/* Comic-style scrollbar — WebKit/Chromium */
.modal__card::-webkit-scrollbar {
  width: 12px;
}
.modal__card::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}
.modal__card::-webkit-scrollbar-thumb {
  background: var(--ink);
  border: 3px solid #fff;
  border-radius: 999px;
}
.modal__card::-webkit-scrollbar-thumb:hover {
  background: var(--pws-cyan);
}

.modal.is-open .modal__card {
  transform: translateY(0);
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
  background: #f2f2f2;
  border: 3px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.modal__close:hover {
  background: var(--pws-yellow);
  color: var(--ink);
}

.modal__title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.modal__subtitle {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--pws-cyan);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal__body {
  margin-top: 18px;
  font-size: 16px;
  line-height: 1.65;
  color: #3a3a3a;
}

.modal__body p + p {
  margin-top: 12px;
}

.modal__body ul {
  margin: 12px 0 0 18px;
}

.modal__body a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--pws-yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}

/* ---------- Photo gallery (dummy placeholders for now) ---------- */
.modal__gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.modal__photo {
  position: relative;
  margin: 18px 0;
  border: 3px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  background: #f0f0f0;
}

.modal__photo img {
  width: 100%;
  height: auto;
  display: block;
}

.modal__photo--dummy {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tint) 28%, #ffffff), #f4f4f4);
  border: 2px dashed color-mix(in srgb, var(--tint) 55%, #cccccc);
}

.modal__photo--dummy span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--tint) 65%, #555555);
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .modal__gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

.modal__cta {
  display: inline-block;
  margin-top: 22px;
  padding: 13px 26px;
  background: var(--pws-yellow);
  color: var(--ink);
  font-weight: 800;
  border: 3px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.9);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.modal__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.9), 0 10px 24px rgba(255, 204, 0, 0.5);
}

/* ---------- Hint chip ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  transform: translateX(-50%);
  padding: 9px 18px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.hint.is-visible {
  opacity: 1;
}

@media (max-width: 600px) {
  .modal__card {
    padding: 36px 22px 28px;
  }
  .modal__title {
    font-size: 24px;
  }
}

/* ---------- Footer ---------- */
.footer-controls {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.2s ease;
}

.footer-toggle::after {
  content: "▴";
  font-size: 12px;
  transition: transform 0.3s ease;
}

.footer-toggle.is-open::after {
  transform: rotate(180deg);
}

.footer-toggle:hover {
  transform: translateY(-2px);
  background: #000;
}

/* ---------- Music mute ---------- */
.music-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--pws-yellow);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.2s ease;
}

.music-toggle:hover {
  transform: translateY(-2px);
  background: #ffd633;
}

.music-toggle.is-muted {
  background: var(--ink);
  color: #fff;
}

.music-toggle.is-muted:hover {
  background: #000;
}

/* diagonal slash shown when muted */
.music-toggle.is-muted::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* ---------- Language switcher ---------- */
.lang-switch {
  position: relative;
}

.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--pws-yellow);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.2s ease;
}

.lang-toggle:hover {
  transform: translateY(-2px);
  background: #ffd633;
}

.lang-toggle.is-open {
  background: #ffd633;
}

.lang-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 168px;
  padding: 8px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.lang-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.lang-menu__heading {
  margin: 2px 6px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lang-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lang-menu__item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.lang-menu__item.is-active {
  background: var(--pws-yellow);
}

.lang-menu__code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 8px;
}

.lang-menu__item.is-active .lang-menu__code {
  background: var(--ink);
}

.lang-menu__name {
  flex: 1 1 auto;
}

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 24;
  background: rgba(16, 16, 16, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #eaeaea;
  border-top: 4px solid var(--pws-yellow);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.footer.is-open {
  transform: translateY(0);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 28px 14px;
}

.footer__brand {
  max-width: 260px;
}

.footer__brand strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--pws-yellow);
}

.footer__brand p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #b5b5b5;
}

.footer__cols {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.footer__col h4 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pws-cyan);
  margin-bottom: 10px;
}

.footer__col ul {
  list-style: none;
}

.footer__col li {
  margin: 6px 0;
}

.footer__col a {
  color: #dcdcdc;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.18s ease;
}

.footer__col a:hover {
  color: var(--pws-yellow);
}

.footer__bar {
  padding: 12px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  color: #9a9a9a;
  text-align: center;
}

@media (max-width: 600px) {
  .footer__inner {
    flex-direction: column;
    gap: 20px;
    padding: 24px 20px 10px;
  }
  .footer__cols {
    gap: 26px;
  }
  .footer {
    max-height: 78vh;
    overflow-y: auto;
  }
}

