:root {
  --bg: #0d1117;
  --bg-elev: #161b22;
  --bg-input: #0b1017;
  --border: #263041;
  --border-soft: #1e2733;
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --accent: #f0524d;
  --accent-2: #4f9cf9;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(1200px 600px at 15% -10%, #1b2534 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

/* ------------------------------------------------------------------ header */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: cover;
  border-radius: 4px;
  filter: drop-shadow(0 4px 10px rgba(240, 82, 77, 0.35));
}

.brand-text h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.4px;
}

.brand-text p {
  margin: 2px 0 0;
  color: var(--text-dim);
  font-size: 12.5px;
}

.conn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 6px 14px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.dot-ok {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.7);
}

.dot-err {
  background: var(--err);
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.7);
}

.dot-idle {
  background: var(--warn);
}

/* -------------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: 6px;
  margin: 24px 0 16px;
  border-bottom: 1px solid var(--border-soft);
}

.tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 14.5px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* 只剩一个页签时不做成可点的假按钮 */
.tab-static {
  cursor: default;
}

/* ------------------------------------------------------------------ panels */

.panel {
  display: none;
}

.panel.is-active {
  display: block;
  animation: fade 0.18s ease-out;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.25fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  text-transform: uppercase;
  opacity: 0.85;
}

.card-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 16px 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

/* 段落标题右侧：说明文字 + 操作按钮 */
.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sub-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text);
}

.section-note {
  font-size: 12px;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ fields */

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input[type="text"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.15);
}

/* ----------------------------------------------------------------- buttons */

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn {
  appearance: none;
  background: #1d2532;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  background: #232d3d;
  border-color: #38465c;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #f4605a, #d8413c);
  border-color: #e04b46;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ff6d67, #e04b46);
  border-color: #ff6d67;
}

.btn-tiny {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 7px;
}

/* ----------------------------------------------------------------- account */

.account-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border-soft);
  margin-bottom: 14px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, #3d5a80, #29384f);
  border: 1px solid var(--border);
  flex: none;
  overflow: hidden;
}

.account-name {
  font-size: 16px;
  font-weight: 700;
}

.account-sub {
  font-size: 12.5px;
  color: var(--text-dim);
}

.kv {
  margin: 0 0 14px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
}

.kv-row dt {
  color: var(--text-dim);
  font-size: 12.5px;
  flex: none;
}

.kv-row dd {
  margin: 0;
  text-align: right;
  word-break: break-all;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
}

/* 冷却 / 服役勋章这类中文结果不适合等宽字体 */
.kv-row dd.plain {
  font-family: inherit;
  font-size: 13px;
}

/* Steam64 → Steam 个人主页链接 */
.profile-link {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px dashed rgba(79, 156, 249, 0.5);
  cursor: pointer;
}

.profile-link:hover {
  color: #8ec2ff;
  border-bottom-style: solid;
}

.profile-link.is-disabled {
  color: inherit;
  border-bottom: none;
  cursor: default;
}

.btn-danger { color: #ffb4ae; border-color: rgba(248, 81, 73, 0.55); }
.btn-danger:hover:not(:disabled) { background: rgba(248, 81, 73, 0.16); border-color: #ff7b72; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: #1d2532;
  border: 1px solid var(--border);
  color: var(--text-dim);
  margin-bottom: 16px;
}

.badge.ok {
  background: rgba(63, 185, 80, 0.14);
  border-color: rgba(63, 185, 80, 0.5);
  color: #56d364;
}

.badge.err {
  background: rgba(248, 81, 73, 0.14);
  border-color: rgba(248, 81, 73, 0.5);
  color: #ff7b72;
}

.badge.busy {
  background: rgba(79, 156, 249, 0.14);
  border-color: rgba(79, 156, 249, 0.5);
  color: #79b8ff;
}

/* ----------------------------------------------------------------- metrics */

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
}

.metric-wide {
  grid-column: 1 / -1;
}

.metric-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.metric strong {
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

/* ---------------------------------------------------------------- progress */

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 12px;
  background: rgba(79, 156, 249, 0.08);
  border: 1px solid rgba(79, 156, 249, 0.25);
  border-radius: 9px;
  font-size: 13px;
  color: #9dc4f5;
}

/* hidden 属性必须真正生效：.progress 上的 display:flex 优先级高于浏览器给 [hidden]
   加的 display:none，不做这条兜底，进度条会永远可见、一直停在上一条文案。 */
.progress[hidden] {
  display: none;
}

/* 查询收尾态：不转圈，改成绿色 ✓ */
.progress.is-done {
  background: rgba(63, 185, 80, 0.08);
  border-color: rgba(63, 185, 80, 0.3);
  color: #56d364;
}

.progress.is-done .spinner {
  display: none;
}

.progress.is-done::before {
  content: '✓';
  font-weight: 700;
  flex: none;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(157, 196, 245, 0.3);
  border-top-color: #79b8ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ----------------------------------------------------------------- history */

.history {
  margin-top: 20px;
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 190px;
  overflow-y: auto;
}

.history-list li {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.history-list li:hover {
  background: #1d2532;
  border-color: var(--border);
}

.history-list li .huser {
  font-weight: 600;
}

.history-list li .hid {
  color: var(--text-dim);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.history-empty {
  color: var(--text-dim);
  cursor: default !important;
  justify-content: center;
}

.history-empty:hover {
  background: transparent !important;
  border-color: transparent !important;
}

/* --------------------------------------------------------------- raw/status */

.raw-toggle {
  margin-top: 16px;
}

.raw {
  margin: 10px 0 0;
  padding: 12px;
  background: #080c12;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
  color: #9fb0c4;
}

.statusbar {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-dim);
}

.statusbar.ok {
  border-color: rgba(63, 185, 80, 0.45);
  color: #56d364;
}

.statusbar.err {
  border-color: rgba(248, 81, 73, 0.45);
  color: #ff7b72;
}

.statusbar.info {
  border-color: rgba(79, 156, 249, 0.45);
  color: #79b8ff;
}

.status-icon {
  font-weight: 700;
}
