/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background: #000;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: #fff;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0a0a0a 0%, #000 100%);
}

/* 顶部 */
.app-header {
  padding: 20px 16px 12px;
  text-align: center;
  border-bottom: 1px solid #222;
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #00ff00;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.status-text {
  font-size: 12px;
  color: #00ff00;
  letter-spacing: 2px;
}

.app-title {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #00ff00, #00cc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.app-version {
  font-size: 12px;
  color: #666;
}

/* 步骤通用 */
.step {
  flex: 1;
  padding: 20px 16px;
  display: none;
}

.step.active {
  display: block;
}

.step-header {
  margin-bottom: 20px;
}

.step-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.step-desc {
  font-size: 13px;
  color: #888;
}

/* 金额输入区域 */
.amount-section {
  background: #111;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.amount-input-wrap {
  display: flex;
  align-items: center;
  background: #1a1a1a;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.currency {
  font-size: 24px;
  font-weight: 800;
  color: #00ff00;
  margin-right: 8px;
}

.amount-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  outline: none;
}

.amount-input-wrap input::placeholder {
  color: #555;
}

.amount-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset {
  flex: 1;
  min-width: 60px;
  padding: 10px 0;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  color: #ffd700;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.preset:active {
  transform: scale(0.95);
  background: #333;
}

.section-divider {
  text-align: center;
  margin: 16px 0;
  position: relative;
}

.divider-text {
  background: #000;
  color: #555;
  font-size: 12px;
  padding: 0 12px;
  position: relative;
  z-index: 1;
}

.section-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #333;
}

/* 输入槽位 */
.input-slots {
  margin-bottom: 20px;
}

.slot-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}

.slot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 2px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
}

.slot:active {
  transform: scale(0.95);
}

