/* ================= lovergame · 游戏共享样式基座 ================= */

:root {
  --bg-deep: #14081f;
  --bg-mid: #1f0f33;
  --bg-card: #2a1745;
  --accent: #ff5c8d;
  --accent-2: #b388ff;
  --gold: #ffd166;
  --text: #f3eaff;
  --text-dim: #b9a6d8;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #3b1a63 0%, var(--bg-mid) 45%, var(--bg-deep) 100%);
  color: var(--text);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- 屏幕切换 ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; animation: screenIn 0.45s ease both; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 24px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s;
  font-family: inherit;
}
.btn:active { transform: scale(0.96); filter: brightness(1.08); }
.btn { touch-action: manipulation; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #c94bff 100%);
  color: #fff;
  box-shadow: 0 6px 22px rgba(255, 92, 141, 0.4);
}
.btn-primary:disabled { filter: grayscale(0.6) brightness(0.7); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-refuse { background: rgba(255, 255, 255, 0.1); color: var(--text-dim); }
.btn-small { font-size: 13px; padding: 7px 16px; background: rgba(255,255,255,0.14); color: var(--text); }
.btn-lg { font-size: 18px; padding: 16px 30px; width: 100%; }
.btn-sticky { position: sticky; bottom: 16px; margin-top: 8px; }

/* ---------- 年龄确认 ---------- */
#screen-age { align-items: center; justify-content: center; padding: 24px; }
.age-card {
  width: min(420px, 100%);
  background: rgba(42, 23, 69, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.logo-heart { font-size: 56px; animation: wheelSpin 6s linear infinite; }
@keyframes wheelSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.title-main {
  font-size: 32px;
  background: linear-gradient(135deg, #ff8fb3, #c58bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle { color: var(--text-dim); font-size: 14px; letter-spacing: 2px; }
.age-notice { font-size: 14px; line-height: 1.8; color: var(--text-dim); }
.age-notice strong { color: var(--gold); }
.age-tip { margin-top: 8px; font-size: 12px; opacity: 0.8; }

/* ---------- 设置页 ---------- */
#screen-setup { padding: 24px 20px 32px; }
.setup-wrap { width: min(480px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.back-link {
  align-self: flex-start;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transition: all 0.2s;
}
.back-link:active { transform: scale(0.95); background: rgba(255, 255, 255, 0.12); }
.screen-title { font-size: 24px; text-align: center; padding: 8px 0; }
.setup-label { font-size: 15px; margin-bottom: 10px; color: var(--text); }

.seg-group { display: flex; gap: 10px; }
.seg-btn {
  flex: 1;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  transition: all 0.2s ease;
  font-family: inherit;
}
.seg-btn span { font-size: 11px; font-weight: 400; color: var(--text-dim); }
.seg-btn.active {
  border-color: var(--accent);
  background: rgba(255, 92, 141, 0.16);
  box-shadow: 0 0 16px rgba(255, 92, 141, 0.25);
  transform: translateY(-2px);
}

.player-inputs { display: flex; flex-direction: column; gap: 8px; }
.player-input-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.player-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}
.player-input-row input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.player-input-row input:focus { border-color: var(--accent-2); }
.pair-hint { margin-top: 10px; font-size: 12px; color: var(--text-dim); }

.gender-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 2px;
  flex-shrink: 0;
}
.g-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  width: 32px;
  height: 30px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.g-btn.active[data-g="m"] { background: rgba(79, 195, 247, 0.3); color: #aee3fb; }
.g-btn.active[data-g="f"] { background: rgba(255, 92, 141, 0.3); color: #ffb3ca; }

.rules-block {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  padding: 16px;
}
.rules-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rules-list li { font-size: 13px; line-height: 1.7; color: var(--text-dim); padding-left: 18px; position: relative; }
.rules-list li::before { content: '·'; position: absolute; left: 4px; color: var(--accent); font-weight: bold; }
.rules-list strong { color: var(--text); }

/* ---------- 游戏页 ---------- */
#screen-game { overflow: hidden; }

.game-header {
  padding: 10px 12px 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.player-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; flex: 1; min-width: 0; }

.header-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.hdr-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}
.hdr-btn:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.15); }

.player-chip {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 5px 12px 5px 6px;
  font-size: 12px;
  transition: all 0.25s ease;
}
.player-chip.current {
  border-color: var(--pc);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 14px color-mix(in srgb, var(--pc) 45%, transparent);
  transform: scale(1.06);
}
.chip-emoji {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--pc);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.chip-name { font-weight: 600; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-star { color: var(--gold); font-size: 11px; font-weight: 700; }

/* ---------- 底栏 ---------- */
.game-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px calc(14px + env(safe-area-inset-bottom));
  gap: 14px;
  background: rgba(20, 8, 31, 0.7);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.turn-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.turn-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}
.turn-text { display: flex; flex-direction: column; min-width: 0; }
#turn-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-tip { font-size: 12px; color: var(--text-dim); }
.star-goal { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ---------- 卡片弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.show { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 4, 18, 0.78);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.card-flip-wrap {
  position: relative;
  width: min(340px, 88vw);
  aspect-ratio: 3 / 4.2;
  perspective: 1200px;
  animation: cardPop 0.28s cubic-bezier(0.34, 1.45, 0.64, 1);
}
@keyframes cardPop {
  from { transform: scale(0.6) translateY(40px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.card-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.34s cubic-bezier(0.4, 0.1, 0.2, 1);
  cursor: pointer;
}
.card-inner.flipped { transform: rotateY(180deg); cursor: default; }

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 22px;
}
.card-back {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 92, 141, 0.28), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(179, 136, 255, 0.28), transparent 55%),
    linear-gradient(160deg, #33194f, #1d0d33);
  border: 2px solid rgba(255, 255, 255, 0.14);
  gap: 14px;
}
.card-back-icon { font-size: 72px; animation: floaty 2.4s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.card-back-text { color: var(--text-dim); font-size: 14px; letter-spacing: 3px; }

.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(165deg, #3b2060, #241040);
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  gap: 16px;
  text-align: center;
}
.card-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  letter-spacing: 1px;
  border: 1px solid transparent;
}

.card-title { font-size: 22px; font-weight: 800; }
.card-text { font-size: 15px; line-height: 1.85; color: #e2d5f7; }

.card-timer {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 8px 14px;
}
.card-timer.hidden { display: none; }
#timer-display { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); }

.card-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px; }
.card-actions .btn { width: 100%; font-size: 15px; padding: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 14%;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(30, 14, 52, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: var(--shadow);
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 胜利页 ---------- */
#screen-win { align-items: center; justify-content: center; padding: 24px; text-align: center; }
.win-wrap {
  position: relative;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.win-trophy { font-size: 76px; animation: trophyBounce 1.1s cubic-bezier(0.34, 1.5, 0.64, 1) both; }
@keyframes trophyBounce {
  from { transform: scale(0) rotate(-30deg); }
  to { transform: scale(1) rotate(0); }
}
.win-name {
  font-size: 30px;
  background: linear-gradient(135deg, var(--gold), #ff9f68);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.win-sub { color: var(--text-dim); font-size: 14px; }

.final-card {
  width: 100%;
  background: linear-gradient(160deg, rgba(255, 209, 102, 0.14), rgba(255, 92, 141, 0.1));
  border: 1.5px solid rgba(255, 209, 102, 0.4);
  border-radius: 20px;
  padding: 22px 20px;
  margin: 8px 0;
  animation: screenIn 0.6s 0.3s ease both;
}
.final-card-head { font-size: 15px; font-weight: 800; color: var(--gold); margin-bottom: 12px; letter-spacing: 1px; }
.final-card-text { font-size: 15px; line-height: 1.9; color: var(--text); }

.win-confetti {
  position: absolute;
  inset: -40px 0 0;
  pointer-events: none;
  overflow: visible;
}
.confetti {
  position: absolute;
  top: -30px;
  animation: confettiFall linear 1;
  animation-duration: 1.6s !important;
  animation-iteration-count: 1;
}
@keyframes confettiFall {
  from { transform: translateY(-40px) rotate(0deg); opacity: 1; }
  to { transform: translateY(75vh) rotate(360deg); opacity: 0; }
}

/* Skip long scripted waits (NPPace) */
.np-pace-skip {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(72px, calc(env(safe-area-inset-bottom) + 64px));
  z-index: 1200;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(32, 24, 44, 0.92);
  color: #f3eaff;
  font: 600 14px/1.2 system-ui, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
}
.np-pace-skip:active { transform: scale(0.96); filter: brightness(1.1); }
.np-pace-skip[hidden] { display: none !important; }


/* ---------- 联络按钮（统一样式，无 icon） ---------- */
.contact-link,
.setup-contact {
  display: none !important;
}
.contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: #f3eaff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
}
.contact-logo {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}
.contact-link:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.14);
}
.setup-contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 4px;
  margin-top: 4px;
}

/* 兼容旧 class（若缓存残留） */
.tg-contact,
.x-contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: #f3eaff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.tg-icon,
.x-icon { display: none; }



/* np: three-d-off chrome — 3D entry/toggles hidden while THREE_D_ENABLED is false */
html[data-three-d="0"] [data-experience="3d"],
html[data-three-d="0"] .np-view-group,
html[data-three-d="0"] #btn-view-orbit,
html[data-three-d="0"] #btn-view-2d,
html[data-three-d="0"] .np-quality,
html[data-three-d="0"] #btn-quality {
  display: none !important;
}
