/* ============================================
   神皇预测 App - 全局样式
   Mobile-first, 主题: 深蓝黑 + 红
   ============================================ */

:root {
  --bg: #f5f5f5;
  --bg-dark: #1a1a2e;
  --red: #e94560;
  --red-dark: #c23150;
  --white: #ffffff;
  --text: #333333;
  --text-light: #999999;
  --text-white: #ffffff;
  --border: #eeeeee;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 56px;
  --header-height: 48px;
  --tab-height: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, button { font-family: inherit; outline: none; border: none; }
button { cursor: pointer; }

/* ============================================
   App Container
   ============================================ */
#app {
  width: 100%;
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* ============================================
   Page System
   ============================================ */
.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
}

.page.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* prediction page — flex layout (no position:fixed hack) */
#page-prediction.active {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#page-prediction.active .predict-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}
#page-prediction.active .predict-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.page.pb-full {
  padding-bottom: calc(var(--header-height) + 20px);
}

body.page-splash .bottom-nav,
body.page-login .bottom-nav,
body.page-webview .bottom-nav { display: none; }

body.page-splash .page.pb-full,
body.page-login .page.pb-full { padding-bottom: 20px; }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  text-align: center;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: var(--text-white);
  border: none;
}

.btn-outline {
  background: var(--white);
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-danger {
  background: var(--white);
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

.btn-block {
  width: 100%;
  display: flex;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-outline-primary {
  background: var(--white);
  color: var(--bg-dark);
  border: 1px solid var(--border);
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
  padding-left: 2px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--red);
}

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 20px;
  color: var(--text-light);
  transition: color 0.2s;
  font-size: 11px;
}

.nav-item.active {
  color: var(--red);
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
}

.nav-label {
  font-size: 11px;
}

/* ============================================
   Floating Button
   ============================================ */
.float-btn {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.3);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: floatPulse 2s infinite;
}

.float-btn img {
  width: 32px;
  height: 32px;
}

@keyframes floatPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(233, 69, 96, 0.3); }
  50% { box-shadow: 0 4px 24px rgba(233, 69, 96, 0.5); }
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton-card {
  background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  margin: 12px;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Spinner
   ============================================ */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  width: 85%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  animation: slideUp 0.25s ease;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--bg-dark);
  text-align: center;
}

.modal-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  text-align: center;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Splash Page
   ============================================ */
#page-splash {
  background: var(--bg-dark);
}

.splash-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.splash-loading {
  text-align: center;
}

.splash-loading p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-top: 8px;
}

.splash-ad {
  position: relative;
  width: 100%;
  height: 100%;
}

.splash-ad img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.splash-skip {
  position: absolute;
  top: 40px;
  right: 16px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 10;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

/* ============================================
   Login Page
   ============================================ */
#page-login {
  background: var(--white);
}

.login-container {
  padding: 30px 28px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
  margin-top: 40px;
}

.login-logo {
  font-size: 56px;
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--bg-dark);
  margin-bottom: 6px;
}

.login-header p {
  font-size: 13px;
  color: var(--text-light);
}

.login-tabs {
  display: flex;
  margin-bottom: 24px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.login-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-light);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.login-tab.active {
  background: var(--white);
  color: var(--bg-dark);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.login-form {
  display: none;
}

.login-form.active {
  display: block;
}

/* ============================================
   Common Header (prediction page)
   ============================================ */
.home-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 10px;
}

.home-logo {
  display: flex;
  align-items: center;
  line-height: 1;
}

.home-title {
  color: var(--text-white);
  font-size: 17px;
  font-weight: 600;
  flex: 1;
}

.home-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  flex-shrink: 0;
}

.home-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.notice-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.notice-marquee {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 20px;
}

.notice-marquee span {
  display: block;
  white-space: nowrap;
  animation: marquee 12s linear infinite;
  font-size: 13px;
  color: var(--text-light);
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ============================================
   Prediction Page - Horizontal Scrollable Tabs
   ============================================ */
#page-prediction {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.predict-tabs-wrapper {
  position: sticky;
  top: 62px;
  z-index: 49;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.predict-tabs-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 8px;
  gap: 4px;
}

.predict-tabs-container::-webkit-scrollbar {
  display: none;
}

.predict-tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  user-select: none;
}

.predict-tab:active {
  color: var(--red);
}

.predict-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
}

.predict-tabs-skeleton {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
}

.skeleton-tab {
  width: 80px;
  height: 28px;
  border-radius: 14px;
  margin: 0;
}

/* Prediction Content Area */
.predict-content {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.predict-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.predict-placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  opacity: 0.5;
}

.predict-placeholder p {
  font-size: 14px;
}

.predict-content iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  display: block;
}

/* ============================================
   WebView Page
   ============================================ */
#page-webview {
  background: var(--white);
}

.webview-header {
  display: flex;
  align-items: center;
  padding: 0 8px;
  height: var(--header-height);
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 8px;
}

.webview-back {
  background: none;
  color: var(--text-white);
  font-size: 16px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.webview-title {
  color: var(--text-white);
  font-size: 16px;
  font-weight: 500;
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 20px;
}

.webview-container {
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
}

.webview-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.webview-close {
  display: none;
}

/* ============================================
   Profile Page
   ============================================ */
#page-profile {
  background: var(--bg);
}

.profile-header {
  text-align: center;
  padding: 30px 20px 24px;
  background: linear-gradient(135deg, var(--bg-dark), #2d2d50);
  color: var(--text-white);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 12px;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-nickname {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.profile-vip-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.profile-vip-status.vip-active {
  color: #ffd700;
}

.profile-form,
.profile-actions {
  padding: 16px;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* VIP Section inside Profile */
.profile-vip-section {
  padding: 16px;
  margin-top: 8px;
}

.vip-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--bg-dark);
  margin-bottom: 14px;
  text-align: center;
}

.vip-section-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--bg-dark);
  margin-bottom: 12px;
}

.vip-packages {
  display: flex;
  flex-direction: column;
}

.vip-package {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.vip-package.selected {
  border-color: var(--red);
}

.vip-package-info h3 {
  font-size: 16px;
  color: var(--bg-dark);
  margin-bottom: 4px;
}

.vip-package-info p {
  font-size: 13px;
  color: var(--text-light);
}

.vip-package-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--red);
}

.vip-package-price span {
  font-size: 13px;
}

.vip-paymethods {
  margin-top: 16px;
}

.paymethod-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paymethod-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.paymethod-item.selected {
  border-color: var(--red);
}

.paymethod-item .paymethod-name {
  font-size: 15px;
  color: var(--bg-dark);
}

.paymethod-item .paymethod-check {
  color: var(--red);
  font-size: 18px;
  display: none;
}

.paymethod-item.selected .paymethod-check {
  display: block;
}

.vip-pay-btn {
  margin-top: 14px;
}

/* ============================================
   Chat Page (placeholder)
   ============================================ */
#page-chat {
  padding-bottom: 56px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.chat-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px 20px;
}

.chat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  opacity: 0.7;
}

.chat-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--bg-dark);
  margin-bottom: 8px;
}

.chat-desc {
  font-size: 13px;
  color: var(--text-light);
}

/* ============================================
   Payment Form Overlay
   ============================================ */
.payment-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.payment-container {
  background: var(--white);
  border-radius: var(--radius);
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  overflow: auto;
  padding: 16px 20px;
  position: relative;
  animation: slideUp 0.25s ease;
}

.payment-close {
  position: sticky;
  top: 0;
  text-align: right;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  z-index: 1;
}

.payment-container iframe {
  width: 100%;
  min-height: 300px;
  border: none;
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}
