* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  overflow: hidden;
}
#app { display: flex; height: 100vh; }

#sidebar {
  width: 300px;
  min-width: 260px;
  padding: 18px 16px;
  background: #161b22;
  border-right: 1px solid #30363d;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#sidebar h1 { font-size: 20px; color: #58a6ff; }
#sidebar .sub { font-size: 12px; color: #8b949e; }

#upload-box {
  border: 2px dashed #30363d;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: #8b949e;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s;
}
#upload-box:hover { border-color: #58a6ff; }
#upload-box input[type=file] { display: none; }
#progress { margin-top: 8px; color: #58a6ff; }

#case-panel { display: flex; flex-direction: column; gap: 10px; }
.case-head { display: flex; align-items: center; justify-content: space-between; }
.case-head span { font-size: 15px; font-weight: 600; }
#btn-upload-more {
  background: #21262d; color: #e6edf3; border: 1px solid #30363d;
  border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-size: 16px;
}
.case-meta { font-size: 12px; color: #8b949e; }

#struct-list { display: flex; flex-direction: column; gap: 6px; }
.struct {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; background: #21262d; border-radius: 6px; font-size: 13px;
  cursor: pointer;
}
.struct:hover { background: #2a3038; }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.struct input[type=checkbox] { width: 15px; height: 15px; accent-color: #58a6ff; cursor: pointer; }
.sname { flex: 1; }
.svol { color: #8b949e; font-size: 12px; }

.btn-row { display: flex; gap: 8px; }
.btn-row button {
  flex: 1; padding: 7px 0; background: #21262d; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn-row button:hover { background: #2a3038; border-color: #58a6ff; }

.tips { font-size: 11px; color: #8b949e; line-height: 1.6; }

#error {
  background: #3d1d1d; border: 1px solid #f85149; color: #f85149;
  padding: 10px; border-radius: 6px; font-size: 12px; word-break: break-all;
}

#btn-wxcode {
  width: 100%; padding: 9px 0; background: #1f6feb; color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-size: 13px;
}
#btn-wxcode:hover { background: #388bfd; }

#qr-modal {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  align-items: center; justify-content: center; z-index: 100;
}
#qr-modal.open { display: flex; }
.qr-box {
  background: #fff; border-radius: 12px; padding: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: #161b22; max-width: 320px;
}
.qr-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600;
}
.qr-head button {
  background: none; border: none; font-size: 20px; cursor: pointer; color: #555;
}
#qr-img { width: 260px; height: 260px; display: none; border-radius: 6px; }
#qr-hint { font-size: 12px; color: #d73a49; min-height: 16px; text-align: center; }
.qr-foot { display: flex; gap: 8px; width: 100%; }
.qr-foot button {
  flex: 1; padding: 7px 0; border: 1px solid #ccc; border-radius: 6px;
  background: #f6f8fa; cursor: pointer; font-size: 13px;
}

.site-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #30363d;
  font-size: 11px;
  text-align: center;
  position: sticky;
  bottom: 0;
  background: #161b22;
}
.site-footer a { display: block; line-height: 1.7; color: #8b949e; text-decoration: none; }
.site-footer a:hover { color: #58a6ff; text-decoration: underline; }

#viewport { flex: 1; position: relative; touch-action: none; -webkit-touch-callout: none; }
#viewport canvas { display: block; }

@media (max-width: 640px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%; height: auto; max-height: 42vh; border-right: none; border-bottom: 1px solid #30363d;
  }
}