/* Coding Plan Hub —— 终端风界面
   字体全部用系统字体栈（国内访问不了 Google Fonts，也不引入任何 CDN） */

:root {
  --bg: #07090c;
  --surface: #0d1117;
  --surface-2: #121a24;
  --surface-3: #05070a;
  --border: #1d2733;
  --border-bright: #2f4152;
  --text: #d3dde4;
  --muted: #76858f;
  --amber: #ffb648;
  --green: #52e08a;
  --red: #ff6b6b;
  --link: #7fd1ff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--mono), var(--cn);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* 背景氛围：细网格 + 扫描线 + 暗角，全部不拦截鼠标 */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    linear-gradient(rgba(82, 224, 138, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 224, 138, .035) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

body::after {
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 100% 70% at 50% 0%, transparent 40%, rgba(0, 0, 0, .55));
  opacity: .5;
}

::selection { background: var(--amber); color: #07090c; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 19px; margin: 0; }
h2 { font-size: 15px; margin: 28px 0 12px; color: var(--text); }
h3 { font-size: 13px; margin: 20px 0 8px; }
p { margin: 8px 0; }

h1::before,
h2::before {
  content: "❯";
  color: var(--amber);
  margin-right: 8px;
  opacity: .9;
}

/* ---------- 顶栏：命令行提示符 ---------- */

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  background: linear-gradient(180deg, #0c1219, #090d13);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  color: var(--text);
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
}

.topbar .brand::before {
  content: "team@coding-plan:~$ ";
  color: var(--green);
  font-weight: 400;
}

.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.topbar nav a,
.topbar .link {
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid transparent;
  text-decoration: none;
}

.topbar nav a:hover,
.topbar .link:hover {
  color: var(--amber);
  border-color: var(--border-bright);
  background: rgba(255, 182, 72, .07);
  text-decoration: none;
}

/* ---------- 布局 ---------- */

.container {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 28px auto 64px;
  padding: 0 20px;
}

.container > *,
.container section { animation: rise .4s cubic-bezier(.2, .7, .3, 1) both; }
.container > *:nth-child(2) { animation-delay: .04s; }
.container > *:nth-child(3) { animation-delay: .08s; }
.container > *:nth-child(4) { animation-delay: .12s; }
.container > *:nth-child(n+5) { animation-delay: .16s; }

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

@media (prefers-reduced-motion: reduce) {
  .container > *, .container section { animation: none; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar h1, .toolbar h2 { flex: 1; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; margin: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
form.inline { display: inline; }

/* ---------- 卡片：四角刻线 ---------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  opacity: .55;
  background:
    linear-gradient(var(--amber), var(--amber)) 0 0 / 12px 1px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 0 0 / 1px 12px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 100% 0 / 12px 1px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 100% 0 / 1px 12px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 0 100% / 12px 1px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 0 100% / 1px 12px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 100% 100% / 12px 1px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 100% 100% / 1px 12px no-repeat;
}

.card.narrow { max-width: 420px; margin: 72px auto; }
.card.form { max-width: 640px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }

/* ---------- 套餐卡片 ---------- */

.plan-card { transition: border-color .15s, transform .15s; }
.plan-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.plan-card .plan-name { color: var(--text); font-weight: 600; }
.plan-card .plan-name:hover { color: var(--amber); text-decoration: none; }
.plan-card .meta { color: var(--muted); font-size: 12.5px; margin: 10px 0 12px; }
.plan-disabled { opacity: .5; }

.key-row {
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 8px 10px;
}

.key-row .tag { color: var(--muted); font-size: 11px; letter-spacing: .08em; }

/* ---------- 徽标 ---------- */

.badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--muted);
  border: 1px solid var(--border-bright);
  background: rgba(255, 255, 255, .02);
}

.badge-active { color: var(--green); border-color: rgba(82, 224, 138, .45); background: rgba(82, 224, 138, .1); }
.badge-active::before { content: "● "; }
.badge-disabled { color: var(--muted); }

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

label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 12.5px; }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 0;
  caret-color: var(--amber);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 182, 72, .12);
}

