:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: #1a1a2e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

body.pcMode {
  background: #fff;
}

.pcNotice {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
}

.pcNoticeBox {
  width: min(520px, 100%);
  padding: 22px 18px;
  border: 2px solid #2563eb;
  border-radius: 14px;
  color: #2563eb;
  text-align: center;
  background: #fff;
}

.pcNoticeMain {
  font-size: 18px;
  font-weight: 800;
}

.pcNoticeSub {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(37, 99, 235, 0.75);
  line-height: 1.4;
}

button {
  font: inherit;
  touch-action: manipulation;
}

.app {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.screen {
  position: relative;
  height: 100%;
  width: 100%;
}

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateZ(0);
}

.overlay {
  position: absolute;
  inset: 0;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.enterButton {
  position: absolute;
  left: calc(50% - 10px);
  top: calc(62% + -5px);
  transform: translate(-50%, -50%);
  z-index: 20;
  border: 0;
  background: transparent;
  color: #000000;
  padding: 0;
  border-radius: 0;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: none;
}

.enterButton.blink {
  animation: enterBlink 350ms ease-in-out 3;
}

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

.lotteryBtn {
  width: 100%;
  border: 0;
  background: #fff;
  color: #111;
  padding: 14px 18px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.lotteryBtn:active {
  transform: scale(0.99);
}

.rankBtn {
  width: 100%;
  border: 0;
  background: #fff;
  color: #111;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.rankBtn:active {
  transform: scale(0.99);
}

.resultActions {
  width: min(520px, calc(100% - 100px));
  margin-bottom: 50px;
  display: flex;
  gap: 12px;
}

.resultActions > button {
  flex: 1 1 0;
}

.resultText {
  display: none;
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  z-index: 20;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-align: center;
  max-width: calc(100% - 40px);
}

.rankOverlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
}

.rankBox {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  padding: 18px 16px 14px;
}

.rankTitle {
  font-size: 18px;
  font-weight: 900;
  color: #111;
  text-align: center;
  margin-bottom: 14px;
  cursor: pointer;
}

.rankList {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.rankItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  color: #111;
  font-size: 15px;
  font-weight: 700;
}

.rankItemLeft {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rankItemIcon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}

.rankItem.active {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.rankItemRight {
  color: rgba(17, 17, 17, 0.55);
  font-weight: 700;
  font-size: 13px;
}

.rankItem.active .rankItemRight {
  color: rgba(37, 99, 235, 0.9);
}

.rankClose {
  width: 100%;
  border: 0;
  background: #2563eb;
  color: #fff;
  padding: 12px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
}

.rankClose:active {
  transform: scale(0.99);
}

.card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 14px 14px 10px;
  backdrop-filter: blur(6px);
  border: 2px solid #2563eb;
}

#quizOverlay .card {
  transform: translateY(-60px);
  max-height: 55vh;
  overflow-y: auto;
}

.progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #333;
  margin-bottom: 10px;
}

.questionTitle {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  color: #2563eb;
  margin: 0 0 12px;
}

.options {
  display: grid;
  gap: 10px;
}

.optionBtn {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #111;
  padding: 12px 12px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.3;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.optionKey {
  flex: 0 0 auto;
  min-width: 28px;
  font-weight: 800;
}

.optionText {
  flex: 1 1 auto;
  word-break: break-word;
}

.optionBtn:active {
  transform: scale(0.99);
}

.optionBtn.selected {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(37, 99, 235, 0.1);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18);
}

.optionBtn:disabled {
  opacity: 0.95;
}

.quizLogo {
  margin-top: 12px;
  margin-bottom: 8px;
  text-align: center;
}

.quizLogoImg {
  height: 44px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
}

.hidden {
  display: none !important;
}

.centerOverlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  background: #fff;
}

.loadingBox {
  width: min(520px, 100%);
  background: transparent;
  border-radius: 16px;
  padding: 16px;
  font-size: 14px;
  color: #111;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loader {
  width: 100px;
  height: 100px;
  position: relative;
  animation: shake 3s infinite ease-in-out;
}

.loaderBrand {
  margin-top: 18px;
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
}

.cup {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 30px;
  background-color: #5b4022cb;
  border: 1px solid #2e2e2e;
  border-radius: 3px 3px 10px 10px;
  z-index: 1;
  animation: cupPulse 6s infinite ease-in-out;
}

.cup::before {
  content: "";
  position: absolute;
  bottom: -5px;
  width: calc(100% - 2px);
  height: 6px;
  background: #5b4022cb;
  border: 1px solid #2e2e2e;
  border-top: none;
  border-radius: 50%;
  z-index: -1;
  animation: cupPulse 6s infinite ease-in-out;
}

.cup::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 1px;
  width: calc(100% - 2px);
  height: 4px;
  background: #da8920ca;
  border: 1px solid #2e2e2e;
  border-radius: 50%;
  animation: coffeeGlow 6s infinite ease-in-out;
}

.cup-handle {
  position: absolute;
  top: 5px;
  right: -10px;
  width: 10px;
  height: 15px;
  border: 2px solid #2e2e2e;
  border-left: none;
  border-radius: 0 10px 10px 0;
  background: transparent;
}

.smoke {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 10px;
  height: 25px;
  background: rgba(72, 67, 67, 0.501);
  border-radius: 50%;
  transform: translateX(-50%);
  animation: rise 3s infinite ease-in-out;
  filter: blur(8px);
}

.smoke.one {
  animation-delay: 0s;
}
.smoke.two {
  animation-delay: 0.8s;
}
.smoke.three {
  animation-delay: 1.6s;
}

.load {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #2e2e2e;
  opacity: 0.75;
  white-space: nowrap;
}

@keyframes rise {
  0% {
    transform: translate(-50%, 0) scale(0.4);
    opacity: 0;
  }
  30% {
    opacity: 0.7;
  }
  60% {
    opacity: 0.4;
  }
  100% {
    transform: translate(-50%, -120px) scale(1);
    opacity: 0;
  }
}

@keyframes shake {
  0% {
    transform: translateX(0) translateY(0) rotate(0);
  }
  25% {
    transform: translateX(-4px) translateY(-2px) rotate(-2deg);
  }
  50% {
    transform: translateX(0) translateY(0) rotate(0);
  }
  75% {
    transform: translateX(4px) translateY(-2px) rotate(2deg);
  }
  100% {
    transform: translateX(0) translateY(0) rotate(0);
  }
}

@keyframes cupPulse {
  0%,
  100% {
    background-color: #5b4022cb;
  }
  50% {
    background-color: #f5f5f5bd;
  }
}

@keyframes coffeeGlow {
  0%,
  100% {
    background: #da8920ca;
  }
  50% {
    background: #fed197d5;
  }
}
