:root {
  /* Telegram 原生主题变量接入，带回退默认值（iOS 浅色风格） */
  --bg-color: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --section-bg: var(--tg-theme-bg-color, #ffffff);
  --text-color: var(--tg-theme-text-color, #000000);
  --hint-color: var(--tg-theme-hint-color, #8e8e93);
  --link-color: var(--tg-theme-link-color, #007aff);
  --button-color: var(--tg-theme-button-color, #007aff);
  --button-text-color: var(--tg-theme-button-text-color, #ffffff);
  --separator-color: var(--tg-theme-section-separator-color, rgba(60,60,67,0.15));
  --danger-color: #ff3b30;
  --ok-color: #34c759;
  
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  margin: 0;
  padding: 0 0 40px 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  -webkit-tap-highlight-color: transparent;
}

/* 顶部 Header */
.header {
  padding: 16px 20px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.status-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--hint-color);
  color: #fff;
  font-weight: 500;
  flex-shrink: 0;
}
.status-badge.ok { background: var(--ok-color); }
.status-badge.error { background: var(--danger-color); }

/* 分段选项卡 Segmented Control (iOS 风格) */
.segmented-control {
  display: flex;
  margin: 10px 16px 20px;
  background: rgba(118, 118, 128, 0.12);
  padding: 2px;
  border-radius: 8px;
}

.segment {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.segment.active {
  background: var(--section-bg);
  box-shadow: 0 3px 1px rgba(0,0,0,0.04), 0 3px 8px rgba(0,0,0,0.12);
}

/* 容器面板 */
.panel { display: none; }
.panel.active { 
  display: block; 
  animation: fade-in 0.2s ease-out; 
}
@keyframes fade-in { 
  from { opacity: 0; transform: translateY(5px); } 
  to { opacity: 1; transform: translateY(0); } 
}

/* 列表和标题 (Inset Grouped List) */
.section-title {
  margin: 16px 16px 6px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--hint-color);
  letter-spacing: 0.5px;
}

.section-footer {
  margin: 8px 20px 16px;
  font-size: 13px;
  color: var(--hint-color);
  line-height: 1.4;
}

.list-group {
  background: var(--section-bg);
  border-radius: 10px;
  margin: 0 16px;
  overflow: hidden;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--separator-color);
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}
.list-item:last-child { border-bottom: none; }

.item-label {
  color: var(--text-color);
  white-space: nowrap;
  flex-shrink: 0;
}

.item-value {
  color: var(--hint-color);
  text-align: right;
  margin-left: 16px;
  font-size: 15px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-control {
  flex: 1;
  text-align: right;
  border: none;
  background: transparent;
  color: var(--link-color);
  font-size: 16px;
  outline: none;
  margin-left: 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.item-control option {
  direction: ltr;
}

/* 按钮组 */
.button-group { margin: 12px 16px; display: flex; gap: 8px; }
.button-group.horizontal { flex-direction: row; }
.button-group.horizontal button { flex: 1; }

button {
  display: block;
  width: 100%;
  padding: 11px 16px; /* 减小上下内边距 */
  border-radius: 8px; /* 减小圆角 */
  border: none;
  font-size: 14px; /* 减小字体 */
  font-weight: 500; /* 减轻字重 */
  letter-spacing: 0.3px; /* 增加一点字间距，更精致 */
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1); /* 更顺滑的动画 */
}

button:active { 
  opacity: 0.8; 
  transform: scale(0.98); /* 点击时微微缩小的互动感 */
}

button:active { opacity: 0.7; }
button:disabled { opacity: 0.5; pointer-events: none; }

.primary-btn {
  background: var(--button-color);
  color: var(--button-text-color);
}
.secondary-btn {
  background: rgba(0, 122, 255, 0.08); /* 淡蓝色背景 */
  color: var(--link-color);
}
.danger-btn {
  background: rgba(255, 59, 48, 0.08); /* 淡红色背景 */
  color: var(--danger-color);
}

/* 日志框 */
.logs-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
}
.inline-select {
  border: none;
  background: transparent;
  color: var(--link-color);
  font-size: 13px;
  outline: none;
  max-width: 100px;
}
.log-container {
  margin: 0 16px 20px;
  padding: 12px 16px;
  background: var(--section-bg);
  border-radius: 10px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-color);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.5;
}
.logs-box { color: var(--hint-color); }


.list-item.expandable {
  flex-direction: column;
  align-items: stretch;
  cursor: pointer;
}
.expandable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.expandable-content {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--separator-color);
  font-size: 13px;
  color: var(--hint-color);
  background: rgba(0,0,0,0.02);
  border-radius: 6px;
  padding: 8px;
}
.expandable-content.show {
  display: block;
}
.process-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.process-name { font-family: monospace; }
.process-usage { font-weight: bold; color: var(--text-color); }

.input-text {
  text-align: right;
  direction: ltr; /* 输入框正常方向 */
  background: transparent;
  color: var(--text-color);
}
.input-text::placeholder {
  color: var(--hint-color);
  opacity: 0.6;
}
.tiny-btn {
  padding: 4px 12px;
  font-size: 13px;
  width: auto;
  min-height: auto;
  border-radius: 12px;
  background: var(--button-color);
  color: var(--button-text-color);
  margin-left: 10px;
}
.full-width-select {
  width: 100%;
  text-align: left;
  direction: ltr;
}
