:root {
  --bg: #1b2838;
  --bg2: #16202d;
  --panel: #22303f;
  --text: #dbe4ee;
  --muted: #8a97a5;
  --accent: #66c0f4;
  --ok: #8bc53f;
  --err: #e74c3c;
  --border: #3a4a5a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); }

code { color: var(--accent); }
code.small, .small { font-size: 12px; }

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

.error { background: #4a1f1f; border: 1px solid var(--err); color: #f1b0b0; padding: 10px 14px; border-radius: 4px; margin: 10px 0; }

.ok { color: var(--ok); }
.err { color: var(--err); }

button {
  background: var(--accent);
  color: #0b1c2a;
  border: none;
  border-radius: 3px;
  padding: 7px 16px;
  font-size: 14px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: wait; }

input, select {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  padding: 7px 10px;
  font-size: 14px;
}

/* 登录 */
.login-box {
  max-width: 380px;
  margin: 10vh auto;
  background: var(--panel);
  padding: 32px;
  border-radius: 8px;
}
.login-box h1 { margin-top: 0; font-size: 22px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* 布局 */
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
header .logo { font-weight: 600; color: var(--accent); }
header nav button {
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
}
header nav button.active { color: var(--text); border-bottom: 2px solid var(--accent); border-radius: 0; }
header .spacer { flex: 1; }
header > button { background: transparent; border: 1px solid var(--border); color: var(--muted); }

main { max-width: 1000px; margin: 24px auto; padding: 0 20px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 6px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg2); color: var(--muted); font-weight: 500; font-size: 13px; }
tr.unlocked td { background: rgba(139, 197, 63, 0.06); }

img.icon { width: 42px; height: 42px; border-radius: 4px; }

.badge {
  font-size: 11px;
  background: #4a3a1f;
  color: #e0b050;
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 6px;
}

.panel {
  background: var(--panel);
  border-radius: 6px;
  padding: 18px 22px;
  margin-bottom: 20px;
}
.panel h2 { margin-top: 0; font-size: 17px; }
.panel form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.panel label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.inline-form { flex-direction: row !important; flex-wrap: wrap; max-width: none !important; align-items: center; }

.btn-link { text-decoration: none; }

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
  margin: 12px 0;
  font-size: 14px;
}
.perm-grid label { display: flex; align-items: center; gap: 6px; }

/* 试玩 */
.play-vars { font-size: 12px; margin-bottom: 8px; }
.play-history {
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
  min-height: 120px;
}
.play-history p { margin: 6px 0; }
.play-history .narr { color: var(--text); font-style: italic; }
.play-history .sys { color: var(--muted); font-size: 12px; }
.play-history .choose { color: var(--accent); }
.play-controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.play-opt { text-align: left; }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  border-radius: 4px;
  font-size: 14px;
}
.ok-toast { background: #2c4a1d; color: #c8f0a8; }
.error-toast { background: #4a1f1f; color: #f1b0b0; }
#toast:empty { display: none; }
