@font-face {
  font-family: 'ArkPixel';
  src: url('../font/ark-pixel-12px-monospaced-zh_tw.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'NotoSansTC';
  src: url('../font/NotoSansTC-Medium.ttf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

html,body {
  font-family: NotoSansTC;
  touch-action: pan-x pan-y; /* 禁止捏合縮放 */
  overscroll-behavior: none;
}

ul,li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bokeh {
  position: fixed;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.3) 40%, transparent 80%);
  opacity: 0.8;
  animation: flicker var(--duration) ease-in-out infinite alternate;
}

@keyframes flicker {
  0% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.9) rotate(0deg); }
  50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.1) rotate(15deg); }
  100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

#frontPage {
  overflow: hidden;
  background: url('../ico/starring.png'),radial-gradient(circle at center, #2e3b62, #0a0f24);
  background-size: 95%, cover;
	background-position: center;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-family: 'ArkPixel', monospace;
  letter-spacing: 2px;
  position: absolute;
  z-index: 99999;
  width: 100%;
  height: 100%;
  transition: opacity 1.5s ease;
  opacity: 1;
  cursor: default;
}

#copyrightlogo {
  position: absolute;
  bottom: 30px;
  width: 100px;
}

.star {
  position: absolute;
  z-index: 2;
  opacity: 0;
  animation: twinkle 3s infinite alternate;
  margin: 50px auto;
  width: 4px;
  height: 12px;
  background: linear-gradient(135deg, #fff, #a0e0ff, #fff);
    clip-path: polygon(
    40% 0%, 60% 0%, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%,
    40% 100%, 40% 60%, 0% 60%, 0% 40%, 40% 40%
  );
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.star::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;   /* 水平線 */
  height: 4px;
  background: white;
  transform: translate(-50%, -50%);
}

.star:nth-child(1) { animation-duration: 1.5s; }
.star:nth-child(2) { animation-duration: 2s; }
.star:nth-child(3) { animation-duration: 2.5s; }
.star:nth-child(4) { animation-duration: 1.8s; }
.star:nth-child(5) { animation-duration: 1s; }
.star:nth-child(6) { animation-duration: 2.3s; }
.star:nth-child(7) { animation-duration: 2s; }

@keyframes twinkle {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(0.5); }
}

#langBox {
  position: absolute;
  text-align: center;
  z-index: 2;
}

#langBox h1,
#langBox p {
  margin-bottom: 20px;
  cursor: default;
}

@media (max-width: 500px) {
  #langBox h1, #langBox p {
    padding: 0 30px;
  }
}

.langButton,#helpBtn button {
  background: rgba(255,255,255,0.1);
  border: 1px solid #fff;
  color: white;
  font-size: 14px;
  padding: 10px 20px;
  margin: 10px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  white-space: nowrap;
}

.langButton:hover,
#helpBtn button:hover {
  background: white;
  color: #0a0f24;
  transform: scale(1.1);
}

.desc {
  font-family: NotoSansTC;
  text-align: justify;
  width: 65%;
  margin: auto;
  height: 160px;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 15px;
  box-sizing: border-box;
  user-select: none;
}

@media (max-width: 768px) {
  .desc {
    width: 100%;
  }
}

.desc::-webkit-scrollbar {
    width: 3px;
    padding: 0px;
}

.desc::-webkit-scrollbar-track {
    background-color: transparent;
}

.desc::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.3);
    border-radius: 50px;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    -ms-border-radius: 50px;
    -o-border-radius: 50px;
}

.desc::-webkit-scrollbar-corner {
    background-color: transparent;
}

#webLogo {
  position: absolute;
  z-index: 999;
  top: 10px;
  left: 10px;
  width: 165px;
  cursor: default;
  pointer-events: none;
}

#menuArea {
  background-image: url(../ico/astronaut.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 105.41px;
  height: 200px;
  position: absolute;
  z-index: 999;
  top: 50%;
  left: 0;
  transform: translate(0,-50%);
  display: none;
  cursor: pointer;
}

#menuArea:hover{
  background-image: url(../ico/astronaut_h.png); 
}

#menuArea.inactive:hover{
  background-image: url(../ico/astronaut_h.png);
}

#menuArea.active {
  background-image: url(../ico/astronaut_h.png);
  border-left: 1px solid white;
}


