:root {
  /* 颜色系统 */
  --bg-body: #0a0a0c;
  --bg-card: rgba(18, 18, 20, 0.75);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-hover: rgba(255, 255, 255, 0.08);
  --bg-input-focus: rgba(255, 255, 255, 0.12);

  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.2);
  --border-accent: #0ea5e9;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-accent: #38bdf8;

  --btn-primary: #0284c7;
  --btn-primary-hover: #0369a1;
  --btn-danger: #ef4444;
  --btn-danger-hover: #dc2626;
  --btn-success: #10b981;
  --btn-success-hover: #059669;

  --error-bg: rgba(239, 68, 68, 0.15);
  --error-text: #fca5a5;

  /* 阴影和光效 */
  --shadow-card: 0 24px 80px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.15);

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 增加微妙的背景渐变网格或纹理（这里用极其隐约的径向渐变） */
  background-image: radial-gradient(circle at 50% 0%, rgba(30, 30, 40, 0.5) 0%, var(--bg-body) 100%);
  background-attachment: fixed;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

button,
select,
input {
  font: inherit;
}

/* 通用容器与卡片 */
.wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
}

.hub {
  max-width: 1024px;
  padding: 40px;
}

/* 排版 */
h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

h3 {
  margin: 24px 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}

p.sub {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.panel-sub {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* 等宽字体块 */
.mono {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  color: var(--text-main);
}

code,
.model-value,
.restart-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* 表单与输入框 */
.field {
  margin-bottom: 20px;
}

.field label,
.field span {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field input,
.field select,
.model-form select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-size: 16px;
  transition: all 0.2s ease;
  outline: none;
}

.field select,
.model-form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 40px;
}

option {
  background-color: var(--bg-body);
  color: var(--text-main);
}

.field input:hover,
.field select:hover,
.model-form select:hover {
  background-color: var(--bg-input-hover);
}

.field input:focus,
.field select:focus,
.model-form select:focus {
  background-color: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 20px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--btn-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.btn-inline {
  width: auto;
  min-width: 220px;
}

/* 错误提示 */
.error {
  margin: 0 0 20px;
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 主页服务网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.service {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* 添加一个微妙的渐变发光遮罩效果 */
.service::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.1), transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.service:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-glow);
}

.service:hover::before {
  opacity: 1;
}

.service-icon {
  margin-bottom: 16px;
  color: var(--text-accent);
  width: 32px;
  height: 32px;
}

.service h3 {
  margin: 0 0 8px;
  font-size: 20px;
  position: relative;
  z-index: 1;
}

.service p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* 顶部导航与操作 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 12px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logout {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.logout:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.panel {
  margin-top: 20px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.model-meta {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label {
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.model-value {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  word-break: break-all;
}

.model-form {
  margin-top: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.field-inline {
  flex: 1;
  margin-bottom: 0;
}

.status {
  margin-top: 16px;
  min-height: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.status[data-tone="success"] {
  color: #86efac;
}

.status[data-tone="error"] {
  color: var(--error-text);
}

.restart-log {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 设备列表 */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}

.device-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.device-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.device-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
}

.device-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background: var(--btn-success);
  color: #fff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--btn-danger);
  color: #fff;
}

.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.badge-current {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .card {
    padding: 28px 24px;
    border-radius: var(--radius-lg);
  }

  .hub {
    padding: 24px 20px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 20px;
  }

  .topbar,
  .panel-head,
  .model-form {
    flex-direction: column;
    gap: 16px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .btn-inline,
  .logout {
    width: 100%;
    justify-content: center;
  }

  .device-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .device-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .device-meta .meta-sep {
    display: none;
  }

  .device-meta span {
    word-break: break-all;
  }

  .device-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