.slot.banker {
  background: linear-gradient(135deg, #ff0000, #cc0000);
  border-color: #ff0000;
}

.slot.player {
  background: linear-gradient(135deg, #0000ff, #0000cc);
  border-color: #0000ff;
}

.slot.tie {
  background: linear-gradient(135deg, #ffaa00, #ff8800);
  border-color: #ffaa00;
}

.slot.tie {
  background: linear-gradient(135deg, #ffaa00, #ff8800);
  border-color: #ffaa00;
}

.slot-num {
  font-size: 16px;
  font-weight: 600;
  color: #666;
}

.slot.banker .slot-num,
.slot.player .slot-num {
  color: #fff;
}

/* 统计 */
.input-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  background: #111;
  border-radius: 12px;
  margin-bottom: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 12px;
  color: #888;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.stat-value.banker { color: #ff0000; }
.stat-value.player { color: #0000ff; }
.stat-value.tie { color: #ffaa00; }
.stat-value.tie { color: #ffaa00; }

.stat-unit {
  font-size: 12px;
  color: #888;
}

.stat-divider {
  width: 1px;
  height: 30px;
  background: #333;
}

/* 分析按钮 */
.btn-analyze {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #00ff00, #00cc00);
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-analyze:disabled {
  background: #333;
  color: #666;
}

.btn-analyze:not(:disabled):active {
  transform: scale(0.98);
}

.btn-icon {
  font-size: 18px;
}

.btn-text {
  font-size: 16px;
  font-weight: 600;
  color: #000;
}

.btn-analyze:disabled .btn-text {
  color: #888;
}

/* 扫描动画 */
.scan-animation {
  position: relative;
  height: 200px;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.grid-bg {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(0,255,0,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,0,0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  animation: gridMove 2s linear infinite;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(20px, 20px); }
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #00ff00, #ff0000, transparent);
  animation: scanDown 1.5s linear infinite;
  z-index: 2;
}

@keyframes scanDown {
  0% { top: 0; }
  100% { top: 200px; }
}

/* 进度条 */
.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff0000, #00ff00);
  width: 0;
  transition: width 0.3s;
  border-radius: 4px;
}

.progress-text {
  font-size: 14px;
  font-weight: 600;
  color: #00ff00;
  min-width: 40px;
  text-align: right;
}

/* 终端日志 */
.terminal-log {
  background: #0a0a0a;
  border-radius: 8px;
  padding: 12px;
  max-height: 120px;
  overflow-y: auto;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 12px;
}

.log-line {
  margin-bottom: 4px;
  color: #888;
}

.log-line.success { color: #00ff00; }
.log-line.warning { color: #ff0000; }

/* 预览卡片 */
.preview-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.preview-card {
  flex: 1;
  padding: 16px;
  border-radius: 12px;
  background: #111;
  border-left: 4px solid;
}

.preview-card.banker { border-left-color: #ff0000; }
.preview-card.player { border-left-color: #0000ff; }
.preview-card.tie { border-left-color: #ffaa00; }
.preview-card.tie { border-left-color: #ffaa00; }

.preview-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.preview-value {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.preview-value.banker { color: #ff0000; }
.preview-value.player { color: #0000ff; }
.preview-value.tie { color: #ffaa00; }
.preview-value.tie { color: #ffaa00; }

.preview-amount {
  font-size: 13px;
  color: #ffd700;
  margin-bottom: 6px;
}

.preview-rate {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-rate-bar {
  flex: 1;
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
}

.preview-rate-fill {
  height: 100%;
  background: #00ff00;
}

.preview-rate-text {
  font-size: 12px;
  color: #00ff00;
}

.hint-text {
  text-align: center;
  font-size: 13px;
  color: #ff0000;
  padding: 12px;
  background: rgba(255,0,0,0.1);
  border-radius: 8px;
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  text-align: center;
  border: 1px solid #333;
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #ff0000;
  margin-bottom: 12px;
}

.modal-desc {
  font-size: 14px;
  color: #ccc;
  line-height: 1.8;
  margin-bottom: 16px;
}

.highlight-red { color: #ff0000; font-weight: 600; }
.highlight-yellow { color: #ffd700; font-weight: 600; }

.share-progress {
  font-size: 16px;
  color: #00ff00;
  margin-bottom: 16px;
}

.share-current {
  font-size: 24px;
  font-weight: 700;
}

.btn-share {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ff0000, #cc0000);
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.btn-share:active {
  transform: scale(0.98);
}

/* 完整预测列表 */
.prediction-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.pred-item {
  padding: 16px;
  background: #111;
  border-radius: 12px;
  border-left: 4px solid;
}

.pred-item.banker { border-left-color: #ff0000; }
.pred-item.player { border-left-color: #0000ff; }
.pred-item.tie { border-left-color: #ffaa00; }
.pred-item.tie { border-left-color: #ffaa00; }

.pred-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pred-round {
  font-size: 12px;
  color: #888;
}

.pred-result {
  font-size: 20px;
  font-weight: 700;
}

.pred-result.banker { color: #ff0000; }
.pred-result.player { color: #0000ff; }
.pred-result.tie { color: #ffaa00; }
.pred-result.tie { color: #ffaa00; }

.pred-amount {
  font-size: 16px;
  font-weight: 600;
  color: #ffd700;
}

.pred-rate {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pred-rate-label {
  font-size: 12px;
  color: #888;
}

.pred-rate-bar {
  flex: 1;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
}

.pred-rate-fill {
  height: 100%;
  background: #00ff00;
}

.pred-rate-text {
  font-size: 14px;
  font-weight: 600;
  color: #00ff00;
}

/* 汇总卡片 */
.summary-card {
  background: #111;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.summary-label {
  font-size: 14px;
  color: #888;
}

.summary-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.summary-value.profit { color: #00ff00; }

/* 成功提示 */
.success-toast {
  background: rgba(0,255,0,0.1);
  border: 1px solid #00ff00;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  color: #00ff00;
  margin-bottom: 16px;
}

/* 底部 */
.app-footer {
  background: #111;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #333;
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-label {
  font-size: 14px;
  color: #888;
}

.footer-id {
  font-size: 18px;
  font-weight: 700;
  color: #ffd700;
}

.btn-copy {
  padding: 10px 16px;
  background: #ffd700;
  border: none;
  border-radius: 8px;
  color: #000;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-copy:active {
  transform: scale(0.98);
}

/* 金额分配展示 */
.amount-display {
  font-size: 13px;
  color: #ffd700;
  margin-top: 4px;
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

.step.active {
  animation: slideUp 0.3s ease-out;
}
