/* === 基础重置 & 变量 === */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f1118;
  --surface: #1a1d2b;
  --surface2: #242838;
  --text: #e8eaf0;
  --text2: #8b90a0;
  --accent: #4f8cff;
  --accent2: #6c5ce7;
  --green: #2ecc71;
  --orange: #f39c12;
  --red: #e74c3c;
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 390px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* === 顶部状态栏 === */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.status-bar__left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot--online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot--offline { background: var(--red); box-shadow: 0 0 6px var(--red); }

.status-label { font-size: 12px; color: var(--text2); }

.status-bar__center {
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-icon { font-size: 14px; }
.sim-info { font-size: 12px; color: var(--text2); }

.status-bar__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.update-badge {
  font-size: 10px;
  background: var(--red);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.btn-help {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--text2);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
}

/* === 账号栏 === */
.account-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface2);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.account-label {
  font-size: 12px;
  color: var(--text2);
}

.account-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.account-tag {
  font-size: 10px;
  background: rgba(79,140,255,0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
}

.expire-info {
  margin-left: auto;
  font-size: 11px;
  color: var(--text2);
}

.expire-info--warn {
  color: var(--orange);
  font-weight: 600;
}

.expire-info--danger {
  color: var(--red);
  font-weight: 600;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* === 拨号状态 === */
.dial-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 24px;
}

.dial-status__icon {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.dial-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--surface2);
  border: 3px solid var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: all 0.3s;
  z-index: 2;
}

.dial-circle--active {
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(46,204,113,0.3);
}

.dial-circle--dialing {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(79,140,255,0.3);
}

.dial-circle--playing {
  border-color: var(--accent2);
  box-shadow: 0 0 20px rgba(108,92,231,0.3);
}

.pulse-ring {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  z-index: 1;
}

.pulse-ring--active {
  animation: pulse-expand 1.5s ease-out infinite;
}

@keyframes pulse-expand {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

.dial-status__text {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.dial-status__detail {
  font-size: 13px;
  color: var(--text2);
}

/* === 统计网格 === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 16px 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}

.stat-card--highlight {
  background: rgba(46,204,113,0.1);
  border: 1px solid rgba(46,204,113,0.2);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.stat-card--highlight .stat-value {
  color: var(--green);
}

.stat-label {
  font-size: 11px;
  color: var(--text2);
}

/* === 任务信息 === */
.task-info {
  margin: 0 16px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.task-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.task-row:last-child { border-bottom: none; }

.task-label {
  font-size: 13px;
  color: var(--text2);
}

.task-value {
  font-size: 13px;
  color: var(--text);
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === 系统检查 === */
.check-list {
  margin: 0 16px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.toggle-arrow {
  font-size: 12px;
  transition: transform 0.3s;
}

.toggle-arrow--up { transform: rotate(180deg); }

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.check-item:last-child { border-bottom: none; }

.check-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.check-item--ok .check-icon {
  background: rgba(46,204,113,0.15);
  color: var(--green);
}

.check-item--warn .check-icon {
  background: rgba(243,156,18,0.15);
  color: var(--orange);
}

.check-item--error .check-icon {
  background: rgba(231,76,60,0.15);
  color: var(--red);
}

.check-text {
  font-size: 13px;
  flex: 1;
}

.check-item--warn .check-text { color: var(--orange); }

.btn-fix {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--orange);
  background: transparent;
  color: var(--orange);
  cursor: pointer;
}

/* === 快捷设置 === */
.quick-settings {
  margin: 0 16px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.settings-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.settings-panel--open {
  max-height: 300px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.setting-row:last-child { border-bottom: none; }

.setting-label {
  font-size: 13px;
  color: var(--text2);
}

.setting-value {
  font-size: 13px;
  color: var(--accent);
}

/* === 底部操作栏 === */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 390px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  gap: 12px;
}

.btn-action {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action--start {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}

.btn-action--start:active {
  transform: scale(0.97);
}

.btn-action--stop {
  background: var(--red);
  color: #fff;
}

.btn-action--stop:active {
  transform: scale(0.97);
}

/* === 弹层通用 === */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 999;
  pointer-events: none;
}

.toast--show { opacity: 1; }
