html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
}

#bubbles {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
}

.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 3px 7px;
  font: 600 13px/1.25 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #5a1a0a;
  background: #fff8e7;
  border: 2px solid #5a1a0a;
  box-shadow: 2px 2px 0 rgba(90, 26, 10, 0.35);
  white-space: nowrap;
  animation: pop 0.18s steps(3) both;
}

.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top: 4px solid #5a1a0a;
}

.bubble.fade {
  opacity: 0;
  transition: opacity 0.4s;
}

@keyframes pop {
  from {
    transform: translate(-50%, -80%) scale(0.6);
  }
  to {
    transform: translate(-50%, -100%) scale(1);
  }
}

/* —— 浏览器 / 小工具演示模式 —— */
#demo-desktop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #24345a;
  background: linear-gradient(160deg, #24345a, #5a6f9c 60%, #8a9cc0);
}

#demo-desktop .fake-window {
  position: absolute;
  background: #f4f4f4;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  cursor: move;
  touch-action: none;
}

#demo-desktop .fake-window::before {
  content: "🏮 新春小窗（按住可拖动）";
  display: block;
  height: 32px;
  line-height: 32px;
  padding: 0 12px;
  font: 13px/32px "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #5a1a0a;
  font-weight: 600;
  background: #ffe8c8;
  border-bottom: 1px solid #f0cba0;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-body {
  padding: 14px 16px;
  text-align: center;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.win-countdown {
  display: inline-block;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff8e7;
  background: #c1121f;
  border-radius: 99px;
}

.win-fortune {
  margin: 12px 0 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: #780000;
  background: #fff5dc;
  border: 1px dashed #d48806;
  border-radius: 10px;
  cursor: pointer;
}

.win-tip {
  font-size: 12px;
  line-height: 1.5;
  color: #7a6a5e;
}

#demo-desktop .fake-taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  padding-bottom: 0;
  padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  background: rgba(32, 32, 40, 0.85);
}

#demo-help {
  position: fixed;
  left: 10px;
  right: 10px;
  top: 62px;
  top: calc(62px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 8px 2px;
  font: 12px "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
  background: rgba(25, 10, 10, 0.86);
  border: 1px solid rgba(255, 186, 8, 0.45);
  border-radius: 12px;
  z-index: 20;
}

#demo-help button {
  flex: 0 0 auto;
  white-space: nowrap;
  cursor: pointer;
  margin: 0 6px 4px 0;
  padding: 6px 10px;
  border: none;
  border-radius: 7px;
  font: 600 12px "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff8e7;
  background: rgba(214, 40, 40, 0.9);
}

#demo-help button:hover,
#demo-help button:active {
  background: #ff4d3d;
}

/* —— 久坐一小时全屏居中提醒 & 关于作者 —— */
#rest-modal,
#about-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 8, 6, 0.56);
  z-index: 99;
}

@supports ((-webkit-backdrop-filter: blur(4px)) or (backdrop-filter: blur(4px))) {
  #rest-modal,
  #about-modal {
    background: rgba(20, 8, 6, 0.42);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
}

#rest-modal[hidden],
#about-modal[hidden] {
  display: none;
}

.rest-card {
  width: 88%;
  max-width: 380px;
  max-height: 88%;
  overflow-y: auto;
  padding: 24px 24px 20px;
  text-align: center;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff8e7;
  background: #9d0208;
  background: linear-gradient(155deg, #c1121f, #780000);
  border: 2.5px solid #ffba08;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: modal-pop 0.22s ease-out both;
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.rest-badge {
  display: inline-block;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #780000;
  background: #ffd166;
  border-radius: 99px;
}

.rest-card h2 {
  margin: 14px 0 8px;
  font-size: 20px;
  color: #fff;
}

.rest-card p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: #ffe8c8;
}

.about-qr {
  display: block;
  width: 176px;
  max-width: 100%;
  height: auto;
  margin: -4px auto 12px;
  border-radius: 10px;
  border: 2px solid #ffba08;
  background: #fff;
}

.about-info {
  margin: 0 0 14px;
  padding: 8px 12px;
  font-size: 14px;
  color: #ffd166;
  background: rgba(0, 0, 0, 0.24);
  border-radius: 8px;
  -webkit-user-select: text;
  user-select: text;
}

.rest-actions {
  display: flex;
  flex-direction: column;
}

.rest-actions button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font: 600 14px "PingFang SC", "Microsoft YaHei", sans-serif;
  padding: 10px 14px;
  margin-top: 8px;
}

.rest-actions button:first-child {
  margin-top: 0;
}

.btn-primary {
  background: #ffba08;
  color: #5a1a0a;
}

.btn-primary:hover,
.btn-primary:active {
  background: #ffd166;
}

.btn-sub {
  background: rgba(255, 255, 255, 0.16);
  color: #fff8e7;
}

.btn-sub:hover,
.btn-sub:active {
  background: rgba(255, 255, 255, 0.25);
}

.btn-link {
  background: transparent;
  color: rgba(255, 232, 200, 0.72);
  font-size: 12px !important;
  padding: 4px !important;
}