@media (max-width: 468px) {
  #menuArea {
    background-image: url(../ico/mobileMenu.png);
    top: 35%;
    transform: unset;
    width: 45px;
    height: 101px;
  }

  #menuArea:hover{
    background-image: url(../ico/mobileMenu.png); 
  }

  #menuArea.inactive:hover{
    background-image: url(../ico/mobileMenu_h.png);
  }

  #menuArea.active {
    background-image: url(../ico/mobileMenu_h.png);
    border-left: 1px solid white;
  }
  
}

#menuArea.active li {
  background-image: url(../ico/);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 40px;
  height: 40px;
  position: relative;
  left: -50px;
  margin: 20px 0;
  cursor: pointer;
  transform: translate(0, 60%); /*開啟英文版後移除*/
}

@media (max-width: 468px) {
  #menuArea.active li {
    margin: 10px 0;
    top: -25%;
  }
}

#menuArea.active #language-button {
  background-image: url(../ico/language-solid-full.png) !important;
}

#menuArea.active #map-button {
  background-image: url(../ico/map-regular.png) !important;
}

#menuArea.active #question-button {
  background-image: url(../ico/circle-question-regular.png) !important;
}

#menuArea.active #language-button:hover {
  background-image: url(../ico/language-solid-full-h.png) !important;
}

#menuArea.active #map-button:hover {
  background-image: url(../ico/map-regular-h.png) !important;
}

#menuArea.active #question-button:hover {
  background-image: url(../ico/circle-question-regular-h.png) !important;
}

#menuArea.active #language-button.inactive:hover{
  background-image: url(../ico/language-solid-full-h.png) !important;
}

#menuArea.active #map-button.inactive:hover{
  background-image: url(../ico/map-regular-h.png) !important;
}

#menuArea.active #question-button.inactive:hover{
  background-image: url(../ico/circle-question-regular-h.png) !important;
}

#menuArea.active #language-button.active {
  background-image: url(../ico/language-solid-full-h.png) !important;
}

#menuArea.active #map-button.active {
  background-image: url(../ico/map-regular-h.png) !important;
}

#menuArea.active #question-button.active {
  background-image: url(../ico/circle-question-regular-h.png) !important;
}

#mapArea{
  position: absolute;
  z-index: 999;
  bottom: 10px;
  left: -310px;
  display: none;
}

#mapFrame {
  width: 300px;
  height: 250px;
  background-color: rgba(214,214,214,0.3);
  border-radius: 10px;
  overflow:hidden;
  padding: 20px 40px;
  box-sizing: border-box;
}

#mapScrollBox {
  overflow: hidden;
  width: 220px;
  height: 210px;  
}

#mapDetail {
  position: relative;
  overflow: hidden;
  width: 960px;
  height: 235px;
  top: 50%;
  transform: translate(0, -50%);
}

#mapDetail object,
#mapDetail iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

#mapClose,
#infoClose,
#embedClose,
#drkClose {
  width: 30px;
  position: absolute;
  top: -40px;
  right: 0;
  cursor: pointer;
}

#infoArea,
#helpArea,
#workArea,
#embedArea,
#drkArea {
  position: absolute;
  z-index: 999;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  color: white;
  display: none;
}

#workArea {
  background-color: rgba(0,0,0,0.7); 
}

#infoFrame,
#embedFrame {
  border: 1px solid white;
  width: 75%;
  height: 75%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#infoButton {
  height: 50px;
  position: absolute;
  top: -55px;
  left: 0;
  cursor: pointer;
}

.infoCtrl,
.mapCtrl,
.helpCtrl {
  position: absolute;
  top: 50%;
  transform: translate(0,-50%);
  background-image: url();
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 20.54px;
  height: 35px;
  cursor: pointer;
}

#infoLeft,
#mapLeft,
#helpLeft {
  background-image: url("../ico/left.png");
  left: -30px;
}

#mapLeft {
  left: 10px;
}

#infoLeft:hover,
#mapLeft:hover,
#helpLeft:hover {
  background-image: url("../ico/left_h.png");
}

#infoRight,
#mapRight,
#helpRight {
  background-image: url("../ico/right.png");
  right: -30px;
}

#mapRight {
  right: 10px;
}

#infoRight:hover,
#mapRight:hover,
#helpRight:hover {
  background-image: url("../ico/right_h.png");
}

#infoCircle {
  position: absolute;
  bottom: -40px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}

