/* Grsai Studio — 深空仪表盘
 *
 * 设计意图：科幻感来自「精密仪器」而不是「霓虹灯」。所以用的是
 * 细亮线、角标、等宽数字、克制的辉光；不用大面积渐变和发光文字。
 * 数据是主角，装饰必须让位于可读性。
 *
 * 浅色模式不硬凑科幻 —— 亮底上的深空感是假的。浅色走干净专业路线，
 * 只保留同一套青色主色，让两种模式认得出是同一个产品。
 */

:root {
  /* 深空基底：不是纯黑，带一点蓝，眼睛更舒服 */
  --bg: #070a11;
  --bg-2: #0a0f18;
  --panel: rgba(15, 22, 35, .78);
  --panel-solid: #0f1623;
  --panel-2: rgba(24, 34, 52, .6);

  --line: rgba(96, 165, 220, .14);      /* 常规分隔线 */
  --line-2: rgba(96, 200, 255, .28);    /* 强调边框 */

  --text: #dae4f2;
  --text-dim: #9fb0c6;
  --muted: #6d8098;

  --accent: #35d6f5;                    /* 主色：青 */
  --accent-2: #7c6cff;                  /* 次色：紫，只用于点缀 */
  --accent-dim: rgba(53, 214, 245, .12);

  --ok: #3ce0a0;
  --bad: #ff6b74;
  --warn: #ffc25c;
  --warn-bg: rgba(255, 194, 92, .09);

  --radius: 6px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", monospace;
  --shadow: 0 2px 18px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6fa;
    --bg-2: #eaeef5;
    --panel: #ffffff;
    --panel-solid: #ffffff;
    --panel-2: #f0f3f8;
    --line: #dde3ec;
    --line-2: rgba(20, 150, 180, .35);
    --text: #14202f;
    --text-dim: #46586e;
    --muted: #6c7d92;
    --accent: #0d9fc4;
    --accent-2: #6250e8;
    --accent-dim: rgba(13, 159, 196, .1);
    --ok: #12855c;
    --bad: #cc3844;
    --warn: #9a6600;
    --warn-bg: #fff6e2;
    --shadow: 0 1px 4px rgba(20, 40, 70, .08);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Inter", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 背景层：两团极淡的辉光 + 一层网格。z-index 压在最底，不吃点击。 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(53, 214, 245, .10), transparent 60%),
    radial-gradient(760px 480px at 92% 4%, rgba(124, 108, 255, .09), transparent 62%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .5;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body::after { opacity: .55; }
}

/* ---------------------------------------------------------------- 顶栏 */

header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 52px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand span { color: var(--accent); }

nav { display: flex; gap: 2px; height: 100%; min-width: 0; }
nav button {
  position: relative;
  background: none;
  border: 0;
  padding: 0 14px;
  height: 100%;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  letter-spacing: .02em;
  transition: color .15s;
  /* 不许被压缩换行 —— 窄屏时宁可横向滚动，也不能把「生成」竖排 */
  flex: none;
  white-space: nowrap;
}
nav button:hover { color: var(--text); }
nav button.on { color: var(--accent); }
/* 激活态用一条底部亮线 + 微弱上扬辉光，像仪表盘的选中通道 */
nav button.on::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
nav button.on::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, var(--accent-dim));
  pointer-events: none;
}

.spacer { flex: 1; }

main { padding: 22px 20px 60px; max-width: 1440px; margin: 0 auto; }
.page { display: none; animation: rise .22s ease-out; }
.page.on { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

/* ---------------------------------------------------------------- 卡片 */

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
/* 顶边一条渐隐的亮线 —— 卡片的「通电」感来源 */
.card::before {
  content: "";
  position: absolute;
  top: -1px; left: 14px; right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2) 30%,
              var(--line-2) 70%, transparent);
}
/* 左上角标 */
.card::after {
  content: "";
  position: absolute;
  top: 8px; left: 8px;
  width: 9px; height: 9px;
  border-left: 1px solid var(--line-2);
  border-top: 1px solid var(--line-2);
  opacity: .8;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}
/* 标题右侧拉一条延伸线，强化仪表面板的分区感 */
.card h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* ---------------------------------------------------------------- 表单 */

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

