/* 伤感咩吖 — 入口页样式 */

body.gate {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--theme-deep, #5b4530) 72%, #111827) 0%, #0d0805 60%),
    #0d0805;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  position: relative;
}

.gate-stage {
  width: min(960px, calc(100vw - 40px));
  aspect-ratio: 16 / 9;
  position: relative;
  z-index: 1;
}

/* —— 平板及更窄：取消 16/9 强制比，按内容自适应 —— */
@media (max-width: 720px), (orientation: portrait) and (max-width: 900px) {
  .gate-stage {
    aspect-ratio: auto;
    min-height: 78svh;
    width: min(560px, calc(100vw - 40px));
  }
}

.gate-card {
  width: 100%;
  height: 100%;
  padding: 28px 36px 30px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: stretch;
}

.gate-card .top-row,
.gate-card .bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(245, 232, 212, 0.78);
  font-size: 13px;
  position: relative;
  z-index: 2;
}

.gate-card .top-row a:hover,
.gate-card .bottom-row a:hover {
  color: #fff;
  text-decoration: underline dotted rgba(255, 255, 255, 0.5);
  text-underline-offset: 3px;
}

.gate-card .credit,
.gate-card .policy,
.gate-card .sponsor {
  font-family: var(--font-hand-en);
  font-size: 16px;
  letter-spacing: 0.02em;
}

.gate-hero {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 2;
}

.gate-hero h1 {
  font-family: var(--font-hand-en);
  font-weight: 700;
  font-size: clamp(48px, 8vw, 96px);
  margin: 0 0 8px;
  color: #fbf2e2;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 6px 18px rgba(0, 0, 0, 0.55);
  letter-spacing: 0.04em;
  line-height: 1.05;
  transform: rotate(-1.2deg);
}

.gate-hero h1 span {
  display: block;
}

.gate-hero .subtitle {
  font-family: var(--font-hand-en);
  font-size: clamp(20px, 2.4vw, 30px);
  color: rgba(251, 242, 226, 0.85);
  letter-spacing: 0.06em;
  margin-top: 6px;
  transform: rotate(0.6deg);
}

.gate-hero .subtitle::before,
.gate-hero .subtitle::after {
  content: '—';
  margin: 0 10px;
  opacity: 0.6;
}

.gate-hero .enter-btn {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.gate-card .bottom-row {
  align-items: flex-end;
}

.gate-card .bottom-center {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 3;
}

/* —— 触摸端把圆按钮放大，方便点按 —— */
[data-pointer='coarse'] .gate-card .theme-picker .swatch {
  width: 32px;
  height: 32px;
}

/* —— 极窄屏：调整 hero、底栏、padding —— */
@media (max-width: 560px) {
  body.gate {
    padding-left: 0;
    padding-right: 0;
  }
  .gate-card {
    padding: 22px 18px 24px;
  }
  .gate-card .top-row,
  .gate-card .bottom-row {
    font-size: 12px;
    gap: 12px;
    min-width: 0;
  }
  .gate-card .credit,
  .gate-card .policy,
  .gate-card .sponsor {
    font-size: 13px;
    min-width: 0;
  }
  .gate-card .credit {
    max-width: 62%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .gate-card .policy {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .gate-hero h1 {
    max-width: 100%;
    font-size: clamp(32px, 9vw, 40px);
    line-height: 1.08;
    overflow-wrap: normal;
  }
  .gate-hero .subtitle {
    font-size: clamp(17px, 4.6vw, 22px);
  }
  .gate-hero .subtitle::before,
  .gate-hero .subtitle::after {
    margin: 0 6px;
  }
  .gate-card .bottom-center {
    bottom: 14px;
  }
  .gate-card .bottom-row {
    padding-bottom: 36px; /* 给颜色选择器留空间 */
  }
}

@media (max-width: 380px) {
  .gate-card .credit {
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* —— 气球光标 —— */
.balloon-cursor-el {
  position: fixed;
  top: 0;
  left: 0;
  width: 42px;
  height: 64px;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50px, -50px, 0);
  transition: opacity 0.2s ease;
  will-change: transform;
}

.balloon-cursor-el.hidden {
  opacity: 0;
}

/* —— 密码弹窗（Windows 复古风，致敬草图） —— */
.pw-mask {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 3, 0.55);
  display: grid;
  place-items: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
}

.pw-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.pw-window {
  width: min(360px, 86vw);
  background: #cdd0d6;
  border: 1px solid #2f3a55;
  box-shadow:
    2px 2px 0 #2f3a55,
    inset 1px 1px 0 #fff;
  font-family: 'Tahoma', 'Microsoft YaHei', sans-serif;
  font-size: 12px;
  color: #1c1c1c;
  transform: translateY(8px) scale(0.96);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.pw-mask.show .pw-window {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.pw-window .titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 22px;
  padding: 0 4px 0 6px;
  background: linear-gradient(180deg, #2b4a9e 0%, #15306a 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pw-window .titlebar .x {
  width: 18px;
  height: 16px;
  background: #c4c8d0;
  color: #000;
  border: 1px solid #fff;
  display: grid;
  place-items: center;
  font-family: 'Tahoma', sans-serif;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.pw-window .titlebar .x:hover {
  background: #e2a3a3;
}

.pw-window .body {
  padding: 14px 14px 12px;
  display: grid;
  gap: 10px;
}

.pw-window label {
  display: block;
}

.pw-window input[type='password'] {
  width: 100%;
  height: 22px;
  padding: 2px 6px;
  border: 1px solid #7a7a7a;
  background: #fff;
  box-shadow: inset 1px 1px 0 #888;
  font: inherit;
  color: #1c1c1c;
}

.pw-window .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.pw-window .btn {
  height: 22px;
  padding: 0 14px;
  background: #cdd0d6;
  border: 1px solid #2f3a55;
  box-shadow:
    1px 1px 0 #2f3a55,
    inset 1px 1px 0 #fff;
  font: inherit;
  color: #1c1c1c;
  cursor: pointer;
}

.pw-window .btn:hover {
  background: #d8dbe0;
}

.pw-window .btn:active {
  box-shadow:
    inset 1px 1px 0 #2f3a55,
    inset -1px -1px 0 #fff;
  transform: translate(1px, 1px);
}

.pw-window .hint {
  color: #6b1b2e;
  font-size: 11px;
  min-height: 14px;
}

/* —— 入场 / 通过时的气球飞天动画 —— */
.balloon-fly {
  position: fixed;
  width: 64px;
  height: 96px;
  pointer-events: none;
  z-index: 10000;
  will-change: transform, opacity;
  animation: balloonFly 1100ms cubic-bezier(.38,.05,.55,.05) forwards;
}

@keyframes balloonFly {
  0%   { transform: translate3d(0,0,0) rotate(0deg);    opacity: 1; }
  40%  { transform: translate3d(-6vw,-30vh,0) rotate(-6deg); opacity: 1; }
  100% { transform: translate3d(4vw,-130vh,0) rotate(8deg);  opacity: 0.2; }
}

/* 落幕白光遮罩，把入口场景柔和地洗白成主页 */
.gate-fadeout {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 60%, rgba(255,242,222,0.85), rgba(13,8,5,0.95) 80%);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.7s ease 0.2s;
}

.gate-fadeout.show {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .balloon-fly { animation-duration: 1ms !important; }
  .gate-fadeout { transition: opacity 0.15s ease !important; }
}
