/* Shared look for the team hub (/) and the knowledge base (/kb/).
   Concept: a tower-defense studio's war table — cool map paper with a faint tile grid,
   one dark "sandbox" panel for the project, ore-amber for sparks (灵感池), steel blue for actions. */
:root {
  --paper: #eef1f6; --tile: rgba(27, 33, 64, .055); --surface: #ffffff; --surface-2: #f4f6fa;
  --ink: #1b2140; --muted: #5d6683; --faint: #8a92ab; --line: #dde2ec;
  --accent: #2f5bd3; --accent-soft: #e8eefc; --on-accent: #ffffff;
  --ore: #f0a63a; --ore-deep: #94570a; --ore-soft: #fff3dc; --ore-line: #f2d39b;
  --night: #182042; --night-2: #232d5a; --night-line: rgba(255, 255, 255, .09); --night-ink: #edf0ff; --night-muted: #a3acd8;
  --good: #1f8a5b; --good-soft: #e3f4ea; --danger: #c2372f;
  --font-display: "ZCOOL KuaiLe", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-hud: "Chakra Petch", "Noto Sans SC", ui-monospace, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1222; --tile: rgba(255, 255, 255, .035); --surface: #161b30; --surface-2: #1c2238;
    --ink: #e8ebf7; --muted: #a3abc6; --faint: #7c85a3; --line: #2a3150;
    --accent: #7f9cff; --accent-soft: #222c52; --on-accent: #0b1020;
    --ore: #f5b94f; --ore-deep: #f5c46b; --ore-soft: #2a2213; --ore-line: #4d3c1a;
    --night: #1b2346; --night-2: #26315f; --night-line: rgba(255, 255, 255, .1); --night-ink: #edf0ff; --night-muted: #a3acd8;
    --good: #5fd39a; --good-soft: #15301f; --danger: #ff7b72; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1222; --tile: rgba(255, 255, 255, .035); --surface: #161b30; --surface-2: #1c2238;
  --ink: #e8ebf7; --muted: #a3abc6; --faint: #7c85a3; --line: #2a3150;
  --accent: #7f9cff; --accent-soft: #222c52; --on-accent: #0b1020;
  --ore: #f5b94f; --ore-deep: #f5c46b; --ore-soft: #2a2213; --ore-line: #4d3c1a;
  --night: #1b2346; --night-2: #26315f; --night-line: rgba(255, 255, 255, .1); --night-ink: #edf0ff; --night-muted: #a3acd8;
  --good: #5fd39a; --good-soft: #15301f; --danger: #ff7b72; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  /* map tiles */
  background-image: linear-gradient(var(--tile) 1px, transparent 1px), linear-gradient(90deg, var(--tile) 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { text-wrap: balance; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 24px; padding-block: 28px 80px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.hud { font-family: var(--font-hud); font-weight: 600; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--faint); }
h1 { font-family: var(--font-display); font-size: 38px; margin: 0; line-height: 1.1; font-weight: 400; letter-spacing: 1px; }
.lead { margin: 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* header: brand on the left, who you are on the right */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
/* the mark: a tower tile seen from above */
.mark { width: 40px; height: 40px; border-radius: 10px; background: var(--night); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px var(--night-line); }
.mark i { width: 14px; height: 14px; background: var(--ore); transform: rotate(45deg); border-radius: 2px; box-shadow: 0 0 12px color-mix(in srgb, var(--ore) 70%, transparent); }
.brand .hud { display: block; line-height: 1.2; }
.back { font-size: 13px; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--accent); }
.userbar { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 4px; font-size: 13px; }
.userbar .nm { font-weight: 700; font-size: 14px; margin: 0 6px; }
.avatar { --h: 230; width: 32px; height: 32px; border-radius: 9px; background: hsl(var(--h) 70% 90%); color: hsl(var(--h) 50% 30%); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.tag-admin { font-family: var(--font-hud); font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--ore-deep); background: var(--ore-soft); border-radius: 6px; padding: 1px 7px; }
.linkbtn { border: 0; background: none; padding: 3px 8px; color: var(--muted); cursor: pointer; font-size: 13px; border-radius: 999px; text-decoration: none; }
.linkbtn:hover { background: var(--accent-soft); color: var(--accent); }

.gate { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 12px; max-width: 440px; }
.gate h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 22px; }
.gate input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; }
.err { color: var(--danger); font-size: 13px; margin: 0; min-height: 1.3em; }
.who-list { display: flex; flex-wrap: wrap; gap: 8px; }
.who-list button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 6px 14px 6px 6px; cursor: pointer; font-weight: 700; }
.who-list button:hover { border-color: var(--accent); color: var(--accent); }

