:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e4e7ef;
  --text: #161e2e;
  --text-muted: #667085;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --amber-bg: #fff7ed;
  --amber-text: #c2410c;
  --purple-bg: #f5f3ff;
  --purple-text: #6d28d9;
  --green-bg: #ecfdf3;
  --green-text: #027a48;
  --danger: #dc2626;
  --shadow: 0 4px 18px rgba(16, 24, 40, 0.06);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131b;
    --surface: #171f2c;
    --surface-2: #212b3d;
    --border: #2b374b;
    --text: #f3f5f8;
    --text-muted: #98a2b3;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --amber-bg: #2e1d10;
    --amber-text: #fdba74;
    --purple-bg: #251942;
    --purple-text: #c4b5fd;
    --green-bg: #064e3b;
    --green-text: #6ee7b7;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* 登录视图 */
.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 26px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--purple-bg);
  color: var(--purple-text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.login-desc {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: center;
  letter-spacing: 2px;
}

.login-form input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-color: var(--primary);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* 总站外壳 */
.portal-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.portal-topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.portal-logo {
  font-size: 28px;
  line-height: 1;
}

.portal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.portal-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.portal-main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

.hero-strip {
  margin-bottom: 22px;
}

.hero-copy h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.hero-copy p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* 工具卡片网格 */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.app-card-live:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.12);
}

.app-card-soon,
.app-card-placeholder {
  border-style: dashed;
}

.app-card-placeholder {
  opacity: 0.78;
}

.app-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
}

.app-icon-amber {
  background: var(--amber-bg);
}

.app-icon-purple {
  background: var(--purple-bg);
}

.app-icon-slate {
  background: var(--surface-2);
}

.app-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.pill-live {
  background: var(--green-bg);
  color: var(--green-text);
}

.pill-alert {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.pill-soon {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.pill-neutral {
  background: var(--surface-2);
  color: var(--text-muted);
}

.app-name {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 700;
}

.app-desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.app-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface-2);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.app-metrics strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.app-meta-note {
  font-size: 12px;
  color: var(--purple-text);
  background: var(--purple-bg);
  padding: 7px 10px;
  border-radius: 10px;
}

.app-cta {
  margin-top: auto;
  padding-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.app-cta-muted {
  color: var(--text-muted);
  font-weight: 600;
}

.portal-footer {
  text-align: center;
  padding: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #182230;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
}

@media (max-width: 560px) {
  .portal-sub {
    display: none;
  }
  .apps-grid {
    grid-template-columns: 1fr;
  }
}
