* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: linear-gradient(to bottom, #ffffff, #F7F3FD);
  --card-bg: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #888;
  --accent: #6b4ce6;
  --battery-green: #4caf50;
  --battery-bg: #e0e0e0;
  --border-radius: 20px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg) no-repeat fixed;
  color: var(--text-primary);
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  overflow-x: hidden;
}

/* 登录页面 */
.login-screen {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  padding-top: 168px;
}

.login-box {
  width: 100%;
  text-align: center;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.app {
  padding: 16px 20px;
  padding-bottom: 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 顶部 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  position: relative;
  z-index: 1;
}

.header-spacer {
  width: 24px;
}

.settings-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.settings-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

/* 电动车图片 */
.scooter-image {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.scooter-image img {
  width: 100%;
  height: auto;
}

.scooter-emoji {
  font-size: 100px;
  line-height: 1;
}

/* 卡片 */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* 主卡片 - 预计续航 */
.main-card {
  padding: 28px 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  margin-top: 270px;
}

.estimated-mileage {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}

.mileage-value {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
}

.mileage-unit {
  font-size: 24px;
  font-weight: 400;
  color: var(--text-secondary);
}

.battery-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

.battery-bar-container {
  width: 100%;
  height: 10px;
  background: var(--battery-bg);
  border-radius: 5px;
  overflow: hidden;
}

.battery-bar {
  height: 100%;
  background: var(--battery-green);
  border-radius: 5px;
  transition: width 0.6s ease;
}

.battery-label {
  display: inline-block;
  background: #333;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 8px;
}

/* 输入卡片 */
.input-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.input-card {
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.input-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.input-value-display {
  width: 100%;
}

.input-field {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  outline: none;
  padding: 0;
  -moz-appearance: textfield;
}

.input-field::-webkit-outer-spin-button,
.input-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-field::placeholder {
  color: #ddd;
}

.input-unit {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 滑动计算按钮 */
.slider-container {
  margin-top: auto;
  /* padding-top: 20px; */
}

.slider-track {
  position: relative;
  background: #101010;
  border-radius: 40px;
  height: 70px;
  display: flex;
  align-items: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.slider-thumb {
  position: absolute;
  left: 5px;
  top: 5px;
  width: 60px;
  height: 60px;
  background: #ffffff;;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 2;
  transition: none;
  touch-action: none;
}

.slider-thumb:active {
  cursor: grabbing;
}

.slider-thumb.reset {
  transition: left 0.3s ease;
}

.slider-thumb.success {
  background: var(--battery-green);
  transition: left 0.3s ease, background 0.3s ease;
}

.slider-text {
  flex: 1;
  text-align: center;
  color: #bbb;
  font-size: 15px;
  pointer-events: none;
  z-index: 1;
}

.slider-arrows {
  position: absolute;
  right: 20px;
  color: #ffffff;
  font-size: 18px;
  letter-spacing: 2px;
  pointer-events: none;
  animation: arrowPulse 1.5s ease-in-out infinite;
}

@keyframes arrowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  
  background: rgba(0, 0, 0, 0.4); /* 透明一点更好看 */
  backdrop-filter: blur(3px);   /* 核心：背景模糊 */
  -webkit-backdrop-filter: blur(3px); /* Safari 兼容 */

  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
}

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

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-body {
  padding: 20px 24px 24px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.setting-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.setting-input:focus {
  border-color: var(--accent);
}

.save-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.save-btn:active {
  opacity: 0.8;
}

.error-msg {
  color: #e74c3c;
  font-size: 13px;
  margin: 8px 0;
  min-height: 20px;
}

.modal-message {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Toast 提示 */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}
