:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --muted: #8b92a0;
  --accent: #4f8cff;
  --accent-hover: #3a78f0;
  --danger: #ff5c5c;
  --success: #34d399;
  --running: #34d399;
  --manual: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

/* ---------- 登录页 ---------- */
.login-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  overflow: hidden;
}
.login-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
  z-index: -1;
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.login-card {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.login-logo {
  text-align: center;
  margin-bottom: 8px;
}
.login-logo img { width: 72px; height: 72px; object-fit: contain; border-radius: 50%; background: #fff; padding: 4px; }
.login-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
  text-align: center;
  color: #fff;
  letter-spacing: 1px;
}
.login-card .subtitle {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  text-align: center;
}
.login-card .field span { color: rgba(255, 255, 255, 0.85); }
.login-card .field input {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}
.login-card .field input::placeholder { color: rgba(255, 255, 255, 0.6); }
.login-card .field input:focus {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.2);
}
.login-card .remember { color: rgba(255, 255, 255, 0.85); }
.login-btn-wrap {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.login-card button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 11px 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 24px;
  letter-spacing: 4px;
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}
.login-card button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(102, 126, 234, 0.6);
}
.login-card button:disabled { opacity: 0.6; }
.login-card .error {
  color: #ffe0e0;
  text-align: center;
  margin-top: 14px;
}

/* ---------- 主界面背景 ---------- */
.main-body {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  color: #fff;
}
.app-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
  z-index: -1;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-icon img { width: 32px; height: 32px; object-fit: contain; border-radius: 50%; background: #fff; padding: 2px; display: block; }
.topbar h1 { margin: 0; font-size: 18px; color: #fff; letter-spacing: 1px; }
.topbar .ghost {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 14px;
}
.topbar .ghost:hover { background: rgba(255, 255, 255, 0.25); }

/* ---------- 左右布局 ---------- */
.layout {
  display: flex;
  gap: 20px;
  padding: 20px 28px;
  height: calc(100vh - 57px);
  box-sizing: border-box;
}
.panel {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  box-sizing: border-box;
}
.left-panel { flex: 4; min-width: 0; }
.right-panel { flex: 6; min-width: 0; display: flex; flex-direction: column; }
.panel-title {
  margin: 0 0 18px;
  font-size: 16px;
  color: #fff;
  letter-spacing: 1px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

/* ---------- 表单 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field span { font-size: 13px; color: rgba(255, 255, 255, 0.85); }
.field input {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
}
.field input::placeholder { color: rgba(255, 255, 255, 0.55); }
.field input:focus {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.22);
}
.field input[readonly] { opacity: 0.7; }

.code-row { display: flex; gap: 10px; align-items: flex-end; }
.code-row .field { flex: 1; margin-bottom: 0; }
.code-row .field input { height: 40px; box-sizing: border-box; }
.code-row .secondary {
  height: 40px;
  width: 120px;
  box-sizing: border-box;
  padding: 0 12px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, transform 0.15s;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  width: 100%;
  letter-spacing: 4px;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}
.primary:hover:not(:disabled) { transform: translateY(-1px); }
.secondary {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  white-space: nowrap;
}
.secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.28); }

.error { color: #ffd0d0; font-size: 13px; margin: 10px 0 0; }
.success { color: #d0ffe6; font-size: 13px; margin: 10px 0 0; }

/* ---------- 时长滚轮（紧凑） ---------- */
.duration-block { margin: 10px 0 16px; }
.duration-preview {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.duration-big { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.duration-unit { color: rgba(255, 255, 255, 0.75); font-size: 12px; }

.roller-wrap {
  position: relative;
  display: flex;
  gap: 10px;
  justify-content: center;
  height: 160px;
}
.roller {
  width: 64px;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}
.roller::-webkit-scrollbar { display: none; }
.roller-item {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  user-select: none;
}
.roller-item:hover { color: #fff; }
.roller-spacer { visibility: hidden; }
.roller-highlight {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 148px;
  height: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  pointer-events: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.presets {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.presets button {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 14px;
}
.presets button.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}

/* ---------- 状态展示区 ---------- */
.status-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.status-label { color: rgba(255, 255, 255, 0.75); font-size: 14px; }
.status-value { font-size: 16px; font-weight: 600; color: #fff; }
.status-value.running { color: #7ef0b8; }
.status-value.closed { color: rgba(255, 255, 255, 0.6); }
.status-value.manual { color: #ffd86b; }
.status-hint { margin: 12px 0 0; color: rgba(255, 255, 255, 0.7); font-size: 13px; }

/* ---------- 代理列表 ---------- */
.proxies-box {
  margin-top: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.proxies-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px 10px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
.proxies-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.proxies-list {
  flex: 1;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 0 0 10px 10px;
  padding: 0 14px;
}
.proxies-list::-webkit-scrollbar { width: 6px; }
.proxies-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 3px; }
.proxy-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 14px;
}
.proxy-row:last-child { border-bottom: none; }
.proxy-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.proxy-name {
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proxy-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proxy-conns { color: rgba(255, 255, 255, 0.7); white-space: nowrap; }
.muted { color: rgba(255, 255, 255, 0.6); font-size: 13px; margin: 12px 0; text-align: center; }