input, select, textarea, button.btn {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 11px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea {
  width: 100%;
  resize: vertical;
  min-height: 84px;
  line-height: 1.62;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--panel-solid);
}
input:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
/* 数字用等宽，读数才对得齐 */
input[type="number"] { font-family: var(--mono); }

button.btn { cursor: pointer; letter-spacing: .01em; }
button.btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
button.btn:active:not(:disabled) { transform: translateY(1px); }

button.primary {
  background: linear-gradient(180deg, var(--accent), #1eb8d8);
  color: #041018;
  border-color: transparent;
  font-weight: 600;
  padding: 9px 20px;
  box-shadow: 0 0 16px rgba(53, 214, 245, .22);
}
button.primary:hover:not(:disabled) {
  color: #041018;
  filter: brightness(1.1);
  box-shadow: 0 0 22px rgba(53, 214, 245, .38);
}
button.primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
button.tiny { padding: 4px 10px; font-size: 12px; }

/* ---------------------------------------------------------------- 状态标 */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .02em;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--text-dim);
  white-space: nowrap;
}
/* 前置状态点：默认灰，ok 绿，bad 红，带同色辉光 */
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.pill.ok { color: var(--ok); border-color: rgba(60, 224, 160, .3); }
.pill.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.bad { color: var(--bad); border-color: rgba(255, 107, 116, .3); }
.pill.bad::before { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
/* 内含勾选框时不要那个状态点 */
.pill:has(input[type="checkbox"])::before { display: none; }
.pill input[type="checkbox"] { accent-color: var(--accent); margin: 0; }

/* ---------------------------------------------------------------- 图片网格 */

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.thumb {
  position: relative;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.thumb:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .4);
}
.thumb.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px rgba(53, 214, 245, .25);
}
.thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  /* 棋盘格：透明底素材一眼可辨 */
  background:
    repeating-conic-gradient(rgba(128, 150, 180, .16) 0% 25%, transparent 0% 50%)
    50% / 16px 16px;
}
.thumb .meta {
  padding: 9px 10px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.thumb .meta b { color: var(--text-dim); font-weight: 500; }
.thumb .p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.badge {
  position: absolute;
  top: 8px; left: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(5, 10, 18, .82);
  border: 1px solid var(--line-2);
  color: var(--accent);
  backdrop-filter: blur(4px);
}

/* ---------------------------------------------------------------- 表格 */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-bottom-color: var(--line-2);
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: var(--accent-dim); }
/* 表格里的数字对齐才像仪表盘 */
td { font-variant-numeric: tabular-nums; }
code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------- 杂项 */

.bar {
  height: 4px;
  background: var(--panel-2);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 10px var(--accent);
  transition: width .35s ease;
}

.muted { color: var(--muted); }
.err { color: var(--bad); }

.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(255, 194, 92, .3);
  border-left: 2px solid var(--warn);
  border-radius: 4px;
  padding: 11px 13px;
  font-size: 13px;
  margin-bottom: 12px;
}
.warn b { color: var(--warn); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px 0;
  font-size: 13px;
  letter-spacing: .02em;
}

/* ---------------------------------------------------------------- 浮层 */

#toast {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: flex-end;
}
#toast div {
  background: var(--panel-solid);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--accent);
  padding: 11px 15px;
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
  max-width: 440px;
  font-size: 13px;
  animation: slide .2s ease-out;
}
#toast div.bad { border-left-color: var(--bad); color: var(--bad); }
@keyframes slide { from { opacity: 0; transform: translateX(14px); } }

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, .9);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
#lightbox.on { display: flex; }
#lightbox img {
  max-width: 86vw;
  max-height: 76vh;
  object-fit: contain;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background:
    repeating-conic-gradient(rgba(128, 150, 180, .16) 0% 25%, transparent 0% 50%)
    50% / 18px 18px;
}
#lightbox .actions { display: flex; gap: 9px; }

/* iframe（平台面板）跟随主题边框 */
iframe {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
}

/* 滚动条：细，不抢戏 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

/* 窄屏：顶栏导航横向滚动，不换行挤压 */
@media (max-width: 880px) {
  header { gap: 12px; padding: 0 12px; }
  nav { overflow-x: auto; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav button { padding: 0 10px; font-size: 12.5px; }
  main { padding: 16px 12px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
