:root {
  --ink: #2c2118;
  --paper: #fff8e8;
  --card: #fffdf8;
  --line: #ead9b8;
  --muted: #7a6a58;
  --brand: #2563eb;
  --sky: #4ec4f5;
  --coral: #ff6b57;
  --sun: #ffd23f;
  --mint: #3ddc97;
  --ok: #047857;
  --bg: #f3efe4;
  --shadow: 0 3px 0 var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, #fff6c8 0 18%, transparent 19%),
    linear-gradient(180deg, #e8f7ff 0%, var(--bg) 28%);
  color: var(--ink);
}
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 248, 232, .94);
  backdrop-filter: blur(10px);
  border-bottom: 3px solid var(--ink);
  padding: 10px 16px 8px;
}
.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.brand-admin {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-admin h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
.brand-admin .who { font-size: 12px; font-weight: 700; color: var(--muted); }
.pill {
  display: none;
  font-size: 12px;
  font-weight: 800;
  background: var(--sun);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
}
.pill.on { display: inline-flex; }
.back-game {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 14px 14px 96px; }
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.tabs button {
  min-height: 40px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}
.tabs button.on { background: var(--sky); }
.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.sub { color: var(--muted); margin: 6px 0 12px; font-size: 13px; font-weight: 700; }
label { display: block; font-size: 12px; font-weight: 800; margin: 8px 0 4px; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 72px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 140px; }
.chk { display: flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 750; }
.chk input { width: 18px; height: 18px; min-height: 18px; }
button, .file-btn {
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: #fff;
}
.primary { background: var(--brand); color: #fff; border-color: #1d4ed8; }
.sun { background: var(--sun); }
.mint { background: var(--mint); }
.danger { background: #fee2e2; color: #991b1b; }
.ghost { background: #fff; }
.file-btn { display: inline-flex; align-items: center; }
.hidden { display: none !important; }
.msg { min-height: 20px; font-size: 13px; color: #b45309; margin: 8px 0; font-weight: 700; }
.msg.ok { color: var(--ok); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px;
}
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 800; }
.stat.go { cursor: pointer; }
.stat.go:hover { background: #e8f7ff; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
}
.badge-on { background: #d1fae5; color: #047857; }
.badge-off { background: #fee2e2; color: #991b1b; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-sky { background: #e0f2fe; color: #075985; }
.sticky {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 248, 232, .96);
  border-top: 3px solid var(--ink);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.sticky-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.sticky .primary { flex: 1; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(44, 33, 24, .25);
}
.toast.ok { background: var(--ok); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow: auto; padding-bottom: 4px; }
.chip {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #fff;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.chip.on { background: var(--sky); }
.chip em { font-style: normal; opacity: .65; margin-left: 4px; }
.lv-world {
  width: 100%;
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.q-work {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}
.q-rows { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 2; }
.q-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  min-height: 0;
}
.q-row.on { border-color: var(--brand); box-shadow: 0 0 0 3px #dbeafe; background: #f8fbff; }
.q-row.off { opacity: .55; }
.q-thumb {
  width: 52px;
  height: 44px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.q-thumb img, .q-thumb svg { max-width: 48px; max-height: 40px; }
.q-main { min-width: 0; }
.q-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-main small { color: var(--muted); font-weight: 700; font-size: 11px; }
.q-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.q-editor {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 12px;
}
.q-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.q-nav .ghost { flex: 0 0 auto; min-width: 72px; }
.opt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  padding: 6px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.opt-line.on { border-color: var(--ok); background: #ecfdf5; }
.opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--sun);
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
  flex: 0 0 auto;
}
.opt-line input[type="radio"] { width: 18px; min-height: 18px; flex: 0 0 auto; }
.opt-line input[type="text"], .opt-line input:not([type="radio"]) { margin: 0; }
.q-preview {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 8px;
  min-height: 110px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.q-preview svg, .q-preview img { max-height: 150px; max-width: 100%; }
.img-lib { display: flex; flex-wrap: wrap; gap: 8px; }
.img-wrap { position: relative; }
.img-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.img-thumb.picked { outline: 3px solid var(--brand); }
.img-wrap button {
  position: absolute;
  top: -6px;
  right: -6px;
  min-height: 22px;
  padding: 0 6px;
  font-size: 11px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.filters input, .filters select { flex: 1; min-width: 160px; }

.m-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.m-toolbar input, .m-toolbar select { flex: 1; min-width: 140px; }
.m-table { width: 100%; border-collapse: collapse; }
.m-head, .m-row {
  display: grid;
  grid-template-columns: 1.3fr 1.1fr 1.1fr .9fr .7fr 1.1fr 44px;
  gap: 8px;
  align-items: center;
}
.m-head {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  padding: 4px 8px;
}
.m-row {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 10px 8px;
  margin-bottom: 6px;
  cursor: pointer;
}
.m-row.on { border-color: var(--brand); box-shadow: 0 0 0 3px #dbeafe; }
.m-row b { display: block; font-size: 14px; }
.m-row small { color: var(--muted); font-weight: 700; font-size: 11px; }
.m-edit {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  margin-top: 6px;
}
.mem-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mem-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.mem-actions button { flex: 1; min-width: 110px; }
.add-box { border: 2px dashed var(--ink); border-radius: 14px; padding: 12px; margin-top: 12px; background: #fff; }
details.add-box > summary { font-weight: 800; cursor: pointer; }
.creative {
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px;
  margin-top: 10px;
  background: #fff;
}
.theme-row {
  display: grid;
  grid-template-columns: 1fr 90px 70px 90px;
  gap: 8px;
  align-items: end;
}
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick button { flex: 1; min-width: 120px; }

@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 960px) {
  .q-work { grid-template-columns: 1fr 400px; }
  .q-editor { position: sticky; top: 78px; max-height: calc(100dvh - 96px); overflow: auto; }
}
@media (max-width: 760px) {
  .m-head { display: none; }
  .m-row {
    grid-template-columns: 1fr 1fr;
  }
  .m-row .hide-sm { display: none; }
  .theme-row { grid-template-columns: 1fr 1fr; }
}