input::placeholder { color: #4d5a64; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin-right: 8px; accent-color: var(--amber); }
input[type=date] { color-scheme: dark; }

/* ---------- 按钮 ---------- */

button, .button {
  display: inline-block;
  padding: 7px 16px;
  font: inherit;
  letter-spacing: .03em;
  color: #07090c;
  background: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, box-shadow .15s, transform .1s;
}

button:hover, .button:hover {
  box-shadow: 0 0 16px rgba(255, 182, 72, .3);
  text-decoration: none;
}

button:active, .button:active { transform: translateY(1px); }

button.secondary, .button.secondary {
  color: var(--amber);
  background: transparent;
}

button.secondary:hover, .button.secondary:hover { background: rgba(255, 182, 72, .12); }

button.danger { color: #07090c; background: var(--red); border-color: var(--red); }
button.danger:hover { box-shadow: 0 0 16px rgba(255, 107, 107, .3); }

button.link {
  padding: 0 4px;
  color: var(--link);
  background: none;
  border: none;
  box-shadow: none;
}

button.link:hover { color: var(--amber); box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
button.link.danger { color: var(--red); background: none; border: none; }

/* ---------- 提示条 ---------- */

.flash {
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid;
  border-left-width: 3px;
}

.flash-success { color: var(--green); border-color: rgba(82, 224, 138, .4); background: rgba(82, 224, 138, .08); }
.flash-success::before { content: "[ok] "; opacity: .8; }
.flash-error { color: var(--red); border-color: rgba(255, 107, 107, .4); background: rgba(255, 107, 107, .08); }
.flash-error::before { content: "[!] "; opacity: .8; }

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

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .06em; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
table.kv th { width: 132px; white-space: nowrap; }

/* ---------- 代码与片段 ---------- */

code { color: var(--green); word-break: break-all; }

pre {
  margin: 0 0 10px;
  padding: 14px 16px;
  color: #cfe6d6;
  background: var(--surface-3);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.card h3 {
  display: inline-block;
  margin-bottom: 0;
  padding: 5px 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
}

.card h3 + pre { margin-top: 0; }

/* ---------- 值日 ---------- */

.duty-today { font-size: 18px; letter-spacing: .02em; }
.duty-today strong { color: var(--amber); }

.duty-today::after {
  content: "▋";
  margin-left: 8px;
  color: var(--amber);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.duty-calendar { table-layout: fixed; }
.duty-calendar th { text-align: center; border-bottom: 1px solid var(--border-bright); }

.duty-calendar td {
  height: 86px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  vertical-align: top;
  transition: background .15s;
}

.duty-calendar td:hover { background: rgba(255, 255, 255, .03); }
.duty-calendar td.other-month { opacity: .32; }

.duty-calendar td.rest {
  color: var(--muted);
  background-image: repeating-linear-gradient(45deg, transparent 0 7px, rgba(255, 255, 255, .035) 7px 14px);
}

.duty-calendar td.today {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber), 0 0 20px rgba(255, 182, 72, .12);
}

.duty-calendar td.today .day-num { color: var(--amber); }
.duty-calendar .day-num { font-size: 11.5px; color: var(--muted); }
.duty-calendar .day-link { display: block; height: 100%; color: inherit; }
.duty-calendar .day-link:hover { color: inherit; text-decoration: none; }
.duty-calendar .badge { padding: 0 5px; font-size: 10.5px; }

/* ---------- 状态栏 ---------- */

.statusbar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 18px;
  padding: 8px 24px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: .04em;
  background: #090d13;
  border-top: 1px solid var(--border);
}

.statusbar .dot { color: var(--green); }

/* ---------- 滚动条 ---------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #080b10; }
::-webkit-scrollbar-thumb { background: #1f2a36; border: 2px solid #080b10; }
::-webkit-scrollbar-thumb:hover { background: #2f4152; }

/* ---------- 窄屏 ---------- */

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; }
  .container { margin: 18px auto 48px; padding: 0 14px; }
  .card { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .duty-calendar td { height: 64px; padding: 5px; font-size: 12px; }
  .card.narrow { margin: 32px auto; }
}