.btn { border: 1px solid transparent; background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 10px 20px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .12s, filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.sm { padding: 6px 14px; font-size: 14px; border-radius: 8px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.del { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); margin-left: auto; }

/* panel: a titled block on the hub */
.panel { padding: 20px 22px; display: grid; gap: 14px; align-content: start; }
.panel-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.panel-h h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; letter-spacing: .5px; line-height: 1.2; }
.panel-h .right { margin-left: auto; font-size: 13px; color: var(--faint); }
.panel-h a.right { color: var(--accent); font-weight: 700; text-decoration: none; }
.panel-h a.right:hover { text-decoration: underline; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; border-radius: 6px; padding: 1px 8px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip b { font-family: var(--font-hud); font-weight: 600; color: var(--ink); margin-right: 2px; }
.chip.state { color: var(--accent); background: var(--accent-soft); border-color: transparent; font-weight: 700; }
.chip.mine-yes { color: var(--good); background: var(--good-soft); border-color: transparent; }
.chip.mine-no { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
code, kbd { font-family: ui-monospace, "Consolas", monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--ink); }

/* list rows (知识库) */
.rows { margin: 0; padding: 0; list-style: none; }
.rows.card { padding: 4px 20px; }
.rows > li { padding: 13px 0; border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.rows > li.empty { color: var(--muted); font-size: 14px; }
.edit { flex: none; font-size: 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 6px; padding: 1px 10px; cursor: pointer; }
.edit:hover { border-color: var(--accent); color: var(--accent); }
.meta { font-size: 12px; color: var(--faint); }
.body { font-size: 13px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }

/* inline editor */
.editor { display: grid; gap: 8px; }
.editor input, .editor textarea, .editor select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
.editor textarea { min-height: 76px; resize: vertical; }
.editor .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.editor .acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 640px) {
  .wrap { padding-inline: 16px; padding-block: 18px 56px; gap: 14px; }
  h1 { font-size: 30px; }
  .userbar .nm { max-width: 5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .panel { padding: 16px; }
  .panel-h h2 { font-size: 21px; }
  .rows.card { padding-inline: 14px; }
  .editor .row { grid-template-columns: 1fr; }
}

/* side drawer for details and editors (a bottom sheet on phones) */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(14, 18, 34, .38); animation: fade .15s ease-out; }
.drawer { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -16px 0 48px rgba(16, 24, 40, .2); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: slide .2s ease-out; padding-top: env(safe-area-inset-top, 0px); }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 22px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { margin: 0; flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 400; font-size: 21px; line-height: 1.25; }
.drawer-x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 10px; border-radius: 8px; }
.drawer-x:hover { background: var(--surface-2); color: var(--ink); }
.drawer-b { overflow-y: auto; padding: 18px 22px 22px; display: grid; gap: 14px; align-content: start; }
.drawer-f { padding: 12px 22px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@keyframes slide { from { transform: translateX(28px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(36px); opacity: 0; } }
@media (max-width: 640px) {
  .drawer { top: auto; left: 0; width: 100%; max-height: 88vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; animation-name: rise; }
}
/* sub-page header: brand on the left; back link and who you are on the right */
.top-r { display: flex; align-items: center; gap: 12px; }