#infoCircle li {
  width: 15px;
  height: 15px;
  border-radius: 50px;
  border: 1px solid white;
  margin: 0 5px;
}

#infoCircle li:hover {
  background-color: rgba(255,255,255,0.3);
}

#infoCircle li.active {
  background-color: white;
}

#infoDetail,
#embedDetail {
  width: 100%;
  height: 100%;
  text-align: center;
  overflow: hidden;
  position: relative;
}

#infoDetail img {
  max-width: 70%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, 0);
  cursor: move;
  user-select: none;
}

@media (max-width: 860px) {
  #infoDetail img {
    max-width: 100%;
  }  
}

#infoDetail p{
  position: absolute;
  height: 15vh;
  overflow-x: hidden;
  overflow-y: scroll;
  text-align: justify;
  padding: 0 20px;
  bottom: 20px;
  cursor: default;
}

#infoDetail p::-webkit-scrollbar {
    width: 3px;
    padding: 0px;
}

#infoDetail p::-webkit-scrollbar-track {
    background-color: transparent;
}

#infoDetail p::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.3);
    border-radius: 50px;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    -ms-border-radius: 50px;
    -o-border-radius: 50px;
}

#infoDetail p::-webkit-scrollbar-corner {
    background-color: transparent;
}

#embedDetail iframe {
  height: 100%;
  border: 0;  
}

#embedText {
    position: absolute;
    top: -40px;
}

#helpSelect,
#helpFrame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

#helpSelect .deco-block {
  display: flex;
  flex-direction: row;
  align-items: center;
}

#helpDeco {
  width: 199.8px;
  height: 300px;
}

#helpBtn {
  display: flex;
  flex-direction: column;
}

#helpFrame {
  display: none;
  width: 420px;
}

@media (max-width: 768px) {
  #helpFrame {
    width: auto;
  }  
}

#help-pic {
  width: 350px;
}

@media (max-width: 468px) {
  #help-pic {
    width: 250px;
  } 
}

#help-desc {
  margin-bottom: 30px;
}

.helpBottom {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

#helpClose,#helpClz,#helpBack {
  display: flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  margin-top: 35px;
  cursor: pointer;
}

#helpClz {
  justify-content: right;
}

#skip-text,#clz-text {
  margin-right: 10px;
}

#back-text {
  margin-left: 10px;
}

#workArea{
  overflow: hidden;
}

#workArea img {
  position: absolute;
}

#workArea .role {
  width: 250px;
}

.air {
  right: 20%;
  bottom: 5%;
}

.gene {
  left: 15%;
  bottom: 10%;
}

.water {
  top: 18%;
  left: 20%;
}

.land {
  top: 10%;
  right: 25%;
  width: 200px !important;
}

@media (max-width: 870px) {
  .air {
    right: 50px;
  }

  .gene {
    left: 50px;
  }

  .water {
    left: 80px;
  }

  .land {
    right: 60px;
  }  
}

@media (max-width: 640px) {

  .water {
    left: 0;
  }
  
}

@media (max-width: 468px) {

  #workArea .role {
    width: 150px;
  }

  .land {
    right: 100px;
    width: 100px !important;
  }  
}

#workArea .work1{
  width: 450px;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

@media (max-width:765px) {
  #workArea .work1{
    width: 300px;
  }
}

#workArea .work2{
    left: 0;
    width: 190px;
    top: 30%;
    opacity: 0;
    animation: show2 5s infinite;
}

#workArea .work3{
  opacity: 0;
  width: 1100px;
  bottom: 0;
  right: 30px;
  animation: show3 5s infinite;
}

#workArea .work4{
  opacity: 0;
  width: 510px;
  right: 0;
  animation: blink 5s infinite;
}

#workArea .work5{
  opacity: 0;
  width: 1400px;
  bottom: -100px;
  animation: blink 5s infinite;
}

@media (max-width:500px) {
  #workArea .work2{
    width: 100px;
  }

  #workArea .work3{
    width: 750px;
  }

  #workArea .work4{
    width: 350px;
  }
}

/* 總循環時間 8s，每張圖片顯示 2s */
@keyframes show2 {
  0%, 100% { opacity: 0; }
  0%, 25% { opacity: 1; }
}

@keyframes show3 {
  0%, 100% { opacity: 0; }
  25%, 50% { opacity: 1; }
}

/* 閃爍動畫 */
@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

#drkFrame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}