:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #18181b;
  --panel: #18181b;
  --line: #27272a;
  --ink: #fafafa;
  --muted: #a1a1aa;
  --gold: #fafafa;
  --grain: #7fb069;
  --wood: #b58a55;
  --iron: #7f96b3;
  --stone: #a8a49a;
  --glow: #09090b;
  --notice-bg: #27272a;
  --notice-ink: #fafafa;
  --hover: #27272a;
  --on-ink: #18181b;
  --gold-line: #3f3f46;
  --shadow: rgba(0, 0, 0, 0.4);
  --rail: #09090b;
}
html[data-theme="day"] {
  color-scheme: light;
  --bg: #f2f2f2;
  --surface: #fff;
  --panel: #fff;
  --line: #e4e4e7;
  --ink: #09090b;
  --muted: #71717a;
  --gold: #18181b;
  --glow: #f2f2f2;
  --notice-bg: #f4f4f5;
  --notice-ink: #09090b;
  --hover: #f4f4f5;
  --on-ink: #fafafa;
  --gold-line: #d4d4d8;
  --shadow: rgba(0, 0, 0, 0.06);
  --rail: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  display: flex;
  min-height: 100vh;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.rail {
  width: 80px;
  flex: 0 0 80px;
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 8px;
}
.logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px dashed var(--line);
}
.ico {
  width: 52px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}
.ico.on { background: var(--gold); color: var(--on-ink); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
header.top {
  height: 60px;
  background: var(--rail);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
header.top h1 { margin: 0; min-height: 0; font-size: 16px; font-weight: 600; letter-spacing: 0; }
.top-start { display: flex; align-items: center; gap: 8px; }
.menu {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.menu span { display: block; width: 16px; height: 2px; border-radius: 1px; background: currentColor; }
.nav-mask { display: none; }
.page { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.view { display: none; flex-direction: column; gap: 16px; }
.view.on { display: flex; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.kicker { margin: 0; font-size: 13px; color: var(--muted); }
.alliance { margin: 8px 0 0; min-height: 1.2em; font-size: 36px; font-weight: 700; letter-spacing: 0.04em; }
.notice {
  margin: 14px 0 0;
  padding: 10px 14px;
  background: var(--notice-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--notice-ink);
  white-space: pre-wrap;
}
.notice:empty { display: none; }
.statline { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.statline span {
  font-size: 13px;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--hover);
}
.statline b { color: var(--ink); font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 8px;
  text-align: center;
}
.card .k { font-size: 13px; color: var(--muted); }
.card .v { display: inline-flex; align-items: flex-end; justify-content: center; gap: 1px; font-size: 28px; font-weight: 700; margin-top: 8px; }
.card .cap { font-size: 16px; font-weight: 500; color: var(--muted); }
.searchbox { position: relative; }
.search-row { display: flex; gap: 8px; align-items: center; }
.search-row .field { flex: 1; min-width: 0; }
.group-pick {
  height: 40px;
  min-width: 132px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
}
.searchbox .field {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  height: 40px;
}
.searchbox .field:focus-within { border-color: var(--muted); }
.searchbox input {
  flex: 1;
  width: 100%;
  background: none;
  border: 0;
  outline: none;
  color: var(--ink);
  font-size: 14px;
}
.searchbox input::placeholder { color: var(--muted); }
.suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 300px;
  overflow: auto;
  display: none;
  box-shadow: 0 14px 34px var(--shadow);
}
.suggest.open { display: block; }
.suggest button {
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  background: transparent;
  border: 0;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.suggest button:hover { background: var(--hover); }
.suggest .c { color: var(--muted); font-size: 12px; }
.result { margin-top: 0; }
.result[hidden] { display: none; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.hint[hidden] { display: none; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.pname { font-size: 20px; font-weight: 700; }
.pmeta { color: var(--muted); font-size: 13px; }
.head .spacer { margin-left: auto; display: flex; gap: 8px; }
.chip, .back, .mark, .more {
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
}
.chip.on, .mark.on { background: var(--gold); color: var(--on-ink); border-color: var(--gold); }
.chip .n { opacity: 0.75; }
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.toolbar .lbl { font-size: 13px; color: var(--muted); }
select.lv {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
}
.sort { display: flex; gap: 4px; margin-left: auto; }
.copy-hint { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.tile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
}
.tile .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.tile .lv { font-weight: 700; }
.tile .tp { color: var(--muted); }
.tile .xy { margin-left: auto; font-variant-numeric: tabular-nums; }
.t-wood .dot { background: var(--wood); }
.t-wood .lv { color: var(--wood); }
.t-iron .dot { background: var(--iron); }
.t-iron .lv { color: var(--iron); }
.t-stone .dot { background: var(--stone); }
.t-stone .lv { color: var(--stone); }
.t-grain .dot { background: var(--grain); }
.t-grain .lv { color: var(--grain); }
.roster .rt { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.public-row { margin: 0 0 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.public-row[hidden] { display: none; }
.search-row .chip { height: 40px; white-space: nowrap; }
.names { display: flex; flex-wrap: wrap; gap: 8px; }
.nm {
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--hover);
}
.nm.mine { border-color: var(--gold); }
.status, .empty { color: var(--muted); min-height: 1.2em; }
.log { border-top: 1px solid var(--line); padding: 12px 0; text-align: left; }
.log summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.log-time, .log-who { color: var(--muted); }
.log ul { margin: 8px 0 0; padding-left: 18px; }
.log li { word-break: break-all; }
.more { margin-top: 12px; }
.hidden { display: none !important; }
.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 6px 12px;
  font-size: 13px;
}
.empty { width: 100%; text-align: center; padding: 18px 0; }
@media (max-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: 1fr 1fr; }
  .sort { margin-left: 0; width: 100%; }
  .rail { width: 64px; flex-basis: 64px; }
}
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: 0;
  height: 2px;
  background: var(--gold);
  pointer-events: none;
}
html.nav-go body::before { animation: nav-go .45s ease; }
@keyframes nav-go {
  0% { width: 0; opacity: 1; }
  70% { width: 100%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}
.view.on { animation: view-in .25s ease; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.ico, .chip, .nm, .back, .mark, .more, .theme-toggle, .tile {
  background-repeat: no-repeat;
  background-position: center;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.nm:hover, .chip:hover, .back:hover, .mark:hover, .more:hover, .ico:hover, .tile:hover {
  box-shadow: 0 4px 12px var(--shadow);
}
.nm:active, .chip:active, .back:active, .mark:active, .more:active, .ico:active, .tile:active, .theme-toggle:active {
  transform: scale(.96);
  background-image: radial-gradient(circle, color-mix(in srgb, currentColor 18%, transparent), transparent 70%);
  background-size: 240% 240%;
}
.log ul { animation: view-in .2s ease; }
@media (prefers-reduced-motion: reduce) {
  .view.on, html.nav-go body::before, .log ul { animation: none; }
  .ico, .chip, .nm, .back, .mark, .more, .theme-toggle, .tile, .panel, .card { transition: none; }
}
@media (max-width: 640px) {
  .menu { display: inline-flex; }
  .rail {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    height: 100%;
    width: 80px;
    flex-basis: 80px;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  body.nav-open .rail { transform: none; }
  .nav-mask {
    position: fixed;
    inset: 0;
    z-index: 30;
    border: 0;
    background: rgba(0, 0, 0, 0.45);
  }
  body.nav-open .nav-mask { display: block; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .rail { transition: none; }
}
