/* LXW 奇门遁甲 V9.0 - 移动端响应式样式 */

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

:root {
  --bg-dark: #0f0f1e;
  --bg-card: #1a1a2e;
  --bg-card-2: #232342;
  --border: #2d2d4a;
  --text: #e8e8f0;
  --text-2: #a0a0b8;
  --text-3: #6e6e8a;
  --primary: #d4af37;       /* 古铜金 */
  --primary-2: #f0c850;
  --accent: #8b5cf6;         /* 玄紫 */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
  background: var(--bg-dark);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ============ 启动屏 ============ */
.splash {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 50%, #2d1b4e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.splash-inner { text-align: center; }
.splash-symbol {
  font-size: 80px;
  color: var(--primary);
  text-shadow: 0 0 30px rgba(212,175,55,0.6);
  animation: pulse 2s ease-in-out infinite;
}
.splash-title {
  font-size: 24px;
  color: var(--text);
  margin-top: 16px;
  letter-spacing: 4px;
}
.splash-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 8px;
}
.splash-loader {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  margin: 24px auto 0;
  animation: loading 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}
@keyframes loading {
  0% { transform: translateX(-30px); }
  100% { transform: translateX(30px); }
}

/* ============ App 容器 ============ */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-dark);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ============ 顶部 ============ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  padding: 0 16px;
  background: rgba(15, 15, 30, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo {
  font-size: 22px;
  color: var(--primary);
  text-shadow: 0 0 8px rgba(212,175,55,0.4);
}
.brand {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
}
.user-info {
  font-size: 13px;
  color: var(--text-2);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  margin-left: 8px;
}
.btn-icon:hover { color: var(--danger); border-color: var(--danger); }

/* ============ 标签栏 ============ */
.tab-bar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  height: 64px;
  background: rgba(15, 15, 30, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: color 0.2s;
}
.tab.active { color: var(--primary); }
.tab-icon { font-size: 20px; }
.tab-label { font-size: 11px; }

/* ============ 内容 ============ */
.content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
}
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 卡片 ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}
.card-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
}

/* ============ 表单 ============ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  height: 44px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
textarea.form-control {
  height: auto;
  min-height: 60px;
  padding: 12px 14px;
  resize: vertical;
}
.form-control:focus { border-color: var(--primary); }

.time-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.time-row .form-control { flex: 1; }

.form-tip {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
  text-align: center;
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #0f0f1e;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(212,175,55,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(212,175,55,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
  background: var(--bg-card-2);
  color: var(--text);
  border: 1px solid var(--border);
  height: 44px;
  padding: 0 16px;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }

/* ============ 标签切换 ============ */
.tab-switch {
  display: flex;
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}
.ts-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-2);
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.ts-tab.active {
  background: var(--primary);
  color: #0f0f1e;
  font-weight: 600;
}

/* ============ 起盘结果 ============ */
.pan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.pan-dun {
  font-size: 14px;
  padding: 4px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
}

/* 九宫格 */
.nine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  aspect-ratio: 1;
  margin-bottom: 16px;
  background: var(--bg-card-2);
  border-radius: 12px;
  padding: 4px;
}
.gong-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  position: relative;
  min-height: 70px;
}
.gong-cell.center { background: linear-gradient(135deg, var(--bg-card) 0%, rgba(139,92,246,0.1) 100%); }
.gong-name {
  font-size: 11px;
  color: var(--text-3);
  position: absolute;
  top: 4px;
  left: 6px;
}
.gong-gan {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 8px rgba(212,175,55,0.3);
}
.gong-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-2);
}
.gong-meta .xing { color: var(--accent); font-size: 12px; font-weight: 600; }
.gong-meta .men { color: var(--success); }
.gong-meta .shen { color: var(--warning); }

.pan-summary {
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}
.pan-summary-item { display: flex; gap: 6px; }
.pan-summary-label { color: var(--text-3); }
.pan-summary-value { color: var(--text); font-weight: 600; }

.pan-interpretation {
  background: var(--bg-card-2);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.watermark {
  font-size: 10px;
  color: var(--text-3);
  text-align: right;
  font-family: 'Courier New', monospace;
  word-break: break-all;
  padding: 8px;
  background: var(--bg-card-2);
  border-radius: 6px;
}

/* ============ 历史列表 ============ */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.history-item:hover { border-color: var(--primary); }
.history-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.history-item-type {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--primary);
  color: #0f0f1e;
  border-radius: 4px;
  font-weight: 600;
}
.history-item-time {
  font-size: 12px;
  color: var(--text-3);
}
.history-item-q {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}
.history-item-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* ============ 我的页 ============ */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-of-type { border-bottom: none; margin-bottom: 16px; }
.info-row span:first-child { color: var(--text-2); }
.info-row span:last-child { color: var(--text); font-weight: 500; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: 280px;
  text-align: center;
}
.toast.show { opacity: 1; }
.toast.error { background: rgba(239, 68, 68, 0.95); }
.toast.success { background: rgba(16, 185, 129, 0.95); }

/* ============ 响应式 ============ */
@media (min-width: 768px) {
  .app { box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  .nine-grid { max-width: 400px; margin: 0 auto 16px; }
}
@media (max-width: 360px) {
  body { font-size: 14px; }
  .card { padding: 16px; }
  .gong-gan { font-size: 18px; }
}
